public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] gdb/infrun: move a 'regcache_read_pc' call down to first use
@ 2020-05-14 12:16 Tankut Baris Aktemur
0 siblings, 0 replies; only message in thread
From: Tankut Baris Aktemur @ 2020-05-14 12:16 UTC (permalink / raw)
To: gdb-cvs
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=7ca9b62a2b63ae04d554053c2a2053d13a9d8c92
commit 7ca9b62a2b63ae04d554053c2a2053d13a9d8c92
Author: Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
Date: Thu May 14 13:59:53 2020 +0200
gdb/infrun: move a 'regcache_read_pc' call down to first use
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-05-14 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
* infrun.c (resume_1): Move a 'regcache_read_pc' call down to first
use.
Diff:
---
gdb/ChangeLog | 5 +++++
gdb/infrun.c | 3 ++-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 462884ce41e..8b756c451b4 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2020-05-14 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
+
+ * infrun.c (resume_1): Move a 'regcache_read_pc' call down to first
+ use.
+
2020-05-14 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
* regcache.c (regcache_read_pc_protected): New function
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 5e01336ab09..db88a1eef15 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -2279,7 +2279,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
@@ -2358,6 +2357,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), "
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-05-14 12:16 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-14 12:16 [binutils-gdb] gdb/infrun: move a 'regcache_read_pc' call down to first use Tankut Baris Aktemur
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).