public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] gdb: make "maintenance info line-table" show relocated addresses again
@ 2023-03-20 16:30 Simon Marchi
  2023-03-20 21:35 ` Andrew Burgess
  0 siblings, 1 reply; 16+ messages in thread
From: Simon Marchi @ 2023-03-20 16:30 UTC (permalink / raw)
  To: gdb-patches; +Cc: Simon Marchi

Commit 1acc9dca423f ("Change linetables to be objfile-independent")
changed "maintenance info line-table" to print unrelocated addresses
instead of relocated.  This breaks a few tests on systems where that
matters.  The ones I see are:

    Running /home/smarchi/src/binutils-gdb/gdb/testsuite/gdb.base/consecutive.exp ...
    FAIL: gdb.base/consecutive.exp: stopped at bp, 2nd instr (missing hex prefix)
    Running /home/smarchi/src/binutils-gdb/gdb/testsuite/gdb.base/async.exp ...
    FAIL: gdb.base/async.exp: stepi&
    FAIL: gdb.base/async.exp: nexti&
    FAIL: gdb.base/async.exp: finish&

These tests run "maintenance info line-table" to record the address of
some lines, and then use these addresses in expected patterns.

For the time being, I suggest simply reverting the command to show
relocated addresses.

Change-Id: I59558f167e13e63421c9e0f2cad192e7c95c10cf
---
 gdb/symmisc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/symmisc.c b/gdb/symmisc.c
index 54dc570d282f..8296857d06c3 100644
--- a/gdb/symmisc.c
+++ b/gdb/symmisc.c
@@ -996,7 +996,7 @@ maintenance_print_one_line_table (struct symtab *symtab, void *data)
 	  else
 	    uiout->field_string ("line", _("END"));
 	  uiout->field_core_addr ("address", objfile->arch (),
-				  CORE_ADDR (item->raw_pc ()));
+				  item->pc (objfile));
 	  uiout->field_string ("is-stmt", item->is_stmt ? "Y" : "");
 	  uiout->field_string ("prologue-end", item->prologue_end ? "Y" : "");
 	  uiout->text ("\n");
-- 
2.40.0


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

* Re: [PATCH] gdb: make "maintenance info line-table" show relocated addresses again
  2023-03-20 16:30 [PATCH] gdb: make "maintenance info line-table" show relocated addresses again Simon Marchi
@ 2023-03-20 21:35 ` Andrew Burgess
  2023-03-21  1:18   ` Simon Marchi
  0 siblings, 1 reply; 16+ messages in thread
From: Andrew Burgess @ 2023-03-20 21:35 UTC (permalink / raw)
  To: Simon Marchi via Gdb-patches, gdb-patches; +Cc: Simon Marchi

Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> writes:

> Commit 1acc9dca423f ("Change linetables to be objfile-independent")
> changed "maintenance info line-table" to print unrelocated addresses
> instead of relocated.  This breaks a few tests on systems where that
> matters.  The ones I see are:
>
>     Running /home/smarchi/src/binutils-gdb/gdb/testsuite/gdb.base/consecutive.exp ...
>     FAIL: gdb.base/consecutive.exp: stopped at bp, 2nd instr (missing hex prefix)
>     Running /home/smarchi/src/binutils-gdb/gdb/testsuite/gdb.base/async.exp ...
>     FAIL: gdb.base/async.exp: stepi&
>     FAIL: gdb.base/async.exp: nexti&
>     FAIL: gdb.base/async.exp: finish&
>
> These tests run "maintenance info line-table" to record the address of
> some lines, and then use these addresses in expected patterns.
>
> For the time being, I suggest simply reverting the command to show
> relocated addresses.

This makes sense to me.  When I use 'maint info line-table' it's usually
because I want to try and match up the line table with the code being
executed, so having the relocated addresses would be far more useful.

Reviewed-By: Andrew Burgess <aburgess@redhat.com>

Thanks,
Andrew

>
> Change-Id: I59558f167e13e63421c9e0f2cad192e7c95c10cf
> ---
>  gdb/symmisc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/gdb/symmisc.c b/gdb/symmisc.c
> index 54dc570d282f..8296857d06c3 100644
> --- a/gdb/symmisc.c
> +++ b/gdb/symmisc.c
> @@ -996,7 +996,7 @@ maintenance_print_one_line_table (struct symtab *symtab, void *data)
>  	  else
>  	    uiout->field_string ("line", _("END"));
>  	  uiout->field_core_addr ("address", objfile->arch (),
> -				  CORE_ADDR (item->raw_pc ()));
> +				  item->pc (objfile));
>  	  uiout->field_string ("is-stmt", item->is_stmt ? "Y" : "");
>  	  uiout->field_string ("prologue-end", item->prologue_end ? "Y" : "");
>  	  uiout->text ("\n");
> -- 
> 2.40.0


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

* Re: [PATCH] gdb: make "maintenance info line-table" show relocated addresses again
  2023-03-20 21:35 ` Andrew Burgess
@ 2023-03-21  1:18   ` Simon Marchi
  2023-03-21  9:23     ` Andrew Burgess
  0 siblings, 1 reply; 16+ messages in thread
From: Simon Marchi @ 2023-03-21  1:18 UTC (permalink / raw)
  To: Andrew Burgess, Simon Marchi via Gdb-patches; +Cc: Simon Marchi



On 3/20/23 17:35, Andrew Burgess via Gdb-patches wrote:
> Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> writes:
> 
>> Commit 1acc9dca423f ("Change linetables to be objfile-independent")
>> changed "maintenance info line-table" to print unrelocated addresses
>> instead of relocated.  This breaks a few tests on systems where that
>> matters.  The ones I see are:
>>
>>     Running /home/smarchi/src/binutils-gdb/gdb/testsuite/gdb.base/consecutive.exp ...
>>     FAIL: gdb.base/consecutive.exp: stopped at bp, 2nd instr (missing hex prefix)
>>     Running /home/smarchi/src/binutils-gdb/gdb/testsuite/gdb.base/async.exp ...
>>     FAIL: gdb.base/async.exp: stepi&
>>     FAIL: gdb.base/async.exp: nexti&
>>     FAIL: gdb.base/async.exp: finish&
>>
>> These tests run "maintenance info line-table" to record the address of
>> some lines, and then use these addresses in expected patterns.
>>
>> For the time being, I suggest simply reverting the command to show
>> relocated addresses.
> 
> This makes sense to me.  When I use 'maint info line-table' it's usually
> because I want to try and match up the line table with the code being
> executed, so having the relocated addresses would be far more useful.
> 
> Reviewed-By: Andrew Burgess <aburgess@redhat.com>

What would you think about showing both, like this?

    (gdb) maintenance info line-table
    objfile: /home/simark/build/binutils-gdb/gdb/a.out ((struct objfile *) 0x614000007240)
    compunit_symtab: test.c ((struct compunit_symtab *) 0x621000123890)
    symtab: /home/simark/build/binutils-gdb/gdb/test.c ((struct symtab *) 0x621000123910)
    linetable: ((struct linetable *) 0x62100015fc20):
    INDEX  LINE   REL-ADDRESS        UNREL-ADDRESS      IS-STMT PROLOGUE-END
    0      6      0x0000555555555119 0x0000000000001119 Y
    1      7      0x000055555555511d 0x000000000000111d Y
    2      8      0x0000555555555123 0x0000000000001123 Y
    3      END    0x0000555555555125 0x0000000000001125 Y

I think it could be useful to match the unrelocated address with what
you see in the DWARF info.  If the objfile is not position-independent,
or not relocated yet, the two columns show the same values.

Simon

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

* Re: [PATCH] gdb: make "maintenance info line-table" show relocated addresses again
  2023-03-21  1:18   ` Simon Marchi
@ 2023-03-21  9:23     ` Andrew Burgess
  2023-03-22  1:35       ` Simon Marchi
  0 siblings, 1 reply; 16+ messages in thread
From: Andrew Burgess @ 2023-03-21  9:23 UTC (permalink / raw)
  To: Simon Marchi, Simon Marchi via Gdb-patches; +Cc: Simon Marchi

Simon Marchi <simark@simark.ca> writes:

> On 3/20/23 17:35, Andrew Burgess via Gdb-patches wrote:
>> Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> writes:
>> 
>>> Commit 1acc9dca423f ("Change linetables to be objfile-independent")
>>> changed "maintenance info line-table" to print unrelocated addresses
>>> instead of relocated.  This breaks a few tests on systems where that
>>> matters.  The ones I see are:
>>>
>>>     Running /home/smarchi/src/binutils-gdb/gdb/testsuite/gdb.base/consecutive.exp ...
>>>     FAIL: gdb.base/consecutive.exp: stopped at bp, 2nd instr (missing hex prefix)
>>>     Running /home/smarchi/src/binutils-gdb/gdb/testsuite/gdb.base/async.exp ...
>>>     FAIL: gdb.base/async.exp: stepi&
>>>     FAIL: gdb.base/async.exp: nexti&
>>>     FAIL: gdb.base/async.exp: finish&
>>>
>>> These tests run "maintenance info line-table" to record the address of
>>> some lines, and then use these addresses in expected patterns.
>>>
>>> For the time being, I suggest simply reverting the command to show
>>> relocated addresses.
>> 
>> This makes sense to me.  When I use 'maint info line-table' it's usually
>> because I want to try and match up the line table with the code being
>> executed, so having the relocated addresses would be far more useful.
>> 
>> Reviewed-By: Andrew Burgess <aburgess@redhat.com>
>
> What would you think about showing both, like this?
>
>     (gdb) maintenance info line-table
>     objfile: /home/simark/build/binutils-gdb/gdb/a.out ((struct objfile *) 0x614000007240)
>     compunit_symtab: test.c ((struct compunit_symtab *) 0x621000123890)
>     symtab: /home/simark/build/binutils-gdb/gdb/test.c ((struct symtab *) 0x621000123910)
>     linetable: ((struct linetable *) 0x62100015fc20):
>     INDEX  LINE   REL-ADDRESS        UNREL-ADDRESS      IS-STMT PROLOGUE-END
>     0      6      0x0000555555555119 0x0000000000001119 Y
>     1      7      0x000055555555511d 0x000000000000111d Y
>     2      8      0x0000555555555123 0x0000000000001123 Y
>     3      END    0x0000555555555125 0x0000000000001125 Y
>
> I think it could be useful to match the unrelocated address with what
> you see in the DWARF info.  If the objfile is not position-independent,
> or not relocated yet, the two columns show the same values.

I'm never going to complain about more information.  Especially not in
maintainer commands.

Just wanted to make sure my use case was noted.

Thanks,
Andrew


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

* Re: [PATCH] gdb: make "maintenance info line-table" show relocated addresses again
  2023-03-21  9:23     ` Andrew Burgess
@ 2023-03-22  1:35       ` Simon Marchi
  2023-03-22 10:26         ` [PATCH 0/1] gdb: Update doc of the "maintenance info line-table" Lancelot SIX
  2023-03-22 13:46         ` [PATCH] gdb: make "maintenance info line-table" show relocated addresses again Tom de Vries
  0 siblings, 2 replies; 16+ messages in thread
From: Simon Marchi @ 2023-03-22  1:35 UTC (permalink / raw)
  To: Andrew Burgess, Simon Marchi via Gdb-patches; +Cc: Simon Marchi


> I'm never going to complain about more information.  Especially not in
> maintainer commands.
> 
> Just wanted to make sure my use case was noted.

Thanks, here's what I pushed.

Simon


From 904d9b02a185c9048cf17bf7295b89d7380cea3d Mon Sep 17 00:00:00 2001
From: Simon Marchi <simon.marchi@efficios.com>
Date: Thu, 16 Mar 2023 16:30:34 -0400
Subject: [PATCH] gdb: make "maintenance info line-table" show relocated
 addresses again

Commit 1acc9dca423f ("Change linetables to be objfile-independent")
changed "maintenance info line-table" to print unrelocated addresses
instead of relocated.  This breaks a few tests on systems where that
matters.  The ones I see are:

    Running /home/smarchi/src/binutils-gdb/gdb/testsuite/gdb.base/consecutive.exp ...
    FAIL: gdb.base/consecutive.exp: stopped at bp, 2nd instr (missing hex prefix)
    Running /home/smarchi/src/binutils-gdb/gdb/testsuite/gdb.base/async.exp ...
    FAIL: gdb.base/async.exp: stepi&
    FAIL: gdb.base/async.exp: nexti&
    FAIL: gdb.base/async.exp: finish&

These tests run "maintenance info line-table" to record the address of
some lines, and then use these addresses in expected patterns.  It
therefore expects these addresses to match the runtime addresses,
therefore the relocated addresses.

Add back the relocated addresses, next to the unrelocated addresses,
like so:

    INDEX  LINE   REL-ADDRESS        UNREL-ADDRESS      IS-STMT PROLOGUE-END
    0      6      0x0000555555555119 0x0000000000001119 Y
    1      7      0x000055555555511d 0x000000000000111d Y
    2      8      0x0000555555555123 0x0000000000001123 Y
    3      END    0x0000555555555125 0x0000000000001125 Y

The unrelocated addresses can always be useful trying to map this
information with a DWARF info dump.

Adjust the is_stmt_addresses proc in the testsuite to match the new
output.

Change-Id: I59558f167e13e63421c9e0f2cad192e7c95c10cf
---
 gdb/symmisc.c             | 9 ++++++---
 gdb/testsuite/lib/gdb.exp | 2 +-
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/gdb/symmisc.c b/gdb/symmisc.c
index 54dc570d282f..a09b541f1b39 100644
--- a/gdb/symmisc.c
+++ b/gdb/symmisc.c
@@ -976,10 +976,11 @@ maintenance_print_one_line_table (struct symtab *symtab, void *data)
       /* Leave space for 6 digits of index and line number.  After that the
 	 tables will just not format as well.  */
       struct ui_out *uiout = current_uiout;
-      ui_out_emit_table table_emitter (uiout, 5, -1, "line-table");
+      ui_out_emit_table table_emitter (uiout, 6, -1, "line-table");
       uiout->table_header (6, ui_left, "index", _("INDEX"));
       uiout->table_header (6, ui_left, "line", _("LINE"));
-      uiout->table_header (18, ui_left, "address", _("ADDRESS"));
+      uiout->table_header (18, ui_left, "rel-address", _("REL-ADDRESS"));
+      uiout->table_header (18, ui_left, "unrel-address", _("UNREL-ADDRESS"));
       uiout->table_header (7, ui_left, "is-stmt", _("IS-STMT"));
       uiout->table_header (12, ui_left, "prologue-end", _("PROLOGUE-END"));
       uiout->table_body ();
@@ -995,7 +996,9 @@ maintenance_print_one_line_table (struct symtab *symtab, void *data)
 	    uiout->field_signed ("line", item->line);
 	  else
 	    uiout->field_string ("line", _("END"));
-	  uiout->field_core_addr ("address", objfile->arch (),
+	  uiout->field_core_addr ("rel-address", objfile->arch (),
+				  item->pc (objfile));
+	  uiout->field_core_addr ("unrel-address", objfile->arch (),
 				  CORE_ADDR (item->raw_pc ()));
 	  uiout->field_string ("is-stmt", item->is_stmt ? "Y" : "");
 	  uiout->field_string ("prologue-end", item->prologue_end ? "Y" : "");
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 0a0ae697d1ee..6c2d7e1c74e5 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -8872,7 +8872,7 @@ proc is_stmt_addresses { file } {
     set is_stmt [list]
 
     gdb_test_multiple "maint info line-table $file" "" {
-	-re "\r\n$decimal\[ \t\]+$decimal\[ \t\]+($hex)\[ \t\]+Y\[^\r\n\]*" {
+	-re "\r\n$decimal\[ \t\]+$decimal\[ \t\]+($hex)\[ \t\]+$hex\[ \t\]+Y\[^\r\n\]*" {
 	    lappend is_stmt $expect_out(1,string)
 	    exp_continue
 	}

base-commit: bcefc6be9754d45fb9391993e6daaf01a68d9bd5
-- 
2.40.0


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

* [PATCH 0/1] gdb: Update doc of the "maintenance info line-table"
  2023-03-22  1:35       ` Simon Marchi
@ 2023-03-22 10:26         ` Lancelot SIX
  2023-03-22 10:26           ` [PATCH 1/1] " Lancelot SIX
  2023-03-22 13:46         ` [PATCH] gdb: make "maintenance info line-table" show relocated addresses again Tom de Vries
  1 sibling, 1 reply; 16+ messages in thread
From: Lancelot SIX @ 2023-03-22 10:26 UTC (permalink / raw)
  To: gdb-patches, simon.marchi; +Cc: lsix, Lancelot SIX

Hi,

It looks like the patch you have pushed is missing the documentation
update for the command.  Her is a patch for it.

Best,
Lancelot.

Lancelot SIX (1):
  gdb: Update doc of the "maintenance info line-table"

 gdb/doc/gdb.texinfo | 32 +++++++++++++++++++-------------
 1 file changed, 19 insertions(+), 13 deletions(-)


base-commit: bf3f6c02d73f9823b8cb4f59524f29fbbfb6126d
-- 
2.34.1


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

* [PATCH 1/1] gdb: Update doc of the "maintenance info line-table"
  2023-03-22 10:26         ` [PATCH 0/1] gdb: Update doc of the "maintenance info line-table" Lancelot SIX
@ 2023-03-22 10:26           ` Lancelot SIX
  2023-03-22 13:59             ` Simon Marchi
  2023-03-22 14:58             ` [PATCH 1/1] " Eli Zaretskii
  0 siblings, 2 replies; 16+ messages in thread
From: Lancelot SIX @ 2023-03-22 10:26 UTC (permalink / raw)
  To: gdb-patches, simon.marchi; +Cc: lsix, Lancelot SIX

Commit 904d9b02a18 (gdb: make "maintenance info line-table" show
relocated addresses again) have updated the "maintenance info
line-table" command, but did not update the associated documentation.

This patch updates the documentation to reflect the new command output.
---
 gdb/doc/gdb.texinfo | 32 +++++++++++++++++++-------------
 1 file changed, 19 insertions(+), 13 deletions(-)

diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 6c811b8be2e..dbb6267f3fd 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -20345,21 +20345,27 @@ objfile: /home/gnu/build/a.out ((struct objfile *) 0x6120000e0d40)
 compunit_symtab: simple.cpp ((struct compunit_symtab *) 0x6210000ff450)
 symtab: /home/gnu/src/simple.cpp ((struct symtab *) 0x6210000ff4d0)
 linetable: ((struct linetable *) 0x62100012b760):
-INDEX  LINE   ADDRESS            IS-STMT PROLOGUE-END
-0      3      0x0000000000401110 Y
-1      4      0x0000000000401114 Y       Y
-2      9      0x0000000000401120 Y
-3      10     0x0000000000401124 Y       Y
-4      10     0x0000000000401129
-5      15     0x0000000000401130 Y
-6      16     0x0000000000401134 Y       Y
-7      16     0x0000000000401139
-8      21     0x0000000000401140 Y
-9      22     0x000000000040114f Y       Y
-10     22     0x0000000000401154
-11     END    0x000000000040115a Y
+INDEX  LINE   REL-ADDRESS        UNREL-ADDRESS      IS-STMT PROLOGUE-END
+0      3      0x0000555555955110 0x0000000000401110 Y
+1      4      0x0000555555955114 0x0000000000401114 Y       Y
+2      9      0x0000555555955120 0x0000000000401120 Y
+3      10     0x0000555555955124 0x0000000000401124 Y       Y
+4      10     0x0000555555955129 0x0000000000401129
+5      15     0x0000555555955130 0x0000000000401130 Y
+6      16     0x0000555555955134 0x0000000000401134 Y       Y
+7      16     0x0000555555955139 0x0000000000401139
+8      21     0x0000555555955140 0x0000000000401140 Y
+9      22     0x000055555595514f 0x000000000040114f Y       Y
+10     22     0x0000555555955154 0x0000000000401154
+11     END    0x000055555595515a 0x000000000040115a Y
 @end smallexample
 @noindent
+The @samp{UNREL-ADDRESS} column gives the unrelocated address of the
+instruction as read from the debug information.  The @samp{REL-ADDRESS} column
+gives the corresponding address in the process memory (relocated address).  If
+no process is started when executing this command, the relocated address is the
+same as the unrelocated address.
+
 The @samp{IS-STMT} column indicates if the address is a recommended breakpoint
 location to represent a line or a statement.  The @samp{PROLOGUE-END} column
 indicates that a given address is an adequate place to set a breakpoint at the
-- 
2.34.1


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

* Re: [PATCH] gdb: make "maintenance info line-table" show relocated addresses again
  2023-03-22  1:35       ` Simon Marchi
  2023-03-22 10:26         ` [PATCH 0/1] gdb: Update doc of the "maintenance info line-table" Lancelot SIX
@ 2023-03-22 13:46         ` Tom de Vries
  2023-03-22 13:47           ` Simon Marchi
  1 sibling, 1 reply; 16+ messages in thread
From: Tom de Vries @ 2023-03-22 13:46 UTC (permalink / raw)
  To: Simon Marchi, Andrew Burgess, Simon Marchi via Gdb-patches; +Cc: Simon Marchi

On 3/22/23 02:35, Simon Marchi via Gdb-patches wrote:
> 
>> I'm never going to complain about more information.  Especially not in
>> maintainer commands.
>>
>> Just wanted to make sure my use case was noted.
> 
> Thanks, here's what I pushed.
> 

I'm seeing regressions, I'm assuming they're due to this patch:
...
Running 
/data/vries/gdb/src/gdb/testsuite/gdb.dwarf2/dw2-out-of-range-end-of-seq.exp 
...
FAIL: gdb.dwarf2/dw2-out-of-range-end-of-seq.exp: END with address 1 
eliminated
Running /data/vries/gdb/src/gdb/testsuite/gdb.dwarf2/dw2-ranges-base.exp ...
FAIL: gdb.dwarf2/dw2-ranges-base.exp: count END markers in line table
Running /data/vries/gdb/src/gdb/testsuite/gdb.base/maint.exp ...
ERROR: internal buffer is full.
ERROR: internal buffer is full.
...

Thanks,
- Tom

> Simon
> 
> 
>  From 904d9b02a185c9048cf17bf7295b89d7380cea3d Mon Sep 17 00:00:00 2001
> From: Simon Marchi <simon.marchi@efficios.com>
> Date: Thu, 16 Mar 2023 16:30:34 -0400
> Subject: [PATCH] gdb: make "maintenance info line-table" show relocated
>   addresses again
> 
> Commit 1acc9dca423f ("Change linetables to be objfile-independent")
> changed "maintenance info line-table" to print unrelocated addresses
> instead of relocated.  This breaks a few tests on systems where that
> matters.  The ones I see are:
> 
>      Running /home/smarchi/src/binutils-gdb/gdb/testsuite/gdb.base/consecutive.exp ...
>      FAIL: gdb.base/consecutive.exp: stopped at bp, 2nd instr (missing hex prefix)
>      Running /home/smarchi/src/binutils-gdb/gdb/testsuite/gdb.base/async.exp ...
>      FAIL: gdb.base/async.exp: stepi&
>      FAIL: gdb.base/async.exp: nexti&
>      FAIL: gdb.base/async.exp: finish&
> 
> These tests run "maintenance info line-table" to record the address of
> some lines, and then use these addresses in expected patterns.  It
> therefore expects these addresses to match the runtime addresses,
> therefore the relocated addresses.
> 
> Add back the relocated addresses, next to the unrelocated addresses,
> like so:
> 
>      INDEX  LINE   REL-ADDRESS        UNREL-ADDRESS      IS-STMT PROLOGUE-END
>      0      6      0x0000555555555119 0x0000000000001119 Y
>      1      7      0x000055555555511d 0x000000000000111d Y
>      2      8      0x0000555555555123 0x0000000000001123 Y
>      3      END    0x0000555555555125 0x0000000000001125 Y
> 
> The unrelocated addresses can always be useful trying to map this
> information with a DWARF info dump.
> 
> Adjust the is_stmt_addresses proc in the testsuite to match the new
> output.
> 
> Change-Id: I59558f167e13e63421c9e0f2cad192e7c95c10cf
> ---
>   gdb/symmisc.c             | 9 ++++++---
>   gdb/testsuite/lib/gdb.exp | 2 +-
>   2 files changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/gdb/symmisc.c b/gdb/symmisc.c
> index 54dc570d282f..a09b541f1b39 100644
> --- a/gdb/symmisc.c
> +++ b/gdb/symmisc.c
> @@ -976,10 +976,11 @@ maintenance_print_one_line_table (struct symtab *symtab, void *data)
>         /* Leave space for 6 digits of index and line number.  After that the
>   	 tables will just not format as well.  */
>         struct ui_out *uiout = current_uiout;
> -      ui_out_emit_table table_emitter (uiout, 5, -1, "line-table");
> +      ui_out_emit_table table_emitter (uiout, 6, -1, "line-table");
>         uiout->table_header (6, ui_left, "index", _("INDEX"));
>         uiout->table_header (6, ui_left, "line", _("LINE"));
> -      uiout->table_header (18, ui_left, "address", _("ADDRESS"));
> +      uiout->table_header (18, ui_left, "rel-address", _("REL-ADDRESS"));
> +      uiout->table_header (18, ui_left, "unrel-address", _("UNREL-ADDRESS"));
>         uiout->table_header (7, ui_left, "is-stmt", _("IS-STMT"));
>         uiout->table_header (12, ui_left, "prologue-end", _("PROLOGUE-END"));
>         uiout->table_body ();
> @@ -995,7 +996,9 @@ maintenance_print_one_line_table (struct symtab *symtab, void *data)
>   	    uiout->field_signed ("line", item->line);
>   	  else
>   	    uiout->field_string ("line", _("END"));
> -	  uiout->field_core_addr ("address", objfile->arch (),
> +	  uiout->field_core_addr ("rel-address", objfile->arch (),
> +				  item->pc (objfile));
> +	  uiout->field_core_addr ("unrel-address", objfile->arch (),
>   				  CORE_ADDR (item->raw_pc ()));
>   	  uiout->field_string ("is-stmt", item->is_stmt ? "Y" : "");
>   	  uiout->field_string ("prologue-end", item->prologue_end ? "Y" : "");
> diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
> index 0a0ae697d1ee..6c2d7e1c74e5 100644
> --- a/gdb/testsuite/lib/gdb.exp
> +++ b/gdb/testsuite/lib/gdb.exp
> @@ -8872,7 +8872,7 @@ proc is_stmt_addresses { file } {
>       set is_stmt [list]
>   
>       gdb_test_multiple "maint info line-table $file" "" {
> -	-re "\r\n$decimal\[ \t\]+$decimal\[ \t\]+($hex)\[ \t\]+Y\[^\r\n\]*" {
> +	-re "\r\n$decimal\[ \t\]+$decimal\[ \t\]+($hex)\[ \t\]+$hex\[ \t\]+Y\[^\r\n\]*" {
>   	    lappend is_stmt $expect_out(1,string)
>   	    exp_continue
>   	}
> 
> base-commit: bcefc6be9754d45fb9391993e6daaf01a68d9bd5


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

* Re: [PATCH] gdb: make "maintenance info line-table" show relocated addresses again
  2023-03-22 13:46         ` [PATCH] gdb: make "maintenance info line-table" show relocated addresses again Tom de Vries
@ 2023-03-22 13:47           ` Simon Marchi
  2023-03-22 15:17             ` [PATCH] gdb/testsuite: adjust test cases to previous "maintenance info line-table" change Simon Marchi
  0 siblings, 1 reply; 16+ messages in thread
From: Simon Marchi @ 2023-03-22 13:47 UTC (permalink / raw)
  To: Tom de Vries, Andrew Burgess, Simon Marchi via Gdb-patches; +Cc: Simon Marchi



On 3/22/23 09:46, Tom de Vries wrote:
> On 3/22/23 02:35, Simon Marchi via Gdb-patches wrote:
>>
>>> I'm never going to complain about more information.  Especially not in
>>> maintainer commands.
>>>
>>> Just wanted to make sure my use case was noted.
>>
>> Thanks, here's what I pushed.
>>
> 
> I'm seeing regressions, I'm assuming they're due to this patch:
> ...
> Running /data/vries/gdb/src/gdb/testsuite/gdb.dwarf2/dw2-out-of-range-end-of-seq.exp ...
> FAIL: gdb.dwarf2/dw2-out-of-range-end-of-seq.exp: END with address 1 eliminated
> Running /data/vries/gdb/src/gdb/testsuite/gdb.dwarf2/dw2-ranges-base.exp ...
> FAIL: gdb.dwarf2/dw2-ranges-base.exp: count END markers in line table
> Running /data/vries/gdb/src/gdb/testsuite/gdb.base/maint.exp ...
> ERROR: internal buffer is full.
> ERROR: internal buffer is full.

Yeah, I just found that too, looking into it.

Simon

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

* Re: [PATCH 1/1] gdb: Update doc of the "maintenance info line-table"
  2023-03-22 10:26           ` [PATCH 1/1] " Lancelot SIX
@ 2023-03-22 13:59             ` Simon Marchi
  2023-03-22 16:48               ` Lancelot SIX
  2023-03-22 17:20               ` [PATCH v2] " Lancelot SIX
  2023-03-22 14:58             ` [PATCH 1/1] " Eli Zaretskii
  1 sibling, 2 replies; 16+ messages in thread
From: Simon Marchi @ 2023-03-22 13:59 UTC (permalink / raw)
  To: Lancelot SIX, gdb-patches, simon.marchi; +Cc: lsix



On 3/22/23 06:26, Lancelot SIX via Gdb-patches wrote:
> Commit 904d9b02a18 (gdb: make "maintenance info line-table" show
> relocated addresses again) have updated the "maintenance info
> line-table" command, but did not update the associated documentation.
> 
> This patch updates the documentation to reflect the new command output.

Thanks, I didn't think that a maintenance command would have so much
details in the doc.

> ---
>  gdb/doc/gdb.texinfo | 32 +++++++++++++++++++-------------
>  1 file changed, 19 insertions(+), 13 deletions(-)
> 
> diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
> index 6c811b8be2e..dbb6267f3fd 100644
> --- a/gdb/doc/gdb.texinfo
> +++ b/gdb/doc/gdb.texinfo
> @@ -20345,21 +20345,27 @@ objfile: /home/gnu/build/a.out ((struct objfile *) 0x6120000e0d40)
>  compunit_symtab: simple.cpp ((struct compunit_symtab *) 0x6210000ff450)
>  symtab: /home/gnu/src/simple.cpp ((struct symtab *) 0x6210000ff4d0)
>  linetable: ((struct linetable *) 0x62100012b760):
> -INDEX  LINE   ADDRESS            IS-STMT PROLOGUE-END
> -0      3      0x0000000000401110 Y
> -1      4      0x0000000000401114 Y       Y
> -2      9      0x0000000000401120 Y
> -3      10     0x0000000000401124 Y       Y
> -4      10     0x0000000000401129
> -5      15     0x0000000000401130 Y
> -6      16     0x0000000000401134 Y       Y
> -7      16     0x0000000000401139
> -8      21     0x0000000000401140 Y
> -9      22     0x000000000040114f Y       Y
> -10     22     0x0000000000401154
> -11     END    0x000000000040115a Y
> +INDEX  LINE   REL-ADDRESS        UNREL-ADDRESS      IS-STMT PROLOGUE-END
> +0      3      0x0000555555955110 0x0000000000401110 Y
> +1      4      0x0000555555955114 0x0000000000401114 Y       Y
> +2      9      0x0000555555955120 0x0000000000401120 Y
> +3      10     0x0000555555955124 0x0000000000401124 Y       Y
> +4      10     0x0000555555955129 0x0000000000401129
> +5      15     0x0000555555955130 0x0000000000401130 Y
> +6      16     0x0000555555955134 0x0000000000401134 Y       Y
> +7      16     0x0000555555955139 0x0000000000401139
> +8      21     0x0000555555955140 0x0000000000401140 Y
> +9      22     0x000055555595514f 0x000000000040114f Y       Y
> +10     22     0x0000555555955154 0x0000000000401154
> +11     END    0x000055555595515a 0x000000000040115a Y
>  @end smallexample
>  @noindent
> +The @samp{UNREL-ADDRESS} column gives the unrelocated address of the
> +instruction as read from the debug information.  The @samp{REL-ADDRESS} column
> +gives the corresponding address in the process memory (relocated address).  If

process -> inferior, to be generic?

You could also say "in the current inferior's memory" to be more
precise, as the relocated address is given based on the current
inferior.

> +no process is started when executing this command, the relocated address is the

And therefore here, "If the current inferior is not running when
executing the command...".

> +same as the unrelocated address.

The two addresses can also be the same if the executable doesn't require
relocation.  But your formulation doesn't imply that you are describing
all cases where addresses are equal, so perhaps we can leave that detail
out.

Simon

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

* Re: [PATCH 1/1] gdb: Update doc of the "maintenance info line-table"
  2023-03-22 10:26           ` [PATCH 1/1] " Lancelot SIX
  2023-03-22 13:59             ` Simon Marchi
@ 2023-03-22 14:58             ` Eli Zaretskii
  1 sibling, 0 replies; 16+ messages in thread
From: Eli Zaretskii @ 2023-03-22 14:58 UTC (permalink / raw)
  To: Lancelot SIX; +Cc: gdb-patches, simon.marchi, lsix

> Cc: lsix@lancelotsix.com,
> 	Lancelot SIX <lancelot.six@amd.com>
> Date: Wed, 22 Mar 2023 10:26:42 +0000
> From: Lancelot SIX via Gdb-patches <gdb-patches@sourceware.org>
> 
> Commit 904d9b02a18 (gdb: make "maintenance info line-table" show
> relocated addresses again) have updated the "maintenance info
> line-table" command, but did not update the associated documentation.
> 
> This patch updates the documentation to reflect the new command output.
> ---
>  gdb/doc/gdb.texinfo | 32 +++++++++++++++++++-------------
>  1 file changed, 19 insertions(+), 13 deletions(-)

This is OK, thanks.

Approved-By: Eli Zaretskii <eliz@gnu.org>

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

* [PATCH] gdb/testsuite: adjust test cases to previous "maintenance info line-table" change
  2023-03-22 13:47           ` Simon Marchi
@ 2023-03-22 15:17             ` Simon Marchi
  2023-03-22 18:01               ` Tom de Vries
  0 siblings, 1 reply; 16+ messages in thread
From: Simon Marchi @ 2023-03-22 15:17 UTC (permalink / raw)
  To: gdb-patches; +Cc: Simon Marchi

Commit 904d9b02a185 ("gdb: make "maintenance info line-table" show
relocated addresses again") changed the format of that command, but
failed to adjust some test cases that relied on it.  This patch fixes
it.

The failures fixed are:

    FAIL: gdb.base/maint.exp: maint info line-table w/o a file name
    FAIL: gdb.dwarf2/dw2-out-of-range-end-of-seq.exp: END with address 1 eliminated
    FAIL: gdb.dwarf2/dw2-ranges-base.exp: count END markers in line table

Change-Id: I946580d5e100f1beeac99a9e90d7819c6bb4ac6c
---
 gdb/testsuite/gdb.base/maint.exp                         | 8 ++++----
 gdb/testsuite/gdb.dwarf2/dw2-out-of-range-end-of-seq.exp | 4 ++--
 gdb/testsuite/gdb.dwarf2/dw2-ranges-base.exp             | 6 +++---
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/gdb/testsuite/gdb.base/maint.exp b/gdb/testsuite/gdb.base/maint.exp
index 98e23b40ef65..c05d0987e7fa 100644
--- a/gdb/testsuite/gdb.base/maint.exp
+++ b/gdb/testsuite/gdb.base/maint.exp
@@ -386,11 +386,11 @@ gdb_test "maint" \
 set saw_srcfile 0
 gdb_test_multiple "maint info line-table" \
     "maint info line-table w/o a file name" {
-	-re "symtab: \[^\n\r\]+${srcfile} \\(\\(struct symtab \\*\\) $hex\\)\r\nlinetable: \\(\\(struct linetable \\*\\) $hex\\):\r\nINDEX\[ \t\]+LINE\[ \t\]+ADDRESS\[^\r\n\]*" {
+    -re "symtab: \[^\n\r\]+${srcfile} \\(\\(struct symtab \\*\\) $hex\\)\r\nlinetable: \\(\\(struct linetable \\*\\) $hex\\):\r\nINDEX\[ \t\]+LINE\[ \t\]+REL-ADDRESS\[ \t\]+UNREL-ADDRESS\[^\r\n\]*" {
 	set saw_srcfile 1
 	exp_continue
     }
-    -re "symtab: \[^\n\r\]+ \\(\\(struct symtab \\*\\) $hex\\)\r\nlinetable: \\(\\(struct linetable \\*\\) $hex\\):\r\nINDEX\[ \t\]+LINE\[ \t\]+ADDRESS\[^\r\n\]*" {
+    -re "symtab: \[^\n\r\]+ \\(\\(struct symtab \\*\\) $hex\\)\r\nlinetable: \\(\\(struct linetable \\*\\) $hex\\):\r\nINDEX\[ \t\]+LINE\[ \t\]+REL-ADDRESS\[ \t\]+UNREL-ADDRESS\[^\r\n\]*" {
 	# Match each symtab to avoid overflowing expect's buffer.
 	exp_continue
     }
@@ -398,7 +398,7 @@ gdb_test_multiple "maint info line-table" \
 	# For symtabs with no linetable.
 	exp_continue
     }
-    -re "^$decimal\[ \t\]+$decimal\[ \t\]+$hex\[^\r\n\]*\r\n" {
+    -re "^$decimal\[ \t\]+$decimal\[ \t\]+$hex\[ \t\]+$hex\[^\r\n\]*\r\n" {
 	# Line table entries can be long too:
 	#
 	#  INDEX    LINE ADDRESS
@@ -416,7 +416,7 @@ gdb_test_multiple "maint info line-table" \
 	# Match each line to avoid overflowing expect's buffer.
 	exp_continue
     }
-    -re "^$decimal\[ \t\]+END\[ \t\]+$hex\[^\r\n\]*\r\n" {
+    -re "^$decimal\[ \t\]+END\[ \t\]+$hex\[ \t\]+$hex\[^\r\n\]*\r\n" {
 	# Matches an end marker in the above.
 	exp_continue
     }
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-out-of-range-end-of-seq.exp b/gdb/testsuite/gdb.dwarf2/dw2-out-of-range-end-of-seq.exp
index c0a33b95b653..bd3ea5b5d548 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-out-of-range-end-of-seq.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-out-of-range-end-of-seq.exp
@@ -85,10 +85,10 @@ if ![runto_main] {
 
 set test "END with address 1 eliminated"
 gdb_test_multiple "maint info line-table $srcfile$" $test {
-    -re -wrap "END *0x0*1 *Y *\r\n.*" {
+    -re -wrap "END *0x0*1 *$hex *Y *\r\n.*" {
 	fail $gdb_test_name
     }
-    -re -wrap "END *$hex *Y *" {
+    -re -wrap "END *$hex *$hex *Y *" {
 	pass $gdb_test_name
     }
 }
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ranges-base.exp b/gdb/testsuite/gdb.dwarf2/dw2-ranges-base.exp
index 147e943361e0..ee274ee128c4 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-ranges-base.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-ranges-base.exp
@@ -145,7 +145,7 @@ set prev -1
 set seq_count 0
 gdb_test_multiple "maint info line-table gdb.dwarf2/dw2-ranges-base.c" \
     "count END markers in line table" {
-	-re "^$decimal\[ \t\]+$decimal\[ \t\]+$hex\(\[ \t\]+Y\)? *\r\n" {
+	-re "^$decimal\[ \t\]+$decimal\[ \t\]+$hex\[ \t\]+$hex\(\[ \t\]+Y\)? *\r\n" {
 	    if { $prev != -1 } {
 		gdb_assert "$prev == 1" \
 		    "prev of normal entry at $seq_count is end marker"
@@ -154,7 +154,7 @@ gdb_test_multiple "maint info line-table gdb.dwarf2/dw2-ranges-base.c" \
 	    incr seq_count
 	    exp_continue
 	}
-	-re "^$decimal\[ \t\]+END\[ \t\]+$hex\(\[ \t\]+Y\)? *\r\n" {
+	-re "^$decimal\[ \t\]+END\[ \t\]+$hex\[ \t\]+$hex\(\[ \t\]+Y\)? *\r\n" {
 	    if { $prev != -1 } {
 		gdb_assert "$prev == 0" \
 		    "prev of end marker at $seq_count is normal entry"
@@ -174,7 +174,7 @@ gdb_test_multiple "maint info line-table gdb.dwarf2/dw2-ranges-base.c" \
 	-re ".*linetable: \\(\\(struct linetable \\*\\) 0x0\\):\r\nNo line table.\r\n" {
 	    exp_continue
 	}
-	-re ".*linetable: \\(\\(struct linetable \\*\\) $hex\\):\r\nINDEX\[ \t\]+LINE\[ \t\]+ADDRESS\[ \t\]+IS-STMT\[ \t\]PROLOGUE-END *\r\n" {
+	-re ".*linetable: \\(\\(struct linetable \\*\\) $hex\\):\r\nINDEX\[ \t\]+LINE\[ \t\]+REL-ADDRESS\[ \t\]+UNREL-ADDRESS\[ \t\]+IS-STMT\[ \t\]PROLOGUE-END *\r\n" {
 	    exp_continue
 	}
     }

base-commit: bf3f6c02d73f9823b8cb4f59524f29fbbfb6126d
-- 
2.40.0


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

* Re: [PATCH 1/1] gdb: Update doc of the "maintenance info line-table"
  2023-03-22 13:59             ` Simon Marchi
@ 2023-03-22 16:48               ` Lancelot SIX
  2023-03-22 17:20               ` [PATCH v2] " Lancelot SIX
  1 sibling, 0 replies; 16+ messages in thread
From: Lancelot SIX @ 2023-03-22 16:48 UTC (permalink / raw)
  To: Simon Marchi, gdb-patches, simon.marchi; +Cc: lsix

Hi,

>>
>> This patch updates the documentation to reflect the new command output.
> 
> Thanks, I didn't think that a maintenance command would have so much
> details in the doc.

The textual description might be unnecessary for a maint command but 
does not hurt either.  At least, the example output should match what 
GDB produces.


>> +The @samp{UNREL-ADDRESS} column gives the unrelocated address of the
>> +instruction as read from the debug information.  The @samp{REL-ADDRESS} column
>> +gives the corresponding address in the process memory (relocated address).  If
> 
> process -> inferior, to be generic?

Done locally.

> 
> You could also say "in the current inferior's memory" to be more
> precise, as the relocated address is given based on the current
> inferior.
> 
>> +no process is started when executing this command, the relocated address is the
> 
> And therefore here, "If the current inferior is not running when
> executing the command...".
> 
>> +same as the unrelocated address.
> 
> The two addresses can also be the same if the executable doesn't require
> relocation.  But your formulation doesn't imply that you are describing
> all cases where addresses are equal, so perhaps we can leave that detail
> out.

I'll add a "or if the executable does not require relocation".  But I 
could also remove the phrase discussing when relocated == unrelocated. 
This part of the manual documents the maint function, not relocations.

> 
> Simon

I'll send a V2 soon.

Lancelot.

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

* [PATCH v2] gdb: Update doc of the "maintenance info line-table"
  2023-03-22 13:59             ` Simon Marchi
  2023-03-22 16:48               ` Lancelot SIX
@ 2023-03-22 17:20               ` Lancelot SIX
  1 sibling, 0 replies; 16+ messages in thread
From: Lancelot SIX @ 2023-03-22 17:20 UTC (permalink / raw)
  To: gdb-patches; +Cc: lsix, Lancelot SIX

Commit 904d9b02a18 (gdb: make "maintenance info line-table" show
relocated addresses again) have updated the "maintenance info
line-table" command, but did not update the associated documentation.

This patch updates the documentation to reflect the new command output.
---
 gdb/doc/gdb.texinfo | 33 ++++++++++++++++++++-------------
 1 file changed, 20 insertions(+), 13 deletions(-)

diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 6c811b8be2e..6b071c0cb1d 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -20345,21 +20345,28 @@ objfile: /home/gnu/build/a.out ((struct objfile *) 0x6120000e0d40)
 compunit_symtab: simple.cpp ((struct compunit_symtab *) 0x6210000ff450)
 symtab: /home/gnu/src/simple.cpp ((struct symtab *) 0x6210000ff4d0)
 linetable: ((struct linetable *) 0x62100012b760):
-INDEX  LINE   ADDRESS            IS-STMT PROLOGUE-END
-0      3      0x0000000000401110 Y
-1      4      0x0000000000401114 Y       Y
-2      9      0x0000000000401120 Y
-3      10     0x0000000000401124 Y       Y
-4      10     0x0000000000401129
-5      15     0x0000000000401130 Y
-6      16     0x0000000000401134 Y       Y
-7      16     0x0000000000401139
-8      21     0x0000000000401140 Y
-9      22     0x000000000040114f Y       Y
-10     22     0x0000000000401154
-11     END    0x000000000040115a Y
+INDEX  LINE   REL-ADDRESS        UNREL-ADDRESS      IS-STMT PROLOGUE-END
+0      3      0x0000555555955110 0x0000000000401110 Y
+1      4      0x0000555555955114 0x0000000000401114 Y       Y
+2      9      0x0000555555955120 0x0000000000401120 Y
+3      10     0x0000555555955124 0x0000000000401124 Y       Y
+4      10     0x0000555555955129 0x0000000000401129
+5      15     0x0000555555955130 0x0000000000401130 Y
+6      16     0x0000555555955134 0x0000000000401134 Y       Y
+7      16     0x0000555555955139 0x0000000000401139
+8      21     0x0000555555955140 0x0000000000401140 Y
+9      22     0x000055555595514f 0x000000000040114f Y       Y
+10     22     0x0000555555955154 0x0000000000401154
+11     END    0x000055555595515a 0x000000000040115a Y
 @end smallexample
 @noindent
+The @samp{UNREL-ADDRESS} column gives the unrelocated address of the
+instruction as read from the debug information.  The @samp{REL-ADDRESS} column
+gives the corresponding address in the current inferior's memory (relocated
+address).  If the current inferior is not running when executing the command or
+if the executable does not require relocation, the relocated address is the
+same as the unrelocated address.
+
 The @samp{IS-STMT} column indicates if the address is a recommended breakpoint
 location to represent a line or a statement.  The @samp{PROLOGUE-END} column
 indicates that a given address is an adequate place to set a breakpoint at the

base-commit: bf3f6c02d73f9823b8cb4f59524f29fbbfb6126d
-- 
2.34.1


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

* Re: [PATCH] gdb/testsuite: adjust test cases to previous "maintenance info line-table" change
  2023-03-22 15:17             ` [PATCH] gdb/testsuite: adjust test cases to previous "maintenance info line-table" change Simon Marchi
@ 2023-03-22 18:01               ` Tom de Vries
  2023-03-22 19:14                 ` Simon Marchi
  0 siblings, 1 reply; 16+ messages in thread
From: Tom de Vries @ 2023-03-22 18:01 UTC (permalink / raw)
  To: Simon Marchi, gdb-patches

On 3/22/23 16:17, Simon Marchi via Gdb-patches wrote:
> Commit 904d9b02a185 ("gdb: make "maintenance info line-table" show
> relocated addresses again") changed the format of that command, but
> failed to adjust some test cases that relied on it.  This patch fixes
> it.
> 
> The failures fixed are:
> 
>      FAIL: gdb.base/maint.exp: maint info line-table w/o a file name
>      FAIL: gdb.dwarf2/dw2-out-of-range-end-of-seq.exp: END with address 1 eliminated
>      FAIL: gdb.dwarf2/dw2-ranges-base.exp: count END markers in line table
> 

Hi,

I did a clean build and test run, and confirmed that these are the only 
three regressions.

Then I applied this patch, and verified that if fixes the regressions.

LGTM.

Thanks,
- Tom

> Change-Id: I946580d5e100f1beeac99a9e90d7819c6bb4ac6c
> ---
>   gdb/testsuite/gdb.base/maint.exp                         | 8 ++++----
>   gdb/testsuite/gdb.dwarf2/dw2-out-of-range-end-of-seq.exp | 4 ++--
>   gdb/testsuite/gdb.dwarf2/dw2-ranges-base.exp             | 6 +++---
>   3 files changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/gdb/testsuite/gdb.base/maint.exp b/gdb/testsuite/gdb.base/maint.exp
> index 98e23b40ef65..c05d0987e7fa 100644
> --- a/gdb/testsuite/gdb.base/maint.exp
> +++ b/gdb/testsuite/gdb.base/maint.exp
> @@ -386,11 +386,11 @@ gdb_test "maint" \
>   set saw_srcfile 0
>   gdb_test_multiple "maint info line-table" \
>       "maint info line-table w/o a file name" {
> -	-re "symtab: \[^\n\r\]+${srcfile} \\(\\(struct symtab \\*\\) $hex\\)\r\nlinetable: \\(\\(struct linetable \\*\\) $hex\\):\r\nINDEX\[ \t\]+LINE\[ \t\]+ADDRESS\[^\r\n\]*" {
> +    -re "symtab: \[^\n\r\]+${srcfile} \\(\\(struct symtab \\*\\) $hex\\)\r\nlinetable: \\(\\(struct linetable \\*\\) $hex\\):\r\nINDEX\[ \t\]+LINE\[ \t\]+REL-ADDRESS\[ \t\]+UNREL-ADDRESS\[^\r\n\]*" {
>   	set saw_srcfile 1
>   	exp_continue
>       }
> -    -re "symtab: \[^\n\r\]+ \\(\\(struct symtab \\*\\) $hex\\)\r\nlinetable: \\(\\(struct linetable \\*\\) $hex\\):\r\nINDEX\[ \t\]+LINE\[ \t\]+ADDRESS\[^\r\n\]*" {
> +    -re "symtab: \[^\n\r\]+ \\(\\(struct symtab \\*\\) $hex\\)\r\nlinetable: \\(\\(struct linetable \\*\\) $hex\\):\r\nINDEX\[ \t\]+LINE\[ \t\]+REL-ADDRESS\[ \t\]+UNREL-ADDRESS\[^\r\n\]*" {
>   	# Match each symtab to avoid overflowing expect's buffer.
>   	exp_continue
>       }
> @@ -398,7 +398,7 @@ gdb_test_multiple "maint info line-table" \
>   	# For symtabs with no linetable.
>   	exp_continue
>       }
> -    -re "^$decimal\[ \t\]+$decimal\[ \t\]+$hex\[^\r\n\]*\r\n" {
> +    -re "^$decimal\[ \t\]+$decimal\[ \t\]+$hex\[ \t\]+$hex\[^\r\n\]*\r\n" {
>   	# Line table entries can be long too:
>   	#
>   	#  INDEX    LINE ADDRESS
> @@ -416,7 +416,7 @@ gdb_test_multiple "maint info line-table" \
>   	# Match each line to avoid overflowing expect's buffer.
>   	exp_continue
>       }
> -    -re "^$decimal\[ \t\]+END\[ \t\]+$hex\[^\r\n\]*\r\n" {
> +    -re "^$decimal\[ \t\]+END\[ \t\]+$hex\[ \t\]+$hex\[^\r\n\]*\r\n" {
>   	# Matches an end marker in the above.
>   	exp_continue
>       }
> diff --git a/gdb/testsuite/gdb.dwarf2/dw2-out-of-range-end-of-seq.exp b/gdb/testsuite/gdb.dwarf2/dw2-out-of-range-end-of-seq.exp
> index c0a33b95b653..bd3ea5b5d548 100644
> --- a/gdb/testsuite/gdb.dwarf2/dw2-out-of-range-end-of-seq.exp
> +++ b/gdb/testsuite/gdb.dwarf2/dw2-out-of-range-end-of-seq.exp
> @@ -85,10 +85,10 @@ if ![runto_main] {
>   
>   set test "END with address 1 eliminated"
>   gdb_test_multiple "maint info line-table $srcfile$" $test {
> -    -re -wrap "END *0x0*1 *Y *\r\n.*" {
> +    -re -wrap "END *0x0*1 *$hex *Y *\r\n.*" {
>   	fail $gdb_test_name
>       }
> -    -re -wrap "END *$hex *Y *" {
> +    -re -wrap "END *$hex *$hex *Y *" {
>   	pass $gdb_test_name
>       }
>   }
> diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ranges-base.exp b/gdb/testsuite/gdb.dwarf2/dw2-ranges-base.exp
> index 147e943361e0..ee274ee128c4 100644
> --- a/gdb/testsuite/gdb.dwarf2/dw2-ranges-base.exp
> +++ b/gdb/testsuite/gdb.dwarf2/dw2-ranges-base.exp
> @@ -145,7 +145,7 @@ set prev -1
>   set seq_count 0
>   gdb_test_multiple "maint info line-table gdb.dwarf2/dw2-ranges-base.c" \
>       "count END markers in line table" {
> -	-re "^$decimal\[ \t\]+$decimal\[ \t\]+$hex\(\[ \t\]+Y\)? *\r\n" {
> +	-re "^$decimal\[ \t\]+$decimal\[ \t\]+$hex\[ \t\]+$hex\(\[ \t\]+Y\)? *\r\n" {
>   	    if { $prev != -1 } {
>   		gdb_assert "$prev == 1" \
>   		    "prev of normal entry at $seq_count is end marker"
> @@ -154,7 +154,7 @@ gdb_test_multiple "maint info line-table gdb.dwarf2/dw2-ranges-base.c" \
>   	    incr seq_count
>   	    exp_continue
>   	}
> -	-re "^$decimal\[ \t\]+END\[ \t\]+$hex\(\[ \t\]+Y\)? *\r\n" {
> +	-re "^$decimal\[ \t\]+END\[ \t\]+$hex\[ \t\]+$hex\(\[ \t\]+Y\)? *\r\n" {
>   	    if { $prev != -1 } {
>   		gdb_assert "$prev == 0" \
>   		    "prev of end marker at $seq_count is normal entry"
> @@ -174,7 +174,7 @@ gdb_test_multiple "maint info line-table gdb.dwarf2/dw2-ranges-base.c" \
>   	-re ".*linetable: \\(\\(struct linetable \\*\\) 0x0\\):\r\nNo line table.\r\n" {
>   	    exp_continue
>   	}
> -	-re ".*linetable: \\(\\(struct linetable \\*\\) $hex\\):\r\nINDEX\[ \t\]+LINE\[ \t\]+ADDRESS\[ \t\]+IS-STMT\[ \t\]PROLOGUE-END *\r\n" {
> +	-re ".*linetable: \\(\\(struct linetable \\*\\) $hex\\):\r\nINDEX\[ \t\]+LINE\[ \t\]+REL-ADDRESS\[ \t\]+UNREL-ADDRESS\[ \t\]+IS-STMT\[ \t\]PROLOGUE-END *\r\n" {
>   	    exp_continue
>   	}
>       }
> 
> base-commit: bf3f6c02d73f9823b8cb4f59524f29fbbfb6126d


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

* Re: [PATCH] gdb/testsuite: adjust test cases to previous "maintenance info line-table" change
  2023-03-22 18:01               ` Tom de Vries
@ 2023-03-22 19:14                 ` Simon Marchi
  0 siblings, 0 replies; 16+ messages in thread
From: Simon Marchi @ 2023-03-22 19:14 UTC (permalink / raw)
  To: Tom de Vries, gdb-patches

> I did a clean build and test run, and confirmed that these are the only three regressions.
> 
> Then I applied this patch, and verified that if fixes the regressions.
> 
> LGTM.
> 
> Thanks,
> - Tom

Thanks, pushed.

Simon


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

end of thread, other threads:[~2023-03-22 19:14 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-20 16:30 [PATCH] gdb: make "maintenance info line-table" show relocated addresses again Simon Marchi
2023-03-20 21:35 ` Andrew Burgess
2023-03-21  1:18   ` Simon Marchi
2023-03-21  9:23     ` Andrew Burgess
2023-03-22  1:35       ` Simon Marchi
2023-03-22 10:26         ` [PATCH 0/1] gdb: Update doc of the "maintenance info line-table" Lancelot SIX
2023-03-22 10:26           ` [PATCH 1/1] " Lancelot SIX
2023-03-22 13:59             ` Simon Marchi
2023-03-22 16:48               ` Lancelot SIX
2023-03-22 17:20               ` [PATCH v2] " Lancelot SIX
2023-03-22 14:58             ` [PATCH 1/1] " Eli Zaretskii
2023-03-22 13:46         ` [PATCH] gdb: make "maintenance info line-table" show relocated addresses again Tom de Vries
2023-03-22 13:47           ` Simon Marchi
2023-03-22 15:17             ` [PATCH] gdb/testsuite: adjust test cases to previous "maintenance info line-table" change Simon Marchi
2023-03-22 18:01               ` Tom de Vries
2023-03-22 19:14                 ` Simon Marchi

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