Skip to content

Commit 57fb9be

Browse files
dcpleungstephanosio
authored andcommitted
gdb: xtensa: don't error out when registers cannot be read
On Xtensa, some privileged registers cannot be read using 'p' packet. So keep these marked as unavailable so GDB can still fetch other registers instead of stopping at error. Signed-off-by: Daniel Leung <daniel.leung@intel.com>
1 parent c1e3f09 commit 57fb9be

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

gdb/remote.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8869,6 +8869,7 @@ remote_target::fetch_register_using_p (struct regcache *regcache,
88698869
char *buf, *p;
88708870
gdb_byte *regp = (gdb_byte *) alloca (register_size (gdbarch, reg->regnum));
88718871
int i;
8872+
enum bfd_architecture bfd_arch = gdbarch_bfd_arch_info (gdbarch)->arch;
88728873

88738874
if (m_features.packet_support (PACKET_p) == PACKET_DISABLE)
88748875
return 0;
@@ -8893,6 +8894,15 @@ remote_target::fetch_register_using_p (struct regcache *regcache,
88938894
case PACKET_UNKNOWN:
88948895
return 0;
88958896
case PACKET_ERROR:
8897+
/* On Xtensa, some privileged registers cannot be read using 'p'
8898+
packet. So keep these marked as unavailable so GDB can still
8899+
fetch other registers instead of stopping at error. */
8900+
if (bfd_arch == bfd_arch_xtensa)
8901+
{
8902+
regcache->raw_supply (reg->regnum, NULL);
8903+
return 1;
8904+
}
8905+
88968906
error (_("Could not fetch register \"%s\"; remote failure reply '%s'"),
88978907
gdbarch_register_name (regcache->arch (), reg->regnum),
88988908
result.err_msg ());

0 commit comments

Comments
 (0)