[PATCH v5 2/5] gdb/infrun: move a 'regcache_read_pc' call down to first use
Tankut Baris Aktemur
tankut.baris.aktemur@intel.com
Mon Apr 6 15:45:48 GMT 2020
In infrun.c's resume_1 function, move the definition of the local
variable PC down to its first use. This is useful if the thread we want
to resume is already gone with a pending exit event, because we avoid
the error we would see otherwise when trying to read the PC.
gdb/ChangeLog:
2020-04-03 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
* infrun.c (resume_1): Move a 'regcache_read_pc' call down to first
use.
---
gdb/infrun.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/gdb/infrun.c b/gdb/infrun.c
index d6265c6df51..f5d3b79e0d0 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -2271,7 +2271,6 @@ resume_1 (enum gdb_signal sig)
struct regcache *regcache = get_current_regcache ();
struct gdbarch *gdbarch = regcache->arch ();
struct thread_info *tp = inferior_thread ();
- CORE_ADDR pc = regcache_read_pc (regcache);
const address_space *aspace = regcache->aspace ();
ptid_t resume_ptid;
/* This represents the user's step vs continue request. When
@@ -2350,6 +2349,8 @@ resume_1 (enum gdb_signal sig)
step = 0;
}
+ CORE_ADDR pc = regcache_read_pc (regcache);
+
if (debug_infrun)
fprintf_unfiltered (gdb_stdlog,
"infrun: resume (step=%d, signal=%s), "
--
2.17.1
More information about the Gdb-patches
mailing list