public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug go/30941] New: [gdb/go] cannot find package2.Foo in expanded symtab containing go.package2.Foo
@ 2023-10-05 12:28 vries at gcc dot gnu.org
  2023-10-05 13:09 ` [Bug go/30941] " vries at gcc dot gnu.org
  2023-10-05 21:22 ` cvs-commit at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: vries at gcc dot gnu.org @ 2023-10-05 12:28 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 30941
           Summary: [gdb/go] cannot find package2.Foo in expanded symtab
                    containing go.package2.Foo
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: go
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

While investigating PR27238, I found that when not generating dwarf info:
...
$ gccgo-7 ./src/gdb/testsuite/gdb.go/package2.go -c -g0
$ gccgo-7 ./src/gdb/testsuite/gdb.go/package1.go package2.o -g0
$ gdb -q -batch a.out -ex "break package2.Foo"
Breakpoint 1 at 0x402563
...
the breakpoint is set just fine.

When generating dwarf info:
...
$ gccgo-7 ./src/gdb/testsuite/gdb.go/package2.go -c -g
$ gccgo-7 ./src/gdb/testsuite/gdb.go/package1.go package2.o -g
$ gdb -q -batch a.out -ex "break package2.Foo"
Breakpoint 1 at 0x402563: file ./src/gdb/testsuite/gdb.go/package2.go, line 5.
...
we get line info in addition, but the dwarf is not actually used to find the
function address.

I only found this out during debugging, I didn't find a good way to demonstrate
it otherwise:
...
(gdb) fin
Run till exit from #0  find_linespec_symbols (state=0x7fffffffcd10, 
    file_symtabs=std::vector of length 1, capacity 1 = {...},
    lookup_name=0x370a770 "package2.Foo", 
    name_match_type=symbol_name_match_type::WILD,
    symbols=0x7fffffffc980,
    minsyms=0x7fffffffc960)
    at /data/vries/gdb/src/gdb/linespec.c:3814
linespec_parse_basic (parser=0x7fffffffcce0) at linespec.c:1822
1822          if (!symbols.empty () || !minimal_symbols.empty ())
(gdb) p symbols.empty ()
$1 = true
(gdb) p minimal_symbols.empty ()
$2 = false
...

The expansion of the symtab seems to be happening, but the following search in
the expanded symtab fails to return anything.

My guess is that package2.Foo fails to match on go.package2.Foo:
...
block #000, object at 0x476a640, 2 symbols in 0x402563..0x40263f
 void go.package2.Foo(void); block object 0x476a4c0, 0x402563..0x40263f section
.text
 package2;

  block #001, object at 0x476a5f0 under 0x476a640, 0 symbols in
0x402563..0x40263f
    block #002, object at 0x476a4c0 under 0x476a5f0, 0 symbols in
0x402563..0x40263f, function go.package2.Foo, go.package2.Foo
...

I tried the same with -ex "break go.package2.Foo", and in that case gdb does
manage to find it in the expanded symtab.

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

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

end of thread, other threads:[~2023-10-05 21:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-05 12:28 [Bug go/30941] New: [gdb/go] cannot find package2.Foo in expanded symtab containing go.package2.Foo vries at gcc dot gnu.org
2023-10-05 13:09 ` [Bug go/30941] " vries at gcc dot gnu.org
2023-10-05 21:22 ` cvs-commit 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).