Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [FTR][gdb/testsuite] Add missing .debug_aranges to dw2-ranges-func-{hi,lo}-cold.c
Date: Thu, 23 Apr 2020 14:50:24 +0200	[thread overview]
Message-ID: <20200423125023.GA6207@delia> (raw)

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"
+);


                 reply	other threads:[~2020-04-23 12:50 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20200423125023.GA6207@delia \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    /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