This is the mail archive of the gdb-patches@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]

Re: [RFA] Move alloca(0) to wait_for_inferior() from registers_changed()


On 13-Nov-2000, Nick Duffek wrote:

>The appended patch moves an alloca (0) call from
>registers_changed() in regcache.c to wait_for_inferior() in infrun.c.

I haven't received a yea or nay on this yet.  Andrew, are you the person
to [dis]approve this, since neither regcache.c nor infrun.c is mentioned
in MAINTAINERS?

I've augmented the comment in infrun.c a bit; modified patch is appended.
No regressions on i686-pc-linux-gnu.

Nick

Index: gdb/infrun.c
===================================================================
diff -up gdb/infrun.c gdb/infrun.c
--- gdb/infrun.c	Mon Dec 11 12:29:47 2000
+++ gdb/infrun.c	Thu Dec 31 19:23:50 1987
@@ -1287,6 +1287,12 @@ wait_for_inferior (void)
 
   while (1)
     {
+      /* Garbage-collect libiberty's alloca() emulation here, to clean up
+	 areas allocated by low level target code that may build up during
+	 lengthy interactions between GDB and the target before GDB gives
+	 control to the user (i.e. watchpoints).  */
+      alloca (0);
+
       if (target_wait_hook)
 	ecs->pid = target_wait_hook (ecs->waiton_pid, ecs->wp);
       else
Index: gdb/regcache.c
===================================================================
diff -up gdb/regcache.c gdb/regcache.c
--- gdb/regcache.c	Mon Dec 11 12:30:23 2000
+++ gdb/regcache.c	Thu Dec 31 19:23:55 1987
@@ -295,13 +295,6 @@ registers_changed (void)
 
   registers_pid = -1;
 
-  /* Force cleanup of any alloca areas if using C alloca instead of
-     a builtin alloca.  This particular call is used to clean up
-     areas allocated by low level target code which may build up
-     during lengthy interactions between gdb and the target before
-     gdb gives control to the user (ie watchpoints).  */
-  alloca (0);
-
   for (i = 0; i < ARCH_NUM_REGS; i++)
     register_valid[i] = 0;
 

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