diff options
author | Hannes Domani <ssbssa@yahoo.de> | 2024-02-11 17:40:59 +0100 |
---|---|---|
committer | Hannes Domani <ssbssa@yahoo.de> | 2024-02-11 17:42:46 +0100 |
commit | 1d197b254519d68245d460cad1dd835874f6629b (patch) | |
tree | ce02848f9d375461a00ec014b392bdec739f393f /gdb/frame.c | |
parent | 8c3e96141ea8acbf5e0246105d8220eb9f33bfdc (diff) | |
download | binutils-1d197b254519d68245d460cad1dd835874f6629b.zip binutils-1d197b254519d68245d460cad1dd835874f6629b.tar.gz binutils-1d197b254519d68245d460cad1dd835874f6629b.tar.bz2 |
Fix crash when calling Frame.static_link
If you try to call Frame.static_link for a frame without debug info,
gdb crashes:
```
Temporary breakpoint 1, 0x000000013f821650 in main ()
(gdb) py print(gdb.selected_frame().static_link())
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
```
The problem was a missing check if get_frame_block returns nullptr
inside frame_follow_static_link.
With this, it works:
```
Temporary breakpoint 1, 0x000000013f941650 in main ()
(gdb) py print(gdb.selected_frame().static_link())
None
```
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31366
Approved-By: Tom Tromey <tom@tromey.com>
Diffstat (limited to 'gdb/frame.c')
-rw-r--r-- | gdb/frame.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/gdb/frame.c b/gdb/frame.c index fae89cb..72a34fc 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -3121,6 +3121,9 @@ frame_info_ptr frame_follow_static_link (frame_info_ptr frame) { const block *frame_block = get_frame_block (frame, nullptr); + if (frame_block == nullptr) + return {}; + frame_block = frame_block->function_block (); const struct dynamic_prop *static_link = frame_block->static_link (); |