summaryrefslogtreecommitdiff
path: root/gdb/python/py-frame.c
diff options
context:
space:
mode:
authorkpouget <kpouget>2011-12-23 17:06:05 +0000
committerkpouget <kpouget>2011-12-23 17:06:05 +0000
commit7c56fb07bde331d79eb73ece26b8fc960aa13eb2 (patch)
tree9f8be9c78943853eb5f7d12206957634521f5eba /gdb/python/py-frame.c
parent2b86ff17b1b9b2f9a412419b4e3130c70c5b8970 (diff)
downloadgdb-7c56fb07bde331d79eb73ece26b8fc960aa13eb2.tar.gz
Introduce gdb.FinishBreakpoint in Python
* Makefile.in (SUBDIR_PYTHON_OBS): Add py-finishbreakpoint.o. (SUBDIR_PYTHON_SRCS): Add python/py-finishbreakpoint.c. Add build rule for this file. * infcmd.c (print_return_value): Split to create get_return_value. (get_return_value): New function based on print_return_value. Handle case where stop_registers are not set. * inferior.h (get_return_value): New prototype. * python/py-breakpoint.c (bppy_pending_object): Make non-static. (gdbpy_breakpoint_created): Set is_py_finish_bp is necessary. (struct breakpoint_object): Move to python-internal.h (BPPY_REQUIRE_VALID): Likewise. (BPPY_SET_REQUIRE_VALID): Likewise. (gdbpy_breakpoint_created): Initialize is_finish_bp. (gdbpy_should_stop): Add pre/post hooks before/after calling stop method. * python/python-internal.h (breakpoint_object_type): Add as extern. (bppy_pending_object): Likewise. (typedef struct breakpoint_object) Removed. (struct breakpoint_object): Moved from py-breakpoint.c. Add field is_finish_bp. (BPPY_REQUIRE_VALID): Moved from py-breakpoint.c. (BPPY_SET_REQUIRE_VALID): Likewise. (frame_object_to_frame_info): New prototype. (gdbpy_initialize_finishbreakpoints): New prototype. (bpfinishpy_is_finish_bp): Likewise. (bpfinishpy_pre_stop_hook): Likewise. (bpfinishpy_post_stop_hook): Likewise. * python/py-finishbreakpoint.c: New file. * python/py-frame.c(frame_object_to_frame_info): Make non-static and accept PyObject instead of frame_object. (frapy_is_valid): Don't cast to frame_object. (frapy_name): Likewise. (frapy_type): Likewise. (frapy_unwind_stop_reason): Likewise. (frapy_pc): Likewise. (frapy_block): Likewise. (frapy_function): Likewise. (frapy_older): Likewise. (frapy_newer): Likewise. (frapy_find_sal): Likewise. (frapy_read_var): Likewise. (frapy_select): Likewise. * python/python.c (gdbpy_is_stopped_at_finish_bp): New noop function. (_initialize_python): Add gdbpy_initialize_finishbreakpoints. * python/python.h: Include breakpoint.h (gdbpy_is_stopped_at_finish_bp): New prototype. doc/ * gdb.texinfo (Finish Breakpoints in Python): New subsection. (Python API): Add menu entry for Finish Breakpoints. testsuite/ * Makefile.in (EXECUTABLES): Add py-finish-breakpoint and py-finish-breakpoint2 (MISCALLANEOUS): Add py-events-shlib.so and py-events-shlib-nodebug.so * gdb.python/py-breakpoint.exp (mult_line): Define and use variable instead of line number. * gdb.python/py-finish-breakpoint.c: New file. * gdb.python/py-finish-breakpoint.exp: New file. * gdb.python/py-finish-breakpoint.py: New file. * gdb.python/py-finish-breakpoint2.cc: New file. * gdb.python/py-finish-breakpoint2.exp: New file. * gdb.python/py-finish-breakpoint2.py: New file.
Diffstat (limited to 'gdb/python/py-frame.c')
-rw-r--r--gdb/python/py-frame.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/gdb/python/py-frame.c b/gdb/python/py-frame.c
index 20064cab49d..c334f63d723 100644
--- a/gdb/python/py-frame.c
+++ b/gdb/python/py-frame.c
@@ -60,9 +60,10 @@ static PyTypeObject frame_object_type;
object. If the frame doesn't exist anymore (the frame id doesn't
correspond to any frame in the inferior), returns NULL. */
-static struct frame_info *
-frame_object_to_frame_info (frame_object *frame_obj)
+struct frame_info *
+frame_object_to_frame_info (PyObject *obj)
{
+ frame_object *frame_obj = (frame_object *) obj;
struct frame_info *frame;
frame = frame_find_by_id (frame_obj->frame_id);
@@ -106,7 +107,7 @@ frapy_is_valid (PyObject *self, PyObject *args)
TRY_CATCH (except, RETURN_MASK_ALL)
{
- frame = frame_object_to_frame_info ((frame_object *) self);
+ frame = frame_object_to_frame_info (self);
}
GDB_PY_HANDLE_EXCEPTION (except);
@@ -130,7 +131,7 @@ frapy_name (PyObject *self, PyObject *args)
TRY_CATCH (except, RETURN_MASK_ALL)
{
- FRAPY_REQUIRE_VALID ((frame_object *) self, frame);
+ FRAPY_REQUIRE_VALID (self, frame);
find_frame_funname (frame, &name, &lang, NULL);
}
@@ -159,7 +160,7 @@ frapy_type (PyObject *self, PyObject *args)
TRY_CATCH (except, RETURN_MASK_ALL)
{
- FRAPY_REQUIRE_VALID ((frame_object *) self, frame);
+ FRAPY_REQUIRE_VALID (self, frame);
type = get_frame_type (frame);
}
@@ -180,7 +181,7 @@ frapy_unwind_stop_reason (PyObject *self, PyObject *args)
TRY_CATCH (except, RETURN_MASK_ALL)
{
- FRAPY_REQUIRE_VALID ((frame_object *) self, frame);
+ FRAPY_REQUIRE_VALID (self, frame);
}
GDB_PY_HANDLE_EXCEPTION (except);
@@ -201,7 +202,7 @@ frapy_pc (PyObject *self, PyObject *args)
TRY_CATCH (except, RETURN_MASK_ALL)
{
- FRAPY_REQUIRE_VALID ((frame_object *) self, frame);
+ FRAPY_REQUIRE_VALID (self, frame);
pc = get_frame_pc (frame);
}
@@ -222,7 +223,7 @@ frapy_block (PyObject *self, PyObject *args)
TRY_CATCH (except, RETURN_MASK_ALL)
{
- FRAPY_REQUIRE_VALID ((frame_object *) self, frame);
+ FRAPY_REQUIRE_VALID (self, frame);
block = get_frame_block (frame, NULL);
}
GDB_PY_HANDLE_EXCEPTION (except);
@@ -263,7 +264,7 @@ frapy_function (PyObject *self, PyObject *args)
TRY_CATCH (except, RETURN_MASK_ALL)
{
- FRAPY_REQUIRE_VALID ((frame_object *) self, frame);
+ FRAPY_REQUIRE_VALID (self, frame);
sym = find_pc_function (get_frame_address_in_block (frame));
}
@@ -330,7 +331,7 @@ frapy_older (PyObject *self, PyObject *args)
TRY_CATCH (except, RETURN_MASK_ALL)
{
- FRAPY_REQUIRE_VALID ((frame_object *) self, frame);
+ FRAPY_REQUIRE_VALID (self, frame);
prev = get_prev_frame (frame);
if (prev)
@@ -359,7 +360,7 @@ frapy_newer (PyObject *self, PyObject *args)
TRY_CATCH (except, RETURN_MASK_ALL)
{
- FRAPY_REQUIRE_VALID ((frame_object *) self, frame);
+ FRAPY_REQUIRE_VALID (self, frame);
next = get_next_frame (frame);
if (next)
@@ -388,7 +389,7 @@ frapy_find_sal (PyObject *self, PyObject *args)
TRY_CATCH (except, RETURN_MASK_ALL)
{
- FRAPY_REQUIRE_VALID ((frame_object *) self, frame);
+ FRAPY_REQUIRE_VALID (self, frame);
find_frame_sal (frame, &sal);
sal_obj = symtab_and_line_to_sal_object (sal);
@@ -444,7 +445,7 @@ frapy_read_var (PyObject *self, PyObject *args)
TRY_CATCH (except, RETURN_MASK_ALL)
{
- FRAPY_REQUIRE_VALID ((frame_object *) self, frame);
+ FRAPY_REQUIRE_VALID (self, frame);
if (!block)
block = get_frame_block (frame, NULL);
@@ -472,7 +473,7 @@ frapy_read_var (PyObject *self, PyObject *args)
TRY_CATCH (except, RETURN_MASK_ALL)
{
- FRAPY_REQUIRE_VALID ((frame_object *) self, frame);
+ FRAPY_REQUIRE_VALID (self, frame);
val = read_var_value (var, frame);
}
@@ -487,12 +488,11 @@ static PyObject *
frapy_select (PyObject *self, PyObject *args)
{
struct frame_info *fi;
- frame_object *frame = (frame_object *) self;
volatile struct gdb_exception except;
TRY_CATCH (except, RETURN_MASK_ALL)
{
- FRAPY_REQUIRE_VALID (frame, fi);
+ FRAPY_REQUIRE_VALID (self, fi);
select_frame (fi);
}