mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-05-28 06:03:00 +08:00
Fix Python gdb.Breakpoint.location crash
I noticed today that gdb.Breakpoint.location will crash when applied to a catchpoint made with "catch throw". The bug is that "catch throw" makes a breakpoint that is of type bp_breakpoint, but which does not have a location. Regression tested on x86-64 Fedora 28. gdb/ChangeLog 2018-10-06 Tom Tromey <tom@tromey.com> * python/py-breakpoint.c (bppy_get_location): Handle a bp_breakpoint without a location. gdb/testsuite/ChangeLog 2018-10-06 Tom Tromey <tom@tromey.com> * gdb.python/py-breakpoint.exp (check_last_event): Check location of a "throw" catchpoint.
This commit is contained in:
@ -391,7 +391,12 @@ bppy_get_location (PyObject *self, void *closure)
|
||||
if (obj->bp->type != bp_breakpoint)
|
||||
Py_RETURN_NONE;
|
||||
|
||||
str = event_location_to_string (obj->bp->location.get ());
|
||||
struct event_location *location = obj->bp->location.get ();
|
||||
/* "catch throw" makes a breakpoint of type bp_breakpoint that does
|
||||
not have a location. */
|
||||
if (location == nullptr)
|
||||
Py_RETURN_NONE;
|
||||
str = event_location_to_string (location);
|
||||
if (! str)
|
||||
str = "";
|
||||
return host_string_to_python_string (str);
|
||||
|
Reference in New Issue
Block a user