From 714534e1b88608f92b6946d8e5a24ea51a40e363 Mon Sep 17 00:00:00 2001 From: Tom de Vries Date: Wed, 22 Apr 2020 13:17:32 +0200 Subject: [gdb/testsuite] Fix .debug_aranges in gdb.dlang/watch-loc.c While investigating PR25862 (an assertion failure with target board cc-with-debug-names), I noticed that the .debug_aranges section in gdb.dlang/watch-loc.c contains a hardcoded 0x1000: ... " .4byte _Dmain \n" // Address " .4byte 0x1000 \n" // Length ... Fix this by using the actual length of _Dmain, along the lines of how that is done in gdb.mi/dw2-ref-missing-frame-func.c: ... " .4byte _Dmain_end - _Dmain \n" // Length ... such that the .debug_aranges entry: ... Address Length 004004a7 0000000b 00000000 00000000 ... matches the addresses found in the corresponding CU: ... <2>: Abbrev Number: 6 (DW_TAG_subprogram) DW_AT_name : _Dmain <105> DW_AT_low_pc : 0x4004a7 <10d> DW_AT_high_pc : 0x4004b2 ... With this fix the assertion failure is no longer triggered for gdb.dlang/watch-loc.exp. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2020-04-22 Tom de Vries * gdb.dlang/watch-loc.c (.debug_aranges): Fix _Dmain length. --- gdb/testsuite/ChangeLog | 4 ++++ gdb/testsuite/gdb.dlang/watch-loc.c | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'gdb/testsuite') diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 26a15d5..33ba594 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2020-04-22 Tom de Vries + + * gdb.dlang/watch-loc.c (.debug_aranges): Fix _Dmain length. + 2020-02-18 Mihails Strasuns * gdb.base/jit-attach-pie.c: Use jit-protocol.h. diff --git a/gdb/testsuite/gdb.dlang/watch-loc.c b/gdb/testsuite/gdb.dlang/watch-loc.c index c3159ce..de594f3 100644 --- a/gdb/testsuite/gdb.dlang/watch-loc.c +++ b/gdb/testsuite/gdb.dlang/watch-loc.c @@ -28,6 +28,8 @@ int _Dmain (void) return 0; } +asm ("_Dmain_end: .globl _Dmain_end"); + int main (void) { @@ -51,7 +53,7 @@ asm ( " .2byte 0 \n" // Pad to 16 byte boundary " .2byte 0 \n" " .4byte _Dmain \n" // Address -" .4byte 0x1000 \n" // Length +" .4byte _Dmain_end - _Dmain \n" // Length " .4byte 0 \n" " .4byte 0 \n" ".Laranges_end: \n" -- cgit v1.1