From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Ulrich Weigand <uweigand@de.ibm.com>
Cc: gdb-patches@sourceware.org,
Joel Brobecker <brobecker@adacore.com>,
Pedro Alves <alves.ped@gmail.com>
Subject: [patch] reread_symbols observer_notify_new_objfile - fix ARM unwinding after reread [Re: [patch+7.4] reread.exp 7.3->7.4 regression]
Date: Wed, 21 Dec 2011 11:46:00 -0000 [thread overview]
Message-ID: <20111221092951.GA22659@host2.jankratochvil.net> (raw)
In-Reply-To: <201112191030.pBJAUsf4028428@d06av02.portsmouth.uk.ibm.com>
On Mon, 19 Dec 2011 11:30:54 +0100, Ulrich Weigand wrote:
> In addition, we should probably call observer_notify_new_objfile so that new
> tables can be built up for the re-read file ...
Implemented.
I have tested it really fixes the problem of ARM unwinding after reread on
stripped GDB binary.
Before this fix:
./gdb -nx ./test-gdb-strip -ex 'b gdb_do_one_event' -ex r -ex bt
Breakpoint 1, 0x00372154 in gdb_do_one_event ()
#0 0x00372154 in gdb_do_one_event ()
#1 0x003722c8 in start_event_loop ()
#2 0x003741bc in cli_command_loop ()
#3 0x0036b9e0 in current_interp_command_loop ()
#4 0x0007a054 in ?? ()
#5 0x0036af08 in catch_errors ()
#6 0x0007b58c in ?? ()
#7 0x0036af08 in catch_errors ()
#8 0x0007b5c4 in gdb_main ()
#9 0x00079cd8 in main ()
(gdb) r
The program being debugged has been started already.
Start it from the beginning? (y or n) y
`/opt/jkratoch/redhat/archer-git/gdb/test-gdb-strip' has changed; re-reading symbols.
(no debugging symbols found)
[...]
Breakpoint 1, 0x00372154 in gdb_do_one_event ()
(gdb) bt
#0 0x00372154 in gdb_do_one_event ()
#1 0x003722c8 in start_event_loop ()
#2 0x003741bc in cli_command_loop ()
#3 0x0036b9e0 in current_interp_command_loop ()
#4 0x0007a054 in ?? ()
#5 0x0007a054 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
After this fix both backtraces are the same.
Testcase is not provided as I do not have some small enough ARM testcase which
unwinds with .ARM.exidx but does not unwind without it.
No regressions on {x86_64,x86_64-m32,i686}-fedora16-linux-gnu and on
arm-fedora13beta-linux-gnueabi.
Thanks,
Jan
gdb/
2011-12-20 Jan Kratochvil <jan.kratochvil@redhat.com>
* symfile.c (objfilep): New typedef and new DEF_VEC_P.
(reread_symbols): Remove variable reread_one, new variables
new_objfiles, all_cleanups and ix. Use new_objfiles instead of
reread_one. Push changed objfiles to new_objfiles, call
observer_notify_new_objfile for them later.
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -2371,15 +2371,22 @@ add_symbol_file_command (char *args, int from_tty)
}
\f
+typedef struct objfile *objfilep;
+
+DEF_VEC_P (objfilep);
+
/* Re-read symbols if a symbol-file has changed. */
void
reread_symbols (void)
{
struct objfile *objfile;
long new_modtime;
- int reread_one = 0;
struct stat new_statbuf;
int res;
+ VEC (objfilep) *new_objfiles = NULL;
+ struct cleanup *all_cleanups;
+
+ all_cleanups = make_cleanup (VEC_cleanup (objfilep), &new_objfiles);
/* With the addition of shared libraries, this should be modified,
the load time should be saved in the partial symbol tables, since
@@ -2594,21 +2601,33 @@ reread_symbols (void)
and now, we *want* this to be out of date, so don't call stat
again now. */
objfile->mtime = new_modtime;
- reread_one = 1;
init_entry_point_info (objfile);
+
+ VEC_safe_push (objfilep, new_objfiles, objfile);
}
}
- if (reread_one)
+ if (new_objfiles)
{
+ int ix;
+
/* Notify objfiles that we've modified objfile sections. */
objfiles_changed ();
clear_symtab_users (0);
+
+ /* clear_objfile_data for each objfile was called before freeing it and
+ observer_notify_new_objfile (NULL) has been called by
+ clear_symtab_users above. Notify the new files now. */
+ for (ix = 0; VEC_iterate (objfilep, new_objfiles, ix, objfile); ix++)
+ observer_notify_new_objfile (objfile);
+
/* At least one objfile has changed, so we can consider that
the executable we're debugging has changed too. */
observer_notify_executable_changed ();
}
+
+ do_cleanups (all_cleanups);
}
\f
next prev parent reply other threads:[~2011-12-21 9:30 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-18 12:00 [patch+7.4] reread.exp 7.3->7.4 regression Jan Kratochvil
2011-12-19 4:17 ` Joel Brobecker
2011-12-19 9:54 ` Jan Kratochvil
2011-12-19 10:13 ` Joel Brobecker
2011-12-19 10:31 ` Jan Kratochvil
2011-12-19 10:32 ` Ulrich Weigand
2011-12-19 19:05 ` Tom Tromey
2011-12-19 19:12 ` Jan Kratochvil
2011-12-19 20:02 ` Tom Tromey
2011-12-19 19:47 ` Jan Kratochvil
2011-12-19 21:49 ` Ulrich Weigand
2011-12-19 22:56 ` [commit+7.4] " Jan Kratochvil
2011-12-21 11:46 ` Jan Kratochvil [this message]
2011-12-21 13:13 ` [patch] reread_symbols observer_notify_new_objfile - fix ARM unwinding after reread [Re: [patch+7.4] reread.exp 7.3->7.4 regres Ulrich Weigand
2011-12-21 14:27 ` [commit] [patch] reread_symbols observer_notify_new_objfile - fix ARM unwinding after reread Jan Kratochvil
2011-12-19 15:28 ` [patch+7.4] reread.exp 7.3->7.4 regression Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20111221092951.GA22659@host2.jankratochvil.net \
--to=jan.kratochvil@redhat.com \
--cc=alves.ped@gmail.com \
--cc=brobecker@adacore.com \
--cc=gdb-patches@sourceware.org \
--cc=uweigand@de.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox