public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH][gdb/testsuite] Fix gdb.dwarf2/dw2-dir-file-name.exp for aarch64
@ 2022-09-13 14:48 Tom de Vries
  2022-09-13 16:00 ` Luis Machado
  0 siblings, 1 reply; 3+ messages in thread
From: Tom de Vries @ 2022-09-13 14:48 UTC (permalink / raw)
  To: gdb-patches

Hi,

[ Another attempt at fixing the problem described in commit cd919f5533c
("[gdb/testsuite] Fix gdb.dwarf2/dw2-dir-file-name.exp"). ]

When running the test-case gdb.dwarf2/dw2-dir-file-name.exp with
aarch64-linux, we run into:
...
(gdb) continue^M
Continuing.^M
^M
Breakpoint 2, compdir_missing__ldir_missing__file_basename () at \
  tmp-dw2-dir-file-name.c:999^M
(gdb) FAIL: gdb.dwarf2/dw2-dir-file-name.exp: \
  compdir_missing__ldir_missing__file_basename: continue to breakpoint: \
  compdir_missing__ldir_missing__file_basename
...

The breakpoint set at compdir_missing__ldir_missing__file_basename_label,
address 0x400608 starts at a line entry:
...
CU: tmp-dw2-dir-file-name.c:
File name                    Line number    Starting address    View    Stmt
tmp-dw2-dir-file-name.c              999            0x400608               x
tmp-dw2-dir-file-name.c             1000            0x40062c               x
tmp-dw2-dir-file-name.c                -            0x40062c
...
and therefore the breakpoint is printed without instruction address.

In contrast, for x86_64-linux, we have the breakpoint printed with instruction
address:
...
(gdb) continue^M
Continuing.^M
^M
Breakpoint 2, 0x004004c1 in compdir_missing__ldir_missing__file_basename () \
  at tmp-dw2-dir-file-name.c:999^M
(gdb) PASS: gdb.dwarf2/dw2-dir-file-name.exp: \
  compdir_missing__ldir_missing__file_basename: continue to breakpoint: \
  compdir_missing__ldir_missing__file_basename
...

The breakpoint set at compdir_missing__ldir_missing__file_basename_label,
address 0x004004c1 doesn't start at a line entry:
...
CU: tmp-dw2-dir-file-name.c:
File name                    Line number    Starting address    View    Stmt
tmp-dw2-dir-file-name.c              999            0x4004bd               x
tmp-dw2-dir-file-name.c             1000            0x4004d3               x
tmp-dw2-dir-file-name.c                -            0x4004d3
...

Fix this by:
- unifying behaviour between the archs by adding an explicit line number entry
  for the address compdir_missing__ldir_missing__file_basename_label, making
  the FAIL reproducible on x86_64-linux.
- expecting the breakpoint to be printed without instruction address.

Tested on x86_64-linux and aarch64-linux.

Any comments?

Thanks,
- Tom

[gdb/testsuite] Fix gdb.dwarf2/dw2-dir-file-name.exp for aarch64

---
 gdb/testsuite/gdb.dwarf2/dw2-dir-file-name.exp | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/gdb/testsuite/gdb.dwarf2/dw2-dir-file-name.exp b/gdb/testsuite/gdb.dwarf2/dw2-dir-file-name.exp
index 053f7229537..3827ed744b5 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-dir-file-name.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-dir-file-name.exp
@@ -188,13 +188,20 @@ proc out_line { name cu_dir cu_name line_dir line_name } {
 
 .Lline_${name}_lines:
 	.byte		3	/* DW_LNS_advance_line */
-	.sleb128	998	/* ... to 999 */
+	.sleb128	997	/* ... to 998 */
 	.byte		0	/* DW_LNE_set_address */
 	.uleb128	${addr_len}+1
 	.byte		2
 	.${addr_len}byte $name_start
 	.byte		1	/* DW_LNS_copy */
 	.byte		3	/* DW_LNS_advance_line */
+	.sleb128	1	/* ... to 999 */
+	.byte		0	/* DW_LNE_set_address */
+	.uleb128	${addr_len}+1
+	.byte		2
+	.${addr_len}byte ${name}_label
+	.byte		1	/* DW_LNS_copy */
+	.byte		3	/* DW_LNS_advance_line */
 	.sleb128	1	/* ... to 1000 */
 	.byte		0	/* DW_LNE_set_address */
 	.uleb128	${addr_len}+1
@@ -451,19 +458,19 @@ proc test { func compdir filename } {
 	}
 
 	gdb_breakpoint ${func}_label
-	gdb_continue_to_breakpoint $func "$func \\(\\) at .*"
+	gdb_test "continue" "$func \\(\\) at .*" "continue to $func"
 
 	gdb_test_no_output "set filename-display absolute"
 	verbose -log "expect: ${absolute}"
-	gdb_test "frame" " in $func \\(\\) at [string_to_regexp ${absolute}]:999" "absolute"
+	gdb_test "frame" "$func \\(\\) at [string_to_regexp ${absolute}]:999" "absolute"
 
 	gdb_test_no_output "set filename-display basename"
 	verbose -log "expect: [file tail $filename]"
-	gdb_test "frame" " in $func \\(\\) at [string_to_regexp [file tail $filename]]:999" "basename"
+	gdb_test "frame" "$func \\(\\) at [string_to_regexp [file tail $filename]]:999" "basename"
 
 	gdb_test_no_output "set filename-display relative"
 	verbose -log "expect: $filename"
-	gdb_test "frame" " in $func \\(\\) at [string_to_regexp $filename]:999" "relative"
+	gdb_test "frame" "$func \\(\\) at [string_to_regexp $filename]:999" "relative"
     }
 }
 

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

* Re: [PATCH][gdb/testsuite] Fix gdb.dwarf2/dw2-dir-file-name.exp for aarch64
  2022-09-13 14:48 [PATCH][gdb/testsuite] Fix gdb.dwarf2/dw2-dir-file-name.exp for aarch64 Tom de Vries
@ 2022-09-13 16:00 ` Luis Machado
  2022-09-14  8:36   ` Tom de Vries
  0 siblings, 1 reply; 3+ messages in thread
From: Luis Machado @ 2022-09-13 16:00 UTC (permalink / raw)
  To: Tom de Vries, gdb-patches

On 9/13/22 15:48, Tom de Vries wrote:
> Hi,
> 
> [ Another attempt at fixing the problem described in commit cd919f5533c
> ("[gdb/testsuite] Fix gdb.dwarf2/dw2-dir-file-name.exp"). ]

Tricky one. :-)

> 
> When running the test-case gdb.dwarf2/dw2-dir-file-name.exp with
> aarch64-linux, we run into:
> ...
> (gdb) continue^M
> Continuing.^M
> ^M
> Breakpoint 2, compdir_missing__ldir_missing__file_basename () at \
>    tmp-dw2-dir-file-name.c:999^M
> (gdb) FAIL: gdb.dwarf2/dw2-dir-file-name.exp: \
>    compdir_missing__ldir_missing__file_basename: continue to breakpoint: \
>    compdir_missing__ldir_missing__file_basename
> ...
> 
> The breakpoint set at compdir_missing__ldir_missing__file_basename_label,
> address 0x400608 starts at a line entry:
> ...
> CU: tmp-dw2-dir-file-name.c:
> File name                    Line number    Starting address    View    Stmt
> tmp-dw2-dir-file-name.c              999            0x400608               x
> tmp-dw2-dir-file-name.c             1000            0x40062c               x
> tmp-dw2-dir-file-name.c                -            0x40062c
> ...
> and therefore the breakpoint is printed without instruction address.
> 
> In contrast, for x86_64-linux, we have the breakpoint printed with instruction
> address:
> ...
> (gdb) continue^M
> Continuing.^M
> ^M
> Breakpoint 2, 0x004004c1 in compdir_missing__ldir_missing__file_basename () \
>    at tmp-dw2-dir-file-name.c:999^M
> (gdb) PASS: gdb.dwarf2/dw2-dir-file-name.exp: \
>    compdir_missing__ldir_missing__file_basename: continue to breakpoint: \
>    compdir_missing__ldir_missing__file_basename
> ...
> 
> The breakpoint set at compdir_missing__ldir_missing__file_basename_label,
> address 0x004004c1 doesn't start at a line entry:
> ...
> CU: tmp-dw2-dir-file-name.c:
> File name                    Line number    Starting address    View    Stmt
> tmp-dw2-dir-file-name.c              999            0x4004bd               x
> tmp-dw2-dir-file-name.c             1000            0x4004d3               x
> tmp-dw2-dir-file-name.c                -            0x4004d3
> ...
> 
> Fix this by:
> - unifying behaviour between the archs by adding an explicit line number entry
>    for the address compdir_missing__ldir_missing__file_basename_label, making
>    the FAIL reproducible on x86_64-linux.
> - expecting the breakpoint to be printed without instruction address.
> 
> Tested on x86_64-linux and aarch64-linux.
> 
> Any comments?

Thanks for the quick patch.

 From my end it looks good, and makes the tests pass again.

> 
> Thanks,
> - Tom
> 
> [gdb/testsuite] Fix gdb.dwarf2/dw2-dir-file-name.exp for aarch64
> 
> ---
>   gdb/testsuite/gdb.dwarf2/dw2-dir-file-name.exp | 17 ++++++++++++-----
>   1 file changed, 12 insertions(+), 5 deletions(-)
> 
> diff --git a/gdb/testsuite/gdb.dwarf2/dw2-dir-file-name.exp b/gdb/testsuite/gdb.dwarf2/dw2-dir-file-name.exp
> index 053f7229537..3827ed744b5 100644
> --- a/gdb/testsuite/gdb.dwarf2/dw2-dir-file-name.exp
> +++ b/gdb/testsuite/gdb.dwarf2/dw2-dir-file-name.exp
> @@ -188,13 +188,20 @@ proc out_line { name cu_dir cu_name line_dir line_name } {
>   
>   .Lline_${name}_lines:
>   	.byte		3	/* DW_LNS_advance_line */
> -	.sleb128	998	/* ... to 999 */
> +	.sleb128	997	/* ... to 998 */
>   	.byte		0	/* DW_LNE_set_address */
>   	.uleb128	${addr_len}+1
>   	.byte		2
>   	.${addr_len}byte $name_start
>   	.byte		1	/* DW_LNS_copy */
>   	.byte		3	/* DW_LNS_advance_line */
> +	.sleb128	1	/* ... to 999 */
> +	.byte		0	/* DW_LNE_set_address */
> +	.uleb128	${addr_len}+1
> +	.byte		2
> +	.${addr_len}byte ${name}_label
> +	.byte		1	/* DW_LNS_copy */
> +	.byte		3	/* DW_LNS_advance_line */
>   	.sleb128	1	/* ... to 1000 */
>   	.byte		0	/* DW_LNE_set_address */
>   	.uleb128	${addr_len}+1
> @@ -451,19 +458,19 @@ proc test { func compdir filename } {
>   	}
>   
>   	gdb_breakpoint ${func}_label
> -	gdb_continue_to_breakpoint $func "$func \\(\\) at .*"
> +	gdb_test "continue" "$func \\(\\) at .*" "continue to $func"
>   
>   	gdb_test_no_output "set filename-display absolute"
>   	verbose -log "expect: ${absolute}"
> -	gdb_test "frame" " in $func \\(\\) at [string_to_regexp ${absolute}]:999" "absolute"
> +	gdb_test "frame" "$func \\(\\) at [string_to_regexp ${absolute}]:999" "absolute"
>   
>   	gdb_test_no_output "set filename-display basename"
>   	verbose -log "expect: [file tail $filename]"
> -	gdb_test "frame" " in $func \\(\\) at [string_to_regexp [file tail $filename]]:999" "basename"
> +	gdb_test "frame" "$func \\(\\) at [string_to_regexp [file tail $filename]]:999" "basename"
>   
>   	gdb_test_no_output "set filename-display relative"
>   	verbose -log "expect: $filename"
> -	gdb_test "frame" " in $func \\(\\) at [string_to_regexp $filename]:999" "relative"
> +	gdb_test "frame" "$func \\(\\) at [string_to_regexp $filename]:999" "relative"
>       }
>   }
>   


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

* Re: [PATCH][gdb/testsuite] Fix gdb.dwarf2/dw2-dir-file-name.exp for aarch64
  2022-09-13 16:00 ` Luis Machado
@ 2022-09-14  8:36   ` Tom de Vries
  0 siblings, 0 replies; 3+ messages in thread
From: Tom de Vries @ 2022-09-14  8:36 UTC (permalink / raw)
  To: Luis Machado, gdb-patches

On 9/13/22 18:00, Luis Machado wrote:
> On 9/13/22 15:48, Tom de Vries wrote:
>> Hi,
>>
>> [ Another attempt at fixing the problem described in commit cd919f5533c
>> ("[gdb/testsuite] Fix gdb.dwarf2/dw2-dir-file-name.exp"). ]
> 
> Tricky one. :-)
> 

It is indeed.

I just did a run with cc-with-debug-names target board, and ran into 
FAILs in the same test-case.  I haven't done root cause analysis yet, 
but my suspicion is that I'll need to add a .debug_aranges entries.

>>
>> When running the test-case gdb.dwarf2/dw2-dir-file-name.exp with
>> aarch64-linux, we run into:
>> ...
>> (gdb) continue^M
>> Continuing.^M
>> ^M
>> Breakpoint 2, compdir_missing__ldir_missing__file_basename () at \
>>    tmp-dw2-dir-file-name.c:999^M
>> (gdb) FAIL: gdb.dwarf2/dw2-dir-file-name.exp: \
>>    compdir_missing__ldir_missing__file_basename: continue to 
>> breakpoint: \
>>    compdir_missing__ldir_missing__file_basename
>> ...
>>
>> The breakpoint set at compdir_missing__ldir_missing__file_basename_label,
>> address 0x400608 starts at a line entry:
>> ...
>> CU: tmp-dw2-dir-file-name.c:
>> File name                    Line number    Starting address    
>> View    Stmt
>> tmp-dw2-dir-file-name.c              999            
>> 0x400608               x
>> tmp-dw2-dir-file-name.c             1000            
>> 0x40062c               x
>> tmp-dw2-dir-file-name.c                -            0x40062c
>> ...
>> and therefore the breakpoint is printed without instruction address.
>>
>> In contrast, for x86_64-linux, we have the breakpoint printed with 
>> instruction
>> address:
>> ...
>> (gdb) continue^M
>> Continuing.^M
>> ^M
>> Breakpoint 2, 0x004004c1 in 
>> compdir_missing__ldir_missing__file_basename () \
>>    at tmp-dw2-dir-file-name.c:999^M
>> (gdb) PASS: gdb.dwarf2/dw2-dir-file-name.exp: \
>>    compdir_missing__ldir_missing__file_basename: continue to 
>> breakpoint: \
>>    compdir_missing__ldir_missing__file_basename
>> ...
>>
>> The breakpoint set at compdir_missing__ldir_missing__file_basename_label,
>> address 0x004004c1 doesn't start at a line entry:
>> ...
>> CU: tmp-dw2-dir-file-name.c:
>> File name                    Line number    Starting address    
>> View    Stmt
>> tmp-dw2-dir-file-name.c              999            
>> 0x4004bd               x
>> tmp-dw2-dir-file-name.c             1000            
>> 0x4004d3               x
>> tmp-dw2-dir-file-name.c                -            0x4004d3
>> ...
>>
>> Fix this by:
>> - unifying behaviour between the archs by adding an explicit line 
>> number entry
>>    for the address compdir_missing__ldir_missing__file_basename_label, 
>> making
>>    the FAIL reproducible on x86_64-linux.
>> - expecting the breakpoint to be printed without instruction address.
>>
>> Tested on x86_64-linux and aarch64-linux.
>>
>> Any comments?
> 
> Thanks for the quick patch.
> 
>  From my end it looks good, and makes the tests pass again.
> 

Ack, I'll commit today.

Thanks,
- Tom

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

end of thread, other threads:[~2022-09-14  8:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-13 14:48 [PATCH][gdb/testsuite] Fix gdb.dwarf2/dw2-dir-file-name.exp for aarch64 Tom de Vries
2022-09-13 16:00 ` Luis Machado
2022-09-14  8:36   ` Tom de Vries

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