public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug symtab/27604] New: FAIL: gdb.dwarf2/dw2-cu-size.exp: ptype noloc
@ 2021-03-18 13:06 vries at gcc dot gnu.org
  2021-03-18 14:13 ` [Bug symtab/27604] " vries at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: vries at gcc dot gnu.org @ 2021-03-18 13:06 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 27604
           Summary: FAIL: gdb.dwarf2/dw2-cu-size.exp: ptype noloc
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: symtab
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

...
(gdb) file dw2-cu-size^M
Reading symbols from dw2-cu-size...^M
DW_FORM_strp pointing outside of .debug_str section [in module dw2-cu-size]^M
(No debugging symbols found in dw2-cu-size)^M
(gdb) ptype noloc^M
No symbol table is loaded.  Use the "file" command.^M
(gdb) FAIL: gdb.dwarf2/dw2-cu-size.exp: ptype noloc
...

This happens for this here:
while processing attribute 0:
...
#6  0x000000000068137e
    in read_full_die_1 (reader=0x7fffffffd270,
                        diep=0x7fffffffd2b0, 
                        info_ptr=0x18c79e5 "file1.txt",
                        num_extra_attrs=0)
    at read.c:19220
19220         info_ptr = read_attribute (reader, &die->attrs[i],
&abbrev->attrs[i],
(gdb) l
19215     die->num_attrs = abbrev->num_attrs;
19216
19217     bool any_need_reprocess = false;
19218     for (i = 0; i < abbrev->num_attrs; ++i)
19219       {
19220         info_ptr = read_attribute (reader, &die->attrs[i],
&abbrev->attrs[i],
19221                                    info_ptr);
19222         if (die->attrs[i].requires_reprocessing_p ())
19223           any_need_reprocess = true;
19224       }
...
for this DIE:
...
(gdb) p *die
$15 = {tag = DW_TAG_compile_unit, num_attrs = 7 '\a', building_fullname = 0
'\000', 
  in_process = 0 '\000', has_children = 1 '\001', abbrev = 1, sect_off =
(unknown: 0x124), 
  child = 0x0, sibling = 0x0, parent = 0x0, attrs = {{name = DW_AT_producer, 
      requires_reprocessing = 0, form = DW_FORM_strp, string_is_canonical = 0,
u = {
        str = 0x0, blk = 0x0, unsnd = 0, snd = 0, addr = 0, signature = 0}}}}
...
and this attribute:
...
(gdb) p i
$14 = 0
...

In other words, the DW_AT_name attribute of:
...
  Compilation Unit @ offset 0x119:
   Length:        0x35 (32-bit)
   Version:       2
   Abbrev Offset: 0x9b
   Pointer Size:  4
 <0><124>: Abbrev Number: 1 (DW_TAG_compile_unit)
    <125>   DW_AT_name        : file1.txt
    <12f>   DW_AT_producer    : GNU C 3.3.3
    <13b>   DW_AT_language    : 1       (ANSI C)
...

It seems strange that the at position 0 we have the DW_AT_producer attribute
instead of the DW_AT_name attribute.

Also, bot the name and producer have form DW_FORM_string:
...
  Number TAG (0x9b)
   1      DW_TAG_compile_unit    [has children]
    DW_AT_name         DW_FORM_string
    DW_AT_producer     DW_FORM_string
    DW_AT_language     DW_FORM_data1 
    DW_AT value: 0     DW_FORM value: 0
...
but the DIE seems to think that it has DW_FORM_strp instead.

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

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

* [Bug symtab/27604] FAIL: gdb.dwarf2/dw2-cu-size.exp: ptype noloc
  2021-03-18 13:06 [Bug symtab/27604] New: FAIL: gdb.dwarf2/dw2-cu-size.exp: ptype noloc vries at gcc dot gnu.org
@ 2021-03-18 14:13 ` vries at gcc dot gnu.org
  2021-03-18 14:25 ` vries at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: vries at gcc dot gnu.org @ 2021-03-18 14:13 UTC (permalink / raw)
  To: gdb-prs

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

Tom de Vries <vries at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tromey at sourceware dot org

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
Bisects to:

commit 27012aba8a638a636940c2813f191383ccd713fd (HEAD)
Author: Tom Tromey <tom@tromey.com>
Date:   Sat Mar 13 09:41:04 2021 -0700

    Remove Irix 6 workaround from DWARF abbrev reader

    abbrev_table::read has a workaround for Irix 6.  The last release of
    Irix was in 2006, and (according to Wikipedia) hardware produced after
    2007 cannot run Irix.  I think this workaround can safely be retired.

    gdb/ChangeLog
    2021-03-13  Tom Tromey  <tom@tromey.com>

            * dwarf2/abbrev.c (abbrev_table::read): Remove Irix 6 workaround.

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

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

* [Bug symtab/27604] FAIL: gdb.dwarf2/dw2-cu-size.exp: ptype noloc
  2021-03-18 13:06 [Bug symtab/27604] New: FAIL: gdb.dwarf2/dw2-cu-size.exp: ptype noloc vries at gcc dot gnu.org
  2021-03-18 14:13 ` [Bug symtab/27604] " vries at gcc dot gnu.org
@ 2021-03-18 14:25 ` vries at gcc dot gnu.org
  2021-03-18 14:29 ` vries at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: vries at gcc dot gnu.org @ 2021-03-18 14:25 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> ---
OK, so we have:
...
  Number TAG (0x9b)
   1      DW_TAG_compile_unit    [has children]
    DW_AT_name         DW_FORM_string
    DW_AT_producer     DW_FORM_string
    DW_AT_language     DW_FORM_data1
    DW_AT value: 0     DW_FORM value: 0
   2      DW_TAG_variable    [no children]
    DW_AT_name         DW_FORM_string
    DW_AT_type         DW_FORM_ref4
    DW_AT_external     DW_FORM_flag
    DW_AT value: 0     DW_FORM value: 0
   3      DW_TAG_base_type    [no children]
    DW_AT_name         DW_FORM_string
    DW_AT_byte_size    DW_FORM_data1
    DW_AT_encoding     DW_FORM_data1
    DW_AT value: 0     DW_FORM value: 0
   4      DW_TAG_const_type    [no children]
    DW_AT_type         DW_FORM_ref_udata
    DW_AT value: 0     DW_FORM value: 0
   1      DW_TAG_compile_unit    [has children]
    DW_AT_producer     DW_FORM_strp
    DW_AT_language     DW_FORM_data1
    DW_AT_name         DW_FORM_strp
    DW_AT_comp_dir     DW_FORM_strp
    DW_AT_low_pc       DW_FORM_addr
    DW_AT_high_pc      DW_FORM_data8
    DW_AT_stmt_list    DW_FORM_sec_offset
    DW_AT value: 0     DW_FORM value: 0
...

So, we use abbrev 1 twice, which obviously causes trouble.  The second one is
for:
...
  Compilation Unit @ offset 0x152:
   Length:        0x1b4 (32-bit)
   Version:       4
   Abbrev Offset: 0xc3
   Pointer Size:  8
 <0><15d>: Abbrev Number: 1 (DW_TAG_compile_unit)
    <15e>   DW_AT_producer    : (indirect string, offset: 0x2d9): GNU C11 7.5.0
-mtune=generic -march=x86-64 -g -O2 -std=gnu11 -fgnu89-inline
-fasynchronous-unwind-tables -fmerge-all-constants -fmessage-length=0
-frounding-math -fstack-clash-protection -fstack-protector-strong
-funwind-tables -fno-stack-protector -fPIC -ftls-model=initial-exec
    <162>   DW_AT_language    : 12      (ANSI C99)
    <163>   DW_AT_name        : (indirect string, offset: 0x2ce): elf-init.c
    <167>   DW_AT_comp_dir    : (indirect string, offset: 0x1a):
/home/abuild/rpmbuild/BUILD/glibc-2.26/csu
    <16b>   DW_AT_low_pc      : 0x4004c0
    <173>   DW_AT_high_pc     : 0x72
    <17b>   DW_AT_stmt_list   : 0x17f
...
but apparently the two abbrev parts get merged.

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

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

* [Bug symtab/27604] FAIL: gdb.dwarf2/dw2-cu-size.exp: ptype noloc
  2021-03-18 13:06 [Bug symtab/27604] New: FAIL: gdb.dwarf2/dw2-cu-size.exp: ptype noloc vries at gcc dot gnu.org
  2021-03-18 14:13 ` [Bug symtab/27604] " vries at gcc dot gnu.org
  2021-03-18 14:25 ` vries at gcc dot gnu.org
@ 2021-03-18 14:29 ` vries at gcc dot gnu.org
  2021-03-18 20:32 ` vries at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: vries at gcc dot gnu.org @ 2021-03-18 14:29 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #3 from Tom de Vries <vries at gcc dot gnu.org> ---
Looking at the output of:
...
$ gcc hello.c -g -dA -save-temps
...
we have at the end of the .debug_abbrev section:
...
        .uleb128 0x2116 # (DW_AT_GNU_all_tail_call_sites)
        .uleb128 0x19   # (DW_FORM_flag_present)
        .byte   0
        .byte   0
        .byte   0
        .section        .debug_aranges,"",@progbits
...
this seems like a good change:
...
$ git diff
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-cu-size.S
b/gdb/testsuite/gdb.dwarf2/dw2-cu-size.
S
index af951ea8777..18ffd2fbc00 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-cu-size.S
+++ b/gdb/testsuite/gdb.dwarf2/dw2-cu-size.S
@@ -104,3 +104,4 @@

        .byte           0x0                     /* Terminator */
        .byte           0x0                     /* Terminator */
+       .byte           0x0                     /* Terminator */
...

Indeed, with this patch, the test passes.

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

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

* [Bug symtab/27604] FAIL: gdb.dwarf2/dw2-cu-size.exp: ptype noloc
  2021-03-18 13:06 [Bug symtab/27604] New: FAIL: gdb.dwarf2/dw2-cu-size.exp: ptype noloc vries at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2021-03-18 14:29 ` vries at gcc dot gnu.org
@ 2021-03-18 20:32 ` vries at gcc dot gnu.org
  2021-03-19 18:02 ` tromey at sourceware dot org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: vries at gcc dot gnu.org @ 2021-03-18 20:32 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #4 from Tom de Vries <vries at gcc dot gnu.org> ---
Easily visible using:
...
$ readelf -wi outputs/gdb.dwarf2/dw2-cu-size/dw2-cu-size  |grep "Abbrev
Offset:"
   Abbrev Offset: 0x0
   Abbrev Offset: 0x14
   Abbrev Offset: 0x52
   Abbrev Offset: 0x64
   Abbrev Offset: 0x9b
   Abbrev Offset: 0xc3
   Abbrev Offset: 0x1db
$ readelf -wa outputs/gdb.dwarf2/dw2-cu-size/dw2-cu-size | grep "Number TAG"
  Number TAG (0x0)
  Number TAG (0x14)
  Number TAG (0x52)
  Number TAG (0x64)
  Number TAG (0x9b)
  Number TAG (0x1db)
...

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

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

* [Bug symtab/27604] FAIL: gdb.dwarf2/dw2-cu-size.exp: ptype noloc
  2021-03-18 13:06 [Bug symtab/27604] New: FAIL: gdb.dwarf2/dw2-cu-size.exp: ptype noloc vries at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2021-03-18 20:32 ` vries at gcc dot gnu.org
@ 2021-03-19 18:02 ` tromey at sourceware dot org
  2021-03-30 13:13 ` [Bug testsuite/27604] " vries at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: tromey at sourceware dot org @ 2021-03-19 18:02 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #5 from Tom Tromey <tromey at sourceware dot org> ---
(In reply to Tom de Vries from comment #3)

> Indeed, with this patch, the test passes.

It looks good to me.  Thank you for doing this.

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

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

* [Bug testsuite/27604] FAIL: gdb.dwarf2/dw2-cu-size.exp: ptype noloc
  2021-03-18 13:06 [Bug symtab/27604] New: FAIL: gdb.dwarf2/dw2-cu-size.exp: ptype noloc vries at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2021-03-19 18:02 ` tromey at sourceware dot org
@ 2021-03-30 13:13 ` vries at gcc dot gnu.org
  2021-03-30 13:16 ` cvs-commit at gcc dot gnu.org
  2021-03-30 13:17 ` vries at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: vries at gcc dot gnu.org @ 2021-03-30 13:13 UTC (permalink / raw)
  To: gdb-prs

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

Tom de Vries <vries at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|symtab                      |testsuite

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

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

* [Bug testsuite/27604] FAIL: gdb.dwarf2/dw2-cu-size.exp: ptype noloc
  2021-03-18 13:06 [Bug symtab/27604] New: FAIL: gdb.dwarf2/dw2-cu-size.exp: ptype noloc vries at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2021-03-30 13:13 ` [Bug testsuite/27604] " vries at gcc dot gnu.org
@ 2021-03-30 13:16 ` cvs-commit at gcc dot gnu.org
  2021-03-30 13:17 ` vries at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-03-30 13:16 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #6 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tom de Vries <vries@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=b953e70356feb6161a2c1c5b18dbebcdb7ea0c94

commit b953e70356feb6161a2c1c5b18dbebcdb7ea0c94
Author: Tom de Vries <tdevries@suse.de>
Date:   Tue Mar 30 15:16:26 2021 +0200

    [gdb/testsuite] Add missing .debug_abbrev terminator in dw2-cu-size.S

    Since commit 27012aba8a6 "Remove Irix 6 workaround from DWARF abbrev
reader"
    we have:
    ...
    (gdb) file dw2-cu-size^M
    Reading symbols from dw2-cu-size...^M
    DW_FORM_strp pointing outside of .debug_str section [in module
dw2-cu-size]^M
    (No debugging symbols found in dw2-cu-size)^M
    (gdb) ptype noloc^M
    No symbol table is loaded.  Use the "file" command.^M
    (gdb) FAIL: gdb.dwarf2/dw2-cu-size.exp: ptype noloc
    ...

    The problem is a missing .debug_abbrev terminator in dw2-cu-size.S, which
    causes the .debug_abbrev contribution to be merged with the next:
    ...
     Number TAG (0x9b)
       1      DW_TAG_compile_unit    [has children]
        DW_AT_name         DW_FORM_string
        DW_AT_producer     DW_FORM_string
        DW_AT_language     DW_FORM_data1
        DW_AT value: 0     DW_FORM value: 0
       2      DW_TAG_variable    [no children]
        DW_AT_name         DW_FORM_string
        DW_AT_type         DW_FORM_ref4
        DW_AT_external     DW_FORM_flag
        DW_AT value: 0     DW_FORM value: 0
       3      DW_TAG_base_type    [no children]
        DW_AT_name         DW_FORM_string
        DW_AT_byte_size    DW_FORM_data1
        DW_AT_encoding     DW_FORM_data1
        DW_AT value: 0     DW_FORM value: 0
       4      DW_TAG_const_type    [no children]
        DW_AT_type         DW_FORM_ref_udata
        DW_AT value: 0     DW_FORM value: 0
       1      DW_TAG_compile_unit    [has children]
        DW_AT_producer     DW_FORM_strp
        DW_AT_language     DW_FORM_data1
        DW_AT_name         DW_FORM_strp
        DW_AT_comp_dir     DW_FORM_strp
        DW_AT_low_pc       DW_FORM_addr
        DW_AT_high_pc      DW_FORM_data8
        DW_AT_stmt_list    DW_FORM_sec_offset
        DW_AT value: 0     DW_FORM value: 0
    ...
    and consequently, abbreviation code 1 no longer refers to a unique entry.

    The eventually causes us to access the first attribute of this DIE:
    ...
     <0><124>: Abbrev Number: 1 (DW_TAG_compile_unit)
        <125>   DW_AT_name        : file1.txt
        <12f>   DW_AT_producer    : GNU C 3.3.3
        <13b>   DW_AT_language    : 1       (ANSI C)
    ...
    which has form DW_FORM_string, using DW_FORM_strp.

    Fix this by adding the missing .debug_abbrev terminator in dw2-cu-size.S.

    gdb/testsuite/ChangeLog:

    2021-03-30  Tom de Vries  <tdevries@suse.de>

            PR testsuite/27604
            * gdb.dwarf2/dw2-cu-size.S: Add missing .debug_abbrev terminator.

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

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

* [Bug testsuite/27604] FAIL: gdb.dwarf2/dw2-cu-size.exp: ptype noloc
  2021-03-18 13:06 [Bug symtab/27604] New: FAIL: gdb.dwarf2/dw2-cu-size.exp: ptype noloc vries at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2021-03-30 13:16 ` cvs-commit at gcc dot gnu.org
@ 2021-03-30 13:17 ` vries at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: vries at gcc dot gnu.org @ 2021-03-30 13:17 UTC (permalink / raw)
  To: gdb-prs

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

Tom de Vries <vries at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |11.1

--- Comment #7 from Tom de Vries <vries at gcc dot gnu.org> ---
Patch fixing test-case committed, marking resolved-fixed.

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

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

end of thread, other threads:[~2021-03-30 13:17 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-18 13:06 [Bug symtab/27604] New: FAIL: gdb.dwarf2/dw2-cu-size.exp: ptype noloc vries at gcc dot gnu.org
2021-03-18 14:13 ` [Bug symtab/27604] " vries at gcc dot gnu.org
2021-03-18 14:25 ` vries at gcc dot gnu.org
2021-03-18 14:29 ` vries at gcc dot gnu.org
2021-03-18 20:32 ` vries at gcc dot gnu.org
2021-03-19 18:02 ` tromey at sourceware dot org
2021-03-30 13:13 ` [Bug testsuite/27604] " vries at gcc dot gnu.org
2021-03-30 13:16 ` cvs-commit at gcc dot gnu.org
2021-03-30 13:17 ` 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).