public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH v2] gdb: Remove redundant frame switching
@ 2023-05-16 16:30 Richard Bunt
  2023-05-18 17:18 ` Tom Tromey
  0 siblings, 1 reply; 2+ messages in thread
From: Richard Bunt @ 2023-05-16 16:30 UTC (permalink / raw)
  To: gdb-patches; +Cc: Richard Bunt

547ce8f00b fixed an issue where dynamic types were not being resolved
correctly prior to printing a value. The same issue was discovered when
printing the value using mi-mode, which was not covered by the fix.
Porting the fix to the mi-mode code path resolved the issue.

However, it was discovered that a later patch series, ending
2fc3b8a4cb8, independently fixed the issue in both the cli- and mi-mode
code paths, making the original fix unneeded.

This commit removes this extra frame switch and adds test coverage for
the mi-mode scenario to protect against any future divergence in this
area.

GDB built with GCC 11.

No test suite regressions detected. Compilers: GCC 12.1.0, ACfL 22.1,
Intel 22.1; Platforms: x86_64, aarch64.

---
 gdb/stack.c                                    |  6 ------
 gdb/testsuite/gdb.fortran/mixed-lang-stack.exp | 12 ++++++++++++
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/gdb/stack.c b/gdb/stack.c
index b1b25aa1c7e..e941eb639df 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -742,12 +742,6 @@ print_frame_args (const frame_print_options &fp_opts,
     = (print_names
        && fp_opts.print_frame_arguments != print_frame_arguments_none);
 
-  /* Temporarily change the selected frame to the given FRAME.
-     This allows routines that rely on the selected frame instead
-     of being given a frame as parameter to use the correct frame.  */
-  scoped_restore_selected_frame restore_selected_frame;
-  select_frame (frame);
-
   if (func)
     {
       const struct block *b = func->value_block ();
diff --git a/gdb/testsuite/gdb.fortran/mixed-lang-stack.exp b/gdb/testsuite/gdb.fortran/mixed-lang-stack.exp
index 6ab3f8adeba..5fc36f7b95b 100644
--- a/gdb/testsuite/gdb.fortran/mixed-lang-stack.exp
+++ b/gdb/testsuite/gdb.fortran/mixed-lang-stack.exp
@@ -92,6 +92,18 @@ proc run_tests { lang } {
 	    }
 	}
 
+	# Check backtrace arguments in MI mode.
+	set mi_a "\{name=\"a\",value=\"1\"\}"
+	set mi_b "\{name=\"b\",value=\"2\"\}"
+	set mi_c "\{name=\"c\",value=\"3\"\}"
+	set mi_d "\{name=\"d\",value=\"\\(4,5\\)\"\}"
+	set mi_e "\{name=\"e\",value=\"$e_arg\"\}"
+	set mi_g "\{name=\"g\",value=\"\\( a = 1.5, b = 2.5 \\)\"\}"
+	# Hidden argument name changes depending on compiler.
+	set mi_hidden "\{name=\"\[^\r\n\]+\",value=\"6\"\}"
+	gdb_test "interpreter-exec mi '-stack-list-arguments --no-frame-filters --all-values 7 7'" \
+		 "\\^done,stack-args=\\\[frame=\{level=\"7\",args=\\\[$mi_a,$mi_b,$mi_c,$mi_d,$mi_e,$mi_g,$mi_hidden\\\]\}\\\]"
+
 	# Check the language for frame #0.
 	gdb_test "info frame" "source language fortran\..*" \
 	    "info frame in frame #0"
-- 
2.32.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] gdb: Remove redundant frame switching
  2023-05-16 16:30 [PATCH v2] gdb: Remove redundant frame switching Richard Bunt
@ 2023-05-18 17:18 ` Tom Tromey
  0 siblings, 0 replies; 2+ messages in thread
From: Tom Tromey @ 2023-05-18 17:18 UTC (permalink / raw)
  To: Richard Bunt via Gdb-patches; +Cc: Richard Bunt

>>>>> "Richard" == Richard Bunt via Gdb-patches <gdb-patches@sourceware.org> writes:

Richard> This commit removes this extra frame switch and adds test coverage for
Richard> the mi-mode scenario to protect against any future divergence in this
Richard> area.

Richard> GDB built with GCC 11.

Richard> No test suite regressions detected. Compilers: GCC 12.1.0, ACfL 22.1,
Richard> Intel 22.1; Platforms: x86_64, aarch64.

Thanks, I think this is ok.

Approved-By: Tom Tromey <tom@tromey.com>

Tom

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-05-18 17:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-16 16:30 [PATCH v2] gdb: Remove redundant frame switching Richard Bunt
2023-05-18 17:18 ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).