Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [FTR][gdb/testsuite] Add missing .debug_aranges to dw2-ranges-func-{hi,lo}-cold.c
@ 2020-04-23 12:50 Tom de Vries
  0 siblings, 0 replies; only message in thread
From: Tom de Vries @ 2020-04-23 12:50 UTC (permalink / raw)
  To: gdb-patches

Hi,

I ran into these FAILs with test-case gdb.dwarf2/dw2-ranges-func.exp and target
board cc-with-debug-names:
...
FAIL: gdb.dwarf2/dw2-ranges-func.exp: lo-cold: disassemble foo (pattern 2)
FAIL: gdb.dwarf2/dw2-ranges-func.exp: hi-cold: disassemble foo (pattern 2)
...

My initial investigation pointed towards missing .debug_aranges info, so I
wrote this patch that adds that, which indeed fixes the FAILs.

However, that did not fix the same FAILs with target board readnow, which I
fixed with commit ae3ab1f067b "[gdb/symtab] Fix disassembly of non-contiguous
functions".

After committing that fix, the FAILs with cc-with-debug-names no longer
reproduce.

So, I'm posting this for the record, for now.

Thanks,
- Tom

[gdb/testsuite] Add missing .debug_aranges to dw2-ranges-func-{hi,lo}-cold.c

---
 gdb/testsuite/gdb.dwarf2/dw2-ranges-func-hi-cold.c | 30 ++++++++++++++++++++++
 gdb/testsuite/gdb.dwarf2/dw2-ranges-func-lo-cold.c | 30 ++++++++++++++++++++++
 2 files changed, 60 insertions(+)

diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ranges-func-hi-cold.c b/gdb/testsuite/gdb.dwarf2/dw2-ranges-func-hi-cold.c
index 2e40e9668f5..032b3547a78 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-ranges-func-hi-cold.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-ranges-func-hi-cold.c
@@ -41,6 +41,11 @@ void bar (void);
 void foo_cold (void);
 void baz (void);
 
+asm (
+".text \n"
+".Lcu_text_start: .globl .Lcu_text_start"
+);
+
 void
 foo (void)
 {						/* foo prologue */
@@ -80,3 +85,28 @@ main (void)
   return 0;					/* main return */
 }						/* main end */
 
+asm (".Lcu_text_end: .globl .Lcu_text_end");
+
+/* The .debug_names-based index support depends on .debug_aranges
+   generated by GCC.  (.gdb_index includes a gdb-generated map
+   instead.)  */
+asm (
+"       .pushsection    .debug_info,\"\",%progbits \n"
+".Lcu1_begin: \n"
+"       .popsection \n"
+"	.pushsection	.debug_aranges,\"\",%progbits \n"
+"	.4byte	.Laranges_end - .Laranges_start \n"	// Length of Address Ranges Info
+".Laranges_start: \n"
+"	.2byte	0x2 \n"	// DWARF Version
+"	.4byte  .Lcu1_begin\n" // .Ldebug_info0 - Offset of Compilation Unit Info
+"	.byte	4 \n"	// Size of Address
+"	.byte	0 \n"	// Size of Segment Descriptor
+"	.2byte	0 \n"	// Pad to 16 byte boundary
+"	.2byte	0 \n"
+"	.4byte	.Lcu_text_start \n"	// Address
+"	.4byte	.Lcu_text_end - .Lcu_text_start \n"	// Length
+"	.4byte	0 \n"
+"	.4byte	0 \n"
+".Laranges_end: \n"
+"	.popsection \n"
+);
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ranges-func-lo-cold.c b/gdb/testsuite/gdb.dwarf2/dw2-ranges-func-lo-cold.c
index 61ca3ac5fab..40be6578bac 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-ranges-func-lo-cold.c
+++ b/gdb/testsuite/gdb.dwarf2/dw2-ranges-func-lo-cold.c
@@ -41,6 +41,11 @@ void bar (void);
 void foo_cold (void);
 void baz (void);
 
+asm (
+".text \n"
+".Lcu_text_start: .globl .Lcu_text_start"
+);
+
 void
 baz (void)
 {
@@ -80,3 +85,28 @@ main (void)
   return 0;					/* main return */
 }						/* main end */
 
+asm (".Lcu_text_end: .globl .Lcu_text_end");
+
+/* The .debug_names-based index support depends on .debug_aranges
+   generated by GCC.  (.gdb_index includes a gdb-generated map
+   instead.)  */
+asm (
+"       .pushsection    .debug_info,\"\",%progbits \n"
+".Lcu1_begin: \n"
+"       .popsection \n"
+"	.pushsection	.debug_aranges,\"\",%progbits \n"
+"	.4byte	.Laranges_end - .Laranges_start \n"	// Length of Address Ranges Info
+".Laranges_start: \n"
+"	.2byte	0x2 \n"	// DWARF Version
+"	.4byte  .Lcu1_begin\n" // .Ldebug_info0 - Offset of Compilation Unit Info
+"	.byte	4 \n"	// Size of Address
+"	.byte	0 \n"	// Size of Segment Descriptor
+"	.2byte	0 \n"	// Pad to 16 byte boundary
+"	.2byte	0 \n"
+"	.4byte	.Lcu_text_start \n"	// Address
+"	.4byte	.Lcu_text_end - .Lcu_text_start \n"	// Length
+"	.4byte	0 \n"
+"	.4byte	0 \n"
+".Laranges_end: \n"
+"	.popsection \n"
+);


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-04-23 12:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-23 12:50 [FTR][gdb/testsuite] Add missing .debug_aranges to dw2-ranges-func-{hi,lo}-cold.c 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