aboutsummaryrefslogtreecommitdiff
path: root/gdb/python/py-finishbreakpoint.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/python/py-finishbreakpoint.c')
-rw-r--r--gdb/python/py-finishbreakpoint.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/gdb/python/py-finishbreakpoint.c b/gdb/python/py-finishbreakpoint.c
index e3d4867..671fd23 100644
--- a/gdb/python/py-finishbreakpoint.c
+++ b/gdb/python/py-finishbreakpoint.c
@@ -29,6 +29,7 @@
#include "observer.h"
#include "inferior.h"
#include "block.h"
+#include "location.h"
/* Function that is called when a Python finish bp is found out of scope. */
static char * const outofscope_func = "out_of_scope";
@@ -169,7 +170,7 @@ bpfinishpy_init (PyObject *self, PyObject *args, PyObject *kwargs)
PyObject *internal = NULL;
int internal_bp = 0;
CORE_ADDR finish_pc, pc;
- char *addr_str, small_buf[100];
+ char small_buf[100], *p;
struct symbol *function;
if (!PyArg_ParseTupleAndKeywords (args, kwargs, "|OO", keywords,
@@ -296,13 +297,17 @@ bpfinishpy_init (PyObject *self, PyObject *args, PyObject *kwargs)
TRY
{
+ struct event_location *location;
+ struct cleanup *back_to;
+
/* Set a breakpoint on the return address. */
finish_pc = get_frame_pc (prev_frame);
xsnprintf (small_buf, sizeof (small_buf), "*%s", hex_string (finish_pc));
- addr_str = small_buf;
-
+ p = small_buf;
+ location = new_linespec_location (&p);
+ back_to = make_cleanup_delete_event_location (location);
create_breakpoint (python_gdbarch,
- addr_str, NULL, thread, NULL,
+ location, NULL, thread, NULL,
0,
1 /*temp_flag*/,
bp_breakpoint,
@@ -310,6 +315,7 @@ bpfinishpy_init (PyObject *self, PyObject *args, PyObject *kwargs)
AUTO_BOOLEAN_TRUE,
&bkpt_breakpoint_ops,
0, 1, internal_bp, 0);
+ do_cleanups (back_to);
}
CATCH (except, RETURN_MASK_ALL)
{