Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Andrew Burgess" <aburgess@broadcom.com>
To: gdb-patches@sourceware.org
Cc: "Pedro Alves" <palves@redhat.com>
Subject: Re: Add fullname field in disassembly output
Date: Fri, 02 Nov 2012 10:59:00 -0000	[thread overview]
Message-ID: <5093A785.3060103@broadcom.com> (raw)
In-Reply-To: <50913B7F.10707@redhat.com>

On 31/10/2012 2:53 PM, Pedro Alves wrote:

>> Ok to commit?
> 
> Not yet, sorry.  This new field needs to be documented in the manual, and mentioned in NEWS.

Sorry, I should have realised I'd need to do these things.

Latest version of patch, includes fullname field, test
updates, noted in documentation and in NEWS file.

Is this Ok?


Thanks,

Andrew



gdb/ChangeLog

2012-11-02  Andrew Burhess  <aburgess@broadcom.com>

	* source.c (print_source_lines_base): Add fullname field giving
	full path to file in mi output.
	* NEWS: Mention the new fullname field.

diff --git a/gdb/NEWS b/gdb/NEWS
index 069b84f..f953602 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -64,6 +64,9 @@ py [command]
      async record "=record-started" and "=record-stopped".
   ** Memory changes are now notified using new async record
      "=memory-changed".
+  ** The data-disassemble command response will include a "fullname" field
+     containing the full path to the source file when gdb can determine the
+     full path, and source has been requested in the output.
 
 *** Changes in GDB 7.5

diff --git a/gdb/source.c b/gdb/source.c
index bd11c63..465382e 100644
--- a/gdb/source.c
+++ b/gdb/source.c
@@ -1301,6 +1301,13 @@ print_source_lines_base (struct symtab *s, int line, int stopline, int noerror)
 	  ui_out_field_int (uiout, "line", line);
 	  ui_out_text (uiout, "\tin ");
 	  ui_out_field_string (uiout, "file", s->filename);
+	  if (ui_out_is_mi_like_p (uiout))
+	    {
+	      const char *fullname = symtab_to_fullname (s);
+
+	      if (fullname != NULL)
+		ui_out_field_string (uiout, "fullname", fullname);
+	    }
 	  ui_out_text (uiout, "\n");
 	}



 
gdb/doc/ChangeLog

2012-11-02  Andrew Burgess  <aburgess@broadcom.com>

	* gdb.texinfo (GDB/MI Data Manipulation): Add fullname field to
	the example -data-disassemble output.

diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 21db475..88ee695 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -30795,13 +30795,15 @@ Disassemble 3 instructions from the start of @code{main} in mixed mode:
 -data-disassemble -f basics.c -l 32 -n 3 -- 1
 ^done,asm_insns=[
 src_and_asm_line=@{line="31",
-file="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb/ \
-  testsuite/gdb.mi/basics.c",line_asm_insn=[
+file="../../../src/gdb/testsuite/gdb.mi/basics.c",
+fullname="/absolute/path/to/src/gdb/testsuite/ \
+gdb.mi/basics.c",line_asm_insn=[
 @{address="0x000107bc",func-name="main",offset="0",
 inst="save  %sp, -112, %sp"@}]@},
 src_and_asm_line=@{line="32",
-file="/kwikemart/marge/ezannoni/flathead-dev/devo/gdb/ \
-  testsuite/gdb.mi/basics.c",line_asm_insn=[
+file="../../../src/gdb/testsuite/gdb.mi/basics.c",
+fullname="/absolute/path/to/src/gdb/testsuite/ \
+gdb.mi/basics.c",line_asm_insn=[
 @{address="0x000107c0",func-name="main",offset="4",
 inst="mov  2, %o0"@},
 @{address="0x000107c4",func-name="main",offset="8",



 
gdb/testsuite/ChangeLog

2012-11-02  Andrew Burgess  <aburgess@broadcom.com>

	* gdb.mi/mi-disassemble.exp: Expect fullname field in mi
	disassembly output.

diff --git a/gdb/testsuite/gdb.mi/mi-disassemble.exp b/gdb/testsuite/gdb.mi/mi-disassemble.exp
index 377ffde..695521a 100644
--- a/gdb/testsuite/gdb.mi/mi-disassemble.exp
+++ b/gdb/testsuite/gdb.mi/mi-disassemble.exp
@@ -115,6 +115,7 @@ proc test_disassembly_mixed {} {
     global mi_gdb_prompt
     global hex
     global decimal
+    global fullname_syntax
 
     set line_callee2_head       [gdb_get_line_number "callee2 ("]
     set line_callee2_open_brace [expr $line_callee2_head + 1]
@@ -125,7 +126,7 @@ proc test_disassembly_mixed {} {
     # -data-disassembly -s $pc -e "$pc+8" -- 1
 
     mi_gdb_test "002-data-disassemble -f basics.c -l $line_callee2_open_brace -- 1" \
-	    "002\\^done,asm_insns=\\\[src_and_asm_line=\{line=\"$line_callee2_open_brace\",file=\".*basics.c\",line_asm_insn=\\\[\{address=\"$hex\",func-name=\"callee2\",offset=\"0\",inst=\".*\"\}.*\\\]\}.*,src_and_asm_line=\{line=\"$decimal\",file=\".*basics.c\",line_asm_insn=\\\[.*\{address=\"$hex\",func-name=\"callee2\",offset=\"$decimal\",inst=\".*\"\}\\\]\}\\\]" \
+	    "002\\^done,asm_insns=\\\[src_and_asm_line=\{line=\"$line_callee2_open_brace\",file=\".*basics.c\",fullname=\"${fullname_syntax}basics.c\",line_asm_insn=\\\[\{address=\"$hex\",func-name=\"callee2\",offset=\"0\",inst=\".*\"\}.*\\\]\}.*,src_and_asm_line=\{line=\"$decimal\",file=\".*basics.c\",fullname=\"${fullname_syntax}basics.c\",line_asm_insn=\\\[.*\{address=\"$hex\",func-name=\"callee2\",offset=\"$decimal\",inst=\".*\"\}\\\]\}\\\]" \
              "data-disassemble file, line assembly mixed"
 
     #
@@ -134,7 +135,7 @@ proc test_disassembly_mixed {} {
     # which we are now, even if we have specified that the range is only 2 insns.
     #
     mi_gdb_test "003-data-disassemble -s \$pc -e \"\$pc+4\" -- 1" \
-	    "003\\^done,asm_insns=\\\[src_and_asm_line=\{line=\"$decimal\",file=\".*basics.c\",line_asm_insn=\\\[\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",inst=\".*\"\}.*\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",inst=\".*\"\}\\\]\}\\\]" \
+	    "003\\^done,asm_insns=\\\[src_and_asm_line=\{line=\"$decimal\",file=\".*basics.c\",fullname=\"${fullname_syntax}basics.c\",line_asm_insn=\\\[\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",inst=\".*\"\}.*\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",inst=\".*\"\}\\\]\}\\\]" \
              "data-disassemble range assembly mixed"
 }
 
@@ -142,6 +143,7 @@ proc test_disassembly_mixed_with_opcodes {} {
     global mi_gdb_prompt
     global hex
     global decimal
+    global fullname_syntax
 
     set line_callee2_head       [gdb_get_line_number "callee2 ("]
     set line_callee2_open_brace [expr $line_callee2_head + 1]
@@ -152,7 +154,7 @@ proc test_disassembly_mixed_with_opcodes {} {
     # -data-disassembly -s $pc -e "$pc+8" -- 3
 
     mi_gdb_test "002-data-disassemble -f basics.c -l $line_callee2_open_brace -- 3" \
-           "002\\^done,asm_insns=\\\[src_and_asm_line=\{line=\"$line_callee2_open_brace\",file=\".*basics.c\",line_asm_insn=\\\[\{address=\"$hex\",func-name=\"callee2\",offset=\"0\",opcodes=\".*\",inst=\".*\"\}.*\\\]\}.*,src_and_asm_line=\{line=\"$decimal\",file=\".*basics.c\",line_asm_insn=\\\[.*\{address=\"$hex\",func-name=\"callee2\",offset=\"$decimal\",opcodes=\".*\",inst=\".*\"\}\\\]\}\\\]" \
+           "002\\^done,asm_insns=\\\[src_and_asm_line=\{line=\"$line_callee2_open_brace\",file=\".*basics.c\",fullname=\"${fullname_syntax}basics.c\",line_asm_insn=\\\[\{address=\"$hex\",func-name=\"callee2\",offset=\"0\",opcodes=\".*\",inst=\".*\"\}.*\\\]\}.*,src_and_asm_line=\{line=\"$decimal\",file=\".*basics.c\",fullname=\"${fullname_syntax}basics.c\",line_asm_insn=\\\[.*\{address=\"$hex\",func-name=\"callee2\",offset=\"$decimal\",opcodes=\".*\",inst=\".*\"\}\\\]\}\\\]" \
              "data-disassemble file, line assembly mixed with opcodes"
 
     #
@@ -161,7 +163,7 @@ proc test_disassembly_mixed_with_opcodes {} {
     # which we are now, even if we have specified that the range is only 2 insns.
     #
     mi_gdb_test "003-data-disassemble -s \$pc -e \"\$pc+4\" -- 3" \
-           "003\\^done,asm_insns=\\\[src_and_asm_line=\{line=\"$decimal\",file=\".*basics.c\",line_asm_insn=\\\[\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",opcodes=\".*\",inst=\".*\"\}.*\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",opcodes=\".*\",inst=\".*\"\}\\\]\}\\\]" \
+           "003\\^done,asm_insns=\\\[src_and_asm_line=\{line=\"$decimal\",file=\".*basics.c\",fullname=\"${fullname_syntax}basics.c\",line_asm_insn=\\\[\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",opcodes=\".*\",inst=\".*\"\}.*\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",opcodes=\".*\",inst=\".*\"\}\\\]\}\\\]" \
              "data-disassemble range assembly mixed with opcodes"
 }
 
@@ -169,6 +171,7 @@ proc test_disassembly_mixed_lines_limit {} {
     global mi_gdb_prompt
     global hex
     global decimal
+    global fullname_syntax
 
     set line_main_head       [gdb_get_line_number "main ("]
     set line_main_open_brace [expr $line_main_head + 1]
@@ -182,15 +185,15 @@ proc test_disassembly_mixed_lines_limit {} {
 
     mi_gdb_test "print/x \$pc" "" ""
     mi_gdb_test "222-data-disassemble  -f basics.c -l $line_main_body -n 20 -- 1" \
-	    "222\\^done,asm_insns=\\\[src_and_asm_line=\{line=\"$decimal\",file=\".*basics.c\",line_asm_insn=\\\[\{address=\"$hex\",func-name=\"main\",offset=\"0\",inst=\".*\"\},.*,\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",inst=\".*\"\}\\\]\}\]" \
+	    "222\\^done,asm_insns=\\\[src_and_asm_line=\{line=\"$decimal\",file=\".*basics.c\",fullname=\"${fullname_syntax}basics.c\",line_asm_insn=\\\[\{address=\"$hex\",func-name=\"main\",offset=\"0\",inst=\".*\"\},.*,\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",inst=\".*\"\}\\\]\}\]" \
               "data-disassemble file, line, number assembly mixed"
 
     mi_gdb_test "222-data-disassemble  -f basics.c -l $line_main_body -n 0 -- 1" \
-	    "222\\^done,asm_insns=\\\[src_and_asm_line=\{line=\"$line_main_open_brace\",file=\".*basics.c\",line_asm_insn=\\\[\\\]\}\\\]" \
+	    "222\\^done,asm_insns=\\\[src_and_asm_line=\{line=\"$line_main_open_brace\",file=\".*basics.c\",fullname=\"${fullname_syntax}basics.c\",line_asm_insn=\\\[\\\]\}\\\]" \
               "data-disassemble file, line, number (zero lines) assembly mixed"
 
     mi_gdb_test "222-data-disassemble  -f basics.c -l $line_main_body -n 50 -- 1" \
-	    "222\\^done,asm_insns=\\\[src_and_asm_line=\{line=\"$decimal\",file=\".*basics.c\",line_asm_insn=\\\[\{address=\"$hex\",func-name=\"main\",offset=\"0\",inst=\".*\"\}.*,\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",inst=\".*\"\}\\\]\}\]" \
+	    "222\\^done,asm_insns=\\\[src_and_asm_line=\{line=\"$decimal\",file=\".*basics.c\",fullname=\"${fullname_syntax}basics.c\",line_asm_insn=\\\[\{address=\"$hex\",func-name=\"main\",offset=\"0\",inst=\".*\"\}.*,\{address=\"$hex\",func-name=\"main\",offset=\"$decimal\",inst=\".*\"\}\\\]\}\]" \
               "data-disassemble file, line, number (more than main lines) assembly mixed"
 }
 



  reply	other threads:[~2012-11-02 10:59 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-04 16:09 [PATCH] Display full file path in MI style disassembly listing Andrew Burgess
2012-10-05 12:44 ` Jan Kratochvil
2012-10-07 14:28   ` Andrew Burgess
2012-10-07 14:34     ` Jan Kratochvil
2012-10-07 15:16       ` Joel Brobecker
2012-10-17 17:20         ` Tom Tromey
2012-10-17 18:13   ` Pedro Alves
2012-10-18  6:48     ` Jan Kratochvil
2012-10-18  9:49       ` Andrew Burgess
2012-10-18 10:17         ` Pedro Alves
2012-10-18 18:06           ` André Pönitz
2012-10-18 13:45         ` Jan Kratochvil
2012-10-17 17:16 ` Tom Tromey
2012-10-18  9:34   ` Andrew Burgess
2012-10-18 13:45     ` Jan Kratochvil
2012-10-17 18:25 ` Pedro Alves
2012-10-22 21:26 ` Add fullname field in disassembly output (Was Re: [PATCH] Display full file path in MI style disassembly listing) Andrew Burgess
2012-10-31 14:54   ` Add fullname field in disassembly output Pedro Alves
2012-11-02 10:59     ` Andrew Burgess [this message]
2012-11-02 15:32       ` Pedro Alves
2012-11-06 12:14         ` Andrew Burgess
2012-11-06 17:44           ` Eli Zaretskii
2012-11-07 15:08             ` Andrew Burgess
2012-11-07 15:48               ` Pedro Alves
2012-11-08 21:30                 ` Tom Tromey
2012-11-09 13:26                   ` Andrew Burgess
2012-11-03  7:42       ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5093A785.3060103@broadcom.com \
    --to=aburgess@broadcom.com \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox