aboutsummaryrefslogtreecommitdiff
path: root/gdb/python
diff options
context:
space:
mode:
authorHannes Domani <ssbssa@yahoo.de>2023-12-12 15:57:14 +0100
committerHannes Domani <ssbssa@yahoo.de>2023-12-12 15:57:14 +0100
commit80ffe7226459e3edf840d0c23462d93cb560d2de (patch)
tree558fb8d74b28d63aae0fca8744249931798e7a0d /gdb/python
parent52e0b52e6f2dc1dc5a7b95740d22fd616241db67 (diff)
downloadfsf-binutils-gdb-80ffe7226459e3edf840d0c23462d93cb560d2de.zip
fsf-binutils-gdb-80ffe7226459e3edf840d0c23462d93cb560d2de.tar.gz
fsf-binutils-gdb-80ffe7226459e3edf840d0c23462d93cb560d2de.tar.bz2
Fix gdb.FinishBreakpoint when returning to an inlined function
Currently, when creating a gdb.FinishBreakpoint in a function called from an inline frame, it will never be hit: ``` (gdb) py fb=gdb.FinishBreakpoint() Temporary breakpoint 1 at 0x13f1917b4: file C:/src/repos/binutils-gdb.git/gdb/testsuite/gdb.python/py-finish-breakpoint.c, line 47. (gdb) c Continuing. Thread-specific breakpoint 1 deleted - thread 1 no longer in the thread list. [Inferior 1 (process 1208) exited normally] ``` The reason is that the frame_id of a breakpoint has to be the ID of a real frame, ignoring any inline frames. With this fixed, it's working correctly: ``` (gdb) py fb=gdb.FinishBreakpoint() Temporary breakpoint 1 at 0x13f5617b4: file C:/src/repos/binutils-gdb.git/gdb/testsuite/gdb.python/py-finish-breakpoint.c, line 47. (gdb) c Continuing. Breakpoint 1, increase_inlined (a=0x40fa5c) at C:/src/repos/binutils-gdb.git/gdb/testsuite/gdb.python/py-finish-breakpoint.c:47 (gdb) py print(fb.return_value) -8 ``` Approved-By: Tom Tromey <tom@tromey.com>
Diffstat (limited to 'gdb/python')
-rw-r--r--gdb/python/py-finishbreakpoint.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/gdb/python/py-finishbreakpoint.c b/gdb/python/py-finishbreakpoint.c
index 627eb29..7f3658d 100644
--- a/gdb/python/py-finishbreakpoint.c
+++ b/gdb/python/py-finishbreakpoint.c
@@ -212,7 +212,8 @@ bpfinishpy_init (PyObject *self, PyObject *args, PyObject *kwargs)
"be set on a dummy frame."));
}
else
- frame_id = get_frame_id (prev_frame);
+ /* Get the real calling frame ID, ignoring inline frames. */
+ frame_id = frame_unwind_caller_id (frame);
}
}
catch (const gdb_exception &except)