[patch] Fix core dump in the Watch Window on symbol reloading.

Fernando Nasser fnasser@cygnus.com
Fri Dec 22 07:47:00 GMT 2000


This patch prevents a core dump the Watch Window, found by Tom Tromey. 
If the user changes/reloads the symbols and has expressions in the Watch
Window, it sometimes dumps core.  

What happens is that the old types are no longer valid but
the variable objects (used by the Watch Window to monitor expression values)
have this information stored internally.

The patch just removes everything from the Watch Window in this case, what is
less than ideal.  The solution is not very simple though, so I added this to
avoid core dumps until I can add some varobj magic to handle this case.

 

        * variables.tcl (constructor): Use the  file_changed_hook to remove
        all variables if the exec file changes.  This prevents the Watch
        Window to dump core because the "types" are not valid anymore.


Index: variables.tcl
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/variables.tcl,v
retrieving revision 1.3
diff -c -p -r1.3 variables.tcl
*** variables.tcl       2000/05/03 19:48:48     1.3
--- variables.tcl       2000/12/22 15:32:35
*************** class VariableWin {
*** 39,44 ****
--- 39,48 ----
        add_hook gdb_no_inferior_hook "$this no_inferior"
        add_hook gdb_idle_hook [list $this idle]
        add_hook gdb_clear_file_hook [code $this clear_file]
+         # FIXME: This is too harsh.  We must add to varobj a method
+         # to re-parse the expressions and compute new types so we can
+       # keep the contents of the window whenever possible.
+       add_hook file_changed_hook [code $this clear_file]
      }
  
      # ------------------------------------------------------------------



                                                                               
-- 
Fernando Nasser
Red Hat Canada Ltd.                     E-Mail:  fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario   M4P 2C9


More information about the Insight mailing list