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]

RFA: patch to fix 'info dcache' crash


If you enable data caching (set remotecache 1) and then do an `info
dcache' before issuing a target command that creates a dcache, GDB 
crashes.  This patch avoids printing the cache state unless a dcache
has been created.

        --jtc

2000-08-10  J.T. Conklin  <jtc@redback.com>

	* dcache.c (dcache_info): Don't print cache state if last_cache 
	is NULL.

Index: dcache.c
===================================================================
RCS file: /cvs/src/src/gdb/dcache.c,v
retrieving revision 1.6
diff -c -r1.6 dcache.c
*** dcache.c	2000/08/10 18:54:27	1.6
--- dcache.c	2000/08/10 18:58:10
***************
*** 461,481 ****
    printf_filtered ("Dcache enabled, line width %d, depth %d\n",
  		   LINE_SIZE, DCACHE_SIZE);
  
!   printf_filtered ("Cache state:\n");
! 
!   for (p = last_cache->valid_head; p; p = p->p)
      {
!       int j;
!       printf_filtered ("Line at %s, referenced %d times\n",
! 		       paddr (p->addr), p->refs);
  
!       for (j = 0; j < LINE_SIZE; j++)
! 	printf_filtered ("%02x", p->data[j] & 0xFF);
!       printf_filtered ("\n");
  
!       for (j = 0; j < LINE_SIZE; j++)
! 	printf_filtered (" %2x", p->state[j]);
!       printf_filtered ("\n");
      }
  }
  
--- 461,484 ----
    printf_filtered ("Dcache enabled, line width %d, depth %d\n",
  		   LINE_SIZE, DCACHE_SIZE);
  
!   if (last_cache)
      {
!       printf_filtered ("Cache state:\n");
! 
!       for (p = last_cache->valid_head; p; p = p->p)
! 	{
! 	  int j;
! 	  printf_filtered ("Line at %s, referenced %d times\n",
! 			   paddr (p->addr), p->refs);
  
! 	  for (j = 0; j < LINE_SIZE; j++)
! 	    printf_filtered ("%02x", p->data[j] & 0xFF);
! 	  printf_filtered ("\n");
  
! 	  for (j = 0; j < LINE_SIZE; j++)
! 	    printf_filtered (" %2x", p->state[j]);
! 	  printf_filtered ("\n");
! 	}
      }
  }
  

-- 
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]