public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug symtab/26800] New: [readnow] symtabs not expanded when re-reading
@ 2020-10-28 12:19 vries at gcc dot gnu.org
  2020-10-28 12:21 ` [Bug symtab/26800] " 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-10-28 12:19 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 26800
           Summary: [readnow] symtabs not expanded when re-reading
           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: ---

There's a group of FAILs with -readnow:
...
FAIL: gdb.ada/exec_changed.exp: start second
FAIL: gdb.ada/exec_changed.exp: start just first
FAIL: gdb.base/reread.exp: opts= "" "" : run to foo() second time
FAIL: gdb.base/reread.exp: opts= "" "" : second pass: run to foo() second time
FAIL: gdb.base/reread.exp: opts= "-fPIE" "ldflags=-pie" : run to foo() second
time
FAIL: gdb.base/reread.exp: opts= "-fPIE" "ldflags=-pie" : second pass: run to
foo() second time
...

This FAIL:
...
FAIL: gdb.base/reread.exp: opts= "" "" : run to foo() second time
...
can be reproduced a follows.

First, run the test-case.  Then rename the reread exec to the original name:
...
$ mv outputs/gdb.base/reread/reread outputs/gdb.base/reread/reread2
...
such that we have:
...
$ ls -1 outputs/gdb.base/reread/reread*
outputs/gdb.base/reread/reread1
outputs/gdb.base/reread/reread2
...

Then, do a run without -readnow for contrast:
...
$ gdb -batch \
    -ex "shell cp outputs/gdb.base/reread/reread1 reread" \
    -ex "file reread" \
    -ex "b foo" \
    -ex run \
    -ex "shell rm reread" \
    -ex "shell cp outputs/gdb.base/reread/reread2 reread" \
    -ex "shell sleep 1" \
    -ex run
Breakpoint 1 at 0x654: file
/home/vries/gdb_versions/devel/src/gdb/testsuite/gdb.base/reread1.c, line 14.

Breakpoint 1, foo () at
/home/vries/gdb_versions/devel/src/gdb/testsuite/gdb.base/reread1.c:14
14        x++;
`/home/vries/gdb_versions/devel/reread' has changed; re-reading symbols.

Breakpoint 1, foo () at
/home/vries/gdb_versions/devel/src/gdb/testsuite/gdb.base/reread2.c:9
9         x++;
...
Note that the second time we hit foo, it shows foo at reread2.c:9.

With -readnow however, the second time we hit foo, no file/lineno is shown:
...
Breakpoint 1 at 0x654: file
/home/vries/gdb_versions/devel/src/gdb/testsuite/gdb.base/reread1.c, line 14.

Breakpoint 1, foo () at
/home/vries/gdb_versions/devel/src/gdb/testsuite/gdb.base/reread1.c:14
14        x++;
`/home/vries/gdb_versions/devel/reread' has changed; re-reading symbols.

Breakpoint 1, 0x000055555555468e in foo ()
...

-- 
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 symtab/26800] [readnow] symtabs not expanded when re-reading
  2020-10-28 12:19 [Bug symtab/26800] New: [readnow] symtabs not expanded when re-reading vries at gcc dot gnu.org
@ 2020-10-28 12:21 ` vries at gcc dot gnu.org
  2020-11-01 17:44 ` tromey at sourceware dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: vries at gcc dot gnu.org @ 2020-10-28 12:21 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
Tentative patch (code copied from symbol_file_add_with_addrs):
...
diff --git a/gdb/symfile.c b/gdb/symfile.c
index 3332e7f69f..2d00cab743 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -2586,6 +2586,12 @@ reread_symbols (void)

          read_symbols (objfile, 0);

+         if ((objfile->flags & OBJF_READNOW))
+           {
+             if (objfile->sf)
+               objfile->sf->qf->expand_all_symtabs (objfile);
+           }
+
          if (!objfile_has_symbols (objfile))
            {
              wrap_here ("");
...

-- 
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 symtab/26800] [readnow] symtabs not expanded when re-reading
  2020-10-28 12:19 [Bug symtab/26800] New: [readnow] symtabs not expanded when re-reading vries at gcc dot gnu.org
  2020-10-28 12:21 ` [Bug symtab/26800] " vries at gcc dot gnu.org
@ 2020-11-01 17:44 ` tromey at sourceware dot org
  2021-10-11 14:56 ` vries at gcc dot gnu.org
  2021-12-07  6:53 ` vries at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: tromey at sourceware dot org @ 2020-11-01 17:44 UTC (permalink / raw)
  To: gdb-prs

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

Tom Tromey <tromey at sourceware dot org> changed:

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

--- Comment #2 from Tom Tromey <tromey at sourceware dot org> ---
We've see a number of bugs come about because reread_symbols
imperfectly duplicates the logic of symbol reading.
It would be more robust to just drop the objfile and reread it.

-- 
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 symtab/26800] [readnow] symtabs not expanded when re-reading
  2020-10-28 12:19 [Bug symtab/26800] New: [readnow] symtabs not expanded when re-reading vries at gcc dot gnu.org
  2020-10-28 12:21 ` [Bug symtab/26800] " vries at gcc dot gnu.org
  2020-11-01 17:44 ` tromey at sourceware dot org
@ 2021-10-11 14:56 ` vries at gcc dot gnu.org
  2021-12-07  6:53 ` vries at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: vries at gcc dot gnu.org @ 2021-10-11 14:56 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #3 from Tom de Vries <vries at gcc dot gnu.org> ---
Patch posted:
https://sourceware.org/pipermail/gdb-patches/2021-October/182488.html

-- 
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 symtab/26800] [readnow] symtabs not expanded when re-reading
  2020-10-28 12:19 [Bug symtab/26800] New: [readnow] symtabs not expanded when re-reading vries at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2021-10-11 14:56 ` vries at gcc dot gnu.org
@ 2021-12-07  6:53 ` vries at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: vries at gcc dot gnu.org @ 2021-12-07  6:53 UTC (permalink / raw)
  To: gdb-prs

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

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

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

--- Comment #4 from Tom de Vries <vries at gcc dot gnu.org> ---
https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=9dec38d3b11c779e8f386050ed5046aaa4e759db

-- 
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:[~2021-12-07  6:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-28 12:19 [Bug symtab/26800] New: [readnow] symtabs not expanded when re-reading vries at gcc dot gnu.org
2020-10-28 12:21 ` [Bug symtab/26800] " vries at gcc dot gnu.org
2020-11-01 17:44 ` tromey at sourceware dot org
2021-10-11 14:56 ` vries at gcc dot gnu.org
2021-12-07  6:53 ` 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).