This is the mail archive of the insight@sourceware.org mailing list for the Insight project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Insight crashing when debugging invalid pointers



But if insight is trying to display the same things (either using tooltips or
watch), the entire Insight is crashing !!!


I thing it is related variable evaluation like {$val value}
I checked the Insight scripts, all calls to {$val value} are secured with
'catch'.
Is "catch {$val value} result" supposed to catch GDB exceptions ???


I wonder if this behavior is specific to my built/target or more generic ...


Good guess. It's probably a problem in varobj (which is part of gdb). Can you run insight on gdb and get a backtrace of where it dies?

Keith

Unfortunately, it is not very easy for me to have a native gdb to debug insight ....


But I think I have found the problem (you're right in varobj.c) :
- When gdb tries to evaluate a value, it calls many functions and subfunctions. One of these is "value_of_child"
When value_of_child cannot acces memory to evaluate a value, it simply return NULL (deletes the value context) instead of reporting the error.
I changed :
if (!gdb_value_fetch_lazy (value))
value = NULL;
to:
if (!gdb_value_fetch_lazy (value))
parent->error = 1;
All functions calling this one are testing the "->error" flag or NULL return value. So it works !


But this patch does not delete the value context as it was done previously....
So further use of the value (for types, names,...) are still possible.
Previously, Insight was crashing when trying to get the 'type' of this variable.


I made another patch in function "my_value_equal" (it assumes that variable can be accessed) :
I changed :
gdb_assert (!value_lazy (val1));
to:
if (value_lazy (val1))
{
*error2 = 1;
return 0;
}



With both these patches, Insight is able to display invalid pointers location with an error message set by gdbtk-varobj.c:variable_value
By the way, in case of error reported by varobj_get_value, variable_value sets an error messages and returns TCL_ERROR to the caller.


But it seems that "catch {$val value} result" does not catch the error ...
How to catch it ?

Thanks,
Elmer.







Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]