[v4,1/2] gdb/regcache: return REG_UNAVAILABLE in raw_read if NOT_AVAILABLE_ERROR is seen
Checks
Context |
Check |
Description |
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_gdb_build--master-arm |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_gdb_check--master-arm |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 |
success
|
Testing passed
|
Commit Message
In regcache's raw_read, it is possible that 'raw_update' fails with an
exception. This could happen, for instance, if the debugged thread is
already exited and the target cannot fetch its registers. Catch the
exception and return REG_UNAVAILABLE if the error is of kind
NOT_AVAILABLE_ERROR. This makes clients' lives easier.
Regression-tested on X86_64-Linux using the unix, native-gdbserver, and
native-extended-gdbserver board files.
---
gdb/regcache.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
@@ -616,7 +616,17 @@ readable_regcache::raw_read (int regnum, gdb::array_view<gdb_byte> dst)
assert_regnum (regnum);
gdb_assert (dst.size () == m_descr->sizeof_register[regnum]);
- raw_update (regnum);
+ try
+ {
+ raw_update (regnum);
+ }
+ catch (const gdb_exception_error &ex)
+ {
+ if (ex.error != NOT_AVAILABLE_ERROR)
+ throw;
+
+ m_register_status[regnum] = REG_UNAVAILABLE;
+ }
if (m_register_status[regnum] != REG_VALID)
memset (dst.data (), 0, dst.size ());