]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
Fix gdb.FinishBreakpoint when returning to an inlined function
authorHannes Domani <ssbssa@yahoo.de>
Tue, 12 Dec 2023 14:57:14 +0000 (15:57 +0100)
committerHannes Domani <ssbssa@yahoo.de>
Tue, 12 Dec 2023 14:57:14 +0000 (15:57 +0100)
commit80ffe7226459e3edf840d0c23462d93cb560d2de
tree558fb8d74b28d63aae0fca8744249931798e7a0d
parent52e0b52e6f2dc1dc5a7b95740d22fd616241db67
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>
gdb/python/py-finishbreakpoint.c
gdb/testsuite/gdb.python/py-finish-breakpoint.c
gdb/testsuite/gdb.python/py-finish-breakpoint.exp