RFA: sim/arm/wrapper.c fix

glen mccready gkm@cygnus.com
Wed Mar 22 13:18:00 GMT 2000


[Sorry about the first message; misfired.]

Error messages that used `myname' were coming out garbled when
the memory it pointed to got freed too early.

Index: ChangeLog
===================================================================
RCS file: /cvs/cvsfiles/devo/sim/arm/ChangeLog,v
retrieving revision 1.77
diff -c -b -r1.77 ChangeLog
*** ChangeLog	1998/09/14 17:04:36	1.77
- --- ChangeLog	2000/03/22 20:27:15
***************
*** 1,3 ****
- --- 1,7 ----
+ Wed Mar 22 15:24:21 2000  glen mccready  <gkm@pobox.com>
+ 
+ 	* wrapper.c (sim_open,sim_close): Copy into myname, free myname
+ 
  Mon Sep 14 09:00:05 1998  Nick Clifton  <nickc@cygnus.com>
  
  	* wrapper.c (sim_open): Set endianness according to BFD or command
Index: wrapper.c
===================================================================
RCS file: /cvs/cvsfiles/devo/sim/arm/wrapper.c,v
retrieving revision 1.24
diff -c -b -r1.24 wrapper.c
*** wrapper.c	1998/09/14 17:04:36	1.24
- --- wrapper.c	2000/03/22 20:27:15
***************
*** 347,353 ****
       char **argv;
  {
    sim_kind = kind;
!   myname = argv[0];
    sim_callback = ptr;
    
    /* Decide upon the endian-ness of the processor.
- --- 347,354 ----
       char **argv;
  {
    sim_kind = kind;
!   if (myname) free(myname);
!   myname = xstrdup(argv[0]);
    sim_callback = ptr;
    
    /* Decide upon the endian-ness of the processor.
***************
*** 405,411 ****
       SIM_DESC sd;
       int quitting;
  {
!   /* nothing to do */
  }
  
  SIM_RC
- --- 406,413 ----
       SIM_DESC sd;
       int quitting;
  {
!   if (myname) free(myname);
!   myname = 0;
  }
  
  SIM_RC


More information about the Gdb-patches mailing list