public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug symtab/30797] New: [gdb/symtab, cc-with-dwz] FAIL: gdb.base/setshow.exp: test_setshow_annotate: annotation_level 1
@ 2023-08-25 13:46 vries at gcc dot gnu.org
  2023-08-29  9:27 ` [Bug symtab/30797] " vries at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: vries at gcc dot gnu.org @ 2023-08-25 13:46 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 30797
           Summary: [gdb/symtab, cc-with-dwz] FAIL: gdb.base/setshow.exp:
                    test_setshow_annotate: annotation_level 1
           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 target board cc-with-dwz I run into:
...
FAIL: gdb.base/setshow.exp: test_setshow_annotate: annotation_level 2 (timeout)
FAIL: gdb.base/setshow.exp: test_setshow_annotate: annotation_level 1
...

The second one in more detail:
...
(gdb) PASS: gdb.base/setshow.exp: test_setshow_annotate: show annotate (1)
info line 1^M
Line 1 of "/data/vries/gdb/src/gdb/testsuite/gdb.base/setshow.c" is at address
0x400527 <main> but contains no code.^M
Line 1 of "/data/vries/gdb/src/gdb/testsuite/gdb.base/setshow.c" is at address
0x400527 <main> but contains no code.^M
(gdb) FAIL: gdb.base/setshow.exp: test_setshow_annotate: annotation_level 1
...

Let's try this with system gdb, based on 12.1:
...
$ gcc ./src/gdb/testsuite/gdb.base/setshow.c -g
$ gdb -q -batch a.out -ex "set annotate 1" -ex "info line 1"
Line 1 of "./src/gdb/testsuite/gdb.base/setshow.c" is at address 0x400517
<main> but contains no code.
��/data/vries/gdb/binutils-gdb.git/gdb/testsuite/gdb.base/setshow.c:1:0:beg:0x400517
$ dwz a.out
$ gdb -q -batch a.out -ex "set annotate 1" -ex "info line 1"
Line 1 of "./src/gdb/testsuite/gdb.base/setshow.c" is at address 0x400517
<main> but contains no code.
��/data/vries/gdb/binutils-gdb.git/gdb/testsuite/gdb.base/setshow.c:1:0:beg:0x400517
$
...

OK, so far so good, now with master:
...
$ gcc ./src/gdb/testsuite/gdb.base/setshow.c -g
$ gdb -q -batch a.out -ex "set annotate 1" -ex "info line 1"
Line 1 of "./src/gdb/testsuite/gdb.base/setshow.c" is at address 0x400517
<main> but contains no code.
��/data/vries/gdb/binutils-gdb.git/gdb/testsuite/gdb.base/setshow.c:1:0:beg:0x400517
$ dwz a.out
$ gdb -q -batch a.out -ex "set annotate 1" -ex "info line 1"
Line 1 of "./src/gdb/testsuite/gdb.base/setshow.c" is at address 0x400517
<main> but contains no code.
Line 1 of "./src/gdb/testsuite/gdb.base/setshow.c" is at address 0x400517
<main> but contains no code.
...

So this is a gdb 12 -> gdb 13 regression.

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

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

* [Bug symtab/30797] [gdb/symtab, cc-with-dwz] FAIL: gdb.base/setshow.exp: test_setshow_annotate: annotation_level 1
  2023-08-25 13:46 [Bug symtab/30797] New: [gdb/symtab, cc-with-dwz] FAIL: gdb.base/setshow.exp: test_setshow_annotate: annotation_level 1 vries at gcc dot gnu.org
@ 2023-08-29  9:27 ` vries at gcc dot gnu.org
  2023-08-29  9:30 ` vries at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: vries at gcc dot gnu.org @ 2023-08-29  9:27 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
So there's the problem of repetition.  In info_line_command, we have the
following sals:
...
(gdb) p sals
$1 = {m_array = 0x2d6b420, m_size = 2}
(gdb) p sals[0]
$2 = (symtab_and_line &) @0x2d6b420: {pspace = 0x29eb280, symtab = 0x2d4c960,
symbol = 0x0, section = 0x0, 
  msymbol = 0x0, line = 1, pc = 0, end = 0, explicit_pc = false, explicit_line
= true, is_stmt = false, prob = 0x0, 
  objfile = 0x0}
(gdb) p sals[1]
$3 = (symtab_and_line &) @0x2d6b478: {pspace = 0x29eb280, symtab = 0x2d4c960,
symbol = 0x0, section = 0x0, 
  msymbol = 0x0, line = 1, pc = 0, end = 0, explicit_pc = false, explicit_line
= true, is_stmt = false, prob = 0x0, 
  objfile = 0x0}
...

The two items are identical.

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

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

* [Bug symtab/30797] [gdb/symtab, cc-with-dwz] FAIL: gdb.base/setshow.exp: test_setshow_annotate: annotation_level 1
  2023-08-25 13:46 [Bug symtab/30797] New: [gdb/symtab, cc-with-dwz] FAIL: gdb.base/setshow.exp: test_setshow_annotate: annotation_level 1 vries at gcc dot gnu.org
  2023-08-29  9:27 ` [Bug symtab/30797] " vries at gcc dot gnu.org
@ 2023-08-29  9:30 ` vries at gcc dot gnu.org
  2023-08-29 10:10 ` vries at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: vries at gcc dot gnu.org @ 2023-08-29  9:30 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Tom de Vries from comment #1)
> So there's the problem of repetition.

Aha.  And that's also reason for the missing line:
...
         /* If this is the only line, show the source code.  If it could        
             not find the file, don't do anything special.  */
          if (annotation_level > 0 && sals.size () == 1)
            annotate_source_line (sal.symtab, sal.line, 0, start_pc);
...

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

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

* [Bug symtab/30797] [gdb/symtab, cc-with-dwz] FAIL: gdb.base/setshow.exp: test_setshow_annotate: annotation_level 1
  2023-08-25 13:46 [Bug symtab/30797] New: [gdb/symtab, cc-with-dwz] FAIL: gdb.base/setshow.exp: test_setshow_annotate: annotation_level 1 vries at gcc dot gnu.org
  2023-08-29  9:27 ` [Bug symtab/30797] " vries at gcc dot gnu.org
  2023-08-29  9:30 ` vries at gcc dot gnu.org
@ 2023-08-29 10:10 ` vries at gcc dot gnu.org
  2023-08-29 11:02 ` vries at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: vries at gcc dot gnu.org @ 2023-08-29 10:10 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #3 from Tom de Vries <vries at gcc dot gnu.org> ---
Tentative patch:
...
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 0117a2a59d7..cfad7716cd8 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -565,6 +565,9 @@ iterate_over_some_symtabs (const char *name,

   for (cust = first; cust != NULL && cust != after_last; cust = cust->next)
     {
+      if (cust->user != nullptr)
+       continue;
+
       for (symtab *s : cust->filetabs ())
        {
          if (compare_filenames_for_search (s->filename, name))
...

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

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

* [Bug symtab/30797] [gdb/symtab, cc-with-dwz] FAIL: gdb.base/setshow.exp: test_setshow_annotate: annotation_level 1
  2023-08-25 13:46 [Bug symtab/30797] New: [gdb/symtab, cc-with-dwz] FAIL: gdb.base/setshow.exp: test_setshow_annotate: annotation_level 1 vries at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2023-08-29 10:10 ` vries at gcc dot gnu.org
@ 2023-08-29 11:02 ` vries at gcc dot gnu.org
  2023-08-29 11:50 ` vries at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: vries at gcc dot gnu.org @ 2023-08-29 11:02 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #4 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Tom de Vries from comment #0)
> So this is a gdb 12 -> gdb 13 regression.

Bisects to commit 9ed6d7410c8 ("[gdb/symtab] Fix line number of static const
class member").

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

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

* [Bug symtab/30797] [gdb/symtab, cc-with-dwz] FAIL: gdb.base/setshow.exp: test_setshow_annotate: annotation_level 1
  2023-08-25 13:46 [Bug symtab/30797] New: [gdb/symtab, cc-with-dwz] FAIL: gdb.base/setshow.exp: test_setshow_annotate: annotation_level 1 vries at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2023-08-29 11:02 ` vries at gcc dot gnu.org
@ 2023-08-29 11:50 ` vries at gcc dot gnu.org
  2023-08-31 10:38 ` vries at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: vries at gcc dot gnu.org @ 2023-08-29 11:50 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #5 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Tom de Vries from comment #4)
> (In reply to Tom de Vries from comment #0)
> > So this is a gdb 12 -> gdb 13 regression.
> 
> Bisects to commit 9ed6d7410c8 ("[gdb/symtab] Fix line number of static const
> class member").

So, it seems this is not a regression, it's just that the FAIL was hidden by 
commit 6d263fe46e0 ("Avoid bad breakpoints with --gc-sections"), until it was
unhidden by the commit mentioned above.

This fails as far back as gdb 8.3.

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

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

* [Bug symtab/30797] [gdb/symtab, cc-with-dwz] FAIL: gdb.base/setshow.exp: test_setshow_annotate: annotation_level 1
  2023-08-25 13:46 [Bug symtab/30797] New: [gdb/symtab, cc-with-dwz] FAIL: gdb.base/setshow.exp: test_setshow_annotate: annotation_level 1 vries at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2023-08-29 11:50 ` vries at gcc dot gnu.org
@ 2023-08-31 10:38 ` vries at gcc dot gnu.org
  2023-09-06  8:15 ` cvs-commit at gcc dot gnu.org
  2023-09-07 21:27 ` vries at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: vries at gcc dot gnu.org @ 2023-08-31 10:38 UTC (permalink / raw)
  To: gdb-prs

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

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

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

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

* [Bug symtab/30797] [gdb/symtab, cc-with-dwz] FAIL: gdb.base/setshow.exp: test_setshow_annotate: annotation_level 1
  2023-08-25 13:46 [Bug symtab/30797] New: [gdb/symtab, cc-with-dwz] FAIL: gdb.base/setshow.exp: test_setshow_annotate: annotation_level 1 vries at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2023-08-31 10:38 ` vries at gcc dot gnu.org
@ 2023-09-06  8:15 ` cvs-commit at gcc dot gnu.org
  2023-09-07 21:27 ` vries at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-09-06  8:15 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #7 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=7023b8d86c6f2403a4d7337e0b55fa9290181a06

commit 7023b8d86c6f2403a4d7337e0b55fa9290181a06
Author: Tom de Vries <tdevries@suse.de>
Date:   Wed Sep 6 10:14:50 2023 +0200

    [gdb/symtab] Handle PU in iterate_over_some_symtabs

    When running test-case gdb.base/setshow.exp with target board cc-with-dwz I
    run into:
    ...
    (gdb) info line 1^M
    Line 1 of "setshow.c" is at address 0x400527 <main> but contains no code.^M
    Line 1 of "setshow.c" is at address 0x400527 <main> but contains no code.^M
    (gdb) FAIL: gdb.base/setshow.exp: test_setshow_annotate: annotation_level 1
    ...
    while the expected output is:
    ...
    Line 1 of "setshow.c" is at address 0x400527 <main> but contains no code.
    ��setshow.c:1:0:beg:0x400527
    ...

    The second line of the expected output is missing due to the first line of
the
    expected output being repeated, so the problem is that the "Line 1" line is
    printed twice.

    This happens because the PU imported by the CU reuses the filetab of the
CU,
    and both the CU and PU are visited by iterate_over_some_symtabs.

    Fix this by skipping PUs in iterate_over_some_symtabs.

    Tested on x86_64-linux, target boards unix, cc-with-dwz and cc-with-dwz-m.

    Approved-By: Tom Tromey <tom@tromey.com>

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

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

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

* [Bug symtab/30797] [gdb/symtab, cc-with-dwz] FAIL: gdb.base/setshow.exp: test_setshow_annotate: annotation_level 1
  2023-08-25 13:46 [Bug symtab/30797] New: [gdb/symtab, cc-with-dwz] FAIL: gdb.base/setshow.exp: test_setshow_annotate: annotation_level 1 vries at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2023-09-06  8:15 ` cvs-commit at gcc dot gnu.org
@ 2023-09-07 21:27 ` vries at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: vries at gcc dot gnu.org @ 2023-09-07 21:27 UTC (permalink / raw)
  To: gdb-prs

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

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

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

--- Comment #8 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] 9+ messages in thread

end of thread, other threads:[~2023-09-07 21:27 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-25 13:46 [Bug symtab/30797] New: [gdb/symtab, cc-with-dwz] FAIL: gdb.base/setshow.exp: test_setshow_annotate: annotation_level 1 vries at gcc dot gnu.org
2023-08-29  9:27 ` [Bug symtab/30797] " vries at gcc dot gnu.org
2023-08-29  9:30 ` vries at gcc dot gnu.org
2023-08-29 10:10 ` vries at gcc dot gnu.org
2023-08-29 11:02 ` vries at gcc dot gnu.org
2023-08-29 11:50 ` vries at gcc dot gnu.org
2023-08-31 10:38 ` vries at gcc dot gnu.org
2023-09-06  8:15 ` cvs-commit at gcc dot gnu.org
2023-09-07 21:27 ` 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).