gdb: protect some 'regcache_read_pc' calls
authorTankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Thu, 14 May 2020 11:59:53 +0000 (13:59 +0200)
committerTankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Thu, 14 May 2020 11:59:53 +0000 (13:59 +0200)
commitfc75c28ba1ea7353fb6e1e5904c5703a48504b67
tree5b1a59f1c2cb60a34c7ca6b34e7868aaac49c975
parent9d95b8e9d631e76eb152c86003db6b89e913bdd9
gdb: protect some 'regcache_read_pc' calls

It possible that a thread whose PC we attempt to read is already dead.
In this case, 'regcache_read_pc' errors out.  This impacts the
"proceed" execution flow, where GDB quits early before having a chance
to check if there exists a pending event.  To remedy, keep going with
a 0 value for the PC if 'regcache_read_pc' fails.  Because the value
of PC before resuming a thread is mostly used for storing and checking
the next time the thread stops, this tolerance is expected to be
harmless for a dead thread/process.

gdb/ChangeLog:
2020-05-14  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

* regcache.c (regcache_read_pc_protected): New function
implementation that returns 0 if the PC cannot read via
'regcache_read_pc'.
* infrun.c (proceed): Call 'regcache_read_pc_protected'
instead of 'regcache_read_pc'.
(keep_going_pass_signal): Ditto.

gdbsupport/ChangeLog:
2020-05-14  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

* common-regcache.h (regcache_read_pc_protected): New function
declaration.
gdb/ChangeLog
gdb/infrun.c
gdb/regcache.c
gdbsupport/ChangeLog
gdbsupport/common-regcache.h
This page took 0.024755 seconds and 4 git commands to generate.