This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RFC: Patch ser-unix.c to only call ui hook when target running


We do want to keep the GUI alive, but sometimes too much of a good thing is bad.
This patch prevents the GUI to be called at inconvenient times (like between
a packet is sent and its acknowledgment or response).  The behavior becomes
the same as for native targets where it is only called when waiting for the inferior
(not in the middle of commands).

This was causing core dumps when people had scripts with commands that set values of
registers.

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

	* ser-unix.c (do_unix_readchar): Only call ui_loop_hook when the
	target is running.

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


Index: ser-unix.c
===================================================================
RCS file: /cvs/src/src/gdb/ser-unix.c,v
retrieving revision 1.6
diff -c -p -r1.6 ser-unix.c
*** ser-unix.c  2000/09/15 20:40:15     1.6
--- ser-unix.c  2000/10/13 20:56:34
*************** do_unix_readchar (serial_t scb, int time
*** 920,930 ****
           someone else might have freed it.  The ui_loop_hook signals that 
           we should exit by returning 1. */
  
!       if (ui_loop_hook)
!       {
!         if (ui_loop_hook (0))
!           return SERIAL_TIMEOUT;
!       }
  
        status = ser_unix_wait_for (scb, delta);
        timeout = (timeout <= 0) ? timeout : (timeout - delta);
--- 920,934 ----
           someone else might have freed it.  The ui_loop_hook signals that 
           we should exit by returning 1. */
  
!       /* NOTE: To prevent GUI commands to be issued while we are executing
!          a previous one, we just call the GUI hook when we have an infinite
!          timeout (that means that our target is running).  FN */
! 
!       if (ui_loop_hook && (timeout < 0))
!         {
!           if (ui_loop_hook (0))
!             return SERIAL_TIMEOUT;
!         }
  
        status = ser_unix_wait_for (scb, delta);
        timeout = (timeout <= 0) ? timeout : (timeout - delta);

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]