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]

[PATCH] procfs.c: allocate saved_entryset, saved_exitset


I've just committed the patch below as an "obvious" fix.

In my 2001-03-26 changes to procfs.c, I turned saved_exitset and
saved_entryset (which are both members of struct procinfo) into
pointers.  I needed to make these members pointers because the
type, sysset_t, does not have a fixed size on AIX 5.  Since it
doesn't have a fixed size, the size needs to to be determined
at runtime and the corresponding structs need to be dynamically
allocated.

Anyway... that's the part I forgot, the allocation and deallocation
of these structs when creating/destroying a struct procinfo.  The
patch below corrects that oversight.

Thanks to Peter Schauer for bringing this problem to my attention.

	* procfs.c (create_procinfo): Allocate space for saved_entryset
	and saved_exitset.
	(destroy_one_procinfo): Free space allocated to saved_entryset
	and saved_exitset.

Index: procfs.c
===================================================================
RCS file: /cvs/src/src/gdb/procfs.c,v
retrieving revision 1.31
diff -u -p -r1.31 procfs.c
--- procfs.c	2001/07/06 21:31:04	1.31
+++ procfs.c	2001/07/07 21:12:09
@@ -674,6 +674,9 @@ create_procinfo (int pid, int tid)
   load_syscalls (pi);
 #endif
 
+  pi->saved_entryset = sysset_t_alloc (pi);
+  pi->saved_exitset = sysset_t_alloc (pi);
+
   /* Chain into list.  */
   if (tid == 0)
     {
@@ -743,6 +746,8 @@ destroy_one_procinfo (procinfo **list, p
 #ifdef DYNAMIC_SYSCALLS
   free_syscalls (pi);
 #endif
+  xfree (pi->saved_entryset);
+  xfree (pi->saved_exitset);
   xfree (pi);
 }
 


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