X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=gdb%2Fregcache.c;h=3bf0b47b3517f593e71e9ad99ff15669006d1131;hb=1d9d99f32d861ae85dd59689ada801cc51d3ac91;hp=ffd13bf8a4ba510365bdf2b961bfcb85943af229;hpb=1297a2f020b41485135f3e58100d689799785ee5;p=binutils-gdb.git diff --git a/gdb/regcache.c b/gdb/regcache.c index ffd13bf8a4b..3bf0b47b351 100644 --- a/gdb/regcache.c +++ b/gdb/regcache.c @@ -230,9 +230,6 @@ read_register_bytes (int in_start, char *in_buf, int in_len) int end; int byte; - if (REGISTER_NAME (regnum) == NULL || *REGISTER_NAME (regnum) == '\0') - continue; - reg_start = REGISTER_BYTE (regnum); reg_len = REGISTER_RAW_SIZE (regnum); reg_end = reg_start + reg_len; @@ -241,8 +238,18 @@ read_register_bytes (int in_start, char *in_buf, int in_len) /* The range the user wants to read doesn't overlap with regnum. */ continue; - /* Force the cache to fetch the entire register. */ - read_register_gen (regnum, reg_buf); + if (REGISTER_NAME (regnum) != NULL && *REGISTER_NAME (regnum) != '\0') + /* Force the cache to fetch the entire register. */ + read_register_gen (regnum, reg_buf); + else + /* Legacy note: even though this register is ``invalid'' we + still need to return something. It would appear that some + code relies on apparent gaps in the register array also + being returned. */ + /* FIXME: cagney/2001-08-18: This is just silly. It defeats + the entire register read/write flow of control. Must + resist temptation to return 0xdeadbeef. */ + memcpy (reg_buf, registers + reg_start, reg_len); /* Legacy note: This function, for some reason, allows a NULL input buffer. If the buffer is NULL, the registers are still