public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] gdb/mi: Fix printing of fortran strings in stack
@ 2023-05-10 10:20 Richard Bunt
  2023-05-10 13:13 ` Andrew Burgess
  2023-05-10 14:52 ` Tom Tromey
  0 siblings, 2 replies; 6+ messages in thread
From: Richard Bunt @ 2023-05-10 10:20 UTC (permalink / raw)
  To: gdb-patches; +Cc: Richard Bunt, Josh Cottingham

547ce8f00b4ef826bdc9bf9a74f119fe9768852e 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. Solved
by porting the fix to the MI mode code path.

GDB built with GCC 13.

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

Co-Authored-By: Josh Cottingham <josh.cottingham@arm.com>

---
 gdb/mi/mi-cmd-stack.c                          |  3 +++
 gdb/testsuite/gdb.fortran/mixed-lang-stack.exp | 12 ++++++++++++
 2 files changed, 15 insertions(+)

diff --git a/gdb/mi/mi-cmd-stack.c b/gdb/mi/mi-cmd-stack.c
index 0172bf9814d..70762880c49 100644
--- a/gdb/mi/mi-cmd-stack.c
+++ b/gdb/mi/mi-cmd-stack.c
@@ -590,6 +590,9 @@ list_args_or_locals (const frame_print_options &fp_opts,
 
   ui_out_emit_list list_emitter (uiout, name_of_result);
 
+  scoped_restore_selected_frame restore_selected_frame;
+  select_frame (fi);
+
   while (block != 0)
     {
       for (struct symbol *sym : block_iterator_range (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] 6+ messages in thread

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

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-10 10:20 [PATCH] gdb/mi: Fix printing of fortran strings in stack Richard Bunt
2023-05-10 13:13 ` Andrew Burgess
2023-05-10 14:52 ` Tom Tromey
2023-05-10 16:36   ` Richard Bunt
2023-05-12 18:38     ` Tom Tromey
2023-05-16 16:24       ` Richard Bunt

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).