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]: dcache.c, memattr.c, and sol-thread.c cleanup.


I'm going to be committing the enclosed patch shortly.

It fixes a typo in dcache.c which causes all sorts of bad things to
happen when the cache is enabled.

It changes free to xfree in memattr.c, in line with all the other 
conversions that are going on.

It also fixes one, and works around another, case where the attrib 
argument is not passed through to the target vector in sol-thread.c.
For sol_thread_xfer_memory() all that was needed to add the attrib
argument to the function and pass it through to the vector functions,
but for rw_common() I worked around by passing 0.  I'm not very happy
with this solution, but I can't figure out how to get the attributes
through.  rw_common() is called by ps_pdread(), ps_pdwrite, ps_ptread(), 
and ps_ptwrite(); but I cannot find where any of these functions are
called from.

        --jtc

2001-01-24  J.T. Conklin  <jtc@redback.com>

	* dcache.c (dcache_write_line): Fix typo.

	* memattr.c (delete_mem_region): Replace free() with xfree().
	(mem_number): Add explicit type.

	* sol-thread.c (sol_thread_xfer_memory): Add attrib argument.
	(rw_common): Likewise.

Index: dcache.c
===================================================================
RCS file: /cvs/src/src/gdb/dcache.c,v
retrieving revision 1.12
diff -c -r1.12 dcache.c
*** dcache.c	2001/01/23 22:48:55	1.12
--- dcache.c	2001/01/24 20:49:56
***************
*** 300,306 ****
  	      if (res <= 0)
  		return 0;
  
! 	      memset (db->state[XFORM(memaddr)], ENTRY_OK, res);
  	      memaddr   += res;
  	      myaddr    += res;
  	      dirty_len -= res;
--- 300,306 ----
  	      if (res <= 0)
  		return 0;
  
! 	      memset (&db->state[XFORM(memaddr)], ENTRY_OK, res);
  	      memaddr   += res;
  	      myaddr    += res;
  	      dirty_len -= res;
Index: memattr.c
===================================================================
RCS file: /cvs/src/src/gdb/memattr.c,v
retrieving revision 1.1
diff -c -r1.1 memattr.c
*** memattr.c	2001/01/23 22:48:55	1.1
--- memattr.c	2001/01/24 20:49:56
***************
*** 28,34 ****
  };
  
  static struct mem_region *mem_region_chain = NULL;
! static mem_number = 0;
  
  static struct mem_region *
  create_mem_region (CORE_ADDR lo, CORE_ADDR hi,
--- 28,34 ----
  };
  
  static struct mem_region *mem_region_chain = NULL;
! static int mem_number = 0;
  
  static struct mem_region *
  create_mem_region (CORE_ADDR lo, CORE_ADDR hi,
***************
*** 71,77 ****
  static void
  delete_mem_region (struct mem_region *m)
  {
!   free (m);
  }
  
  /*
--- 71,77 ----
  static void
  delete_mem_region (struct mem_region *m)
  {
!   xfree (m);
  }
  
  /*
Index: sol-thread.c
===================================================================
RCS file: /cvs/src/src/gdb/sol-thread.c,v
retrieving revision 1.19
diff -c -r1.19 sol-thread.c
*** sol-thread.c	2000/10/30 21:50:58	1.19
--- sol-thread.c	2001/01/24 20:49:57
***************
*** 762,767 ****
--- 762,768 ----
  
  static int
  sol_thread_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int dowrite,
+ 			struct mem_attrib *attrib,
  			struct target_ops *target)
  {
    int retval;
***************
*** 775,784 ****
    /* Note: don't need to call switch_to_thread; we're just reading memory.  */
  
    if (target_has_execution)
!     retval = procfs_ops.to_xfer_memory (memaddr, myaddr, len, dowrite, target);
    else
      retval = orig_core_ops.to_xfer_memory (memaddr, myaddr, len,
! 					   dowrite, target);
  
    do_cleanups (old_chain);
  
--- 776,786 ----
    /* Note: don't need to call switch_to_thread; we're just reading memory.  */
  
    if (target_has_execution)
!     retval = procfs_ops.to_xfer_memory (memaddr, myaddr, len, 
! 					dowrite, attrib, target);
    else
      retval = orig_core_ops.to_xfer_memory (memaddr, myaddr, len,
! 					   dowrite, attrib, target);
  
    do_cleanups (old_chain);
  
***************
*** 1060,1069 ****
      {
        int cc;
  
        if (target_has_execution)
! 	cc = procfs_ops.to_xfer_memory (addr, buf, size, dowrite, &procfs_ops);
        else
! 	cc = orig_core_ops.to_xfer_memory (addr, buf, size, dowrite, &core_ops);
  
        if (cc < 0)
  	{
--- 1062,1074 ----
      {
        int cc;
  
+       /* FIXME: passing 0 as attrib argument.  */
        if (target_has_execution)
! 	cc = procfs_ops.to_xfer_memory (addr, buf, size, 
! 					dowrite, 0, &procfs_ops);
        else
! 	cc = orig_core_ops.to_xfer_memory (addr, buf, size, 
! 					   dowrite, 0, &core_ops);
  
        if (cc < 0)
  	{


-- 
J.T. Conklin
RedBack Networks

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