public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/26030] New: gold gdb-index failure
@ 2020-05-24  8:10 vries at gcc dot gnu.org
  2020-05-25 13:21 ` [Bug gdb/26030] " vries at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: vries at gcc dot gnu.org @ 2020-05-24  8:10 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 26030
           Summary: gold gdb-index failure
           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: ---

Consider target board:
...
$ cat gdb/testsuite/boards/gold-gdb-index.exp

load_board_description "local-board"

# This is based on baseboards/unix.exp.
# At the moment we only support systems that unix.exp supports.
load_generic_config "unix"
process_multilib_options ""
set found_gcc [find_gcc]
set found_gxx [find_g++]
set found_gnatmake [find_gnatmake]
set found_f90 [find_gfortran]
set found_f77 [find_g77]
set_board_info compiler "$found_gcc"

set_board_info debug_flags \
    [join { "-g" \
                "-Wl,--gdb-index" \
                "-fuse-ld=gold" }]
...

Compared to a run that adds -ggnu-pubnames, we have these extra FAILs:
...
FAIL: gdb.python/py-symbol.exp: print line number of rr
FAIL: gdb.python/py-symbol.exp: print value of rr
...

In more detail:
...
(gdb) python print (gdb.lookup_static_symbol ('rr').line)^M
18^M
FAIL: gdb.python/py-symbol.exp: print line number of rr
(gdb) python print (gdb.lookup_static_symbol ('rr').value ())^M
99^M
FAIL: gdb.python/py-symbol.exp: print value of rr
(gdb) 
...

Normally:
...
(gdb) python print (gdb.lookup_static_symbol ('rr').line)^M
46^M
PASS: gdb.python/py-symbol.exp: print line number of rr
(gdb) python print (gdb.lookup_static_symbol ('rr').value ())^M
42^M
PASS: gdb.python/py-symbol.exp: print value of rr
(gdb) 
...

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

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

* [Bug gdb/26030] gold gdb-index failure
  2020-05-24  8:10 [Bug gdb/26030] New: gold gdb-index failure vries at gcc dot gnu.org
@ 2020-05-25 13:21 ` vries at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: vries at gcc dot gnu.org @ 2020-05-25 13:21 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
[ This is similar to PR25857 - "Partial symtab expansion state influences
lookup results". ]

To reproduce on command line:
...
$ gdb -batch py-symbol.ok \
    -ex "python print (gdb.lookup_global_symbol ('rr') is None)" \
    -ex "python print (gdb.lookup_static_symbol ('rr').value ())" 
True
42
...

vs:
...
$ gdb -batch py-symbol.bad \
    -ex "python print (gdb.lookup_global_symbol ('rr') is None)" \
    -ex "python print (gdb.lookup_static_symbol ('rr').value ())" 
True
99
...

where py-symbol.ok is using ggnu-pubnames, and py-symbol.bad is without.

This gives a different state of symtab expansion, in the first case we have
(using "maint info symtabs"):
...
True
{ objfile /data/gdb_versions/devel/py-symbol.ok ((struct objfile *) 0x2afde10)
  { ((struct compunit_symtab *) 0x2b56850)
    debugformat DWARF 2
    producer GNU C11 7.5.0 -mtune=generic -march=x86-64 -g -ggnu-pubnames
-fno-stack-protector -fuse-ld=gold
    dirname /home/vries/gdb_versions/devel/build/gdb/testsuite
    blockvector ((struct blockvector *) 0x2b7b610)
    user ((struct compunit_symtab *) (null))
        { symtab
/data/gdb_versions/devel/src/gdb/testsuite/gdb.python/py-symbol.c ((struct
symtab *) 0x2b568d0)
          fullname (null)
          linetable ((struct linetable *) 0x2b7b640)
        }
  }
}
42
...
and in the second case we have:
...
True
{ objfile /data/gdb_versions/devel/py-symbol.bad ((struct objfile *) 0x24d8e10)
  { ((struct compunit_symtab *) 0x2557ac0)
    debugformat DWARF 2
    producer GNU C11 7.5.0 -mtune=generic -march=x86-64 -g -fno-stack-protector
-fuse-ld=gold
    dirname /home/vries/gdb_versions/devel/build/gdb/testsuite
    blockvector ((struct blockvector *) 0x2557fa0)
    user ((struct compunit_symtab *) (null))
        { symtab
/data/gdb_versions/devel/src/gdb/testsuite/gdb.python/py-symbol-2.c ((struct
symtab *) 0x2557b40)
          fullname (null)
          linetable ((struct linetable *) 0x2557fd0)
        }
  }
  { ((struct compunit_symtab *) 0x24b71b0)
    debugformat DWARF 2
    producer GNU C11 7.5.0 -mtune=generic -march=x86-64 -g -fno-stack-protector
-fuse-ld=gold
    dirname /home/vries/gdb_versions/devel/build/gdb/testsuite
    blockvector ((struct blockvector *) 0x2557950)
    user ((struct compunit_symtab *) (null))
        { symtab
/data/gdb_versions/devel/src/gdb/testsuite/gdb.python/py-symbol.c ((struct
symtab *) 0x24b7230)
          fullname (null)
          linetable ((struct linetable *) 0x2557980)
        }
  }
}
99
...

It seems objfile->compunit_symtabs is not sorted on section offset, but instead
on last-added-first (see add_compunit_symtab_to_objfile).

Note: this property is also exploited in partial_map_expand_apply.

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

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

end of thread, other threads:[~2020-05-25 13:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-24  8:10 [Bug gdb/26030] New: gold gdb-index failure vries at gcc dot gnu.org
2020-05-25 13:21 ` [Bug gdb/26030] " 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).