RFA: Recognize 'x' in response to 'p' packet

Jim Blandy jimb@redhat.com
Fri Dec 17 22:45:00 GMT 2004


Daniel Jacobowitz <drow@false.org> writes:
> I know this came up a bit already, but could you elaborate on why you
> had to silently provide a value of 0?  We do have a defined interface
> for 'currently not available', though we do not use it well.  This
> isn't support for the xx response, just a workaround.

I just missed it.  Is this (untested!) what you're looking for?

2004-12-17  Jim Blandy  <jimb@redhat.com>

	* remote.c (fetch_register_using_p): Recognize a register value
	starting with 'x' as indicating an unfetchable register.

Index: gdb/remote.c
===================================================================
RCS file: /cvs/src/src/gdb/remote.c,v
retrieving revision 1.155
diff -c -p -r1.155 remote.c
*** gdb/remote.c	17 Dec 2004 22:19:51 -0000	1.155
--- gdb/remote.c	17 Dec 2004 22:31:09 -0000
*************** fetch_register_using_p (int regnum)
*** 3192,3213 ****
    p += hexnumstr (p, regnum);
    *p++ = '\0';
    remote_send (buf, rs->remote_packet_size);
!   if (buf[0] != 0 && buf[0] != 'E') {
!     p = buf;
!     i = 0;
!     while (p[0] != 0) {
!       if (p[1] == 0) {
!         error("fetch_register_using_p: early buf termination");
!         return 0;
!       }
!       regp[i++] = fromhex (p[0]) * 16 + fromhex (p[1]);
!       p += 2;
      }
-     regcache_raw_supply (current_regcache, regnum, regp);
-     return 1;
-   }
  
!   return 0;
  }
  
  static void
--- 3192,3224 ----
    p += hexnumstr (p, regnum);
    *p++ = '\0';
    remote_send (buf, rs->remote_packet_size);
! 
!   /* If the stub didn't recognize the packet, or if we got an error,
!      tell our caler.  */
!   if (buf[0] == '\0' || buf[0] == 'E')
!     return 0;
! 
!   /* If this register is unfetchable, tell the regcache.  */
!   if (buf[0] == 'x')
!     {
!       regcache_raw_supply (current_regcache, regnum, NULL);
!       set_register_cached (regnum, -1);
      }
  
!   /* Otherwise, parse and supply the value.  */
!   p = buf;
!   i = 0;
!   while (p[0] != 0) {
!     if (p[1] == 0) {
!       error("fetch_register_using_p: early buf termination");
!       return 0;
!     }
! 
!     regp[i++] = fromhex (p[0]) * 16 + fromhex (p[1]);
!     p += 2;
!   }
!   regcache_raw_supply (current_regcache, regnum, regp);
!   return 1;
  }
  
  static void



More information about the Gdb-patches mailing list