aboutsummaryrefslogtreecommitdiff
path: root/gdb/Makefile.in
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2022-12-13 22:34:39 -0500
committerSimon Marchi <simon.marchi@efficios.com>2023-01-20 14:48:57 -0500
commit836a8d3710462596bb4184617999a9507adc3629 (patch)
treeda76674260e0c55130bfe6931918cfd6a6b8e643 /gdb/Makefile.in
parentbc2cbe815bdbac3bd027bf4acc94c554c29b0189 (diff)
downloadgdb-836a8d3710462596bb4184617999a9507adc3629.zip
gdb-836a8d3710462596bb4184617999a9507adc3629.tar.gz
gdb-836a8d3710462596bb4184617999a9507adc3629.tar.bz2
gdb: make user-created frames reinflatable
This patch teaches frame_info_ptr to reinflate user-created frames (frames created through create_new_frame, with the "select-frame view" command). Before this patch, frame_info_ptr doesn't support reinflating user-created frames, because it currently reinflates by getting the current target frame (for frame 0) or frame_find_by_id (for other frames). To reinflate a user-created frame, we need to call create_new_frame, to make it lookup an existing user-created frame, or otherwise create one. So, in prepare_reinflate, get the frame id even if the frame has level 0, if it is user-created. In reinflate, if the saved frame id is user create it, call create_new_frame. In order to test this, I initially enhanced the gdb.base/frame-view.exp test added by the previous patch by setting a pretty-printer for the type of the function parameters, in which we do an inferior call. This causes print_frame_args to not reinflate its frame (which is a user-created one) properly. On one machine (my Arch Linux one), it properly catches the bug, as the frame is not correctly restored after printing the first parameter, so it messes up the second parameter: frame #0 baz (z1=hahaha, z2=<error reading variable: frame address is not available.>) at /home/simark/src/binutils-gdb/gdb/testsuite/gdb.base/frame-view.c:40 40 return z1.m + z2.n; (gdb) FAIL: gdb.base/frame-view.exp: with_pretty_printer=true: frame frame #0 baz (z1=hahaha, z2=<error reading variable: frame address is not available.>) at /home/simark/src/binutils-gdb/gdb/testsuite/gdb.base/frame-view.c:40 40 return z1.m + z2.n; (gdb) FAIL: gdb.base/frame-view.exp: with_pretty_printer=true: frame again However, on another machine (my Ubuntu 22.04 one), it just passes fine, without the appropriate fix. I then thought about writing a selftest for that, it's more reliable. I left the gdb.base/frame-view.exp pretty printer test there, it's already written, and we never know, it might catch some unrelated issue some day. Change-Id: I5849baf77991fc67a15bfce4b5e865a97265b386 Reviewed-By: Bruno Larsen <blarsen@redhat.com>
Diffstat (limited to 'gdb/Makefile.in')
-rw-r--r--gdb/Makefile.in1
1 files changed, 1 insertions, 0 deletions
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index cce85b8..c3711a0 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -458,6 +458,7 @@ SELFTESTS_SRCS = \
unittests/environ-selftests.c \
unittests/filtered_iterator-selftests.c \
unittests/format_pieces-selftests.c \
+ unittests/frame_info_ptr-selftests.c \
unittests/function-view-selftests.c \
unittests/gdb_tilde_expand-selftests.c \
unittests/gmp-utils-selftests.c \