This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[ob] Clear current symtab before reseting breakpoints
- From: Daniel Jacobowitz <drow at false dot org>
- To: gdb-patches at sources dot redhat dot com
- Date: Tue, 8 Mar 2005 16:43:06 -0500
- Subject: [ob] Clear current symtab before reseting breakpoints
This is a crash I noticed the other day... breakpoint_re_set_one can call
decode_line_1, which will access the 'current' symtab. But when
clear_symtab_users is called, the current symtab is invalid - worse than
invalid, it's a garbage pointer. So be sure to NULL it out before calling
anything which might use it.
Committed as obvious.
--
Daniel Jacobowitz
CodeSourcery, LLC
2005-03-08 Daniel Jacobowitz <dan@codesourcery.com>
* symfile.c (clear_symtab_users): Call
clear_current_source_symtab_and_line first.
Index: symfile.c
===================================================================
RCS file: /big/fsf/rsync/src-cvs/src/gdb/symfile.c,v
retrieving revision 1.144
diff -u -p -r1.144 symfile.c
--- symfile.c 23 Oct 2004 16:18:09 -0000 1.144
+++ symfile.c 29 Dec 2004 18:55:50 -0000
@@ -2329,12 +2329,16 @@ clear_symtab_users (void)
{
/* Someday, we should do better than this, by only blowing away
the things that really need to be blown. */
+
+ /* Clear the "current" symtab first, because it is no longer valid.
+ breakpoint_re_set may try to access the current symtab. */
+ clear_current_source_symtab_and_line ();
+
clear_value_history ();
clear_displays ();
clear_internalvars ();
breakpoint_re_set ();
set_default_breakpoint (0, 0, 0, 0);
- clear_current_source_symtab_and_line ();
clear_pc_function_cache ();
if (deprecated_target_new_objfile_hook)
deprecated_target_new_objfile_hook (NULL);