| Summary: | psym_map_matching_symbols finds symbol in partial symtab, but not in full symtab | ||
|---|---|---|---|
| Product: | gdb | Reporter: | Tom de Vries <vries> |
| Component: | ada | Assignee: | Tom Tromey <tromey> |
| Status: | RESOLVED FIXED | ||
| Severity: | minor | CC: | sam, tromey |
| Priority: | P2 | ||
| Version: | HEAD | ||
| Target Milestone: | 18.1 | ||
| See Also: | https://sourceware.org/bugzilla/show_bug.cgi?id=16998 | ||
| Host: | Target: | ||
| Build: | Last reconfirmed: | ||
| Project(s) to access: | ssh public key: | ||
| Attachments: |
Assert
updated patch |
||
Created attachment 12408 [details]
Assert
(In reply to Tom de Vries from comment #0) > [ Likewise, we could also write an assert that if psym_map_matching_symbols > does not find a symbol in a partial symbol table, it should also not find > one in the full symbol table. ] Hmm, it sounds like such an assert would trigger for the test-case from PR25764. I wonder if this still fails with the new DWARF reader. Created attachment 14401 [details]
updated patch
Still fails with this patch, which is updated to the new DWARF reader.
I haven't debugged any further yet.
This will be fixed by the series to do searches via the quick API, probably bug #16998. I suspect this is fixed now but I haven't verified it yet. I tried this today and, as expected, the assert doesn't fire any more. |
The function psym_map_matching_symbols looks like this: ... for (partial_symtab *ps : require_partial_symbols (objfile, true)) { QUIT; if (ps->readin_p () || match_partial_symbol (objfile, ps, global, name, domain, ordered_compare)) { struct compunit_symtab *cust = psymtab_to_symtab (objfile, ps); const struct block *block; if (cust == NULL) continue; block = BLOCKVECTOR_BLOCK (COMPUNIT_BLOCKVECTOR (cust), block_kind); if (!iterate_over_symbols_terminated (block, name, domain, callback)) return; } } ... So if a symtab is not already expanded, it tries to find the symbol in the partial symtab, and if so, expands the partial symtab into the full symtab and tries to find the symbol there. I wrote an assert to check that if psym_map_matching_symbols finds a symbol in a partial symbol table, and expands it, it should find a matching symbol in the expanded symbol table. [ Likewise, we could also write an assert that if psym_map_matching_symbols does not find a symbol in a partial symbol table, it should also not find one in the full symbol table. ] In a full test run, I ran only into: ... FAIL: gdb.ada/bp_inlined_func.exp: set breakpoint at read_small (GDB internal error) ... Which can be reproduced using: ... $ gdb \ -batch \ outputs/gdb.ada/bp_inlined_func/foo \ -ex 'b main' \ -ex r \ -ex 'b read_small' ... Inspecting the assert shows that the partial/full symtabs are related to foo.adb: ... (gdb) p ps.filename $7 = 0x1a87c90 "/data/gdb_versions/devel/binutils-gdb.git/gdb/testsuite/gdb.ada/bp_inlined_func/foo.adb" (gdb) p cust.name $8 = 0x1b2ebe0 "foo.adb" ... and inspecting the partial symbols gives us: ... (gdb) call maintenance_print_psymbols (0, 0) Partial symtab for source file /data/gdb_versions/devel/binutils-gdb.git/gdb/testsuite/gdb.ada/bp_inlined_func/foo.adb (object 0x1a94660) Read from object file /data/gdb_versions/devel/build/gdb/testsuite/outputs/gdb.ada/bp_inlined_func/foo (0x13103b0) Full symtab was read (at 0x1b2eb70) Symbols cover text addresses 0x402066-0x4020a2 Address map supported - yes. Depends on 0 other partial symtabs. Global partial symbols: `_ada_foo' `foo', function, 0x402066 `b__read_small' `b.read_small', function, 0x40206f ... while inspecting the full symbols gives us: ... Symtab for file /data/gdb_versions/devel/binutils-gdb.git/gdb/testsuite/gdb.ada/bp_inlined_func/foo.adb at 0x1b2ebf0 Compilation directory is /data/gdb_versions/devel/build/gdb/testsuite/outputs/gdb.ada/bp_inlined_func Read from object file /data/gdb_versions/devel/build/gdb/testsuite/outputs/gdb.ada/bp_inlined_func/foo (0x13103b0) Language: ada Line table: line 18 at 0x402066 (stmt) line 20 at 0x40206a (stmt) line 0 at 0x40206f (stmt) line 22 at 0x40209a (stmt) line 23 at 0x40209f (stmt) line 0 at 0x4020a2 (stmt) Blockvector: block #000, object at 0x1b2f000, 1 syms/buckets in 0x402066..0x4020a2 procedure foo; block object 0x1b2ef40, 0x402066..0x4020a2 block #001, object at 0x1b2efa0 under 0x1b2f000, 0 syms/buckets in 0x402066..0x4020a2 block #002, object at 0x1b2ef40 under 0x1b2efa0, 0 syms/buckets in 0x402066..0x4020a2, function _ada_foo, foo block #003, object at 0x1b2ee90 under 0x1b2ef40, 1 syms/buckets in 0x40206f..0x40209a, function b__read_small, b.read_small procedure b.read_small; block object 0x1b2ee90, 0x40206f..0x40209a ... I'm not sure yet if my assert is wrong, and this is expected behaviour, or something needs to be fixed. Filing for further investigation later.