public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug symtab/30720] New: [gdb/symtab, gdb-index] FAIL: gdb.python/py-symbol.exp: print (len (gdb.lookup_static_symbols ('rr')))
@ 2023-08-04 14:26 vries at gcc dot gnu.org
  2023-08-04 17:36 ` [Bug symtab/30720] " vries at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: vries at gcc dot gnu.org @ 2023-08-04 14:26 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 30720
           Summary: [gdb/symtab, gdb-index] FAIL:
                    gdb.python/py-symbol.exp: print (len
                    (gdb.lookup_static_symbols ('rr')))
           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: ---

With test-case gdb.python/py-symbol.exp and target board cc-with-gdb-index, I
run into:
...
(gdb) python print (len (gdb.lookup_static_symbols ('rr')))^M
1^M
(gdb) FAIL: gdb.python/py-symbol.exp: print (len (gdb.lookup_static_symbols
('rr')))
...

This is especially confusing when you're using the index-cache.

$ rm -Rf ~/.cache/gdb/*
$ gdb -q -batch -iex "set index-cache enabled on" py-symbol \
    -ex "python print (len (gdb.lookup_static_symbols ('rr')))"
2
$ gdb -q -batch -iex "set index-cache enabled on" py-symbol \
    -ex "python print (len (gdb.lookup_static_symbols ('rr')))"
1
...

This is a regression, this passes in gdb-12-branch.

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

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

* [Bug symtab/30720] [gdb/symtab, gdb-index] FAIL: gdb.python/py-symbol.exp: print (len (gdb.lookup_static_symbols ('rr')))
  2023-08-04 14:26 [Bug symtab/30720] New: [gdb/symtab, gdb-index] FAIL: gdb.python/py-symbol.exp: print (len (gdb.lookup_static_symbols ('rr'))) vries at gcc dot gnu.org
@ 2023-08-04 17:36 ` vries at gcc dot gnu.org
  2023-08-13 12:08 ` cvs-commit at gcc dot gnu.org
  2023-08-13 12:08 ` vries at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: vries at gcc dot gnu.org @ 2023-08-04 17:36 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
https://sourceware.org/pipermail/gdb-patches/2023-August/201369.html

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

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

* [Bug symtab/30720] [gdb/symtab, gdb-index] FAIL: gdb.python/py-symbol.exp: print (len (gdb.lookup_static_symbols ('rr')))
  2023-08-04 14:26 [Bug symtab/30720] New: [gdb/symtab, gdb-index] FAIL: gdb.python/py-symbol.exp: print (len (gdb.lookup_static_symbols ('rr'))) vries at gcc dot gnu.org
  2023-08-04 17:36 ` [Bug symtab/30720] " vries at gcc dot gnu.org
@ 2023-08-13 12:08 ` cvs-commit at gcc dot gnu.org
  2023-08-13 12:08 ` vries at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-08-13 12:08 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #2 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=aef36dee93bf194cb0b976a4ae49a79a736a188d

commit aef36dee93bf194cb0b976a4ae49a79a736a188d
Author: Tom de Vries <tdevries@suse.de>
Date:   Sun Aug 13 14:08:06 2023 +0200

    [gdb/symtab] Don't deduplicate variables in gdb-index

    When running test-case gdb.python/py-symbol.exp with target board
    cc-with-gdb-index, we run into:
    ...
    (gdb) python print (len (gdb.lookup_static_symbols ('rr')))^M
    1^M
    (gdb) FAIL: gdb.python/py-symbol.exp: print (len (gdb.lookup_static_symbols
('rr')))
    ...

    [ Note that the test-case contains rr in both py-symtab.c:
    ...
    static int __attribute__ ((used)) rr = 42;      /* line of rr */
    ...
    and py-symtab-2.c:
    ...
    static int __attribute__ ((used)) rr = 99;      /* line of other rr */
    ... ]

    This passes with gdb-12-branch, and fails with gdb-13-branch.

    AFAIU the current code in symtab_index_entry::minimize makes the assumption
    that it's fine to store only one copy of rr in the gdb-index, because
    "print rr" will only ever print one, and always the same.

    But that fails to recognize that gdb supports gdb.lookup_static_symbols,
which
    returns a list of variables rather than the first one.

    In other words, the current approach breaks feature parity between cooked
    index and gdb-index.

    Note btw that also debug-names has both instances:
    ...
    [  5] #00597969 rr:
            <4> DW_TAG_variable DW_IDX_compile_unit=3 DW_IDX_GNU_internal=1
            <4> DW_TAG_variable DW_IDX_compile_unit=4 DW_IDX_GNU_internal=1
    ...

    Fix this in symtab_index_entry::minimize, by not deduplicating variables.

    Tested on x86_64-linux, with target boards unix and cc-with-gdb-index.

    Reviewed-by: Kevin Buettner <kevinb@redhat.com>

    PR symtab/30720
    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30720

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

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

* [Bug symtab/30720] [gdb/symtab, gdb-index] FAIL: gdb.python/py-symbol.exp: print (len (gdb.lookup_static_symbols ('rr')))
  2023-08-04 14:26 [Bug symtab/30720] New: [gdb/symtab, gdb-index] FAIL: gdb.python/py-symbol.exp: print (len (gdb.lookup_static_symbols ('rr'))) vries at gcc dot gnu.org
  2023-08-04 17:36 ` [Bug symtab/30720] " vries at gcc dot gnu.org
  2023-08-13 12:08 ` cvs-commit at gcc dot gnu.org
@ 2023-08-13 12:08 ` vries at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: vries at gcc dot gnu.org @ 2023-08-13 12:08 UTC (permalink / raw)
  To: gdb-prs

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

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

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

--- Comment #3 from Tom de Vries <vries at gcc dot gnu.org> ---
Fixed.

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

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

end of thread, other threads:[~2023-08-13 12:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-04 14:26 [Bug symtab/30720] New: [gdb/symtab, gdb-index] FAIL: gdb.python/py-symbol.exp: print (len (gdb.lookup_static_symbols ('rr'))) vries at gcc dot gnu.org
2023-08-04 17:36 ` [Bug symtab/30720] " vries at gcc dot gnu.org
2023-08-13 12:08 ` cvs-commit at gcc dot gnu.org
2023-08-13 12:08 ` 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).