Created attachment 12552 [details] gdb script which demonstrates the bug I am running v9.1 on amd64 (I compiled it from source in ubuntu 20.20 using the packaged gcc v9.3.0). This gdb script (also attached) demonstrates the problem: shell echo "int main(void) { return 0;}" > test.c shell gcc -g test.c file a.out run shell sleep 1 shell touch a.out run quit When I run this I get: $ ./gdb -q -x gdb-bug.gdb [Inferior 1 (process 257896) exited normally] `/home/andy/gdb-test/bin/a.out' has changed; re-reading symbols. warning: Probes-based dynamic linker interface failed. Reverting to original interface. [Inferior 1 (process 257902) exited normally] If I change the "shell sleep 1" to "shell sleep 0" then it works as expected: $ ./gdb -q -x ~/gdb-bug-sleep0.gdb [Inferior 1 (process 257948) exited normally] [Inferior 1 (process 257954) exited normally] In the context of a non-trivial program, whenever I see the "warning: Probes-based dynamic linker interface failed." message, this tends to mean that my stack traces will be broken (filled with ???).
Hi Andy, could you please try the following patch? It fixes the problem you described for me. It also fixes gdb.ada/exec_changed.exp, although I haven't run the full testsuite so I don't know if there are regressions. From 966cd4f85551958bf01c6469db0663f07a0c2610 Mon Sep 17 00:00:00 2001 From: Simon Marchi <simon.marchi@efficios.com> Date: Tue, 19 May 2020 21:54:24 -0400 Subject: [PATCH] gdb: reset/recompute section offset in reread_symbols --- gdb/symfile.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gdb/symfile.c b/gdb/symfile.c index dd8192a67fbb..4d0a12e533fe 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -2543,6 +2543,7 @@ reread_symbols (void) will need to be called (see discussion below). */ obstack_free (&objfile->objfile_obstack, 0); objfile->sections = NULL; + objfile->section_offsets.clear (); objfile->compunit_symtabs = NULL; objfile->template_symbols = NULL; objfile->static_links.reset (nullptr); @@ -2597,6 +2598,8 @@ reread_symbols (void) objfiles_changed (); + objfile->sf->sym_offsets (objfile, {}); + read_symbols (objfile, 0); if (!objfile_has_symbols (objfile)) -- 2.26.2
Yes, this fixes the issue at my end. I will keep on using this version of gdb as my daily driver and let you know if I see anything bad.
Thanks for testing!
This patch went in, so I'm closing this.