public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [RFC] mi: Print frame architecture when printing frames on an MI channel
@ 2018-08-10  5:57 Jan Vrany
  2018-08-10 10:30 ` Pedro Alves
  0 siblings, 1 reply; 14+ messages in thread
From: Jan Vrany @ 2018-08-10  5:57 UTC (permalink / raw)
  To: gdb-patches; +Cc: Jan Vrany

When printing frames on an MI channel also print frame architecture
like in:

    (gdb)
    -stack-list-frames 3 3
    ^done,stack=
    [frame={level="3",addr="0x000107a4",func="foo",
      file="recursive2.c",fullname="/home/foo/bar/recursive2.c",
      line="14",arch="i386:x86_64"}]
   (gdb)

This is usefull for MI clients that need to know the architecture in order
to perform further analysis, for example to use their own disassembler to
analyze mechinbe code.

gdb/Changelog:

	* stack.c (print_frame): print frame architecture when printing on
        an MI output.

gdb/testsuite/Changelog

	* lib/mi-support.exp (mi_expect_stop): Regexp updated tp aaccomodate
	new "arch" field in frame output.
	* gdb.mi/mi-return.exp: Likewise.
	* gdb.mi/mi-stack.exp: Likewise.
	* gdb.mi/mi-syn-frame.exp: Likewise.
	* gdb.mi/user-selected-context-sync.exp: Likewise.

gdb/doc/Changelog

	* gdb.texinfo (The -stack-list-frames Command): Updated description
        to mention "arch".
        Updated MI examples thorough the document to contain "arch" in frame
        output.
---
 gdb/ChangeLog                                 |  5 ++
 gdb/doc/ChangeLog                             |  7 ++
 gdb/doc/gdb.texinfo                           | 90 ++++++++++---------
 gdb/stack.c                                   |  4 +
 gdb/testsuite/ChangeLog                       |  9 ++
 gdb/testsuite/gdb.mi/mi-return.exp            |  2 +-
 gdb/testsuite/gdb.mi/mi-stack.exp             |  4 +-
 gdb/testsuite/gdb.mi/mi-syn-frame.exp         | 10 +--
 .../gdb.mi/user-selected-context-sync.exp     |  6 +-
 gdb/testsuite/lib/mi-support.exp              |  6 +-
 10 files changed, 85 insertions(+), 58 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 2f5d1ef8b7..da1e9fbce6 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2018-08-08  Jan Vrany  <jan.vrany@fit.cvut.cz>
+
+	* stack.c (print_frame): print frame architecture when printing on
+	an MI output.
+
 2018-08-08  Szabolcs Nagy  <szabolcs.nagy@arm.com>
 
 	* remote.c (remote_target::download_tracepoint): Change char* to
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog
index ceb4043e32..a565f6d380 100644
--- a/gdb/doc/ChangeLog
+++ b/gdb/doc/ChangeLog
@@ -1,3 +1,10 @@
+2018-08-08  Jan Vrany  <jan.vrany@fit.cvut.cz>
+
+	* gdb.texinfo (The -stack-list-frames Command): Updated description
+	to mention "arch".
+	Updated MI examples thorough the document to contain "arch" in frame
+	output.
+
 2018-08-07  Simon Marchi  <simon.marchi@ericsson.com>
 
 	* gdb.texinfo (Index Files Speed Up GDB): Add section about
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index b931834400..635275d3ec 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -28001,7 +28001,7 @@ reason that execution stopped.
 <- *stopped,reason="breakpoint-hit",disp="keep",bkptno="1",thread-id="0",
    frame=@{addr="0x08048564",func="main",
    args=[@{name="argc",value="1"@},@{name="argv",value="0xbfc4d4d4"@}],
-   file="myprog.c",fullname="/home/nickrob/myprog.c",line="68"@}
+   file="myprog.c",fullname="/home/nickrob/myprog.c",line="68",arch="i386:x86_64"@}
 <- (gdb)
 -> -exec-continue
 <- ^running
@@ -28664,7 +28664,7 @@ Setting a watchpoint on a variable in the @code{main} function:
 *stopped,reason="watchpoint-trigger",wpt=@{number="2",exp="x"@},
 value=@{old="-268439212",new="55"@},
 frame=@{func="main",args=[],file="recursive2.c",
-fullname="/home/foo/bar/recursive2.c",line="5"@}
+fullname="/home/foo/bar/recursive2.c",line="5",arch="i386:x86_64"@}
 (gdb)
 @end smallexample
 
@@ -28684,7 +28684,7 @@ for the watchpoint going out of scope.
 wpt=@{number="5",exp="C"@},value=@{old="-276895068",new="3"@},
 frame=@{func="callee4",args=[],
 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
-fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="13"@}
+fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="13",arch="i386:x86_64"@}
 (gdb)
 -exec-continue
 ^running
@@ -28693,7 +28693,7 @@ fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="13"@}
 frame=@{func="callee3",args=[@{name="strarg",
 value="0x11940 \"A string argument.\""@}],
 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
-fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="18"@}
+fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="18",arch="i386:x86_64"@}
 (gdb)
 @end smallexample
 
@@ -28729,7 +28729,7 @@ enabled="y",addr="",what="C",thread-groups=["i1"],times="0"@}]@}
 value=@{old="-276895068",new="3"@},
 frame=@{func="callee4",args=[],
 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
-fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="13"@}
+fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="13",arch="i386:x86_64"@}
 (gdb)
 -break-list
 ^done,BreakpointTable=@{nr_rows="2",nr_cols="6",
@@ -28753,7 +28753,7 @@ enabled="y",addr="",what="C",thread-groups=["i1"],times="-5"@}]@}
 frame=@{func="callee3",args=[@{name="strarg",
 value="0x11940 \"A string argument.\""@}],
 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
-fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="18"@}
+fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="18",arch="i386:x86_64"@}
 (gdb)
 -break-list
 ^done,BreakpointTable=@{nr_rows="1",nr_cols="6",
@@ -29232,7 +29232,7 @@ the command.
 @{id="1",target-id="Thread 0xb7e156b0 (LWP 21254)",
    frame=@{level="0",addr="0x0804891f",func="foo",
            args=[@{name="i",value="10"@}],
-           file="/tmp/a.c",fullname="/tmp/a.c",line="158"@},
+           file="/tmp/a.c",fullname="/tmp/a.c",line="158",arch="i386:x86_64"@},
            state="running"@}],
 current-thread-id="1"
 (gdb)
@@ -29308,7 +29308,7 @@ number-of-threads="3"
 ^done,new-thread-id="3",
 frame=@{level="0",func="vprintf",
 args=[@{name="format",value="0x8048e9c \"%*s%c %d %c\\n\""@},
-@{name="arg",value="0x2"@}],file="vprintf.c",line="31"@}
+@{name="arg",value="0x2"@}],file="vprintf.c",line="31",arch="i386:x86_64"@}
 (gdb)
 @end smallexample
 
@@ -29442,7 +29442,7 @@ The corresponding @value{GDBN} corresponding is @samp{continue}.
 @@Hello world
 *stopped,reason="breakpoint-hit",disp="keep",bkptno="2",frame=@{
 func="foo",args=[],file="hello.c",fullname="/home/foo/bar/hello.c",
-line="13"@}
+line="13",arch="i386:x86_64"@}
 (gdb)
 @end smallexample
 
@@ -29476,7 +29476,7 @@ Function returning @code{void}.
 (gdb)
 @@hello from foo
 *stopped,reason="function-finished",frame=@{func="main",args=[],
-file="hello.c",fullname="/home/foo/bar/hello.c",line="7"@}
+file="hello.c",fullname="/home/foo/bar/hello.c",line="7",arch="i386:x86_64"@}
 (gdb)
 @end smallexample
 
@@ -29490,7 +29490,7 @@ value itself.
 (gdb)
 *stopped,reason="function-finished",frame=@{addr="0x000107b0",func="foo",
 args=[@{name="a",value="1"],@{name="b",value="9"@}@},
-file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"@},
+file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",arch="i386:x86_64"@},
 gdb-result-var="$1",return-value="0"
 (gdb)
 @end smallexample
@@ -29538,7 +29538,7 @@ The corresponding @value{GDBN} command is @samp{interrupt}.
 (gdb)
 111*stopped,signal-name="SIGINT",signal-meaning="Interrupt",
 frame=@{addr="0x00010140",func="foo",args=[],file="try.c",
-fullname="/home/foo/bar/try.c",line="13"@}
+fullname="/home/foo/bar/try.c",line="13",arch="i386:x86_64"@}
 (gdb)
 
 (gdb)
@@ -29675,7 +29675,7 @@ file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8"@}
 000*stopped,reason="breakpoint-hit",disp="keep",bkptno="1",
 frame=@{func="callee4",args=[],
 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
-fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="8"@}
+fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="8",arch="i386:x86_64"@}
 (gdb)
 205-break-delete
 205^done
@@ -29685,7 +29685,7 @@ fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="8"@}
 args=[@{name="strarg",
 value="0x11940 \"A string argument.\""@}],
 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
-fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="18"@}
+fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="18",arch="i386:x86_64"@}
 (gdb)
 @end smallexample
 
@@ -29731,7 +29731,7 @@ The corresponding @value{GDBN} command is @samp{run}.
 (gdb)
 *stopped,reason="breakpoint-hit",disp="keep",bkptno="1",
 frame=@{func="main",args=[],file="recursive2.c",
-fullname="/home/foo/bar/recursive2.c",line="4"@}
+fullname="/home/foo/bar/recursive2.c",line="4",arch="i386:x86_64"@}
 (gdb)
 @end smallexample
 
@@ -29805,7 +29805,7 @@ Stepping into a function:
 *stopped,reason="end-stepping-range",
 frame=@{func="foo",args=[@{name="a",value="10"@},
 @{name="b",value="0"@}],file="recursive2.c",
-fullname="/home/foo/bar/recursive2.c",line="11"@}
+fullname="/home/foo/bar/recursive2.c",line="11",arch="i386:x86_64"@}
 (gdb)
 @end smallexample
 
@@ -29851,7 +29851,7 @@ The corresponding @value{GDBN} command is @samp{stepi}.
 (gdb)
 *stopped,reason="end-stepping-range",
 frame=@{func="foo",args=[],file="try.c",
-fullname="/home/foo/bar/try.c",line="10"@}
+fullname="/home/foo/bar/try.c",line="10",arch="i386:x86_64"@}
 (gdb)
 -exec-step-instruction
 ^running
@@ -29859,7 +29859,7 @@ fullname="/home/foo/bar/try.c",line="10"@}
 (gdb)
 *stopped,reason="end-stepping-range",
 frame=@{addr="0x000100f4",func="foo",args=[],file="try.c",
-fullname="/home/foo/bar/try.c",line="10"@}
+fullname="/home/foo/bar/try.c",line="10",arch="i386:x86_64"@}
 (gdb)
 @end smallexample
 
@@ -29891,7 +29891,7 @@ The corresponding @value{GDBN} command is @samp{until}.
 (gdb)
 x = 55
 *stopped,reason="location-reached",frame=@{func="main",args=[],
-file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="6"@}
+file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="6",arch="i386:x86_64"@}
 (gdb)
 @end smallexample
 
@@ -29944,7 +29944,7 @@ The corresponding @value{GDBN} command is @samp{info frame} or @samp{frame}
 -stack-info-frame
 ^done,frame=@{level="1",addr="0x0001076c",func="callee3",
 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
-fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="17"@}
+fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="17",arch="i386:x86_64"@}
 (gdb)
 @end smallexample
 
@@ -30036,19 +30036,19 @@ functionality of @samp{-stack-list-arguments}.
 stack=[
 frame=@{level="0",addr="0x00010734",func="callee4",
 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
-fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="8"@},
+fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="8",arch="i386:x86_64"@},
 frame=@{level="1",addr="0x0001076c",func="callee3",
 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
-fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="17"@},
+fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="17",arch="i386:x86_64"@},
 frame=@{level="2",addr="0x0001078c",func="callee2",
 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
-fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="22"@},
+fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="22",arch="i386:x86_64"@},
 frame=@{level="3",addr="0x000107b4",func="callee1",
 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
-fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="27"@},
+fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="27",arch="i386:x86_64"@},
 frame=@{level="4",addr="0x000107e0",func="main",
 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
-fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="32"@}]
+fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="32",arch="i386:x86_64"@}]
 (gdb)
 -stack-list-arguments 0
 ^done,
@@ -30116,6 +30116,8 @@ Line number corresponding to the @code{$pc}.
 @item @var{from}
 The shared library where this function is defined.  This is only given
 if the frame's function is not known.
+@item @var{arch}
+Frame's architecture.
 @end table
 
 If invoked without arguments, this command prints a backtrace for the
@@ -30141,29 +30143,29 @@ Full stack backtrace:
 -stack-list-frames
 ^done,stack=
 [frame=@{level="0",addr="0x0001076c",func="foo",
-  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="11"@},
+  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="11",arch="i386:x86_64"@},
 frame=@{level="1",addr="0x000107a4",func="foo",
-  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"@},
+  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",arch="i386:x86_64"@},
 frame=@{level="2",addr="0x000107a4",func="foo",
-  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"@},
+  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",arch="i386:x86_64"@},
 frame=@{level="3",addr="0x000107a4",func="foo",
-  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"@},
+  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",arch="i386:x86_64"@},
 frame=@{level="4",addr="0x000107a4",func="foo",
-  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"@},
+  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",arch="i386:x86_64"@},
 frame=@{level="5",addr="0x000107a4",func="foo",
-  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"@},
+  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",arch="i386:x86_64"@},
 frame=@{level="6",addr="0x000107a4",func="foo",
-  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"@},
+  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",arch="i386:x86_64"@},
 frame=@{level="7",addr="0x000107a4",func="foo",
-  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"@},
+  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",arch="i386:x86_64"@},
 frame=@{level="8",addr="0x000107a4",func="foo",
-  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"@},
+  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",arch="i386:x86_64"@},
 frame=@{level="9",addr="0x000107a4",func="foo",
-  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"@},
+  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",arch="i386:x86_64"@},
 frame=@{level="10",addr="0x000107a4",func="foo",
-  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"@},
+  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",arch="i386:x86_64"@},
 frame=@{level="11",addr="0x00010738",func="main",
-  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="4"@}]
+  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="4",arch="i386:x86_64"@}]
 (gdb)
 @end smallexample
 
@@ -30174,11 +30176,11 @@ Show frames between @var{low_frame} and @var{high_frame}:
 -stack-list-frames 3 5
 ^done,stack=
 [frame=@{level="3",addr="0x000107a4",func="foo",
-  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"@},
+  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",arch="i386:x86_64"@},
 frame=@{level="4",addr="0x000107a4",func="foo",
-  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"@},
+  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",arch="i386:x86_64"@},
 frame=@{level="5",addr="0x000107a4",func="foo",
-  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"@}]
+  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",arch="i386:x86_64"@}]
 (gdb)
 @end smallexample
 
@@ -30189,7 +30191,7 @@ Show a single frame:
 -stack-list-frames 3 3
 ^done,stack=
 [frame=@{level="3",addr="0x000107a4",func="foo",
-  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"@}]
+  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",arch="i386:x86_64"@}]
 (gdb)
 @end smallexample
 
@@ -31463,7 +31465,7 @@ On a PPC MBX board:
 (gdb)
 *stopped,reason="breakpoint-hit",disp="keep",bkptno="1",frame=@{
 func="main",args=[],file="try.c",fullname="/home/foo/bar/try.c",
-line="5"@}
+line="5",arch="powerpc"@}
 (gdb)
 -data-list-changed-registers
 ^done,changed-registers=["0","1","2","4","5","6","7","8","9",
@@ -33638,7 +33640,7 @@ and only if there is a corresponding executable file.
    frame=@{level="0",addr="0xffffe410",func="__kernel_vsyscall",args=[]@},state="running"@},
 @{id="1",target-id="Thread 0xb7e156b0 (LWP 21254)",
    frame=@{level="0",addr="0x0804891f",func="foo",args=[@{name="i",value="10"@}],
-           file="/tmp/a.c",fullname="/tmp/a.c",line="158"@},state="running"@}]]
+           file="/tmp/a.c",fullname="/tmp/a.c",line="158",arch="i386:x86_64"@},state="running"@}]]
 -list-thread-groups --available
 ^done,groups=[@{id="17",type="process",pid="yyy",num_children="2",cores=[1,2]@}]
 -list-thread-groups --available --recurse 1
@@ -33870,7 +33872,7 @@ time=@{wallclock="0.05185",user="0.00800",system="0.00000"@}
 *stopped,reason="breakpoint-hit",disp="keep",bkptno="1",thread-id="0",
 frame=@{addr="0x080484ed",func="main",args=[@{name="argc",value="1"@},
 @{name="argv",value="0xbfb60364"@}],file="myprog.c",
-fullname="/home/nickrob/myprog.c",line="73"@}
+fullname="/home/nickrob/myprog.c",line="73",arch="i386:x86_64"@}
 (gdb)
 @end smallexample
 
diff --git a/gdb/stack.c b/gdb/stack.c
index 3da46dd955..6871dd6f46 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -1249,6 +1249,10 @@ print_frame (struct frame_info *frame, int print_level,
 	    uiout->field_string ("from", lib);
 	  }
       }
+    if (uiout->is_mi_like_p ())
+      uiout->field_string ("arch",
+			   (gdbarch_bfd_arch_info (gdbarch))->printable_name);
+
   }
 
   uiout->text ("\n");
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index c79e1e8f20..81cf3fe143 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,12 @@
+2018-08-08  Jan Vrany  <jan.vrany@fit.cvut.cz>
+
+	* lib/mi-support.exp (mi_expect_stop): Regexp updated tp aaccomodate
+	new "arch" field in frame output.
+	* gdb.mi/mi-return.exp: Likewise.
+	* gdb.mi/mi-stack.exp: Likewise.
+	* gdb.mi/mi-syn-frame.exp: Likewise.
+	* gdb.mi/user-selected-context-sync.exp: Likewise.
+
 2018-08-07  Simon Marchi  <simon.marchi@polymtl.ca>
 
 	* gdb.fortran/nested-funcs.exp: Replace "set index = 42" with
diff --git a/gdb/testsuite/gdb.mi/mi-return.exp b/gdb/testsuite/gdb.mi/mi-return.exp
index 8db0c57b33..85b68316c5 100644
--- a/gdb/testsuite/gdb.mi/mi-return.exp
+++ b/gdb/testsuite/gdb.mi/mi-return.exp
@@ -50,7 +50,7 @@ proc test_return_simple {} {
     set line_callee3_call         [expr $line_callee3_head + 2]
     set line_callee3_close_brace  [expr $line_callee3_head + 3]
 
-    mi_gdb_test "111-exec-return" "111\\^done,frame=\{level=\"0\",addr=\"$hex\",func=\"callee3\",args=\\\[.*\\\],file=\".*basics.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"($line_callee3_call|$line_callee3_close_brace)\"\}" "return from callee4 now"
+    mi_gdb_test "111-exec-return" "111\\^done,frame=\{level=\"0\",addr=\"$hex\",func=\"callee3\",args=\\\[.*\\\],file=\".*basics.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"($line_callee3_call|$line_callee3_close_brace)\",arch=\".*\"\}" "return from callee4 now"
 }
 
 mi_runto callee4
diff --git a/gdb/testsuite/gdb.mi/mi-stack.exp b/gdb/testsuite/gdb.mi/mi-stack.exp
index fcb74e2610..e7ca725d97 100644
--- a/gdb/testsuite/gdb.mi/mi-stack.exp
+++ b/gdb/testsuite/gdb.mi/mi-stack.exp
@@ -56,7 +56,7 @@ proc test_stack_frame_listing {} {
     # -stack-list-frames 1 3
     # -stack-info-frame
     mi_gdb_test "231-stack-list-frames" \
-	"231\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"callee4\",file=\".*${srcfile}\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$callee4_begin\"\},frame=\{level=\"1\",addr=\"$hex\",func=\"callee3\",.*\},frame=\{level=\"2\",addr=\"$hex\",func=\"callee2\",.*\},frame=\{level=\"3\",addr=\"$hex\",func=\"callee1\",.*\},frame=\{level=\"4\",addr=\"$hex\",func=\"main\",.*\}\\\]" \
+	"231\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"callee4\",file=\".*${srcfile}\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$callee4_begin\",arch=\".*\"\},frame=\{level=\"1\",addr=\"$hex\",func=\"callee3\",.*\},frame=\{level=\"2\",addr=\"$hex\",func=\"callee2\",.*\},frame=\{level=\"3\",addr=\"$hex\",func=\"callee1\",.*\},frame=\{level=\"4\",addr=\"$hex\",func=\"main\",.*\}\\\]" \
 	"stack frame listing"
     mi_gdb_test "232-stack-list-frames 1 1" \
 	"232\\^done,stack=\\\[frame=\{level=\"1\",addr=\"$hex\",func=\"callee3\",.*\}\\\]" \
@@ -70,7 +70,7 @@ proc test_stack_frame_listing {} {
 	"stack frame listing wrong"
 
     mi_gdb_test "235-stack-info-frame" \
-	"235\\^done,frame=\{level=\"0\",addr=\"$hex\",func=\"callee4\",file=\".*${srcfile}\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$callee4_begin\"\}" \
+	"235\\^done,frame=\{level=\"0\",addr=\"$hex\",func=\"callee4\",file=\".*${srcfile}\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$callee4_begin\",arch=\".*\"\}" \
 	"selected frame listing"
 
     mi_gdb_test "236-stack-list-frames 1 300" \
diff --git a/gdb/testsuite/gdb.mi/mi-syn-frame.exp b/gdb/testsuite/gdb.mi/mi-syn-frame.exp
index 44196324be..6a22994f34 100644
--- a/gdb/testsuite/gdb.mi/mi-syn-frame.exp
+++ b/gdb/testsuite/gdb.mi/mi-syn-frame.exp
@@ -47,7 +47,7 @@ mi_gdb_test "401-data-evaluate-expression foo()" ".*401\\^error,msg=\"The progra
     "call inferior's function with a breakpoint set in it"
 
 
-mi_gdb_test "402-stack-list-frames" "402\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"foo\",file=\".*mi-syn-frame.c\",line=\"$decimal\"\},frame=\{level=\"1\",addr=\"$hex\",func=\"<function called from gdb>\"\},frame=\{level=\"2\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",line=\"$decimal\"\}.*\\\]" "backtrace from inferior function stopped at bp, showing gdb dummy frame"
+mi_gdb_test "402-stack-list-frames" "402\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"foo\",file=\".*mi-syn-frame.c\",line=\"$decimal\",arch=\".*\"\},frame=\{level=\"1\",addr=\"$hex\",func=\"<function called from gdb>\"\},frame=\{level=\"2\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",line=\"$decimal\",arch=\".*\"\}.*\\\]" "backtrace from inferior function stopped at bp, showing gdb dummy frame"
 
 #
 # Continue back to main()
@@ -57,7 +57,7 @@ mi_send_resuming_command "exec-continue" "testing exec continue"
 mi_expect_stop "really-no-reason" "" "" "" "" "" "finished exec continue"
 
 mi_gdb_test "404-stack-list-frames 0 0" \
-  "404\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"\}.*\\\]" \
+  "404\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\",arch=\".*\"\}.*\\\]" \
   "list stack frames"
 
 
@@ -77,7 +77,7 @@ mi_gdb_test "406-data-evaluate-expression have_a_very_merry_interrupt()" \
 # in this next output.
 
 mi_gdb_test "407-stack-list-frames" \
-  "407\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"subroutine\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"\},frame=\{level=\"1\",addr=\"$hex\",func=\"handler\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"\},frame=\{level=\"2\",addr=\"$hex\",func=\"<signal handler called>\"\},.*frame=\{level=\"$decimal\",addr=\"$hex\",func=\"have_a_very_merry_interrupt\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"\},frame=\{level=\"$decimal\",addr=\"$hex\",func=\"<function called from gdb>\"\},frame=\{level=\"$decimal\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"\}.*\\\]" \
+  "407\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"subroutine\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\",arch=\".*\"\},frame=\{level=\"1\",addr=\"$hex\",func=\"handler\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\",arch=\".*\"\},frame=\{level=\"2\",addr=\"$hex\",func=\"<signal handler called>\"\},.*frame=\{level=\"$decimal\",addr=\"$hex\",func=\"have_a_very_merry_interrupt\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\",arch=\".*\"\},frame=\{level=\"$decimal\",addr=\"$hex\",func=\"<function called from gdb>\"\},frame=\{level=\"$decimal\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\",arch=\".*\"\}.*\\\]" \
   "list stack frames"
 
 
@@ -86,7 +86,7 @@ mi_send_resuming_command "exec-continue" "testing exec continue"
 mi_expect_stop "really-no-reason" "" "" "" "" "" "finished exec continue"
 
 mi_gdb_test "409-stack-list-frames 0 0" \
-  "409\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"\}.*\\\]" \
+  "409\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\",arch=\".*\"\}.*\\\]" \
   "list stack frames"
 
 #
@@ -97,7 +97,7 @@ mi_gdb_test "410-data-evaluate-expression bar()" \
   ".*410\\^error,msg=\"The program being debugged was signaled while in a function called from GDB.\\\\nGDB remains in the frame where the signal was received.\\\\nTo change this behavior use \\\\\"set unwindonsignal on\\\\\".\\\\nEvaluation of the expression containing the function\\\\n\\(bar\\) will be abandoned.\\\\nWhen the function is done executing, GDB will silently stop.\"" \
   "call inferior function which raises exception"
 
-mi_gdb_test "411-stack-list-frames" "411\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"bar\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"},frame=\{level=\"1\",addr=\"$hex\",func=\"<function called from gdb>\"\},frame=\{level=\"2\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"}.*\\\]" "backtrace from inferior function at exception"
+mi_gdb_test "411-stack-list-frames" "411\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"bar\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\",arch=\".*\"},frame=\{level=\"1\",addr=\"$hex\",func=\"<function called from gdb>\"\},frame=\{level=\"2\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\",arch=\".*\"}.*\\\]" "backtrace from inferior function at exception"
 
 mi_gdb_exit
 
diff --git a/gdb/testsuite/gdb.mi/user-selected-context-sync.exp b/gdb/testsuite/gdb.mi/user-selected-context-sync.exp
index 05624deb0a..df3ee42af3 100644
--- a/gdb/testsuite/gdb.mi/user-selected-context-sync.exp
+++ b/gdb/testsuite/gdb.mi/user-selected-context-sync.exp
@@ -156,11 +156,11 @@ proc make_mi_re { mode thread frame type } {
     set thread_event_re "=thread-selected,id=\"$thread\""
     set thread_answer_re "\\^done,new-thread-id=\"$thread\""
 
-    set frame_re(0) ",frame=\{level=\"0\",addr=\"$hex\",func=\"child_sub_function\",args=\\\[\\\],file=\"${any}${srcfile}\",fullname=\"${any}${srcfile}\",line=\"$thread_loop_line\"\}"
-    set frame_re(1) ",frame=\{level=\"1\",addr=\"$hex\",func=\"child_function\",args=\\\[\{name=\"args\",value=\"0x0\"\}\\\],file=\"${any}${srcfile}\",fullname=\"${any}${srcfile}\",line=\"$thread_caller_line\"\}"
+    set frame_re(0) ",frame=\{level=\"0\",addr=\"$hex\",func=\"child_sub_function\",args=\\\[\\\],file=\"${any}${srcfile}\",fullname=\"${any}${srcfile}\",line=\"$thread_loop_line\",arch=\".*\"\}"
+    set frame_re(1) ",frame=\{level=\"1\",addr=\"$hex\",func=\"child_function\",args=\\\[\{name=\"args\",value=\"0x0\"\}\\\],file=\"${any}${srcfile}\",fullname=\"${any}${srcfile}\",line=\"$thread_caller_line\",arch=\".*\"\}"
 
     # Special frame for main thread.
-    set frame_re(2) ",frame=\{level=\"0\",addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\"${any}${srcfile}\",fullname=\"${any}${srcfile}\",line=\"${main_break_line}\"\}"
+    set frame_re(2) ",frame=\{level=\"0\",addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\"${any}${srcfile}\",fullname=\"${any}${srcfile}\",line=\"${main_break_line}\",arch=\".*\"\}"
 
     if { $thread != -1 } {
 	if { $type == "event" } {
diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp
index 851e490f4d..a264cfc2a8 100644
--- a/gdb/testsuite/lib/mi-support.exp
+++ b/gdb/testsuite/lib/mi-support.exp
@@ -1240,9 +1240,9 @@ proc mi_expect_stop { reason func args file line extra test } {
 
     set a $after_reason
 
-    verbose -log "mi_expect_stop: expecting: \\*stopped,${r}${a}${bn}frame=\{addr=\"$hex\",func=\"$func\",args=$args,(?:file=\"$any$file\",fullname=\"${fullname_syntax}$file\",line=\"$line\"|from=\"$file\")\}$after_stopped,thread-id=\"$decimal\",stopped-threads=$any\r\n($thread_selected_re|$breakpoint_re)*$prompt_re"
+    verbose -log "mi_expect_stop: expecting: \\*stopped,${r}${a}${bn}frame=\{addr=\"$hex\",func=\"$func\",args=$args,(?:file=\"$any$file\",fullname=\"${fullname_syntax}$file\",line=\"$line\",arch=\".*\"|from=\"$file\")\}$after_stopped,thread-id=\"$decimal\",stopped-threads=$any\r\n($thread_selected_re|$breakpoint_re)*$prompt_re"
     gdb_expect {
-	-re "\\*stopped,${r}${a}${bn}frame=\{addr=\"$hex\",func=\"$func\",args=$args,(?:file=\"$any$file\",fullname=\"${fullname_syntax}$file\",line=\"($line)\"|from=\"$file\")\}$after_stopped,thread-id=\"$decimal\",stopped-threads=$any\r\n($thread_selected_re|$breakpoint_re)*$prompt_re" {
+	-re "\\*stopped,${r}${a}${bn}frame=\{addr=\"$hex\",func=\"$func\",args=$args,(?:file=\"$any$file\",fullname=\"${fullname_syntax}$file\",line=\"($line)\",arch=\".*\"|from=\"$file\")\}$after_stopped,thread-id=\"$decimal\",stopped-threads=$any\r\n($thread_selected_re|$breakpoint_re)*$prompt_re" {
 	    pass "$test"
 	    if {[array names expect_out "2,string"] != ""} {
 		return $expect_out(2,string)
@@ -1250,7 +1250,7 @@ proc mi_expect_stop { reason func args file line extra test } {
 	    # No debug info available but $file does match.
 	    return 0
 	}
-	-re "\\*stopped,${r}${a}${bn}frame=\{addr=\"$hex\",func=\"$any\",args=\[\\\[\{\]$any\[\\\]\}\],file=\"$any\",fullname=\"${fullname_syntax}$any\",line=\"\[0-9\]*\"\}$after_stopped,thread-id=\"$decimal\",stopped-threads=$any\r\n($thread_selected_re|$breakpoint_re)*$prompt_re" {
+	-re "\\*stopped,${r}${a}${bn}frame=\{addr=\"$hex\",func=\"$any\",args=\[\\\[\{\]$any\[\\\]\}\],file=\"$any\",fullname=\"${fullname_syntax}$any\",line=\"\[0-9\]*\",arch=\".*\"\}$after_stopped,thread-id=\"$decimal\",stopped-threads=$any\r\n($thread_selected_re|$breakpoint_re)*$prompt_re" {
 	    verbose -log "got $expect_out(buffer)"
 	    fail "$test (stopped at wrong place)"
 	    return -1
-- 
2.18.0

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

* Re: [RFC] mi: Print frame architecture when printing frames on an MI channel
  2018-08-10  5:57 [RFC] mi: Print frame architecture when printing frames on an MI channel Jan Vrany
@ 2018-08-10 10:30 ` Pedro Alves
  2018-08-13 10:53   ` [RFC] mi: print " Jan Vrany
  0 siblings, 1 reply; 14+ messages in thread
From: Pedro Alves @ 2018-08-10 10:30 UTC (permalink / raw)
  To: Jan Vrany, gdb-patches

Hi Jan,

On 08/10/2018 06:55 AM, Jan Vrany wrote:
> When printing frames on an MI channel also print frame architecture
> like in:
> 
>     (gdb)
>     -stack-list-frames 3 3
>     ^done,stack=
>     [frame={level="3",addr="0x000107a4",func="foo",
>       file="recursive2.c",fullname="/home/foo/bar/recursive2.c",
>       line="14",arch="i386:x86_64"}]
>    (gdb)
> 
> This is usefull for MI clients that need to know the architecture in order

Typo: "useful"

> to perform further analysis, for example to use their own disassembler to
> analyze mechinbe code.

Typo: "machine"

Sounds like a good idea.  Could be useful too for multi-arch debugging (like mixed
SPU and Power frames on Cell).

This needs a NEWS entry.

> 
> gdb/Changelog:
> 
> 	* stack.c (print_frame): print frame architecture when printing on
>         an MI output.

Uppercase "Print".

> 
> gdb/testsuite/Changelog
> 
> 	* lib/mi-support.exp (mi_expect_stop): Regexp updated tp aaccomodate

Typo: "accommodate"

> 	new "arch" field in frame output.
> 	* gdb.mi/mi-return.exp: Likewise.
> 	* gdb.mi/mi-stack.exp: Likewise.
> 	* gdb.mi/mi-syn-frame.exp: Likewise.
> 	* gdb.mi/user-selected-context-sync.exp: Likewise.
> 
> gdb/doc/Changelog
> 
> 	* gdb.texinfo (The -stack-list-frames Command): Updated description
>         to mention "arch".
>         Updated MI examples thorough the document to contain "arch" in frame
>         output.

(Nit: avoid past tense, "Updated" -> "Update" throughout.)


> diff --git a/gdb/testsuite/gdb.mi/user-selected-context-sync.exp b/gdb/testsuite/gdb.mi/user-selected-context-sync.exp
> index 05624deb0a..df3ee42af3 100644
> --- a/gdb/testsuite/gdb.mi/user-selected-context-sync.exp
> +++ b/gdb/testsuite/gdb.mi/user-selected-context-sync.exp
> @@ -156,11 +156,11 @@ proc make_mi_re { mode thread frame type } {
>      set thread_event_re "=thread-selected,id=\"$thread\""
>      set thread_answer_re "\\^done,new-thread-id=\"$thread\""
>  
> -    set frame_re(0) ",frame=\{level=\"0\",addr=\"$hex\",func=\"child_sub_function\",args=\\\[\\\],file=\"${any}${srcfile}\",fullname=\"${any}${srcfile}\",line=\"$thread_loop_line\"\}"
> -    set frame_re(1) ",frame=\{level=\"1\",addr=\"$hex\",func=\"child_function\",args=\\\[\{name=\"args\",value=\"0x0\"\}\\\],file=\"${any}${srcfile}\",fullname=\"${any}${srcfile}\",line=\"$thread_caller_line\"\}"
> +    set frame_re(0) ",frame=\{level=\"0\",addr=\"$hex\",func=\"child_sub_function\",args=\\\[\\\],file=\"${any}${srcfile}\",fullname=\"${any}${srcfile}\",line=\"$thread_loop_line\",arch=\".*\"\}"
> +    set frame_re(1) ",frame=\{level=\"1\",addr=\"$hex\",func=\"child_function\",args=\\\[\{name=\"args\",value=\"0x0\"\}\\\],file=\"${any}${srcfile}\",fullname=\"${any}${srcfile}\",line=\"$thread_caller_line\",arch=\".*\"\}"

I'd rather use a stricter \[^\r\n\]+ or better \[^"\]+ instead of ".*" throughout,
in case ".*" ends up too greedy and manages to consume further attributes,
like a bug that results in:

   ....arch="foo", arch="foo"}

or a bug/regression that causes arch to come out empty, like:

   ....arch=""}

or if .* makes a test manage to consume one frame too many,
or other things like that.  

(In this file, notice the "$any" variable.)

Thanks,
Pedro Alves

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

* [RFC] mi: print frame architecture when printing frames on an MI channel
  2018-08-10 10:30 ` Pedro Alves
@ 2018-08-13 10:53   ` Jan Vrany
  2018-08-16 19:01     ` Pedro Alves
  0 siblings, 1 reply; 14+ messages in thread
From: Jan Vrany @ 2018-08-13 10:53 UTC (permalink / raw)
  To: gdb-patches; +Cc: Jan Vrany

When printing frames on an MI channel also print frame architecture
like in:

    (gdb)
    -stack-list-frames 3 3
    ^done,stack=
    [frame={level="3",addr="0x000107a4",func="foo",
      file="recursive2.c",fullname="/home/foo/bar/recursive2.c",
      line="14",arch="i386:x86_64"}]
   (gdb)

This is useful for MI clients that need to know the architecture in order
to perform further analysis, for example to use their own disassembler to
analyze machine code.

gdb/Changelog:

	* stack.c (print_frame): Print frame architecture when printing on
        an MI output.

gdb/testsuite/Changelog

	* lib/mi-support.exp (mi_expect_stop): Update regexp to
	accommodate new "arch" field in frame output.
	* gdb.mi/mi-return.exp: Likewise.
	* gdb.mi/mi-stack.exp: Likewise.
	* gdb.mi/mi-syn-frame.exp: Likewise.
	* gdb.mi/user-selected-context-sync.exp: Likewise.

gdb/doc/Changelog

	* gdb.texinfo (The -stack-list-frames Command): Update description
	to mention "arch".
	Update MI examples thorough the document to contain "arch" in frame
	output.
---
 gdb/ChangeLog                                 |  5 ++
 gdb/NEWS                                      |  2 +
 gdb/doc/ChangeLog                             |  7 ++
 gdb/doc/gdb.texinfo                           | 90 ++++++++++---------
 gdb/stack.c                                   |  5 +-
 gdb/testsuite/ChangeLog                       |  9 ++
 gdb/testsuite/gdb.mi/mi-return.exp            |  2 +-
 gdb/testsuite/gdb.mi/mi-stack.exp             | 12 ++-
 gdb/testsuite/gdb.mi/mi-syn-frame.exp         | 11 +--
 .../gdb.mi/user-selected-context-sync.exp     |  6 +-
 gdb/testsuite/lib/mi-support.exp              |  6 +-
 11 files changed, 96 insertions(+), 59 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 2f5d1ef8b7..c961ce5cbc 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2018-08-08  Jan Vrany  <jan.vrany@fit.cvut.cz>
+
+	* stack.c (print_frame): Print frame architecture when printing on
+	an MI output.
+
 2018-08-08  Szabolcs Nagy  <szabolcs.nagy@arm.com>
 
 	* remote.c (remote_target::download_tracepoint): Change char* to
diff --git a/gdb/NEWS b/gdb/NEWS
index 7f9466567f..e71340ad8e 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -3,6 +3,8 @@
 
 *** Changes since GDB 8.2
 
+* MI now reports frame architecture in command responses and notifications.
+
 * GDB and GDBserver now support IPv6 connections.  IPv6 addresses
   can be passed using the '[ADDRESS]:PORT' notation, or the regular
   'ADDRESS:PORT' method.
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog
index ceb4043e32..91c953df7f 100644
--- a/gdb/doc/ChangeLog
+++ b/gdb/doc/ChangeLog
@@ -1,3 +1,10 @@
+2018-08-08  Jan Vrany  <jan.vrany@fit.cvut.cz>
+
+	* gdb.texinfo (The -stack-list-frames Command): Update description
+	to mention "arch".
+	Update MI examples thorough the document to contain "arch" in frame
+	output.
+
 2018-08-07  Simon Marchi  <simon.marchi@ericsson.com>
 
 	* gdb.texinfo (Index Files Speed Up GDB): Add section about
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index b931834400..635275d3ec 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -28001,7 +28001,7 @@ reason that execution stopped.
 <- *stopped,reason="breakpoint-hit",disp="keep",bkptno="1",thread-id="0",
    frame=@{addr="0x08048564",func="main",
    args=[@{name="argc",value="1"@},@{name="argv",value="0xbfc4d4d4"@}],
-   file="myprog.c",fullname="/home/nickrob/myprog.c",line="68"@}
+   file="myprog.c",fullname="/home/nickrob/myprog.c",line="68",arch="i386:x86_64"@}
 <- (gdb)
 -> -exec-continue
 <- ^running
@@ -28664,7 +28664,7 @@ Setting a watchpoint on a variable in the @code{main} function:
 *stopped,reason="watchpoint-trigger",wpt=@{number="2",exp="x"@},
 value=@{old="-268439212",new="55"@},
 frame=@{func="main",args=[],file="recursive2.c",
-fullname="/home/foo/bar/recursive2.c",line="5"@}
+fullname="/home/foo/bar/recursive2.c",line="5",arch="i386:x86_64"@}
 (gdb)
 @end smallexample
 
@@ -28684,7 +28684,7 @@ for the watchpoint going out of scope.
 wpt=@{number="5",exp="C"@},value=@{old="-276895068",new="3"@},
 frame=@{func="callee4",args=[],
 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
-fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="13"@}
+fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="13",arch="i386:x86_64"@}
 (gdb)
 -exec-continue
 ^running
@@ -28693,7 +28693,7 @@ fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="13"@}
 frame=@{func="callee3",args=[@{name="strarg",
 value="0x11940 \"A string argument.\""@}],
 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
-fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="18"@}
+fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="18",arch="i386:x86_64"@}
 (gdb)
 @end smallexample
 
@@ -28729,7 +28729,7 @@ enabled="y",addr="",what="C",thread-groups=["i1"],times="0"@}]@}
 value=@{old="-276895068",new="3"@},
 frame=@{func="callee4",args=[],
 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
-fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="13"@}
+fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="13",arch="i386:x86_64"@}
 (gdb)
 -break-list
 ^done,BreakpointTable=@{nr_rows="2",nr_cols="6",
@@ -28753,7 +28753,7 @@ enabled="y",addr="",what="C",thread-groups=["i1"],times="-5"@}]@}
 frame=@{func="callee3",args=[@{name="strarg",
 value="0x11940 \"A string argument.\""@}],
 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
-fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="18"@}
+fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="18",arch="i386:x86_64"@}
 (gdb)
 -break-list
 ^done,BreakpointTable=@{nr_rows="1",nr_cols="6",
@@ -29232,7 +29232,7 @@ the command.
 @{id="1",target-id="Thread 0xb7e156b0 (LWP 21254)",
    frame=@{level="0",addr="0x0804891f",func="foo",
            args=[@{name="i",value="10"@}],
-           file="/tmp/a.c",fullname="/tmp/a.c",line="158"@},
+           file="/tmp/a.c",fullname="/tmp/a.c",line="158",arch="i386:x86_64"@},
            state="running"@}],
 current-thread-id="1"
 (gdb)
@@ -29308,7 +29308,7 @@ number-of-threads="3"
 ^done,new-thread-id="3",
 frame=@{level="0",func="vprintf",
 args=[@{name="format",value="0x8048e9c \"%*s%c %d %c\\n\""@},
-@{name="arg",value="0x2"@}],file="vprintf.c",line="31"@}
+@{name="arg",value="0x2"@}],file="vprintf.c",line="31",arch="i386:x86_64"@}
 (gdb)
 @end smallexample
 
@@ -29442,7 +29442,7 @@ The corresponding @value{GDBN} corresponding is @samp{continue}.
 @@Hello world
 *stopped,reason="breakpoint-hit",disp="keep",bkptno="2",frame=@{
 func="foo",args=[],file="hello.c",fullname="/home/foo/bar/hello.c",
-line="13"@}
+line="13",arch="i386:x86_64"@}
 (gdb)
 @end smallexample
 
@@ -29476,7 +29476,7 @@ Function returning @code{void}.
 (gdb)
 @@hello from foo
 *stopped,reason="function-finished",frame=@{func="main",args=[],
-file="hello.c",fullname="/home/foo/bar/hello.c",line="7"@}
+file="hello.c",fullname="/home/foo/bar/hello.c",line="7",arch="i386:x86_64"@}
 (gdb)
 @end smallexample
 
@@ -29490,7 +29490,7 @@ value itself.
 (gdb)
 *stopped,reason="function-finished",frame=@{addr="0x000107b0",func="foo",
 args=[@{name="a",value="1"],@{name="b",value="9"@}@},
-file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"@},
+file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",arch="i386:x86_64"@},
 gdb-result-var="$1",return-value="0"
 (gdb)
 @end smallexample
@@ -29538,7 +29538,7 @@ The corresponding @value{GDBN} command is @samp{interrupt}.
 (gdb)
 111*stopped,signal-name="SIGINT",signal-meaning="Interrupt",
 frame=@{addr="0x00010140",func="foo",args=[],file="try.c",
-fullname="/home/foo/bar/try.c",line="13"@}
+fullname="/home/foo/bar/try.c",line="13",arch="i386:x86_64"@}
 (gdb)
 
 (gdb)
@@ -29675,7 +29675,7 @@ file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8"@}
 000*stopped,reason="breakpoint-hit",disp="keep",bkptno="1",
 frame=@{func="callee4",args=[],
 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
-fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="8"@}
+fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="8",arch="i386:x86_64"@}
 (gdb)
 205-break-delete
 205^done
@@ -29685,7 +29685,7 @@ fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="8"@}
 args=[@{name="strarg",
 value="0x11940 \"A string argument.\""@}],
 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
-fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="18"@}
+fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="18",arch="i386:x86_64"@}
 (gdb)
 @end smallexample
 
@@ -29731,7 +29731,7 @@ The corresponding @value{GDBN} command is @samp{run}.
 (gdb)
 *stopped,reason="breakpoint-hit",disp="keep",bkptno="1",
 frame=@{func="main",args=[],file="recursive2.c",
-fullname="/home/foo/bar/recursive2.c",line="4"@}
+fullname="/home/foo/bar/recursive2.c",line="4",arch="i386:x86_64"@}
 (gdb)
 @end smallexample
 
@@ -29805,7 +29805,7 @@ Stepping into a function:
 *stopped,reason="end-stepping-range",
 frame=@{func="foo",args=[@{name="a",value="10"@},
 @{name="b",value="0"@}],file="recursive2.c",
-fullname="/home/foo/bar/recursive2.c",line="11"@}
+fullname="/home/foo/bar/recursive2.c",line="11",arch="i386:x86_64"@}
 (gdb)
 @end smallexample
 
@@ -29851,7 +29851,7 @@ The corresponding @value{GDBN} command is @samp{stepi}.
 (gdb)
 *stopped,reason="end-stepping-range",
 frame=@{func="foo",args=[],file="try.c",
-fullname="/home/foo/bar/try.c",line="10"@}
+fullname="/home/foo/bar/try.c",line="10",arch="i386:x86_64"@}
 (gdb)
 -exec-step-instruction
 ^running
@@ -29859,7 +29859,7 @@ fullname="/home/foo/bar/try.c",line="10"@}
 (gdb)
 *stopped,reason="end-stepping-range",
 frame=@{addr="0x000100f4",func="foo",args=[],file="try.c",
-fullname="/home/foo/bar/try.c",line="10"@}
+fullname="/home/foo/bar/try.c",line="10",arch="i386:x86_64"@}
 (gdb)
 @end smallexample
 
@@ -29891,7 +29891,7 @@ The corresponding @value{GDBN} command is @samp{until}.
 (gdb)
 x = 55
 *stopped,reason="location-reached",frame=@{func="main",args=[],
-file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="6"@}
+file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="6",arch="i386:x86_64"@}
 (gdb)
 @end smallexample
 
@@ -29944,7 +29944,7 @@ The corresponding @value{GDBN} command is @samp{info frame} or @samp{frame}
 -stack-info-frame
 ^done,frame=@{level="1",addr="0x0001076c",func="callee3",
 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
-fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="17"@}
+fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="17",arch="i386:x86_64"@}
 (gdb)
 @end smallexample
 
@@ -30036,19 +30036,19 @@ functionality of @samp{-stack-list-arguments}.
 stack=[
 frame=@{level="0",addr="0x00010734",func="callee4",
 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
-fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="8"@},
+fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="8",arch="i386:x86_64"@},
 frame=@{level="1",addr="0x0001076c",func="callee3",
 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
-fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="17"@},
+fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="17",arch="i386:x86_64"@},
 frame=@{level="2",addr="0x0001078c",func="callee2",
 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
-fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="22"@},
+fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="22",arch="i386:x86_64"@},
 frame=@{level="3",addr="0x000107b4",func="callee1",
 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
-fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="27"@},
+fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="27",arch="i386:x86_64"@},
 frame=@{level="4",addr="0x000107e0",func="main",
 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
-fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="32"@}]
+fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="32",arch="i386:x86_64"@}]
 (gdb)
 -stack-list-arguments 0
 ^done,
@@ -30116,6 +30116,8 @@ Line number corresponding to the @code{$pc}.
 @item @var{from}
 The shared library where this function is defined.  This is only given
 if the frame's function is not known.
+@item @var{arch}
+Frame's architecture.
 @end table
 
 If invoked without arguments, this command prints a backtrace for the
@@ -30141,29 +30143,29 @@ Full stack backtrace:
 -stack-list-frames
 ^done,stack=
 [frame=@{level="0",addr="0x0001076c",func="foo",
-  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="11"@},
+  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="11",arch="i386:x86_64"@},
 frame=@{level="1",addr="0x000107a4",func="foo",
-  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"@},
+  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",arch="i386:x86_64"@},
 frame=@{level="2",addr="0x000107a4",func="foo",
-  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"@},
+  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",arch="i386:x86_64"@},
 frame=@{level="3",addr="0x000107a4",func="foo",
-  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"@},
+  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",arch="i386:x86_64"@},
 frame=@{level="4",addr="0x000107a4",func="foo",
-  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"@},
+  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",arch="i386:x86_64"@},
 frame=@{level="5",addr="0x000107a4",func="foo",
-  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"@},
+  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",arch="i386:x86_64"@},
 frame=@{level="6",addr="0x000107a4",func="foo",
-  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"@},
+  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",arch="i386:x86_64"@},
 frame=@{level="7",addr="0x000107a4",func="foo",
-  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"@},
+  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",arch="i386:x86_64"@},
 frame=@{level="8",addr="0x000107a4",func="foo",
-  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"@},
+  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",arch="i386:x86_64"@},
 frame=@{level="9",addr="0x000107a4",func="foo",
-  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"@},
+  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",arch="i386:x86_64"@},
 frame=@{level="10",addr="0x000107a4",func="foo",
-  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"@},
+  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",arch="i386:x86_64"@},
 frame=@{level="11",addr="0x00010738",func="main",
-  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="4"@}]
+  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="4",arch="i386:x86_64"@}]
 (gdb)
 @end smallexample
 
@@ -30174,11 +30176,11 @@ Show frames between @var{low_frame} and @var{high_frame}:
 -stack-list-frames 3 5
 ^done,stack=
 [frame=@{level="3",addr="0x000107a4",func="foo",
-  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"@},
+  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",arch="i386:x86_64"@},
 frame=@{level="4",addr="0x000107a4",func="foo",
-  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"@},
+  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",arch="i386:x86_64"@},
 frame=@{level="5",addr="0x000107a4",func="foo",
-  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"@}]
+  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",arch="i386:x86_64"@}]
 (gdb)
 @end smallexample
 
@@ -30189,7 +30191,7 @@ Show a single frame:
 -stack-list-frames 3 3
 ^done,stack=
 [frame=@{level="3",addr="0x000107a4",func="foo",
-  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"@}]
+  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",arch="i386:x86_64"@}]
 (gdb)
 @end smallexample
 
@@ -31463,7 +31465,7 @@ On a PPC MBX board:
 (gdb)
 *stopped,reason="breakpoint-hit",disp="keep",bkptno="1",frame=@{
 func="main",args=[],file="try.c",fullname="/home/foo/bar/try.c",
-line="5"@}
+line="5",arch="powerpc"@}
 (gdb)
 -data-list-changed-registers
 ^done,changed-registers=["0","1","2","4","5","6","7","8","9",
@@ -33638,7 +33640,7 @@ and only if there is a corresponding executable file.
    frame=@{level="0",addr="0xffffe410",func="__kernel_vsyscall",args=[]@},state="running"@},
 @{id="1",target-id="Thread 0xb7e156b0 (LWP 21254)",
    frame=@{level="0",addr="0x0804891f",func="foo",args=[@{name="i",value="10"@}],
-           file="/tmp/a.c",fullname="/tmp/a.c",line="158"@},state="running"@}]]
+           file="/tmp/a.c",fullname="/tmp/a.c",line="158",arch="i386:x86_64"@},state="running"@}]]
 -list-thread-groups --available
 ^done,groups=[@{id="17",type="process",pid="yyy",num_children="2",cores=[1,2]@}]
 -list-thread-groups --available --recurse 1
@@ -33870,7 +33872,7 @@ time=@{wallclock="0.05185",user="0.00800",system="0.00000"@}
 *stopped,reason="breakpoint-hit",disp="keep",bkptno="1",thread-id="0",
 frame=@{addr="0x080484ed",func="main",args=[@{name="argc",value="1"@},
 @{name="argv",value="0xbfb60364"@}],file="myprog.c",
-fullname="/home/nickrob/myprog.c",line="73"@}
+fullname="/home/nickrob/myprog.c",line="73",arch="i386:x86_64"@}
 (gdb)
 @end smallexample
 
diff --git a/gdb/stack.c b/gdb/stack.c
index 3da46dd955..44e18f6a31 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -1249,11 +1249,14 @@ print_frame (struct frame_info *frame, int print_level,
 	    uiout->field_string ("from", lib);
 	  }
       }
+    if (uiout->is_mi_like_p ())
+      uiout->field_string ("arch",
+			   (gdbarch_bfd_arch_info (gdbarch))->printable_name);
   }
 
   uiout->text ("\n");
 }
-\f
+
 
 /* Read a frame specification in whatever the appropriate format is from
    FRAME_EXP.  Call error() if the specification is in any way invalid (so
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index c79e1e8f20..53ed4fc423 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,12 @@
+2018-08-08  Jan Vrany  <jan.vrany@fit.cvut.cz>
+
+	* lib/mi-support.exp (mi_expect_stop): Update regexp to
+	accommodate new "arch" field in frame output.
+	* gdb.mi/mi-return.exp: Likewise.
+	* gdb.mi/mi-stack.exp: Likewise.
+	* gdb.mi/mi-syn-frame.exp: Likewise.
+	* gdb.mi/user-selected-context-sync.exp: Likewise.
+
 2018-08-07  Simon Marchi  <simon.marchi@polymtl.ca>
 
 	* gdb.fortran/nested-funcs.exp: Replace "set index = 42" with
diff --git a/gdb/testsuite/gdb.mi/mi-return.exp b/gdb/testsuite/gdb.mi/mi-return.exp
index 8db0c57b33..5b21e18db6 100644
--- a/gdb/testsuite/gdb.mi/mi-return.exp
+++ b/gdb/testsuite/gdb.mi/mi-return.exp
@@ -50,7 +50,7 @@ proc test_return_simple {} {
     set line_callee3_call         [expr $line_callee3_head + 2]
     set line_callee3_close_brace  [expr $line_callee3_head + 3]
 
-    mi_gdb_test "111-exec-return" "111\\^done,frame=\{level=\"0\",addr=\"$hex\",func=\"callee3\",args=\\\[.*\\\],file=\".*basics.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"($line_callee3_call|$line_callee3_close_brace)\"\}" "return from callee4 now"
+    mi_gdb_test "111-exec-return" "111\\^done,frame=\{level=\"0\",addr=\"$hex\",func=\"callee3\",args=\\\[.*\\\],file=\".*basics.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"($line_callee3_call|$line_callee3_close_brace)\",arch=\"\[^\"\]+\"\}" "return from callee4 now"
 }
 
 mi_runto callee4
diff --git a/gdb/testsuite/gdb.mi/mi-stack.exp b/gdb/testsuite/gdb.mi/mi-stack.exp
index fcb74e2610..bec0d45097 100644
--- a/gdb/testsuite/gdb.mi/mi-stack.exp
+++ b/gdb/testsuite/gdb.mi/mi-stack.exp
@@ -46,6 +46,8 @@ proc test_stack_frame_listing {} {
     global mi_gdb_prompt
     global hex fullname_syntax srcfile
 
+    set any "\[^\"\]+"
+
     set callee4_begin [gdb_get_line_number "callee4 begin"]
     mi_continue_to_line $callee4_begin "continue to callee4 begin"
 
@@ -56,7 +58,7 @@ proc test_stack_frame_listing {} {
     # -stack-list-frames 1 3
     # -stack-info-frame
     mi_gdb_test "231-stack-list-frames" \
-	"231\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"callee4\",file=\".*${srcfile}\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$callee4_begin\"\},frame=\{level=\"1\",addr=\"$hex\",func=\"callee3\",.*\},frame=\{level=\"2\",addr=\"$hex\",func=\"callee2\",.*\},frame=\{level=\"3\",addr=\"$hex\",func=\"callee1\",.*\},frame=\{level=\"4\",addr=\"$hex\",func=\"main\",.*\}\\\]" \
+	"231\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"callee4\",file=\".*${srcfile}\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$callee4_begin\",arch=\"$any\"\},frame=\{level=\"1\",addr=\"$hex\",func=\"callee3\",.*\},frame=\{level=\"2\",addr=\"$hex\",func=\"callee2\",.*\},frame=\{level=\"3\",addr=\"$hex\",func=\"callee1\",.*\},frame=\{level=\"4\",addr=\"$hex\",func=\"main\",.*\}\\\]" \
 	"stack frame listing"
     mi_gdb_test "232-stack-list-frames 1 1" \
 	"232\\^done,stack=\\\[frame=\{level=\"1\",addr=\"$hex\",func=\"callee3\",.*\}\\\]" \
@@ -70,7 +72,7 @@ proc test_stack_frame_listing {} {
 	"stack frame listing wrong"
 
     mi_gdb_test "235-stack-info-frame" \
-	"235\\^done,frame=\{level=\"0\",addr=\"$hex\",func=\"callee4\",file=\".*${srcfile}\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$callee4_begin\"\}" \
+	"235\\^done,frame=\{level=\"0\",addr=\"$hex\",func=\"callee4\",file=\".*${srcfile}\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$callee4_begin\",arch=\"$any\"\}" \
 	"selected frame listing"
 
     mi_gdb_test "236-stack-list-frames 1 300" \
@@ -82,6 +84,8 @@ proc test_stack_args_listing {} {
     global mi_gdb_prompt
     global hex
 
+    set any "\[^\"\]+"
+
     # Obtain lists for args for the stack frames
     # Tests:
     # -stack-list-arguments 0
@@ -129,6 +133,8 @@ proc test_stack_info_depth {} {
     global mi_gdb_prompt
     global hex
 
+    set any "\[^\"\]+"
+
     # Obtain depth of stack
     # Tests:
     # -stack-info-depth
@@ -156,6 +162,8 @@ proc test_stack_locals_listing {} {
     global mi_gdb_prompt
     global hex fullname_syntax srcfile
 
+    set any "\[^\"\]+"
+
     # Obtain lists for locals for the stack frames
     # Tests:
     # -stack-list-locals 0 (--no-values)
diff --git a/gdb/testsuite/gdb.mi/mi-syn-frame.exp b/gdb/testsuite/gdb.mi/mi-syn-frame.exp
index 44196324be..33ba73128c 100644
--- a/gdb/testsuite/gdb.mi/mi-syn-frame.exp
+++ b/gdb/testsuite/gdb.mi/mi-syn-frame.exp
@@ -23,6 +23,7 @@ if [target_info exists gdb,nosignals] {
 
 load_lib mi-support.exp
 set MIFLAGS "-i=mi"
+set any "\[^\"\]+"
 
 standard_testfile
 
@@ -47,7 +48,7 @@ mi_gdb_test "401-data-evaluate-expression foo()" ".*401\\^error,msg=\"The progra
     "call inferior's function with a breakpoint set in it"
 
 
-mi_gdb_test "402-stack-list-frames" "402\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"foo\",file=\".*mi-syn-frame.c\",line=\"$decimal\"\},frame=\{level=\"1\",addr=\"$hex\",func=\"<function called from gdb>\"\},frame=\{level=\"2\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",line=\"$decimal\"\}.*\\\]" "backtrace from inferior function stopped at bp, showing gdb dummy frame"
+mi_gdb_test "402-stack-list-frames" "402\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"foo\",file=\".*mi-syn-frame.c\",line=\"$decimal\",arch=\"$any\"\},frame=\{level=\"1\",addr=\"$hex\",func=\"<function called from gdb>\"\},frame=\{level=\"2\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",line=\"$decimal\",arch=\"$any\"\}.*\\\]" "backtrace from inferior function stopped at bp, showing gdb dummy frame"
 
 #
 # Continue back to main()
@@ -57,7 +58,7 @@ mi_send_resuming_command "exec-continue" "testing exec continue"
 mi_expect_stop "really-no-reason" "" "" "" "" "" "finished exec continue"
 
 mi_gdb_test "404-stack-list-frames 0 0" \
-  "404\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"\}.*\\\]" \
+  "404\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\",arch=\"$any\"\}.*\\\]" \
   "list stack frames"
 
 
@@ -77,7 +78,7 @@ mi_gdb_test "406-data-evaluate-expression have_a_very_merry_interrupt()" \
 # in this next output.
 
 mi_gdb_test "407-stack-list-frames" \
-  "407\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"subroutine\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"\},frame=\{level=\"1\",addr=\"$hex\",func=\"handler\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"\},frame=\{level=\"2\",addr=\"$hex\",func=\"<signal handler called>\"\},.*frame=\{level=\"$decimal\",addr=\"$hex\",func=\"have_a_very_merry_interrupt\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"\},frame=\{level=\"$decimal\",addr=\"$hex\",func=\"<function called from gdb>\"\},frame=\{level=\"$decimal\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"\}.*\\\]" \
+  "407\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"subroutine\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\",arch=\"$any\"\},frame=\{level=\"1\",addr=\"$hex\",func=\"handler\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\",arch=\"$any\"\},frame=\{level=\"2\",addr=\"$hex\",func=\"<signal handler called>\"\},.*frame=\{level=\"$decimal\",addr=\"$hex\",func=\"have_a_very_merry_interrupt\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\",arch=\"$any\"\},frame=\{level=\"$decimal\",addr=\"$hex\",func=\"<function called from gdb>\"\},frame=\{level=\"$decimal\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\",arch=\"$any\"\}.*\\\]" \
   "list stack frames"
 
 
@@ -86,7 +87,7 @@ mi_send_resuming_command "exec-continue" "testing exec continue"
 mi_expect_stop "really-no-reason" "" "" "" "" "" "finished exec continue"
 
 mi_gdb_test "409-stack-list-frames 0 0" \
-  "409\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"\}.*\\\]" \
+  "409\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\",arch=\"$any\"\}.*\\\]" \
   "list stack frames"
 
 #
@@ -97,7 +98,7 @@ mi_gdb_test "410-data-evaluate-expression bar()" \
   ".*410\\^error,msg=\"The program being debugged was signaled while in a function called from GDB.\\\\nGDB remains in the frame where the signal was received.\\\\nTo change this behavior use \\\\\"set unwindonsignal on\\\\\".\\\\nEvaluation of the expression containing the function\\\\n\\(bar\\) will be abandoned.\\\\nWhen the function is done executing, GDB will silently stop.\"" \
   "call inferior function which raises exception"
 
-mi_gdb_test "411-stack-list-frames" "411\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"bar\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"},frame=\{level=\"1\",addr=\"$hex\",func=\"<function called from gdb>\"\},frame=\{level=\"2\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"}.*\\\]" "backtrace from inferior function at exception"
+mi_gdb_test "411-stack-list-frames" "411\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"bar\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\",arch=\"$any\"},frame=\{level=\"1\",addr=\"$hex\",func=\"<function called from gdb>\"\},frame=\{level=\"2\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\",arch=\"$any\"}.*\\\]" "backtrace from inferior function at exception"
 
 mi_gdb_exit
 
diff --git a/gdb/testsuite/gdb.mi/user-selected-context-sync.exp b/gdb/testsuite/gdb.mi/user-selected-context-sync.exp
index 05624deb0a..eabce97acc 100644
--- a/gdb/testsuite/gdb.mi/user-selected-context-sync.exp
+++ b/gdb/testsuite/gdb.mi/user-selected-context-sync.exp
@@ -156,11 +156,11 @@ proc make_mi_re { mode thread frame type } {
     set thread_event_re "=thread-selected,id=\"$thread\""
     set thread_answer_re "\\^done,new-thread-id=\"$thread\""
 
-    set frame_re(0) ",frame=\{level=\"0\",addr=\"$hex\",func=\"child_sub_function\",args=\\\[\\\],file=\"${any}${srcfile}\",fullname=\"${any}${srcfile}\",line=\"$thread_loop_line\"\}"
-    set frame_re(1) ",frame=\{level=\"1\",addr=\"$hex\",func=\"child_function\",args=\\\[\{name=\"args\",value=\"0x0\"\}\\\],file=\"${any}${srcfile}\",fullname=\"${any}${srcfile}\",line=\"$thread_caller_line\"\}"
+    set frame_re(0) ",frame=\{level=\"0\",addr=\"$hex\",func=\"child_sub_function\",args=\\\[\\\],file=\"${any}${srcfile}\",fullname=\"${any}${srcfile}\",line=\"$thread_loop_line\",arch=\"$any\"\}"
+    set frame_re(1) ",frame=\{level=\"1\",addr=\"$hex\",func=\"child_function\",args=\\\[\{name=\"args\",value=\"0x0\"\}\\\],file=\"${any}${srcfile}\",fullname=\"${any}${srcfile}\",line=\"$thread_caller_line\",arch=\"$any\"\}"
 
     # Special frame for main thread.
-    set frame_re(2) ",frame=\{level=\"0\",addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\"${any}${srcfile}\",fullname=\"${any}${srcfile}\",line=\"${main_break_line}\"\}"
+    set frame_re(2) ",frame=\{level=\"0\",addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\"${any}${srcfile}\",fullname=\"${any}${srcfile}\",line=\"${main_break_line}\",arch=\"$any\"\}"
 
     if { $thread != -1 } {
 	if { $type == "event" } {
diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp
index 851e490f4d..bf9f613985 100644
--- a/gdb/testsuite/lib/mi-support.exp
+++ b/gdb/testsuite/lib/mi-support.exp
@@ -1240,9 +1240,9 @@ proc mi_expect_stop { reason func args file line extra test } {
 
     set a $after_reason
 
-    verbose -log "mi_expect_stop: expecting: \\*stopped,${r}${a}${bn}frame=\{addr=\"$hex\",func=\"$func\",args=$args,(?:file=\"$any$file\",fullname=\"${fullname_syntax}$file\",line=\"$line\"|from=\"$file\")\}$after_stopped,thread-id=\"$decimal\",stopped-threads=$any\r\n($thread_selected_re|$breakpoint_re)*$prompt_re"
+    verbose -log "mi_expect_stop: expecting: \\*stopped,${r}${a}${bn}frame=\{addr=\"$hex\",func=\"$func\",args=$args,(?:file=\"$any$file\",fullname=\"${fullname_syntax}$file\",line=\"$line\",arch=\"$any\"|from=\"$file\")\}$after_stopped,thread-id=\"$decimal\",stopped-threads=$any\r\n($thread_selected_re|$breakpoint_re)*$prompt_re"
     gdb_expect {
-	-re "\\*stopped,${r}${a}${bn}frame=\{addr=\"$hex\",func=\"$func\",args=$args,(?:file=\"$any$file\",fullname=\"${fullname_syntax}$file\",line=\"($line)\"|from=\"$file\")\}$after_stopped,thread-id=\"$decimal\",stopped-threads=$any\r\n($thread_selected_re|$breakpoint_re)*$prompt_re" {
+	-re "\\*stopped,${r}${a}${bn}frame=\{addr=\"$hex\",func=\"$func\",args=$args,(?:file=\"$any$file\",fullname=\"${fullname_syntax}$file\",line=\"($line)\",arch=\"$any\"|from=\"$file\")\}$after_stopped,thread-id=\"$decimal\",stopped-threads=$any\r\n($thread_selected_re|$breakpoint_re)*$prompt_re" {
 	    pass "$test"
 	    if {[array names expect_out "2,string"] != ""} {
 		return $expect_out(2,string)
@@ -1250,7 +1250,7 @@ proc mi_expect_stop { reason func args file line extra test } {
 	    # No debug info available but $file does match.
 	    return 0
 	}
-	-re "\\*stopped,${r}${a}${bn}frame=\{addr=\"$hex\",func=\"$any\",args=\[\\\[\{\]$any\[\\\]\}\],file=\"$any\",fullname=\"${fullname_syntax}$any\",line=\"\[0-9\]*\"\}$after_stopped,thread-id=\"$decimal\",stopped-threads=$any\r\n($thread_selected_re|$breakpoint_re)*$prompt_re" {
+	-re "\\*stopped,${r}${a}${bn}frame=\{addr=\"$hex\",func=\"$any\",args=\[\\\[\{\]$any\[\\\]\}\],file=\"$any\",fullname=\"${fullname_syntax}$any\",line=\"\[0-9\]*\",arch=\"$any\"\}$after_stopped,thread-id=\"$decimal\",stopped-threads=$any\r\n($thread_selected_re|$breakpoint_re)*$prompt_re" {
 	    verbose -log "got $expect_out(buffer)"
 	    fail "$test (stopped at wrong place)"
 	    return -1
-- 
2.18.0

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

* Re: [RFC] mi: print frame architecture when printing frames on an MI channel
  2018-08-13 10:53   ` [RFC] mi: print " Jan Vrany
@ 2018-08-16 19:01     ` Pedro Alves
  2018-08-20 10:24       ` Jan Vrany
  0 siblings, 1 reply; 14+ messages in thread
From: Pedro Alves @ 2018-08-16 19:01 UTC (permalink / raw)
  To: Jan Vrany, gdb-patches

On 08/13/2018 11:52 AM, Jan Vrany wrote:
> When printing frames on an MI channel also print frame architecture
> like in:
> 
>     (gdb)
>     -stack-list-frames 3 3
>     ^done,stack=
>     [frame={level="3",addr="0x000107a4",func="foo",
>       file="recursive2.c",fullname="/home/foo/bar/recursive2.c",
>       line="14",arch="i386:x86_64"}]
>    (gdb)
> 
> This is useful for MI clients that need to know the architecture in order
> to perform further analysis, for example to use their own disassembler to
> analyze machine code.
> 
> gdb/Changelog:
> 
> 	* stack.c (print_frame): Print frame architecture when printing on
>         an MI output.

Missing ChangeLog entry for the NEWS change.

> 
> gdb/testsuite/Changelog
> 
> 	* lib/mi-support.exp (mi_expect_stop): Update regexp to
> 	accommodate new "arch" field in frame output.
> 	* gdb.mi/mi-return.exp: Likewise.
> 	* gdb.mi/mi-stack.exp: Likewise.
> 	* gdb.mi/mi-syn-frame.exp: Likewise.
> 	* gdb.mi/user-selected-context-sync.exp: Likewise.
> 
> gdb/doc/Changelog
> 
> 	* gdb.texinfo (The -stack-list-frames Command): Update description
> 	to mention "arch".
> 	Update MI examples thorough the document to contain "arch" in frame
> 	output.

> ---
>  gdb/ChangeLog                                 |  5 ++
>  gdb/NEWS                                      |  2 +
>  gdb/doc/ChangeLog                             |  7 ++
>  gdb/doc/gdb.texinfo                           | 90 ++++++++++---------
>  gdb/stack.c                                   |  5 +-
>  gdb/testsuite/ChangeLog                       |  9 ++
>  gdb/testsuite/gdb.mi/mi-return.exp            |  2 +-
>  gdb/testsuite/gdb.mi/mi-stack.exp             | 12 ++-
>  gdb/testsuite/gdb.mi/mi-syn-frame.exp         | 11 +--
>  .../gdb.mi/user-selected-context-sync.exp     |  6 +-
>  gdb/testsuite/lib/mi-support.exp              |  6 +-
>  11 files changed, 96 insertions(+), 59 deletions(-)
> 
> diff --git a/gdb/ChangeLog b/gdb/ChangeLog
> index 2f5d1ef8b7..c961ce5cbc 100644
> --- a/gdb/ChangeLog
> +++ b/gdb/ChangeLog
> @@ -1,3 +1,8 @@
> +2018-08-08  Jan Vrany  <jan.vrany@fit.cvut.cz>
> +
> +	* stack.c (print_frame): Print frame architecture when printing on
> +	an MI output.
> +
>  2018-08-08  Szabolcs Nagy  <szabolcs.nagy@arm.com>
>  
>  	* remote.c (remote_target::download_tracepoint): Change char* to
> diff --git a/gdb/NEWS b/gdb/NEWS
> index 7f9466567f..e71340ad8e 100644
> --- a/gdb/NEWS
> +++ b/gdb/NEWS
> @@ -3,6 +3,8 @@
>  
>  *** Changes since GDB 8.2
>  
> +* MI now reports frame architecture in command responses and notifications.

This should go under the new "MI changes" section.

I'd suggest rewording:

* Command responses and notifications that include a frame now include
  the frame's architecture in a new "arch" attribute.



>    uiout->text ("\n");
>  }
> -\f
> +

Spurious change here.

> --- a/gdb/testsuite/gdb.mi/mi-stack.exp
> +++ b/gdb/testsuite/gdb.mi/mi-stack.exp
> @@ -46,6 +46,8 @@ proc test_stack_frame_listing {} {
>      global mi_gdb_prompt
>      global hex fullname_syntax srcfile
>  
> +    set any "\[^\"\]+"
> +
>      set callee4_begin [gdb_get_line_number "callee4 begin"]
>      mi_continue_to_line $callee4_begin "continue to callee4 begin"
>  
> @@ -56,7 +58,7 @@ proc test_stack_frame_listing {} {
>      # -stack-list-frames 1 3
>      # -stack-info-frame
>      mi_gdb_test "231-stack-list-frames" \
> -	"231\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"callee4\",file=\".*${srcfile}\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$callee4_begin\"\},frame=\{level=\"1\",addr=\"$hex\",func=\"callee3\",.*\},frame=\{level=\"2\",addr=\"$hex\",func=\"callee2\",.*\},frame=\{level=\"3\",addr=\"$hex\",func=\"callee1\",.*\},frame=\{level=\"4\",addr=\"$hex\",func=\"main\",.*\}\\\]" \
> +	"231\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"callee4\",file=\".*${srcfile}\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$callee4_begin\",arch=\"$any\"\},frame=\{level=\"1\",addr=\"$hex\",func=\"callee3\",.*\},frame=\{level=\"2\",addr=\"$hex\",func=\"callee2\",.*\},frame=\{level=\"3\",addr=\"$hex\",func=\"callee1\",.*\},frame=\{level=\"4\",addr=\"$hex\",func=\"main\",.*\}\\\]" \
>  	"stack frame listing"
>      mi_gdb_test "232-stack-list-frames 1 1" \
>  	"232\\^done,stack=\\\[frame=\{level=\"1\",addr=\"$hex\",func=\"callee3\",.*\}\\\]" \
> @@ -70,7 +72,7 @@ proc test_stack_frame_listing {} {
>  	"stack frame listing wrong"
>  
>      mi_gdb_test "235-stack-info-frame" \
> -	"235\\^done,frame=\{level=\"0\",addr=\"$hex\",func=\"callee4\",file=\".*${srcfile}\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$callee4_begin\"\}" \
> +	"235\\^done,frame=\{level=\"0\",addr=\"$hex\",func=\"callee4\",file=\".*${srcfile}\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$callee4_begin\",arch=\"$any\"\}" \
>  	"selected frame listing"
>  
>      mi_gdb_test "236-stack-list-frames 1 300" \
> @@ -82,6 +84,8 @@ proc test_stack_args_listing {} {
>      global mi_gdb_prompt
>      global hex
>  
> +    set any "\[^\"\]+"
> +
>      # Obtain lists for args for the stack frames
>      # Tests:
>      # -stack-list-arguments 0
> @@ -129,6 +133,8 @@ proc test_stack_info_depth {} {
>      global mi_gdb_prompt
>      global hex
>  
> +    set any "\[^\"\]+"
> +
>      # Obtain depth of stack
>      # Tests:
>      # -stack-info-depth
> @@ -156,6 +162,8 @@ proc test_stack_locals_listing {} {
>      global mi_gdb_prompt
>      global hex fullname_syntax srcfile
>  
> +    set any "\[^\"\]+"
> +

Are these three "set any" necessary?  Off hand the variable doesn't
appear used.

>      # Obtain lists for locals for the stack frames
>      # Tests:
>      # -stack-list-locals 0 (--no-values)
Thanks,
Pedro Alves

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

* Re: [RFC] mi: print frame architecture when printing frames on an MI channel
  2018-08-16 19:01     ` Pedro Alves
@ 2018-08-20 10:24       ` Jan Vrany
  2018-08-20 11:16         ` Pedro Alves
  0 siblings, 1 reply; 14+ messages in thread
From: Jan Vrany @ 2018-08-20 10:24 UTC (permalink / raw)
  To: Pedro Alves, gdb-patches

Hi,
> 
> >    uiout->text ("\n");
> >  }
> > -
> > +
> 
> Spurious change here.
> 

Actually, it is not spurious. The original source
contains character <0x0C>. It seems (seemed) to me 
that it's some sort of edit error so I removed it
while editing code around. 

If you prefer to keep it there or fix this in another
commit, let me know. 

Jan

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

* Re: [RFC] mi: print frame architecture when printing frames on an MI channel
  2018-08-20 10:24       ` Jan Vrany
@ 2018-08-20 11:16         ` Pedro Alves
  2018-08-20 20:43           ` Jan Vrany
  0 siblings, 1 reply; 14+ messages in thread
From: Pedro Alves @ 2018-08-20 11:16 UTC (permalink / raw)
  To: Jan Vrany, gdb-patches

On 08/20/2018 11:24 AM, Jan Vrany wrote:
> Hi,
>>
>>>    uiout->text ("\n");
>>>  }
>>> -
>>> +
>>
>> Spurious change here.
>>
> 
> Actually, it is not spurious. The original source
> contains character <0x0C>. It seems (seemed) to me 
> that it's some sort of edit error so I removed it
> while editing code around. 

See here, look for "formfeed":

 https://www.gnu.org/prep/standards/html_node/Formatting.html

Several editors (like emacs) are able to jump between "pages"
with keyboard shortcuts.

> 
> If you prefer to keep it there or fix this in another
> commit, let me know. 

Let's just keep it there.

Thanks,
Pedro Alves

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

* [RFC] mi: print frame architecture when printing frames on an MI channel
  2018-08-20 11:16         ` Pedro Alves
@ 2018-08-20 20:43           ` Jan Vrany
  2018-08-21 15:42             ` Pedro Alves
  2018-08-21 16:16             ` [RFC] mi: print frame architecture when printing frames on an MI channel Eli Zaretskii
  0 siblings, 2 replies; 14+ messages in thread
From: Jan Vrany @ 2018-08-20 20:43 UTC (permalink / raw)
  To: gdb-patches; +Cc: Jan Vrany

When printing frames on an MI channel also print frame architecture
like in:

    (gdb)
    -stack-list-frames 3 3
    ^done,stack=
    [frame={level="3",addr="0x000107a4",func="foo",
      file="recursive2.c",fullname="/home/foo/bar/recursive2.c",
      line="14",arch="i386:x86_64"}]
   (gdb)

This is useful for MI clients that need to know the architecture in order
to perform further analysis, for example to use their own disassembler to
analyze machine code.

gdb/Changelog:

	* stack.c (print_frame): Print frame architecture when printing on
        an MI output.
	* NEWS: Mention new "arch" attribute in frame output.

gdb/testsuite/Changelog

	* lib/mi-support.exp (mi_expect_stop): Update regexp to
	accommodate new "arch" field in frame output.
	* gdb.mi/mi-return.exp: Likewise.
	* gdb.mi/mi-stack.exp: Likewise.
	* gdb.mi/mi-syn-frame.exp: Likewise.
	* gdb.mi/user-selected-context-sync.exp: Likewise.

gdb/doc/Changelog

	* gdb.texinfo (The -stack-list-frames Command): Update description
	to mention "arch".
	Update MI examples thorough the document to contain "arch" in frame
	output.
---
 gdb/ChangeLog                                 |  6 ++
 gdb/NEWS                                      |  5 ++
 gdb/doc/ChangeLog                             |  7 ++
 gdb/doc/gdb.texinfo                           | 90 ++++++++++---------
 gdb/stack.c                                   |  3 +
 gdb/testsuite/ChangeLog                       |  9 ++
 gdb/testsuite/gdb.mi/mi-return.exp            |  2 +-
 gdb/testsuite/gdb.mi/mi-stack.exp             |  6 +-
 gdb/testsuite/gdb.mi/mi-syn-frame.exp         | 11 +--
 .../gdb.mi/user-selected-context-sync.exp     |  6 +-
 gdb/testsuite/lib/mi-support.exp              |  6 +-
 11 files changed, 93 insertions(+), 58 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 2f5d1ef8b7..e935fbf160 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2018-08-08  Jan Vrany  <jan.vrany@fit.cvut.cz>
+
+	* stack.c (print_frame): Print frame architecture when printing on
+	an MI output.
+	* NEWS: Mention new "arch" attribute in frame output.
+
 2018-08-08  Szabolcs Nagy  <szabolcs.nagy@arm.com>
 
 	* remote.c (remote_target::download_tracepoint): Change char* to
diff --git a/gdb/NEWS b/gdb/NEWS
index 7f9466567f..43663fd315 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -41,6 +41,11 @@ thread apply [all | COUNT | -COUNT] [FLAG]... COMMAND
   FLAG arguments allow to control what output to produce and how to handle
   errors raised when applying COMMAND to a thread.
 
+* MI changes
+
+  ** Command responses and notifications that include a frame now include
+     the frame's architecture in a new "arch" attribute.
+
 *** Changes in GDB 8.2
 
 * The 'set disassembler-options' command now supports specifying options
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog
index ceb4043e32..91c953df7f 100644
--- a/gdb/doc/ChangeLog
+++ b/gdb/doc/ChangeLog
@@ -1,3 +1,10 @@
+2018-08-08  Jan Vrany  <jan.vrany@fit.cvut.cz>
+
+	* gdb.texinfo (The -stack-list-frames Command): Update description
+	to mention "arch".
+	Update MI examples thorough the document to contain "arch" in frame
+	output.
+
 2018-08-07  Simon Marchi  <simon.marchi@ericsson.com>
 
 	* gdb.texinfo (Index Files Speed Up GDB): Add section about
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index b931834400..635275d3ec 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -28001,7 +28001,7 @@ reason that execution stopped.
 <- *stopped,reason="breakpoint-hit",disp="keep",bkptno="1",thread-id="0",
    frame=@{addr="0x08048564",func="main",
    args=[@{name="argc",value="1"@},@{name="argv",value="0xbfc4d4d4"@}],
-   file="myprog.c",fullname="/home/nickrob/myprog.c",line="68"@}
+   file="myprog.c",fullname="/home/nickrob/myprog.c",line="68",arch="i386:x86_64"@}
 <- (gdb)
 -> -exec-continue
 <- ^running
@@ -28664,7 +28664,7 @@ Setting a watchpoint on a variable in the @code{main} function:
 *stopped,reason="watchpoint-trigger",wpt=@{number="2",exp="x"@},
 value=@{old="-268439212",new="55"@},
 frame=@{func="main",args=[],file="recursive2.c",
-fullname="/home/foo/bar/recursive2.c",line="5"@}
+fullname="/home/foo/bar/recursive2.c",line="5",arch="i386:x86_64"@}
 (gdb)
 @end smallexample
 
@@ -28684,7 +28684,7 @@ for the watchpoint going out of scope.
 wpt=@{number="5",exp="C"@},value=@{old="-276895068",new="3"@},
 frame=@{func="callee4",args=[],
 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
-fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="13"@}
+fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="13",arch="i386:x86_64"@}
 (gdb)
 -exec-continue
 ^running
@@ -28693,7 +28693,7 @@ fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="13"@}
 frame=@{func="callee3",args=[@{name="strarg",
 value="0x11940 \"A string argument.\""@}],
 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
-fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="18"@}
+fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="18",arch="i386:x86_64"@}
 (gdb)
 @end smallexample
 
@@ -28729,7 +28729,7 @@ enabled="y",addr="",what="C",thread-groups=["i1"],times="0"@}]@}
 value=@{old="-276895068",new="3"@},
 frame=@{func="callee4",args=[],
 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
-fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="13"@}
+fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="13",arch="i386:x86_64"@}
 (gdb)
 -break-list
 ^done,BreakpointTable=@{nr_rows="2",nr_cols="6",
@@ -28753,7 +28753,7 @@ enabled="y",addr="",what="C",thread-groups=["i1"],times="-5"@}]@}
 frame=@{func="callee3",args=[@{name="strarg",
 value="0x11940 \"A string argument.\""@}],
 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
-fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="18"@}
+fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="18",arch="i386:x86_64"@}
 (gdb)
 -break-list
 ^done,BreakpointTable=@{nr_rows="1",nr_cols="6",
@@ -29232,7 +29232,7 @@ the command.
 @{id="1",target-id="Thread 0xb7e156b0 (LWP 21254)",
    frame=@{level="0",addr="0x0804891f",func="foo",
            args=[@{name="i",value="10"@}],
-           file="/tmp/a.c",fullname="/tmp/a.c",line="158"@},
+           file="/tmp/a.c",fullname="/tmp/a.c",line="158",arch="i386:x86_64"@},
            state="running"@}],
 current-thread-id="1"
 (gdb)
@@ -29308,7 +29308,7 @@ number-of-threads="3"
 ^done,new-thread-id="3",
 frame=@{level="0",func="vprintf",
 args=[@{name="format",value="0x8048e9c \"%*s%c %d %c\\n\""@},
-@{name="arg",value="0x2"@}],file="vprintf.c",line="31"@}
+@{name="arg",value="0x2"@}],file="vprintf.c",line="31",arch="i386:x86_64"@}
 (gdb)
 @end smallexample
 
@@ -29442,7 +29442,7 @@ The corresponding @value{GDBN} corresponding is @samp{continue}.
 @@Hello world
 *stopped,reason="breakpoint-hit",disp="keep",bkptno="2",frame=@{
 func="foo",args=[],file="hello.c",fullname="/home/foo/bar/hello.c",
-line="13"@}
+line="13",arch="i386:x86_64"@}
 (gdb)
 @end smallexample
 
@@ -29476,7 +29476,7 @@ Function returning @code{void}.
 (gdb)
 @@hello from foo
 *stopped,reason="function-finished",frame=@{func="main",args=[],
-file="hello.c",fullname="/home/foo/bar/hello.c",line="7"@}
+file="hello.c",fullname="/home/foo/bar/hello.c",line="7",arch="i386:x86_64"@}
 (gdb)
 @end smallexample
 
@@ -29490,7 +29490,7 @@ value itself.
 (gdb)
 *stopped,reason="function-finished",frame=@{addr="0x000107b0",func="foo",
 args=[@{name="a",value="1"],@{name="b",value="9"@}@},
-file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"@},
+file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",arch="i386:x86_64"@},
 gdb-result-var="$1",return-value="0"
 (gdb)
 @end smallexample
@@ -29538,7 +29538,7 @@ The corresponding @value{GDBN} command is @samp{interrupt}.
 (gdb)
 111*stopped,signal-name="SIGINT",signal-meaning="Interrupt",
 frame=@{addr="0x00010140",func="foo",args=[],file="try.c",
-fullname="/home/foo/bar/try.c",line="13"@}
+fullname="/home/foo/bar/try.c",line="13",arch="i386:x86_64"@}
 (gdb)
 
 (gdb)
@@ -29675,7 +29675,7 @@ file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8"@}
 000*stopped,reason="breakpoint-hit",disp="keep",bkptno="1",
 frame=@{func="callee4",args=[],
 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
-fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="8"@}
+fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="8",arch="i386:x86_64"@}
 (gdb)
 205-break-delete
 205^done
@@ -29685,7 +29685,7 @@ fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="8"@}
 args=[@{name="strarg",
 value="0x11940 \"A string argument.\""@}],
 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
-fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="18"@}
+fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="18",arch="i386:x86_64"@}
 (gdb)
 @end smallexample
 
@@ -29731,7 +29731,7 @@ The corresponding @value{GDBN} command is @samp{run}.
 (gdb)
 *stopped,reason="breakpoint-hit",disp="keep",bkptno="1",
 frame=@{func="main",args=[],file="recursive2.c",
-fullname="/home/foo/bar/recursive2.c",line="4"@}
+fullname="/home/foo/bar/recursive2.c",line="4",arch="i386:x86_64"@}
 (gdb)
 @end smallexample
 
@@ -29805,7 +29805,7 @@ Stepping into a function:
 *stopped,reason="end-stepping-range",
 frame=@{func="foo",args=[@{name="a",value="10"@},
 @{name="b",value="0"@}],file="recursive2.c",
-fullname="/home/foo/bar/recursive2.c",line="11"@}
+fullname="/home/foo/bar/recursive2.c",line="11",arch="i386:x86_64"@}
 (gdb)
 @end smallexample
 
@@ -29851,7 +29851,7 @@ The corresponding @value{GDBN} command is @samp{stepi}.
 (gdb)
 *stopped,reason="end-stepping-range",
 frame=@{func="foo",args=[],file="try.c",
-fullname="/home/foo/bar/try.c",line="10"@}
+fullname="/home/foo/bar/try.c",line="10",arch="i386:x86_64"@}
 (gdb)
 -exec-step-instruction
 ^running
@@ -29859,7 +29859,7 @@ fullname="/home/foo/bar/try.c",line="10"@}
 (gdb)
 *stopped,reason="end-stepping-range",
 frame=@{addr="0x000100f4",func="foo",args=[],file="try.c",
-fullname="/home/foo/bar/try.c",line="10"@}
+fullname="/home/foo/bar/try.c",line="10",arch="i386:x86_64"@}
 (gdb)
 @end smallexample
 
@@ -29891,7 +29891,7 @@ The corresponding @value{GDBN} command is @samp{until}.
 (gdb)
 x = 55
 *stopped,reason="location-reached",frame=@{func="main",args=[],
-file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="6"@}
+file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="6",arch="i386:x86_64"@}
 (gdb)
 @end smallexample
 
@@ -29944,7 +29944,7 @@ The corresponding @value{GDBN} command is @samp{info frame} or @samp{frame}
 -stack-info-frame
 ^done,frame=@{level="1",addr="0x0001076c",func="callee3",
 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
-fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="17"@}
+fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="17",arch="i386:x86_64"@}
 (gdb)
 @end smallexample
 
@@ -30036,19 +30036,19 @@ functionality of @samp{-stack-list-arguments}.
 stack=[
 frame=@{level="0",addr="0x00010734",func="callee4",
 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
-fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="8"@},
+fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="8",arch="i386:x86_64"@},
 frame=@{level="1",addr="0x0001076c",func="callee3",
 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
-fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="17"@},
+fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="17",arch="i386:x86_64"@},
 frame=@{level="2",addr="0x0001078c",func="callee2",
 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
-fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="22"@},
+fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="22",arch="i386:x86_64"@},
 frame=@{level="3",addr="0x000107b4",func="callee1",
 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
-fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="27"@},
+fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="27",arch="i386:x86_64"@},
 frame=@{level="4",addr="0x000107e0",func="main",
 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
-fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="32"@}]
+fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="32",arch="i386:x86_64"@}]
 (gdb)
 -stack-list-arguments 0
 ^done,
@@ -30116,6 +30116,8 @@ Line number corresponding to the @code{$pc}.
 @item @var{from}
 The shared library where this function is defined.  This is only given
 if the frame's function is not known.
+@item @var{arch}
+Frame's architecture.
 @end table
 
 If invoked without arguments, this command prints a backtrace for the
@@ -30141,29 +30143,29 @@ Full stack backtrace:
 -stack-list-frames
 ^done,stack=
 [frame=@{level="0",addr="0x0001076c",func="foo",
-  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="11"@},
+  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="11",arch="i386:x86_64"@},
 frame=@{level="1",addr="0x000107a4",func="foo",
-  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"@},
+  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",arch="i386:x86_64"@},
 frame=@{level="2",addr="0x000107a4",func="foo",
-  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"@},
+  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",arch="i386:x86_64"@},
 frame=@{level="3",addr="0x000107a4",func="foo",
-  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"@},
+  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",arch="i386:x86_64"@},
 frame=@{level="4",addr="0x000107a4",func="foo",
-  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"@},
+  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",arch="i386:x86_64"@},
 frame=@{level="5",addr="0x000107a4",func="foo",
-  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"@},
+  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",arch="i386:x86_64"@},
 frame=@{level="6",addr="0x000107a4",func="foo",
-  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"@},
+  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",arch="i386:x86_64"@},
 frame=@{level="7",addr="0x000107a4",func="foo",
-  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"@},
+  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",arch="i386:x86_64"@},
 frame=@{level="8",addr="0x000107a4",func="foo",
-  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"@},
+  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",arch="i386:x86_64"@},
 frame=@{level="9",addr="0x000107a4",func="foo",
-  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"@},
+  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",arch="i386:x86_64"@},
 frame=@{level="10",addr="0x000107a4",func="foo",
-  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"@},
+  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",arch="i386:x86_64"@},
 frame=@{level="11",addr="0x00010738",func="main",
-  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="4"@}]
+  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="4",arch="i386:x86_64"@}]
 (gdb)
 @end smallexample
 
@@ -30174,11 +30176,11 @@ Show frames between @var{low_frame} and @var{high_frame}:
 -stack-list-frames 3 5
 ^done,stack=
 [frame=@{level="3",addr="0x000107a4",func="foo",
-  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"@},
+  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",arch="i386:x86_64"@},
 frame=@{level="4",addr="0x000107a4",func="foo",
-  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"@},
+  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",arch="i386:x86_64"@},
 frame=@{level="5",addr="0x000107a4",func="foo",
-  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"@}]
+  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",arch="i386:x86_64"@}]
 (gdb)
 @end smallexample
 
@@ -30189,7 +30191,7 @@ Show a single frame:
 -stack-list-frames 3 3
 ^done,stack=
 [frame=@{level="3",addr="0x000107a4",func="foo",
-  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"@}]
+  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",arch="i386:x86_64"@}]
 (gdb)
 @end smallexample
 
@@ -31463,7 +31465,7 @@ On a PPC MBX board:
 (gdb)
 *stopped,reason="breakpoint-hit",disp="keep",bkptno="1",frame=@{
 func="main",args=[],file="try.c",fullname="/home/foo/bar/try.c",
-line="5"@}
+line="5",arch="powerpc"@}
 (gdb)
 -data-list-changed-registers
 ^done,changed-registers=["0","1","2","4","5","6","7","8","9",
@@ -33638,7 +33640,7 @@ and only if there is a corresponding executable file.
    frame=@{level="0",addr="0xffffe410",func="__kernel_vsyscall",args=[]@},state="running"@},
 @{id="1",target-id="Thread 0xb7e156b0 (LWP 21254)",
    frame=@{level="0",addr="0x0804891f",func="foo",args=[@{name="i",value="10"@}],
-           file="/tmp/a.c",fullname="/tmp/a.c",line="158"@},state="running"@}]]
+           file="/tmp/a.c",fullname="/tmp/a.c",line="158",arch="i386:x86_64"@},state="running"@}]]
 -list-thread-groups --available
 ^done,groups=[@{id="17",type="process",pid="yyy",num_children="2",cores=[1,2]@}]
 -list-thread-groups --available --recurse 1
@@ -33870,7 +33872,7 @@ time=@{wallclock="0.05185",user="0.00800",system="0.00000"@}
 *stopped,reason="breakpoint-hit",disp="keep",bkptno="1",thread-id="0",
 frame=@{addr="0x080484ed",func="main",args=[@{name="argc",value="1"@},
 @{name="argv",value="0xbfb60364"@}],file="myprog.c",
-fullname="/home/nickrob/myprog.c",line="73"@}
+fullname="/home/nickrob/myprog.c",line="73",arch="i386:x86_64"@}
 (gdb)
 @end smallexample
 
diff --git a/gdb/stack.c b/gdb/stack.c
index 3da46dd955..366687e7df 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -1249,6 +1249,9 @@ print_frame (struct frame_info *frame, int print_level,
 	    uiout->field_string ("from", lib);
 	  }
       }
+    if (uiout->is_mi_like_p ())
+      uiout->field_string ("arch",
+			   (gdbarch_bfd_arch_info (gdbarch))->printable_name);
   }
 
   uiout->text ("\n");
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index c79e1e8f20..53ed4fc423 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,12 @@
+2018-08-08  Jan Vrany  <jan.vrany@fit.cvut.cz>
+
+	* lib/mi-support.exp (mi_expect_stop): Update regexp to
+	accommodate new "arch" field in frame output.
+	* gdb.mi/mi-return.exp: Likewise.
+	* gdb.mi/mi-stack.exp: Likewise.
+	* gdb.mi/mi-syn-frame.exp: Likewise.
+	* gdb.mi/user-selected-context-sync.exp: Likewise.
+
 2018-08-07  Simon Marchi  <simon.marchi@polymtl.ca>
 
 	* gdb.fortran/nested-funcs.exp: Replace "set index = 42" with
diff --git a/gdb/testsuite/gdb.mi/mi-return.exp b/gdb/testsuite/gdb.mi/mi-return.exp
index 8db0c57b33..5b21e18db6 100644
--- a/gdb/testsuite/gdb.mi/mi-return.exp
+++ b/gdb/testsuite/gdb.mi/mi-return.exp
@@ -50,7 +50,7 @@ proc test_return_simple {} {
     set line_callee3_call         [expr $line_callee3_head + 2]
     set line_callee3_close_brace  [expr $line_callee3_head + 3]
 
-    mi_gdb_test "111-exec-return" "111\\^done,frame=\{level=\"0\",addr=\"$hex\",func=\"callee3\",args=\\\[.*\\\],file=\".*basics.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"($line_callee3_call|$line_callee3_close_brace)\"\}" "return from callee4 now"
+    mi_gdb_test "111-exec-return" "111\\^done,frame=\{level=\"0\",addr=\"$hex\",func=\"callee3\",args=\\\[.*\\\],file=\".*basics.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"($line_callee3_call|$line_callee3_close_brace)\",arch=\"\[^\"\]+\"\}" "return from callee4 now"
 }
 
 mi_runto callee4
diff --git a/gdb/testsuite/gdb.mi/mi-stack.exp b/gdb/testsuite/gdb.mi/mi-stack.exp
index fcb74e2610..366d0c52c3 100644
--- a/gdb/testsuite/gdb.mi/mi-stack.exp
+++ b/gdb/testsuite/gdb.mi/mi-stack.exp
@@ -46,6 +46,8 @@ proc test_stack_frame_listing {} {
     global mi_gdb_prompt
     global hex fullname_syntax srcfile
 
+    set any "\[^\"\]+"
+
     set callee4_begin [gdb_get_line_number "callee4 begin"]
     mi_continue_to_line $callee4_begin "continue to callee4 begin"
 
@@ -56,7 +58,7 @@ proc test_stack_frame_listing {} {
     # -stack-list-frames 1 3
     # -stack-info-frame
     mi_gdb_test "231-stack-list-frames" \
-	"231\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"callee4\",file=\".*${srcfile}\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$callee4_begin\"\},frame=\{level=\"1\",addr=\"$hex\",func=\"callee3\",.*\},frame=\{level=\"2\",addr=\"$hex\",func=\"callee2\",.*\},frame=\{level=\"3\",addr=\"$hex\",func=\"callee1\",.*\},frame=\{level=\"4\",addr=\"$hex\",func=\"main\",.*\}\\\]" \
+	"231\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"callee4\",file=\".*${srcfile}\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$callee4_begin\",arch=\"$any\"\},frame=\{level=\"1\",addr=\"$hex\",func=\"callee3\",.*\},frame=\{level=\"2\",addr=\"$hex\",func=\"callee2\",.*\},frame=\{level=\"3\",addr=\"$hex\",func=\"callee1\",.*\},frame=\{level=\"4\",addr=\"$hex\",func=\"main\",.*\}\\\]" \
 	"stack frame listing"
     mi_gdb_test "232-stack-list-frames 1 1" \
 	"232\\^done,stack=\\\[frame=\{level=\"1\",addr=\"$hex\",func=\"callee3\",.*\}\\\]" \
@@ -70,7 +72,7 @@ proc test_stack_frame_listing {} {
 	"stack frame listing wrong"
 
     mi_gdb_test "235-stack-info-frame" \
-	"235\\^done,frame=\{level=\"0\",addr=\"$hex\",func=\"callee4\",file=\".*${srcfile}\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$callee4_begin\"\}" \
+	"235\\^done,frame=\{level=\"0\",addr=\"$hex\",func=\"callee4\",file=\".*${srcfile}\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$callee4_begin\",arch=\"$any\"\}" \
 	"selected frame listing"
 
     mi_gdb_test "236-stack-list-frames 1 300" \
diff --git a/gdb/testsuite/gdb.mi/mi-syn-frame.exp b/gdb/testsuite/gdb.mi/mi-syn-frame.exp
index 44196324be..33ba73128c 100644
--- a/gdb/testsuite/gdb.mi/mi-syn-frame.exp
+++ b/gdb/testsuite/gdb.mi/mi-syn-frame.exp
@@ -23,6 +23,7 @@ if [target_info exists gdb,nosignals] {
 
 load_lib mi-support.exp
 set MIFLAGS "-i=mi"
+set any "\[^\"\]+"
 
 standard_testfile
 
@@ -47,7 +48,7 @@ mi_gdb_test "401-data-evaluate-expression foo()" ".*401\\^error,msg=\"The progra
     "call inferior's function with a breakpoint set in it"
 
 
-mi_gdb_test "402-stack-list-frames" "402\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"foo\",file=\".*mi-syn-frame.c\",line=\"$decimal\"\},frame=\{level=\"1\",addr=\"$hex\",func=\"<function called from gdb>\"\},frame=\{level=\"2\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",line=\"$decimal\"\}.*\\\]" "backtrace from inferior function stopped at bp, showing gdb dummy frame"
+mi_gdb_test "402-stack-list-frames" "402\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"foo\",file=\".*mi-syn-frame.c\",line=\"$decimal\",arch=\"$any\"\},frame=\{level=\"1\",addr=\"$hex\",func=\"<function called from gdb>\"\},frame=\{level=\"2\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",line=\"$decimal\",arch=\"$any\"\}.*\\\]" "backtrace from inferior function stopped at bp, showing gdb dummy frame"
 
 #
 # Continue back to main()
@@ -57,7 +58,7 @@ mi_send_resuming_command "exec-continue" "testing exec continue"
 mi_expect_stop "really-no-reason" "" "" "" "" "" "finished exec continue"
 
 mi_gdb_test "404-stack-list-frames 0 0" \
-  "404\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"\}.*\\\]" \
+  "404\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\",arch=\"$any\"\}.*\\\]" \
   "list stack frames"
 
 
@@ -77,7 +78,7 @@ mi_gdb_test "406-data-evaluate-expression have_a_very_merry_interrupt()" \
 # in this next output.
 
 mi_gdb_test "407-stack-list-frames" \
-  "407\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"subroutine\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"\},frame=\{level=\"1\",addr=\"$hex\",func=\"handler\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"\},frame=\{level=\"2\",addr=\"$hex\",func=\"<signal handler called>\"\},.*frame=\{level=\"$decimal\",addr=\"$hex\",func=\"have_a_very_merry_interrupt\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"\},frame=\{level=\"$decimal\",addr=\"$hex\",func=\"<function called from gdb>\"\},frame=\{level=\"$decimal\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"\}.*\\\]" \
+  "407\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"subroutine\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\",arch=\"$any\"\},frame=\{level=\"1\",addr=\"$hex\",func=\"handler\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\",arch=\"$any\"\},frame=\{level=\"2\",addr=\"$hex\",func=\"<signal handler called>\"\},.*frame=\{level=\"$decimal\",addr=\"$hex\",func=\"have_a_very_merry_interrupt\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\",arch=\"$any\"\},frame=\{level=\"$decimal\",addr=\"$hex\",func=\"<function called from gdb>\"\},frame=\{level=\"$decimal\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\",arch=\"$any\"\}.*\\\]" \
   "list stack frames"
 
 
@@ -86,7 +87,7 @@ mi_send_resuming_command "exec-continue" "testing exec continue"
 mi_expect_stop "really-no-reason" "" "" "" "" "" "finished exec continue"
 
 mi_gdb_test "409-stack-list-frames 0 0" \
-  "409\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"\}.*\\\]" \
+  "409\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\",arch=\"$any\"\}.*\\\]" \
   "list stack frames"
 
 #
@@ -97,7 +98,7 @@ mi_gdb_test "410-data-evaluate-expression bar()" \
   ".*410\\^error,msg=\"The program being debugged was signaled while in a function called from GDB.\\\\nGDB remains in the frame where the signal was received.\\\\nTo change this behavior use \\\\\"set unwindonsignal on\\\\\".\\\\nEvaluation of the expression containing the function\\\\n\\(bar\\) will be abandoned.\\\\nWhen the function is done executing, GDB will silently stop.\"" \
   "call inferior function which raises exception"
 
-mi_gdb_test "411-stack-list-frames" "411\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"bar\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"},frame=\{level=\"1\",addr=\"$hex\",func=\"<function called from gdb>\"\},frame=\{level=\"2\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"}.*\\\]" "backtrace from inferior function at exception"
+mi_gdb_test "411-stack-list-frames" "411\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"bar\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\",arch=\"$any\"},frame=\{level=\"1\",addr=\"$hex\",func=\"<function called from gdb>\"\},frame=\{level=\"2\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\",arch=\"$any\"}.*\\\]" "backtrace from inferior function at exception"
 
 mi_gdb_exit
 
diff --git a/gdb/testsuite/gdb.mi/user-selected-context-sync.exp b/gdb/testsuite/gdb.mi/user-selected-context-sync.exp
index 05624deb0a..eabce97acc 100644
--- a/gdb/testsuite/gdb.mi/user-selected-context-sync.exp
+++ b/gdb/testsuite/gdb.mi/user-selected-context-sync.exp
@@ -156,11 +156,11 @@ proc make_mi_re { mode thread frame type } {
     set thread_event_re "=thread-selected,id=\"$thread\""
     set thread_answer_re "\\^done,new-thread-id=\"$thread\""
 
-    set frame_re(0) ",frame=\{level=\"0\",addr=\"$hex\",func=\"child_sub_function\",args=\\\[\\\],file=\"${any}${srcfile}\",fullname=\"${any}${srcfile}\",line=\"$thread_loop_line\"\}"
-    set frame_re(1) ",frame=\{level=\"1\",addr=\"$hex\",func=\"child_function\",args=\\\[\{name=\"args\",value=\"0x0\"\}\\\],file=\"${any}${srcfile}\",fullname=\"${any}${srcfile}\",line=\"$thread_caller_line\"\}"
+    set frame_re(0) ",frame=\{level=\"0\",addr=\"$hex\",func=\"child_sub_function\",args=\\\[\\\],file=\"${any}${srcfile}\",fullname=\"${any}${srcfile}\",line=\"$thread_loop_line\",arch=\"$any\"\}"
+    set frame_re(1) ",frame=\{level=\"1\",addr=\"$hex\",func=\"child_function\",args=\\\[\{name=\"args\",value=\"0x0\"\}\\\],file=\"${any}${srcfile}\",fullname=\"${any}${srcfile}\",line=\"$thread_caller_line\",arch=\"$any\"\}"
 
     # Special frame for main thread.
-    set frame_re(2) ",frame=\{level=\"0\",addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\"${any}${srcfile}\",fullname=\"${any}${srcfile}\",line=\"${main_break_line}\"\}"
+    set frame_re(2) ",frame=\{level=\"0\",addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\"${any}${srcfile}\",fullname=\"${any}${srcfile}\",line=\"${main_break_line}\",arch=\"$any\"\}"
 
     if { $thread != -1 } {
 	if { $type == "event" } {
diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp
index 851e490f4d..bf9f613985 100644
--- a/gdb/testsuite/lib/mi-support.exp
+++ b/gdb/testsuite/lib/mi-support.exp
@@ -1240,9 +1240,9 @@ proc mi_expect_stop { reason func args file line extra test } {
 
     set a $after_reason
 
-    verbose -log "mi_expect_stop: expecting: \\*stopped,${r}${a}${bn}frame=\{addr=\"$hex\",func=\"$func\",args=$args,(?:file=\"$any$file\",fullname=\"${fullname_syntax}$file\",line=\"$line\"|from=\"$file\")\}$after_stopped,thread-id=\"$decimal\",stopped-threads=$any\r\n($thread_selected_re|$breakpoint_re)*$prompt_re"
+    verbose -log "mi_expect_stop: expecting: \\*stopped,${r}${a}${bn}frame=\{addr=\"$hex\",func=\"$func\",args=$args,(?:file=\"$any$file\",fullname=\"${fullname_syntax}$file\",line=\"$line\",arch=\"$any\"|from=\"$file\")\}$after_stopped,thread-id=\"$decimal\",stopped-threads=$any\r\n($thread_selected_re|$breakpoint_re)*$prompt_re"
     gdb_expect {
-	-re "\\*stopped,${r}${a}${bn}frame=\{addr=\"$hex\",func=\"$func\",args=$args,(?:file=\"$any$file\",fullname=\"${fullname_syntax}$file\",line=\"($line)\"|from=\"$file\")\}$after_stopped,thread-id=\"$decimal\",stopped-threads=$any\r\n($thread_selected_re|$breakpoint_re)*$prompt_re" {
+	-re "\\*stopped,${r}${a}${bn}frame=\{addr=\"$hex\",func=\"$func\",args=$args,(?:file=\"$any$file\",fullname=\"${fullname_syntax}$file\",line=\"($line)\",arch=\"$any\"|from=\"$file\")\}$after_stopped,thread-id=\"$decimal\",stopped-threads=$any\r\n($thread_selected_re|$breakpoint_re)*$prompt_re" {
 	    pass "$test"
 	    if {[array names expect_out "2,string"] != ""} {
 		return $expect_out(2,string)
@@ -1250,7 +1250,7 @@ proc mi_expect_stop { reason func args file line extra test } {
 	    # No debug info available but $file does match.
 	    return 0
 	}
-	-re "\\*stopped,${r}${a}${bn}frame=\{addr=\"$hex\",func=\"$any\",args=\[\\\[\{\]$any\[\\\]\}\],file=\"$any\",fullname=\"${fullname_syntax}$any\",line=\"\[0-9\]*\"\}$after_stopped,thread-id=\"$decimal\",stopped-threads=$any\r\n($thread_selected_re|$breakpoint_re)*$prompt_re" {
+	-re "\\*stopped,${r}${a}${bn}frame=\{addr=\"$hex\",func=\"$any\",args=\[\\\[\{\]$any\[\\\]\}\],file=\"$any\",fullname=\"${fullname_syntax}$any\",line=\"\[0-9\]*\",arch=\"$any\"\}$after_stopped,thread-id=\"$decimal\",stopped-threads=$any\r\n($thread_selected_re|$breakpoint_re)*$prompt_re" {
 	    verbose -log "got $expect_out(buffer)"
 	    fail "$test (stopped at wrong place)"
 	    return -1
-- 
2.18.0

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

* Re: [RFC] mi: print frame architecture when printing frames on an MI channel
  2018-08-20 20:43           ` Jan Vrany
@ 2018-08-21 15:42             ` Pedro Alves
  2018-08-21 16:16               ` Eli Zaretskii
  2018-08-22  9:43               ` Jan Vrany
  2018-08-21 16:16             ` [RFC] mi: print frame architecture when printing frames on an MI channel Eli Zaretskii
  1 sibling, 2 replies; 14+ messages in thread
From: Pedro Alves @ 2018-08-21 15:42 UTC (permalink / raw)
  To: Jan Vrany, gdb-patches, Eli Zaretskii

On 08/20/2018 09:42 PM, Jan Vrany wrote:

> diff --git a/gdb/NEWS b/gdb/NEWS
> index 7f9466567f..43663fd315 100644
> --- a/gdb/NEWS
> +++ b/gdb/NEWS
> @@ -41,6 +41,11 @@ thread apply [all | COUNT | -COUNT] [FLAG]... COMMAND
>    FLAG arguments allow to control what output to produce and how to handle
>    errors raised when applying COMMAND to a thread.
>  
> +* MI changes
> +
> +  ** Command responses and notifications that include a frame now include
> +     the frame's architecture in a new "arch" attribute.
> +

Note that there's already an "MI changes" section, added for your
"-data-disassemble -a" patch..  The new entry should go there.

Otherwise this LGTM.

Eli, can you review the documentation bits?

Thanks,
Pedro Alves

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

* Re: [RFC] mi: print frame architecture when printing frames on an MI channel
  2018-08-21 15:42             ` Pedro Alves
@ 2018-08-21 16:16               ` Eli Zaretskii
  2018-08-22  9:43               ` Jan Vrany
  1 sibling, 0 replies; 14+ messages in thread
From: Eli Zaretskii @ 2018-08-21 16:16 UTC (permalink / raw)
  To: Pedro Alves; +Cc: jan.vrany, gdb-patches

> From: Pedro Alves <palves@redhat.com>
> Date: Tue, 21 Aug 2018 16:42:14 +0100
> 
> Eli, can you review the documentation bits?

Done.

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

* Re: [RFC] mi: print frame architecture when printing frames on an MI channel
  2018-08-20 20:43           ` Jan Vrany
  2018-08-21 15:42             ` Pedro Alves
@ 2018-08-21 16:16             ` Eli Zaretskii
  1 sibling, 0 replies; 14+ messages in thread
From: Eli Zaretskii @ 2018-08-21 16:16 UTC (permalink / raw)
  To: Jan Vrany; +Cc: gdb-patches

> From: Jan Vrany <jan.vrany@fit.cvut.cz>
> Cc: Jan Vrany <jan.vrany@fit.cvut.cz>
> Date: Mon, 20 Aug 2018 21:42:50 +0100
> 
> When printing frames on an MI channel also print frame architecture
> like in:
> 
>     (gdb)
>     -stack-list-frames 3 3
>     ^done,stack=
>     [frame={level="3",addr="0x000107a4",func="foo",
>       file="recursive2.c",fullname="/home/foo/bar/recursive2.c",
>       line="14",arch="i386:x86_64"}]
>    (gdb)
> 
> This is useful for MI clients that need to know the architecture in order
> to perform further analysis, for example to use their own disassembler to
> analyze machine code.

Thanks.

> --- a/gdb/NEWS
> +++ b/gdb/NEWS
> @@ -41,6 +41,11 @@ thread apply [all | COUNT | -COUNT] [FLAG]... COMMAND
>    FLAG arguments allow to control what output to produce and how to handle
>    errors raised when applying COMMAND to a thread.
>  
> +* MI changes
> +
> +  ** Command responses and notifications that include a frame now include
> +     the frame's architecture in a new "arch" attribute.
> +

This is OK.

> diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
> index b931834400..635275d3ec 100644
> --- a/gdb/doc/gdb.texinfo
> +++ b/gdb/doc/gdb.texinfo
> @@ -28001,7 +28001,7 @@ reason that execution stopped.
>  <- *stopped,reason="breakpoint-hit",disp="keep",bkptno="1",thread-id="0",
>     frame=@{addr="0x08048564",func="main",
>     args=[@{name="argc",value="1"@},@{name="argv",value="0xbfc4d4d4"@}],
> -   file="myprog.c",fullname="/home/nickrob/myprog.c",line="68"@}
> +   file="myprog.c",fullname="/home/nickrob/myprog.c",line="68",arch="i386:x86_64"@}

The modified line is now too long, please split it into two, otherwise
it might look badly in the printed version of the manual.

> @@ -28684,7 +28684,7 @@ for the watchpoint going out of scope.
>  wpt=@{number="5",exp="C"@},value=@{old="-276895068",new="3"@},
>  frame=@{func="callee4",args=[],
>  file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
> -fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="13"@}
> +fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="13",arch="i386:x86_64"@}

Likewise here, and everywhere else in the patch for the manual.

OK with those fixed.

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

* [RFC] mi: print frame architecture when printing frames on an MI channel
  2018-08-21 15:42             ` Pedro Alves
  2018-08-21 16:16               ` Eli Zaretskii
@ 2018-08-22  9:43               ` Jan Vrany
  2018-08-22 11:39                 ` Pedro Alves
  1 sibling, 1 reply; 14+ messages in thread
From: Jan Vrany @ 2018-08-22  9:43 UTC (permalink / raw)
  To: gdb-patches; +Cc: Jan Vrany

When printing frames on an MI channel also print frame architecture
like in:

    (gdb)
    -stack-list-frames 3 3
    ^done,stack=
    [frame={level="3",addr="0x000107a4",func="foo",
      file="recursive2.c",fullname="/home/foo/bar/recursive2.c",
      line="14",arch="i386:x86_64"}]
   (gdb)

This is useful for MI clients that need to know the architecture in order
to perform further analysis, for example to use their own disassembler to
analyze machine code.

gdb/Changelog:

	* stack.c (print_frame): Print frame architecture when printing on
        an MI output.
	* NEWS: Mention new "arch" attribute in frame output.

gdb/testsuite/Changelog

	* lib/mi-support.exp (mi_expect_stop): Update regexp to
	accommodate new "arch" field in frame output.
	* gdb.mi/mi-return.exp: Likewise.
	* gdb.mi/mi-stack.exp: Likewise.
	* gdb.mi/mi-syn-frame.exp: Likewise.
	* gdb.mi/user-selected-context-sync.exp: Likewise.

gdb/doc/Changelog

	* gdb.texinfo (The -stack-list-frames Command): Update description
	to mention "arch".
	Update MI examples thorough the document to contain "arch" in frame
	output.
---
 gdb/ChangeLog                                 |   6 +
 gdb/NEWS                                      |   3 +
 gdb/doc/ChangeLog                             |   7 +
 gdb/doc/gdb.texinfo                           | 121 +++++++++++-------
 gdb/stack.c                                   |   3 +
 gdb/testsuite/ChangeLog                       |   9 ++
 gdb/testsuite/gdb.mi/mi-return.exp            |   2 +-
 gdb/testsuite/gdb.mi/mi-stack.exp             |   6 +-
 gdb/testsuite/gdb.mi/mi-syn-frame.exp         |  11 +-
 .../gdb.mi/user-selected-context-sync.exp     |   6 +-
 gdb/testsuite/lib/mi-support.exp              |   6 +-
 11 files changed, 122 insertions(+), 58 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index ff4d1cb548..76e2d77ed3 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2018-08-08  Jan Vrany  <jan.vrany@fit.cvut.cz>
+
+	* stack.c (print_frame): Print frame architecture when printing on
+	an MI output.
+	* NEWS: Mention new "arch" attribute in frame output.
+
 2018-08-19  Simon Marchi  <simon.marchi@polymtl.ca>
 
 	* solib-svr4.c (svr4_exec_displacement): Fix formatting.
diff --git a/gdb/NEWS b/gdb/NEWS
index 16d3d72589..65776ca61a 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -49,6 +49,9 @@ thread apply [all | COUNT | -COUNT] [FLAG]... COMMAND
      verified by using the "-list-features" command, which should
      contain "data-disassemble-a-option".
 
+  ** Command responses and notifications that include a frame now include
+     the frame's architecture in a new "arch" attribute.
+
 * New native configurations
 
 GNU/Linux/RISC-V		riscv*-*-linux*
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog
index 8688b7fdd9..cea3f00cbc 100644
--- a/gdb/doc/ChangeLog
+++ b/gdb/doc/ChangeLog
@@ -1,3 +1,10 @@
+2018-08-08  Jan Vrany  <jan.vrany@fit.cvut.cz>
+
+	* gdb.texinfo (The -stack-list-frames Command): Update description
+	to mention "arch".
+	Update MI examples thorough the document to contain "arch" in frame
+	output.
+
 2018-08-14  Jan Vrany  <jan.vrany@fit.cvut.cz>
 
 	* gdb.texinfo (GDB/MI Data Manipulation): Document
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 433a2698a9..330fed51c5 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -28001,7 +28001,8 @@ reason that execution stopped.
 <- *stopped,reason="breakpoint-hit",disp="keep",bkptno="1",thread-id="0",
    frame=@{addr="0x08048564",func="main",
    args=[@{name="argc",value="1"@},@{name="argv",value="0xbfc4d4d4"@}],
-   file="myprog.c",fullname="/home/nickrob/myprog.c",line="68"@}
+   file="myprog.c",fullname="/home/nickrob/myprog.c",line="68",
+   arch="i386:x86_64"@}
 <- (gdb)
 -> -exec-continue
 <- ^running
@@ -28664,7 +28665,7 @@ Setting a watchpoint on a variable in the @code{main} function:
 *stopped,reason="watchpoint-trigger",wpt=@{number="2",exp="x"@},
 value=@{old="-268439212",new="55"@},
 frame=@{func="main",args=[],file="recursive2.c",
-fullname="/home/foo/bar/recursive2.c",line="5"@}
+fullname="/home/foo/bar/recursive2.c",line="5",arch="i386:x86_64"@}
 (gdb)
 @end smallexample
 
@@ -28684,7 +28685,8 @@ for the watchpoint going out of scope.
 wpt=@{number="5",exp="C"@},value=@{old="-276895068",new="3"@},
 frame=@{func="callee4",args=[],
 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
-fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="13"@}
+fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="13",
+arch="i386:x86_64"@}
 (gdb)
 -exec-continue
 ^running
@@ -28693,7 +28695,8 @@ fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="13"@}
 frame=@{func="callee3",args=[@{name="strarg",
 value="0x11940 \"A string argument.\""@}],
 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
-fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="18"@}
+fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="18",
+arch="i386:x86_64"@}
 (gdb)
 @end smallexample
 
@@ -28729,7 +28732,8 @@ enabled="y",addr="",what="C",thread-groups=["i1"],times="0"@}]@}
 value=@{old="-276895068",new="3"@},
 frame=@{func="callee4",args=[],
 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
-fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="13"@}
+fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="13",
+arch="i386:x86_64"@}
 (gdb)
 -break-list
 ^done,BreakpointTable=@{nr_rows="2",nr_cols="6",
@@ -28753,7 +28757,8 @@ enabled="y",addr="",what="C",thread-groups=["i1"],times="-5"@}]@}
 frame=@{func="callee3",args=[@{name="strarg",
 value="0x11940 \"A string argument.\""@}],
 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
-fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="18"@}
+fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="18",
+arch="i386:x86_64"@}
 (gdb)
 -break-list
 ^done,BreakpointTable=@{nr_rows="1",nr_cols="6",
@@ -29232,7 +29237,7 @@ the command.
 @{id="1",target-id="Thread 0xb7e156b0 (LWP 21254)",
    frame=@{level="0",addr="0x0804891f",func="foo",
            args=[@{name="i",value="10"@}],
-           file="/tmp/a.c",fullname="/tmp/a.c",line="158"@},
+           file="/tmp/a.c",fullname="/tmp/a.c",line="158",arch="i386:x86_64"@},
            state="running"@}],
 current-thread-id="1"
 (gdb)
@@ -29308,7 +29313,7 @@ number-of-threads="3"
 ^done,new-thread-id="3",
 frame=@{level="0",func="vprintf",
 args=[@{name="format",value="0x8048e9c \"%*s%c %d %c\\n\""@},
-@{name="arg",value="0x2"@}],file="vprintf.c",line="31"@}
+@{name="arg",value="0x2"@}],file="vprintf.c",line="31",arch="i386:x86_64"@}
 (gdb)
 @end smallexample
 
@@ -29442,7 +29447,7 @@ The corresponding @value{GDBN} corresponding is @samp{continue}.
 @@Hello world
 *stopped,reason="breakpoint-hit",disp="keep",bkptno="2",frame=@{
 func="foo",args=[],file="hello.c",fullname="/home/foo/bar/hello.c",
-line="13"@}
+line="13",arch="i386:x86_64"@}
 (gdb)
 @end smallexample
 
@@ -29476,7 +29481,7 @@ Function returning @code{void}.
 (gdb)
 @@hello from foo
 *stopped,reason="function-finished",frame=@{func="main",args=[],
-file="hello.c",fullname="/home/foo/bar/hello.c",line="7"@}
+file="hello.c",fullname="/home/foo/bar/hello.c",line="7",arch="i386:x86_64"@}
 (gdb)
 @end smallexample
 
@@ -29490,7 +29495,8 @@ value itself.
 (gdb)
 *stopped,reason="function-finished",frame=@{addr="0x000107b0",func="foo",
 args=[@{name="a",value="1"],@{name="b",value="9"@}@},
-file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"@},
+file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",
+arch="i386:x86_64"@},
 gdb-result-var="$1",return-value="0"
 (gdb)
 @end smallexample
@@ -29538,7 +29544,7 @@ The corresponding @value{GDBN} command is @samp{interrupt}.
 (gdb)
 111*stopped,signal-name="SIGINT",signal-meaning="Interrupt",
 frame=@{addr="0x00010140",func="foo",args=[],file="try.c",
-fullname="/home/foo/bar/try.c",line="13"@}
+fullname="/home/foo/bar/try.c",line="13",arch="i386:x86_64"@}
 (gdb)
 
 (gdb)
@@ -29675,7 +29681,8 @@ file="../../../devo/gdb/testsuite/gdb.mi/basics.c",line="8"@}
 000*stopped,reason="breakpoint-hit",disp="keep",bkptno="1",
 frame=@{func="callee4",args=[],
 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
-fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="8"@}
+fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="8",
+arch="i386:x86_64"@}
 (gdb)
 205-break-delete
 205^done
@@ -29685,7 +29692,8 @@ fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="8"@}
 args=[@{name="strarg",
 value="0x11940 \"A string argument.\""@}],
 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
-fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="18"@}
+fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="18",
+arch="i386:x86_64"@}
 (gdb)
 @end smallexample
 
@@ -29731,7 +29739,7 @@ The corresponding @value{GDBN} command is @samp{run}.
 (gdb)
 *stopped,reason="breakpoint-hit",disp="keep",bkptno="1",
 frame=@{func="main",args=[],file="recursive2.c",
-fullname="/home/foo/bar/recursive2.c",line="4"@}
+fullname="/home/foo/bar/recursive2.c",line="4",arch="i386:x86_64"@}
 (gdb)
 @end smallexample
 
@@ -29805,7 +29813,7 @@ Stepping into a function:
 *stopped,reason="end-stepping-range",
 frame=@{func="foo",args=[@{name="a",value="10"@},
 @{name="b",value="0"@}],file="recursive2.c",
-fullname="/home/foo/bar/recursive2.c",line="11"@}
+fullname="/home/foo/bar/recursive2.c",line="11",arch="i386:x86_64"@}
 (gdb)
 @end smallexample
 
@@ -29851,7 +29859,7 @@ The corresponding @value{GDBN} command is @samp{stepi}.
 (gdb)
 *stopped,reason="end-stepping-range",
 frame=@{func="foo",args=[],file="try.c",
-fullname="/home/foo/bar/try.c",line="10"@}
+fullname="/home/foo/bar/try.c",line="10",arch="i386:x86_64"@}
 (gdb)
 -exec-step-instruction
 ^running
@@ -29859,7 +29867,7 @@ fullname="/home/foo/bar/try.c",line="10"@}
 (gdb)
 *stopped,reason="end-stepping-range",
 frame=@{addr="0x000100f4",func="foo",args=[],file="try.c",
-fullname="/home/foo/bar/try.c",line="10"@}
+fullname="/home/foo/bar/try.c",line="10",arch="i386:x86_64"@}
 (gdb)
 @end smallexample
 
@@ -29891,7 +29899,8 @@ The corresponding @value{GDBN} command is @samp{until}.
 (gdb)
 x = 55
 *stopped,reason="location-reached",frame=@{func="main",args=[],
-file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="6"@}
+file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="6",
+arch="i386:x86_64"@}
 (gdb)
 @end smallexample
 
@@ -29944,7 +29953,8 @@ The corresponding @value{GDBN} command is @samp{info frame} or @samp{frame}
 -stack-info-frame
 ^done,frame=@{level="1",addr="0x0001076c",func="callee3",
 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
-fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="17"@}
+fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="17",
+arch="i386:x86_64"@}
 (gdb)
 @end smallexample
 
@@ -30036,19 +30046,24 @@ functionality of @samp{-stack-list-arguments}.
 stack=[
 frame=@{level="0",addr="0x00010734",func="callee4",
 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
-fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="8"@},
+fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="8",
+arch="i386:x86_64"@},
 frame=@{level="1",addr="0x0001076c",func="callee3",
 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
-fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="17"@},
+fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="17",
+arch="i386:x86_64"@},
 frame=@{level="2",addr="0x0001078c",func="callee2",
 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
-fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="22"@},
+fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="22",
+arch="i386:x86_64"@},
 frame=@{level="3",addr="0x000107b4",func="callee1",
 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
-fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="27"@},
+fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="27",
+arch="i386:x86_64"@},
 frame=@{level="4",addr="0x000107e0",func="main",
 file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
-fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="32"@}]
+fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="32",
+arch="i386:x86_64"@}]
 (gdb)
 -stack-list-arguments 0
 ^done,
@@ -30116,6 +30131,8 @@ Line number corresponding to the @code{$pc}.
 @item @var{from}
 The shared library where this function is defined.  This is only given
 if the frame's function is not known.
+@item @var{arch}
+Frame's architecture.
 @end table
 
 If invoked without arguments, this command prints a backtrace for the
@@ -30141,29 +30158,41 @@ Full stack backtrace:
 -stack-list-frames
 ^done,stack=
 [frame=@{level="0",addr="0x0001076c",func="foo",
-  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="11"@},
+  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="11",
+  arch="i386:x86_64"@},
 frame=@{level="1",addr="0x000107a4",func="foo",
-  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"@},
+  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",
+  arch="i386:x86_64"@},
 frame=@{level="2",addr="0x000107a4",func="foo",
-  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"@},
+  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",
+  arch="i386:x86_64"@},
 frame=@{level="3",addr="0x000107a4",func="foo",
-  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"@},
+  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",
+  arch="i386:x86_64"@},
 frame=@{level="4",addr="0x000107a4",func="foo",
-  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"@},
+  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",
+  arch="i386:x86_64"@},
 frame=@{level="5",addr="0x000107a4",func="foo",
-  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"@},
+  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",
+  arch="i386:x86_64"@},
 frame=@{level="6",addr="0x000107a4",func="foo",
-  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"@},
+  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",
+  arch="i386:x86_64"@},
 frame=@{level="7",addr="0x000107a4",func="foo",
-  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"@},
+  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",
+  arch="i386:x86_64"@},
 frame=@{level="8",addr="0x000107a4",func="foo",
-  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"@},
+  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",
+  arch="i386:x86_64"@},
 frame=@{level="9",addr="0x000107a4",func="foo",
-  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"@},
+  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",
+  arch="i386:x86_64"@},
 frame=@{level="10",addr="0x000107a4",func="foo",
-  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"@},
+  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",
+  arch="i386:x86_64"@},
 frame=@{level="11",addr="0x00010738",func="main",
-  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="4"@}]
+  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="4",
+  arch="i386:x86_64"@}]
 (gdb)
 @end smallexample
 
@@ -30174,11 +30203,14 @@ Show frames between @var{low_frame} and @var{high_frame}:
 -stack-list-frames 3 5
 ^done,stack=
 [frame=@{level="3",addr="0x000107a4",func="foo",
-  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"@},
+  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",
+  arch="i386:x86_64"@},
 frame=@{level="4",addr="0x000107a4",func="foo",
-  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"@},
+  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",
+  arch="i386:x86_64"@},
 frame=@{level="5",addr="0x000107a4",func="foo",
-  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"@}]
+  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",
+  arch="i386:x86_64"@}]
 (gdb)
 @end smallexample
 
@@ -30189,7 +30221,8 @@ Show a single frame:
 -stack-list-frames 3 3
 ^done,stack=
 [frame=@{level="3",addr="0x000107a4",func="foo",
-  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14"@}]
+  file="recursive2.c",fullname="/home/foo/bar/recursive2.c",line="14",
+  arch="i386:x86_64"@}]
 (gdb)
 @end smallexample
 
@@ -31469,7 +31502,7 @@ On a PPC MBX board:
 (gdb)
 *stopped,reason="breakpoint-hit",disp="keep",bkptno="1",frame=@{
 func="main",args=[],file="try.c",fullname="/home/foo/bar/try.c",
-line="5"@}
+line="5",arch="powerpc"@}
 (gdb)
 -data-list-changed-registers
 ^done,changed-registers=["0","1","2","4","5","6","7","8","9",
@@ -33647,7 +33680,7 @@ and only if there is a corresponding executable file.
    frame=@{level="0",addr="0xffffe410",func="__kernel_vsyscall",args=[]@},state="running"@},
 @{id="1",target-id="Thread 0xb7e156b0 (LWP 21254)",
    frame=@{level="0",addr="0x0804891f",func="foo",args=[@{name="i",value="10"@}],
-           file="/tmp/a.c",fullname="/tmp/a.c",line="158"@},state="running"@}]]
+           file="/tmp/a.c",fullname="/tmp/a.c",line="158",arch="i386:x86_64"@},state="running"@}]]
 -list-thread-groups --available
 ^done,groups=[@{id="17",type="process",pid="yyy",num_children="2",cores=[1,2]@}]
 -list-thread-groups --available --recurse 1
@@ -33879,7 +33912,7 @@ time=@{wallclock="0.05185",user="0.00800",system="0.00000"@}
 *stopped,reason="breakpoint-hit",disp="keep",bkptno="1",thread-id="0",
 frame=@{addr="0x080484ed",func="main",args=[@{name="argc",value="1"@},
 @{name="argv",value="0xbfb60364"@}],file="myprog.c",
-fullname="/home/nickrob/myprog.c",line="73"@}
+fullname="/home/nickrob/myprog.c",line="73",arch="i386:x86_64"@}
 (gdb)
 @end smallexample
 
diff --git a/gdb/stack.c b/gdb/stack.c
index 3da46dd955..366687e7df 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -1249,6 +1249,9 @@ print_frame (struct frame_info *frame, int print_level,
 	    uiout->field_string ("from", lib);
 	  }
       }
+    if (uiout->is_mi_like_p ())
+      uiout->field_string ("arch",
+			   (gdbarch_bfd_arch_info (gdbarch))->printable_name);
   }
 
   uiout->text ("\n");
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index bdef4be4bb..c94ac454e8 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,12 @@
+2018-08-08  Jan Vrany  <jan.vrany@fit.cvut.cz>
+
+	* lib/mi-support.exp (mi_expect_stop): Update regexp to
+	accommodate new "arch" field in frame output.
+	* gdb.mi/mi-return.exp: Likewise.
+	* gdb.mi/mi-stack.exp: Likewise.
+	* gdb.mi/mi-syn-frame.exp: Likewise.
+	* gdb.mi/user-selected-context-sync.exp: Likewise.
+
 2018-08-19  Michael Spang  <spang@google.com>
 
 	PR gdb/11786
diff --git a/gdb/testsuite/gdb.mi/mi-return.exp b/gdb/testsuite/gdb.mi/mi-return.exp
index 8db0c57b33..5b21e18db6 100644
--- a/gdb/testsuite/gdb.mi/mi-return.exp
+++ b/gdb/testsuite/gdb.mi/mi-return.exp
@@ -50,7 +50,7 @@ proc test_return_simple {} {
     set line_callee3_call         [expr $line_callee3_head + 2]
     set line_callee3_close_brace  [expr $line_callee3_head + 3]
 
-    mi_gdb_test "111-exec-return" "111\\^done,frame=\{level=\"0\",addr=\"$hex\",func=\"callee3\",args=\\\[.*\\\],file=\".*basics.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"($line_callee3_call|$line_callee3_close_brace)\"\}" "return from callee4 now"
+    mi_gdb_test "111-exec-return" "111\\^done,frame=\{level=\"0\",addr=\"$hex\",func=\"callee3\",args=\\\[.*\\\],file=\".*basics.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"($line_callee3_call|$line_callee3_close_brace)\",arch=\"\[^\"\]+\"\}" "return from callee4 now"
 }
 
 mi_runto callee4
diff --git a/gdb/testsuite/gdb.mi/mi-stack.exp b/gdb/testsuite/gdb.mi/mi-stack.exp
index fcb74e2610..366d0c52c3 100644
--- a/gdb/testsuite/gdb.mi/mi-stack.exp
+++ b/gdb/testsuite/gdb.mi/mi-stack.exp
@@ -46,6 +46,8 @@ proc test_stack_frame_listing {} {
     global mi_gdb_prompt
     global hex fullname_syntax srcfile
 
+    set any "\[^\"\]+"
+
     set callee4_begin [gdb_get_line_number "callee4 begin"]
     mi_continue_to_line $callee4_begin "continue to callee4 begin"
 
@@ -56,7 +58,7 @@ proc test_stack_frame_listing {} {
     # -stack-list-frames 1 3
     # -stack-info-frame
     mi_gdb_test "231-stack-list-frames" \
-	"231\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"callee4\",file=\".*${srcfile}\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$callee4_begin\"\},frame=\{level=\"1\",addr=\"$hex\",func=\"callee3\",.*\},frame=\{level=\"2\",addr=\"$hex\",func=\"callee2\",.*\},frame=\{level=\"3\",addr=\"$hex\",func=\"callee1\",.*\},frame=\{level=\"4\",addr=\"$hex\",func=\"main\",.*\}\\\]" \
+	"231\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"callee4\",file=\".*${srcfile}\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$callee4_begin\",arch=\"$any\"\},frame=\{level=\"1\",addr=\"$hex\",func=\"callee3\",.*\},frame=\{level=\"2\",addr=\"$hex\",func=\"callee2\",.*\},frame=\{level=\"3\",addr=\"$hex\",func=\"callee1\",.*\},frame=\{level=\"4\",addr=\"$hex\",func=\"main\",.*\}\\\]" \
 	"stack frame listing"
     mi_gdb_test "232-stack-list-frames 1 1" \
 	"232\\^done,stack=\\\[frame=\{level=\"1\",addr=\"$hex\",func=\"callee3\",.*\}\\\]" \
@@ -70,7 +72,7 @@ proc test_stack_frame_listing {} {
 	"stack frame listing wrong"
 
     mi_gdb_test "235-stack-info-frame" \
-	"235\\^done,frame=\{level=\"0\",addr=\"$hex\",func=\"callee4\",file=\".*${srcfile}\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$callee4_begin\"\}" \
+	"235\\^done,frame=\{level=\"0\",addr=\"$hex\",func=\"callee4\",file=\".*${srcfile}\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$callee4_begin\",arch=\"$any\"\}" \
 	"selected frame listing"
 
     mi_gdb_test "236-stack-list-frames 1 300" \
diff --git a/gdb/testsuite/gdb.mi/mi-syn-frame.exp b/gdb/testsuite/gdb.mi/mi-syn-frame.exp
index 44196324be..33ba73128c 100644
--- a/gdb/testsuite/gdb.mi/mi-syn-frame.exp
+++ b/gdb/testsuite/gdb.mi/mi-syn-frame.exp
@@ -23,6 +23,7 @@ if [target_info exists gdb,nosignals] {
 
 load_lib mi-support.exp
 set MIFLAGS "-i=mi"
+set any "\[^\"\]+"
 
 standard_testfile
 
@@ -47,7 +48,7 @@ mi_gdb_test "401-data-evaluate-expression foo()" ".*401\\^error,msg=\"The progra
     "call inferior's function with a breakpoint set in it"
 
 
-mi_gdb_test "402-stack-list-frames" "402\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"foo\",file=\".*mi-syn-frame.c\",line=\"$decimal\"\},frame=\{level=\"1\",addr=\"$hex\",func=\"<function called from gdb>\"\},frame=\{level=\"2\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",line=\"$decimal\"\}.*\\\]" "backtrace from inferior function stopped at bp, showing gdb dummy frame"
+mi_gdb_test "402-stack-list-frames" "402\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"foo\",file=\".*mi-syn-frame.c\",line=\"$decimal\",arch=\"$any\"\},frame=\{level=\"1\",addr=\"$hex\",func=\"<function called from gdb>\"\},frame=\{level=\"2\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",line=\"$decimal\",arch=\"$any\"\}.*\\\]" "backtrace from inferior function stopped at bp, showing gdb dummy frame"
 
 #
 # Continue back to main()
@@ -57,7 +58,7 @@ mi_send_resuming_command "exec-continue" "testing exec continue"
 mi_expect_stop "really-no-reason" "" "" "" "" "" "finished exec continue"
 
 mi_gdb_test "404-stack-list-frames 0 0" \
-  "404\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"\}.*\\\]" \
+  "404\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\",arch=\"$any\"\}.*\\\]" \
   "list stack frames"
 
 
@@ -77,7 +78,7 @@ mi_gdb_test "406-data-evaluate-expression have_a_very_merry_interrupt()" \
 # in this next output.
 
 mi_gdb_test "407-stack-list-frames" \
-  "407\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"subroutine\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"\},frame=\{level=\"1\",addr=\"$hex\",func=\"handler\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"\},frame=\{level=\"2\",addr=\"$hex\",func=\"<signal handler called>\"\},.*frame=\{level=\"$decimal\",addr=\"$hex\",func=\"have_a_very_merry_interrupt\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"\},frame=\{level=\"$decimal\",addr=\"$hex\",func=\"<function called from gdb>\"\},frame=\{level=\"$decimal\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"\}.*\\\]" \
+  "407\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"subroutine\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\",arch=\"$any\"\},frame=\{level=\"1\",addr=\"$hex\",func=\"handler\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\",arch=\"$any\"\},frame=\{level=\"2\",addr=\"$hex\",func=\"<signal handler called>\"\},.*frame=\{level=\"$decimal\",addr=\"$hex\",func=\"have_a_very_merry_interrupt\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\",arch=\"$any\"\},frame=\{level=\"$decimal\",addr=\"$hex\",func=\"<function called from gdb>\"\},frame=\{level=\"$decimal\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\",arch=\"$any\"\}.*\\\]" \
   "list stack frames"
 
 
@@ -86,7 +87,7 @@ mi_send_resuming_command "exec-continue" "testing exec continue"
 mi_expect_stop "really-no-reason" "" "" "" "" "" "finished exec continue"
 
 mi_gdb_test "409-stack-list-frames 0 0" \
-  "409\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"\}.*\\\]" \
+  "409\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\",arch=\"$any\"\}.*\\\]" \
   "list stack frames"
 
 #
@@ -97,7 +98,7 @@ mi_gdb_test "410-data-evaluate-expression bar()" \
   ".*410\\^error,msg=\"The program being debugged was signaled while in a function called from GDB.\\\\nGDB remains in the frame where the signal was received.\\\\nTo change this behavior use \\\\\"set unwindonsignal on\\\\\".\\\\nEvaluation of the expression containing the function\\\\n\\(bar\\) will be abandoned.\\\\nWhen the function is done executing, GDB will silently stop.\"" \
   "call inferior function which raises exception"
 
-mi_gdb_test "411-stack-list-frames" "411\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"bar\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"},frame=\{level=\"1\",addr=\"$hex\",func=\"<function called from gdb>\"\},frame=\{level=\"2\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\"}.*\\\]" "backtrace from inferior function at exception"
+mi_gdb_test "411-stack-list-frames" "411\\^done,stack=\\\[frame=\{level=\"0\",addr=\"$hex\",func=\"bar\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\",arch=\"$any\"},frame=\{level=\"1\",addr=\"$hex\",func=\"<function called from gdb>\"\},frame=\{level=\"2\",addr=\"$hex\",func=\"main\",file=\".*mi-syn-frame.c\",fullname=\"${fullname_syntax}${srcfile}\",line=\"$decimal\",arch=\"$any\"}.*\\\]" "backtrace from inferior function at exception"
 
 mi_gdb_exit
 
diff --git a/gdb/testsuite/gdb.mi/user-selected-context-sync.exp b/gdb/testsuite/gdb.mi/user-selected-context-sync.exp
index 05624deb0a..eabce97acc 100644
--- a/gdb/testsuite/gdb.mi/user-selected-context-sync.exp
+++ b/gdb/testsuite/gdb.mi/user-selected-context-sync.exp
@@ -156,11 +156,11 @@ proc make_mi_re { mode thread frame type } {
     set thread_event_re "=thread-selected,id=\"$thread\""
     set thread_answer_re "\\^done,new-thread-id=\"$thread\""
 
-    set frame_re(0) ",frame=\{level=\"0\",addr=\"$hex\",func=\"child_sub_function\",args=\\\[\\\],file=\"${any}${srcfile}\",fullname=\"${any}${srcfile}\",line=\"$thread_loop_line\"\}"
-    set frame_re(1) ",frame=\{level=\"1\",addr=\"$hex\",func=\"child_function\",args=\\\[\{name=\"args\",value=\"0x0\"\}\\\],file=\"${any}${srcfile}\",fullname=\"${any}${srcfile}\",line=\"$thread_caller_line\"\}"
+    set frame_re(0) ",frame=\{level=\"0\",addr=\"$hex\",func=\"child_sub_function\",args=\\\[\\\],file=\"${any}${srcfile}\",fullname=\"${any}${srcfile}\",line=\"$thread_loop_line\",arch=\"$any\"\}"
+    set frame_re(1) ",frame=\{level=\"1\",addr=\"$hex\",func=\"child_function\",args=\\\[\{name=\"args\",value=\"0x0\"\}\\\],file=\"${any}${srcfile}\",fullname=\"${any}${srcfile}\",line=\"$thread_caller_line\",arch=\"$any\"\}"
 
     # Special frame for main thread.
-    set frame_re(2) ",frame=\{level=\"0\",addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\"${any}${srcfile}\",fullname=\"${any}${srcfile}\",line=\"${main_break_line}\"\}"
+    set frame_re(2) ",frame=\{level=\"0\",addr=\"$hex\",func=\"main\",args=\\\[\\\],file=\"${any}${srcfile}\",fullname=\"${any}${srcfile}\",line=\"${main_break_line}\",arch=\"$any\"\}"
 
     if { $thread != -1 } {
 	if { $type == "event" } {
diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-support.exp
index 851e490f4d..bf9f613985 100644
--- a/gdb/testsuite/lib/mi-support.exp
+++ b/gdb/testsuite/lib/mi-support.exp
@@ -1240,9 +1240,9 @@ proc mi_expect_stop { reason func args file line extra test } {
 
     set a $after_reason
 
-    verbose -log "mi_expect_stop: expecting: \\*stopped,${r}${a}${bn}frame=\{addr=\"$hex\",func=\"$func\",args=$args,(?:file=\"$any$file\",fullname=\"${fullname_syntax}$file\",line=\"$line\"|from=\"$file\")\}$after_stopped,thread-id=\"$decimal\",stopped-threads=$any\r\n($thread_selected_re|$breakpoint_re)*$prompt_re"
+    verbose -log "mi_expect_stop: expecting: \\*stopped,${r}${a}${bn}frame=\{addr=\"$hex\",func=\"$func\",args=$args,(?:file=\"$any$file\",fullname=\"${fullname_syntax}$file\",line=\"$line\",arch=\"$any\"|from=\"$file\")\}$after_stopped,thread-id=\"$decimal\",stopped-threads=$any\r\n($thread_selected_re|$breakpoint_re)*$prompt_re"
     gdb_expect {
-	-re "\\*stopped,${r}${a}${bn}frame=\{addr=\"$hex\",func=\"$func\",args=$args,(?:file=\"$any$file\",fullname=\"${fullname_syntax}$file\",line=\"($line)\"|from=\"$file\")\}$after_stopped,thread-id=\"$decimal\",stopped-threads=$any\r\n($thread_selected_re|$breakpoint_re)*$prompt_re" {
+	-re "\\*stopped,${r}${a}${bn}frame=\{addr=\"$hex\",func=\"$func\",args=$args,(?:file=\"$any$file\",fullname=\"${fullname_syntax}$file\",line=\"($line)\",arch=\"$any\"|from=\"$file\")\}$after_stopped,thread-id=\"$decimal\",stopped-threads=$any\r\n($thread_selected_re|$breakpoint_re)*$prompt_re" {
 	    pass "$test"
 	    if {[array names expect_out "2,string"] != ""} {
 		return $expect_out(2,string)
@@ -1250,7 +1250,7 @@ proc mi_expect_stop { reason func args file line extra test } {
 	    # No debug info available but $file does match.
 	    return 0
 	}
-	-re "\\*stopped,${r}${a}${bn}frame=\{addr=\"$hex\",func=\"$any\",args=\[\\\[\{\]$any\[\\\]\}\],file=\"$any\",fullname=\"${fullname_syntax}$any\",line=\"\[0-9\]*\"\}$after_stopped,thread-id=\"$decimal\",stopped-threads=$any\r\n($thread_selected_re|$breakpoint_re)*$prompt_re" {
+	-re "\\*stopped,${r}${a}${bn}frame=\{addr=\"$hex\",func=\"$any\",args=\[\\\[\{\]$any\[\\\]\}\],file=\"$any\",fullname=\"${fullname_syntax}$any\",line=\"\[0-9\]*\",arch=\"$any\"\}$after_stopped,thread-id=\"$decimal\",stopped-threads=$any\r\n($thread_selected_re|$breakpoint_re)*$prompt_re" {
 	    verbose -log "got $expect_out(buffer)"
 	    fail "$test (stopped at wrong place)"
 	    return -1
-- 
2.18.0

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

* Re: [RFC] mi: print frame architecture when printing frames on an MI channel
  2018-08-22  9:43               ` Jan Vrany
@ 2018-08-22 11:39                 ` Pedro Alves
  2018-08-24 20:22                   ` Regression on gdb.arch/amd64-invalid-stack-*.exp (was: Re: [RFC] mi: print frame architecture when printing frames on an MI channel) Sergio Durigan Junior
  0 siblings, 1 reply; 14+ messages in thread
From: Pedro Alves @ 2018-08-22 11:39 UTC (permalink / raw)
  To: Jan Vrany, gdb-patches

Merged, thanks.

Pedro Alves

On 08/22/2018 10:42 AM, Jan Vrany wrote:
> When printing frames on an MI channel also print frame architecture
> like in:
> 
>     (gdb)
>     -stack-list-frames 3 3
>     ^done,stack=
>     [frame={level="3",addr="0x000107a4",func="foo",
>       file="recursive2.c",fullname="/home/foo/bar/recursive2.c",
>       line="14",arch="i386:x86_64"}]
>    (gdb)
> 
> This is useful for MI clients that need to know the architecture in order
> to perform further analysis, for example to use their own disassembler to
> analyze machine code.
> 
> gdb/Changelog:
> 
> 	* stack.c (print_frame): Print frame architecture when printing on
>         an MI output.
> 	* NEWS: Mention new "arch" attribute in frame output.
> 
> gdb/testsuite/Changelog
> 
> 	* lib/mi-support.exp (mi_expect_stop): Update regexp to
> 	accommodate new "arch" field in frame output.
> 	* gdb.mi/mi-return.exp: Likewise.
> 	* gdb.mi/mi-stack.exp: Likewise.
> 	* gdb.mi/mi-syn-frame.exp: Likewise.
> 	* gdb.mi/user-selected-context-sync.exp: Likewise.
> 
> gdb/doc/Changelog
> 
> 	* gdb.texinfo (The -stack-list-frames Command): Update description
> 	to mention "arch".
> 	Update MI examples thorough the document to contain "arch" in frame
> 	output.

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

* Regression on gdb.arch/amd64-invalid-stack-*.exp (was: Re: [RFC] mi: print frame architecture when printing frames on an MI channel)
  2018-08-22 11:39                 ` Pedro Alves
@ 2018-08-24 20:22                   ` Sergio Durigan Junior
  2018-08-27 13:37                     ` Jan Vrany
  0 siblings, 1 reply; 14+ messages in thread
From: Sergio Durigan Junior @ 2018-08-24 20:22 UTC (permalink / raw)
  To: Pedro Alves; +Cc: Jan Vrany, gdb-patches

On Wednesday, August 22 2018, Pedro Alves wrote:

> Merged, thanks.

Hi,

This has caused a regression on the gdb.arch/amd64-invalid-stack-*.exp
tests:

Buildslave:
	fedora-x86-64-4

Full Build URL:
	<http://gdb-build.sergiodj.net/builders/Fedora-x86_64-m64/builds/10739>

Commit(s) tested:
	6d52907e226ade45d5f5196eaed8386affda5156

Author(s) (in the same order as the commits):
	Jan Vrany <jan.vrany@fit.cvut.cz>

Subject:
	MI: Print frame architecture when printing frames on an MI channel

Testsuite log (gdb.sum and gdb.log) URL(s):
	<http://gdb-build.sergiodj.net/results/Fedora-x86_64-m64/6d/6d52907e226ade45d5f5196eaed8386affda5156/>

*** Diff to previous build ***
============================
PASS -> FAIL: gdb.arch/amd64-invalid-stack-middle.exp: check mi -stack-list-frames command, first time
PASS -> FAIL: gdb.arch/amd64-invalid-stack-middle.exp: check mi -stack-list-frames command, second time
PASS -> FAIL: gdb.arch/amd64-invalid-stack-top.exp: check mi -stack-list-frames command, first time
PASS -> FAIL: gdb.arch/amd64-invalid-stack-top.exp: check mi -stack-list-frames command, second time
============================

Thanks to Kevin for noticing this earlier.

-- 
Sergio
GPG key ID: 237A 54B1 0287 28BF 00EF  31F4 D0EB 7628 65FC 5E36
Please send encrypted e-mail if possible
http://sergiodj.net/

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

* Re: Regression on gdb.arch/amd64-invalid-stack-*.exp (was: Re: [RFC] mi: print frame architecture when printing frames on an MI channel)
  2018-08-24 20:22                   ` Regression on gdb.arch/amd64-invalid-stack-*.exp (was: Re: [RFC] mi: print frame architecture when printing frames on an MI channel) Sergio Durigan Junior
@ 2018-08-27 13:37                     ` Jan Vrany
  0 siblings, 0 replies; 14+ messages in thread
From: Jan Vrany @ 2018-08-27 13:37 UTC (permalink / raw)
  To: Sergio Durigan Junior, Pedro Alves; +Cc: gdb-patches

On Fri, 2018-08-24 at 16:22 -0400, Sergio Durigan Junior wrote:
> On Wednesday, August 22 2018, Pedro Alves wrote:
> 
> > Merged, thanks.
> 
> Hi,
> 
> This has caused a regression on the gdb.arch/amd64-invalid-stack-*.exp
> tests:

Ah, sorry. I'll send a patch shortly. Note that amd64-invalid-stack-middle.exp fails
on my system because it cannot link the test program (see below [1]) so the fix is done
"blind".

Jan


[1]: Output from (Debian testing)


Running /home/jv/Projects/gdb/users_jv_patches/gdb/testsuite/gdb.arch/amd64-invalid-stack-middle.exp ...
gdb compile failed, /usr/bin/ld: /home/jv/Projects/gdb/users_jv_patches/gdb/testsuite/outputs/gdb.arch/amd64-invalid-stack-middle/amd64-invalid-stack-middle0.o: relocation R_X86_64_32 against
`.rodata' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: final link failed: nonrepresentable section on output
collect2: error: ld returned 1 exit status


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

end of thread, other threads:[~2018-08-27 13:37 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-10  5:57 [RFC] mi: Print frame architecture when printing frames on an MI channel Jan Vrany
2018-08-10 10:30 ` Pedro Alves
2018-08-13 10:53   ` [RFC] mi: print " Jan Vrany
2018-08-16 19:01     ` Pedro Alves
2018-08-20 10:24       ` Jan Vrany
2018-08-20 11:16         ` Pedro Alves
2018-08-20 20:43           ` Jan Vrany
2018-08-21 15:42             ` Pedro Alves
2018-08-21 16:16               ` Eli Zaretskii
2018-08-22  9:43               ` Jan Vrany
2018-08-22 11:39                 ` Pedro Alves
2018-08-24 20:22                   ` Regression on gdb.arch/amd64-invalid-stack-*.exp (was: Re: [RFC] mi: print frame architecture when printing frames on an MI channel) Sergio Durigan Junior
2018-08-27 13:37                     ` Jan Vrany
2018-08-21 16:16             ` [RFC] mi: print frame architecture when printing frames on an MI channel Eli Zaretskii

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