public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug ada/25736] New: psym_map_matching_symbols finds symbol in partial symtab, but not in full symtab
@ 2020-03-27  9:55 vries at gcc dot gnu.org
  2020-03-27  9:56 ` [Bug ada/25736] " vries at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: vries at gcc dot gnu.org @ 2020-03-27  9:55 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 25736
           Summary: psym_map_matching_symbols finds symbol in partial
                    symtab, but not in full symtab
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: minor
          Priority: P2
         Component: ada
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

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.

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

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

* [Bug ada/25736] psym_map_matching_symbols finds symbol in partial symtab, but not in full symtab
  2020-03-27  9:55 [Bug ada/25736] New: psym_map_matching_symbols finds symbol in partial symtab, but not in full symtab vries at gcc dot gnu.org
@ 2020-03-27  9:56 ` vries at gcc dot gnu.org
  2020-04-02 12:48 ` vries at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: vries at gcc dot gnu.org @ 2020-03-27  9:56 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
Created attachment 12408
  --> https://sourceware.org/bugzilla/attachment.cgi?id=12408&action=edit
Assert

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

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

* [Bug ada/25736] psym_map_matching_symbols finds symbol in partial symtab, but not in full symtab
  2020-03-27  9:55 [Bug ada/25736] New: psym_map_matching_symbols finds symbol in partial symtab, but not in full symtab vries at gcc dot gnu.org
  2020-03-27  9:56 ` [Bug ada/25736] " vries at gcc dot gnu.org
@ 2020-04-02 12:48 ` vries at gcc dot gnu.org
  2022-08-04 15:12 ` tromey at sourceware dot org
  2022-10-17 20:02 ` tromey at sourceware dot org
  3 siblings, 0 replies; 5+ messages in thread
From: vries at gcc dot gnu.org @ 2020-04-02 12:48 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> ---
(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.

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

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

* [Bug ada/25736] psym_map_matching_symbols finds symbol in partial symtab, but not in full symtab
  2020-03-27  9:55 [Bug ada/25736] New: psym_map_matching_symbols finds symbol in partial symtab, but not in full symtab vries at gcc dot gnu.org
  2020-03-27  9:56 ` [Bug ada/25736] " vries at gcc dot gnu.org
  2020-04-02 12:48 ` vries at gcc dot gnu.org
@ 2022-08-04 15:12 ` tromey at sourceware dot org
  2022-10-17 20:02 ` tromey at sourceware dot org
  3 siblings, 0 replies; 5+ messages in thread
From: tromey at sourceware dot org @ 2022-08-04 15:12 UTC (permalink / raw)
  To: gdb-prs

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

Tom Tromey <tromey at sourceware dot org> changed:

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

--- Comment #3 from Tom Tromey <tromey at sourceware dot org> ---
I wonder if this still fails with the new DWARF reader.

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

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

* [Bug ada/25736] psym_map_matching_symbols finds symbol in partial symtab, but not in full symtab
  2020-03-27  9:55 [Bug ada/25736] New: psym_map_matching_symbols finds symbol in partial symtab, but not in full symtab vries at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2022-08-04 15:12 ` tromey at sourceware dot org
@ 2022-10-17 20:02 ` tromey at sourceware dot org
  3 siblings, 0 replies; 5+ messages in thread
From: tromey at sourceware dot org @ 2022-10-17 20:02 UTC (permalink / raw)
  To: gdb-prs

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

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #12408|0                           |1
        is obsolete|                            |

--- Comment #4 from Tom Tromey <tromey at sourceware dot org> ---
Created attachment 14401
  --> https://sourceware.org/bugzilla/attachment.cgi?id=14401&action=edit
updated patch

Still fails with this patch, which is updated to the new DWARF reader.

I haven't debugged any further yet.

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

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

end of thread, other threads:[~2022-10-17 20:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-27  9:55 [Bug ada/25736] New: psym_map_matching_symbols finds symbol in partial symtab, but not in full symtab vries at gcc dot gnu.org
2020-03-27  9:56 ` [Bug ada/25736] " vries at gcc dot gnu.org
2020-04-02 12:48 ` vries at gcc dot gnu.org
2022-08-04 15:12 ` tromey at sourceware dot org
2022-10-17 20:02 ` tromey at sourceware dot 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).