public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/27298] New: [cc-with-debug-names] FAIL: gdb.dwarf2/template-specification-full-name.exp: print apply<int>
@ 2021-01-31  7:43 vries at gcc dot gnu.org
  2021-01-31  9:44 ` [Bug gdb/27298] " vries at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2021-01-31  7:43 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=27298

            Bug ID: 27298
           Summary: [cc-with-debug-names] FAIL:
                    gdb.dwarf2/template-specification-full-name.exp: print
                    apply<int>
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

When running test-case gdb.dwarf2/template-specification-full-name.exp with
target board cc-with-debug-names, we get:
...
(gdb) print apply<int>^M
$1 = {void (void)} 0x4004a7 <apply<int>()>^M
Warning: the current language does not match this frame.^M
(gdb) FAIL: gdb.dwarf2/template-specification-full-name.exp: print apply<int>
...
while with native we have instead:
...
(gdb) print apply<int>^M
$1 = {void (void)} 0x4004a7 <apply<int>()>^M
(gdb) PASS: gdb.dwarf2/template-specification-full-name.exp: print apply<int>
...

This seems to be about having language auto/c instead of auto/c++.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug gdb/27298] [cc-with-debug-names] FAIL: gdb.dwarf2/template-specification-full-name.exp: print apply<int>
  2021-01-31  7:43 [Bug gdb/27298] New: [cc-with-debug-names] FAIL: gdb.dwarf2/template-specification-full-name.exp: print apply<int> vries at gcc dot gnu.org
@ 2021-01-31  9:44 ` vries at gcc dot gnu.org
  2021-02-01  9:00 ` vries at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2021-01-31  9:44 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=27298

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
So, the c++ language is normally set like this:
...
(gdb) bt
#0  set_language (lang=language_cplus)
    at /home/vries/gdb_versions/devel/src/gdb/language.c:371
#1  0x00000000006b98b0 in select_frame (fi=0x1f65020)
    at /home/vries/gdb_versions/devel/src/gdb/frame.c:1942
#2  0x000000000075c628 in normal_stop ()
...

But it fails here:
...
(gdb) 
1934          if (get_frame_address_in_block_if_available (fi, &pc))
(gdb) 
1936              struct compunit_symtab *cust = find_pc_compunit_symtab (pc);
(gdb) p /x pc
$8 = 0x4004ab
(gdb) n
1941                  && language_mode == language_mode_auto)
(gdb) p cust
$9 = (compunit_symtab *) 0x0
...

It looks like the problem is a missing .debug_aranges entry.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug gdb/27298] [cc-with-debug-names] FAIL: gdb.dwarf2/template-specification-full-name.exp: print apply<int>
  2021-01-31  7:43 [Bug gdb/27298] New: [cc-with-debug-names] FAIL: gdb.dwarf2/template-specification-full-name.exp: print apply<int> vries at gcc dot gnu.org
  2021-01-31  9:44 ` [Bug gdb/27298] " vries at gcc dot gnu.org
@ 2021-02-01  9:00 ` vries at gcc dot gnu.org
  2021-02-01  9:26 ` vries at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2021-02-01  9:00 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=27298

--- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> ---
Tentative patch:
...
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 0a00f89cf6d..ad9d706d198 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -2889,6 +2889,7 @@ create_addrmap_from_aranges

   const gdb_byte *addr = section->buffer;

+  unsigned int nr_cus = 0;
   while (addr < section->buffer + section->size)
     {
       const gdb_byte *const entry_addr = addr;
@@ -3010,6 +3011,16 @@ create_addrmap_from_aranges
                 - baseaddr);
          addrmap_set_empty (mutable_map, start, end - 1, per_cu);
        }
+      nr_cus++;
+    }
+
+  if (nr_cus != debug_info_offset_to_per_cu.size ())
+    {
+      warning (_("Section .debug_aranges does not contain the same amount o
f"                                                                              
+                " entries (%u) as the amount of CUs (%lu), ignoring"
+                " .debug_aranges."), nr_cus,
+              debug_info_offset_to_per_cu.size ());
+      return;
     }

   objfile->partial_symtabs->psymtabs_addrmap
@@ -5423,6 +5434,11 @@ dwarf2_read_debug_names (dwarf2_per_objfile *per_objfil
e)
     }

   create_addrmap_from_aranges (per_objfile, &per_bfd->debug_aranges);
+  if (objfile->partial_symtabs->psymtabs_addrmap == nullptr)
+    {
+      per_objfile->per_bfd->all_comp_units.clear ();
+      return false;
+    }

   per_bfd->debug_names_table = std::move (map);
   per_bfd->using_index = 1;
...

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug gdb/27298] [cc-with-debug-names] FAIL: gdb.dwarf2/template-specification-full-name.exp: print apply<int>
  2021-01-31  7:43 [Bug gdb/27298] New: [cc-with-debug-names] FAIL: gdb.dwarf2/template-specification-full-name.exp: print apply<int> vries at gcc dot gnu.org
  2021-01-31  9:44 ` [Bug gdb/27298] " vries at gcc dot gnu.org
  2021-02-01  9:00 ` vries at gcc dot gnu.org
@ 2021-02-01  9:26 ` vries at gcc dot gnu.org
  2021-02-01  9:29 ` vries at gcc dot gnu.org
  2021-02-02 16:07 ` vries at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2021-02-01  9:26 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=27298

--- Comment #3 from Tom de Vries <vries at gcc dot gnu.org> ---
So, with the patch, the test-case passes, and we see the warning:
...
(gdb) file
/home/vries/gdb_versions/devel/build/gdb/testsuite/outputs/gdb.dwarf2/template-specification-full-name/template-specification-full-name^M
Reading symbols from
/home/vries/gdb_versions/devel/build/gdb/testsuite/outputs/gdb.dwarf2/template-specification-full-name/template-specification-full-name...^M
warning: Section .debug_aranges does not contain the same amount of entries (5)
as the amount of CUs (6), ignoring .debug_aranges.^M
...

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug gdb/27298] [cc-with-debug-names] FAIL: gdb.dwarf2/template-specification-full-name.exp: print apply<int>
  2021-01-31  7:43 [Bug gdb/27298] New: [cc-with-debug-names] FAIL: gdb.dwarf2/template-specification-full-name.exp: print apply<int> vries at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2021-02-01  9:26 ` vries at gcc dot gnu.org
@ 2021-02-01  9:29 ` vries at gcc dot gnu.org
  2021-02-02 16:07 ` vries at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2021-02-01  9:29 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=27298

--- Comment #4 from Tom de Vries <vries at gcc dot gnu.org> ---
This is essentially a duplicate of
https://sourceware.org/bugzilla/show_bug.cgi?id=24716#c1

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug gdb/27298] [cc-with-debug-names] FAIL: gdb.dwarf2/template-specification-full-name.exp: print apply<int>
  2021-01-31  7:43 [Bug gdb/27298] New: [cc-with-debug-names] FAIL: gdb.dwarf2/template-specification-full-name.exp: print apply<int> vries at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2021-02-01  9:29 ` vries at gcc dot gnu.org
@ 2021-02-02 16:07 ` vries at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2021-02-02 16:07 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=27298

--- Comment #5 from Tom de Vries <vries at gcc dot gnu.org> ---
https://sourceware.org/pipermail/gdb-patches/2021-February/175697.html

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

end of thread, other threads:[~2021-02-02 16:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-31  7:43 [Bug gdb/27298] New: [cc-with-debug-names] FAIL: gdb.dwarf2/template-specification-full-name.exp: print apply<int> vries at gcc dot gnu.org
2021-01-31  9:44 ` [Bug gdb/27298] " vries at gcc dot gnu.org
2021-02-01  9:00 ` vries at gcc dot gnu.org
2021-02-01  9:26 ` vries at gcc dot gnu.org
2021-02-01  9:29 ` vries at gcc dot gnu.org
2021-02-02 16:07 ` vries at gcc dot gnu.org

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