public inbox for insight@sourceware.org
 help / color / mirror / Atom feed
* FYI: Fix to Steven's 1st core dump is (partially) in the sources
@ 2000-10-13 15:04 Fernando Nasser
  2000-10-17 13:10 ` FYI: Fix to Steven's 1st core dump - 2nd part Fernando Nasser
  0 siblings, 1 reply; 3+ messages in thread
From: Fernando Nasser @ 2000-10-13 15:04 UTC (permalink / raw)
  To: insight

The following fix was applied to the sources.  The other part is a gdb change and
I have submitted it to the gdb list for approval.  As this one is independent it
can go in.  But it only covers some of the scenarios (this was a hairy race
condition that took Steven and I many ours of debugging).


2000-10-13  Fernando Nasser  <fnasser@cygnus.com>

	With Steven Johnson <sbjohnson@ozemail.com.au>
        This change fixes part of the possible scenarios where a race condition
	would cause core dumps if there were commands changing registers or other
	target resources in a startup script.
        The remaining scenarios are fixed by a patch to gdb/ser-unix.c.
	* interface.tcl (gdbtk_update_safe): New function. Like gdbtk_update
	but does nothing if target is running.
	(gdbtk_register_changed): Call the above safe version.
	(gdbtk_memory_changed): Likewise.

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


Index: interface.tcl
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/interface.tcl,v
retrieving revision 1.4
diff -c -p -r1.4 interface.tcl
*** interface.tcl       2000/03/28 01:59:39     1.4
--- interface.tcl       2000/10/13 22:03:39
*************** proc gdbtk_update {} {
*** 145,150 ****
--- 145,171 ----
  }
  
  # ------------------------------------------------------------------
+ #   PROCEDURE:  gdbtk_update_safe - run all update hooks in a safe way
+ #
+ #          Use this procedure to force all widgets to update
+ #          themselves. This hook is usually run after command
+ #          that could change target state.
+ #          Like gdbtk_update but safe to be used in "after idle"
+ #          which is used in update hooks.
+ # ------------------------------------------------------------------
+ proc gdbtk_update_safe {} {
+   global gdb_running
+ 
+   # Fencepost: Do not update if we are running the target
+   # We get here because script commands may have changed memory or
+   # registers and "after idle" events registered as a consequence
+   # If we try to update while the target is running we are doomed.
+   if {!$gdb_running} {
+     gdbtk_update
+   }
+ }
+ 
+ # ------------------------------------------------------------------
  #   PROCEDURE: gdbtk_idle - run all idle hooks
  #
  #          Use this procedure to run all the gdb_idle_hook's,
*************** proc gdbtk_tcl_display {action number {v
*** 548,554 ****
  #         the user has changed the contents of a register.
  # ------------------------------------------------------------------
  proc gdbtk_register_changed {} {
!   after idle gdbtk_update
  }
  
  # ------------------------------------------------------------------
--- 569,575 ----
  #         the user has changed the contents of a register.
  # ------------------------------------------------------------------
  proc gdbtk_register_changed {} {
!   after idle gdbtk_update_safe
  }
  
  # ------------------------------------------------------------------
*************** proc gdbtk_register_changed {} {
*** 558,564 ****
  #         the program's variables).
  # ------------------------------------------------------------------
  proc gdbtk_memory_changed {} {
!   after idle gdbtk_update
  }
  
  ####################################################################
--- 579,585 ----
  #         the program's variables).
  # ------------------------------------------------------------------
  proc gdbtk_memory_changed {} {
!   after idle gdbtk_update_safe
  }
  
  ####################################################################

^ permalink raw reply	[flat|nested] 3+ messages in thread

* FYI: Fix to Steven's 1st core dump - 2nd part
  2000-10-13 15:04 FYI: Fix to Steven's 1st core dump is (partially) in the sources Fernando Nasser
@ 2000-10-17 13:10 ` Fernando Nasser
       [not found]   ` <39ECDF74.187CEB95@ozemail.com.au>
  0 siblings, 1 reply; 3+ messages in thread
From: Fernando Nasser @ 2000-10-17 13:10 UTC (permalink / raw)
  To: insight, sbjohnson

This is an Insight fix, instead of the gdb fix that Steven has already tested.

It worked for me with the other problem that I mentioned (with very different symptoms
but nevertheless related to this one).

If it works for Steven, i.e., if he uses this patch in lieu of the patch to
ser-unix.c and does not get core dumps (or any other malfunction), we should
add this patch to the insight sources and leave gdb alone.

Steven: thanks a lot for doing this tests!


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



Index: gdbtk/generic/gdbtk-hooks.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/gdbtk/generic/gdbtk-hooks.c,v
retrieving revision 1.4
diff -c -p -r1.4 gdbtk-hooks.c
*** gdbtk-hooks.c       2000/05/01 04:46:49     1.4
--- gdbtk-hooks.c       2000/10/17 20:03:12
*************** x_event (signo)
*** 416,422 ****
--- 416,432 ----
    static volatile int in_x_event = 0;
    static Tcl_Obj *varname = NULL;
    static int count = 0;
+ 
+   /* Do nor re-enter this code or enter it while collecting gdb output. */
    if (in_x_event || in_fputs)
+     return 0;
+ 
+   /* Also, only do things while the target is running (stops and redraws).
+      FIXME: We wold like to at least redraw at other times but this is bundled
+      together in the TCL_WINDOW_EVENTS group and we would also process user
+      input.  We will have to prevent (unwanted)  user input to be generated
+      in order to be able to redraw (removing this test here). */
+   if (!running_now)
      return 0;
  
    in_x_event = 1;

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: FYI: Fix to Steven's 1st core dump - 2nd part
       [not found]   ` <39ECDF74.187CEB95@ozemail.com.au>
@ 2000-10-17 20:23     ` Fernando Nasser
  0 siblings, 0 replies; 3+ messages in thread
From: Fernando Nasser @ 2000-10-17 20:23 UTC (permalink / raw)
  To: Steven Johnson; +Cc: insight

Steven Johnson wrote:
> 
> Fernando,
> 
> Works for me ...
> 
> Steven Johnson.
> 

Thanks a lot Steven.  I will make this the official fix and check it in the sources
sometime tomorrow.

Cheers,
Fernando


> Fernando Nasser wrote:
> >
> > This is an Insight fix, instead of the gdb fix that Steven has already tested.
> >
> > It worked for me with the other problem that I mentioned (with very different symptoms
> > but nevertheless related to this one).
> >
> > If it works for Steven, i.e., if he uses this patch in lieu of the patch to
> > ser-unix.c and does not get core dumps (or any other malfunction), we should
> > add this patch to the insight sources and leave gdb alone.
> >
> > Steven: thanks a lot for doing this tests!
> >
> > --
> > Fernando Nasser
> > Red Hat - Toronto                       E-Mail:  fnasser@redhat.com
> > 2323 Yonge Street, Suite #300
> > Toronto, Ontario   M4P 2C9
> >
> > Index: gdbtk/generic/gdbtk-hooks.c
> > ===================================================================
> > RCS file: /cvs/cvsfiles/devo/gdb/gdbtk/generic/gdbtk-hooks.c,v
> > retrieving revision 1.4
> > diff -c -p -r1.4 gdbtk-hooks.c
> > *** gdbtk-hooks.c       2000/05/01 04:46:49     1.4
> > --- gdbtk-hooks.c       2000/10/17 20:03:12
> > *************** x_event (signo)
> > *** 416,422 ****
> > --- 416,432 ----
> >     static volatile int in_x_event = 0;
> >     static Tcl_Obj *varname = NULL;
> >     static int count = 0;
> > +
> > +   /* Do nor re-enter this code or enter it while collecting gdb output. */
> >     if (in_x_event || in_fputs)
> > +     return 0;
> > +
> > +   /* Also, only do things while the target is running (stops and redraws).
> > +      FIXME: We wold like to at least redraw at other times but this is bundled
> > +      together in the TCL_WINDOW_EVENTS group and we would also process user
> > +      input.  We will have to prevent (unwanted)  user input to be generated
> > +      in order to be able to redraw (removing this test here). */
> > +   if (!running_now)
> >       return 0;
> >
> >     in_x_event = 1;

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2000-10-17 20:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-10-13 15:04 FYI: Fix to Steven's 1st core dump is (partially) in the sources Fernando Nasser
2000-10-17 13:10 ` FYI: Fix to Steven's 1st core dump - 2nd part Fernando Nasser
     [not found]   ` <39ECDF74.187CEB95@ozemail.com.au>
2000-10-17 20:23     ` Fernando Nasser

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).