[binutils-gdb] Use get_thread_regcache instead of get_current_regcache in post_create_inferior
Simon Marchi
simark@sourceware.org
Wed Jan 15 17:50:00 GMT 2020
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=8dc3273e0c50b607ee97873ae745cbc0d3ec6d7f
commit 8dc3273e0c50b607ee97873ae745cbc0d3ec6d7f
Author: Simon Marchi <simon.marchi@efficios.com>
Date: Wed Jan 15 12:47:44 2020 -0500
Use get_thread_regcache instead of get_current_regcache in post_create_inferior
In post_create_inferior, we get the current thread using the
inferior_thread function and store it in `thr`. We then call
get_current_regcache immediately after, which does:
return get_thread_regcache (inferior_thread ());
This patch makes post_create_inferior use get_thread_regcache, passing
`thr`, saving an unnecessary inferior_thread call.
gdb/ChangeLog:
* infcmd.c (post_create_inferior): Use get_thread_regcache
instead of get_current_regcache.
Diff:
---
gdb/ChangeLog | 5 +++++
gdb/infcmd.c | 3 ++-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index d348abb..cd89a44 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2020-01-15 Simon Marchi <simon.marchi@efficios.com>
+
+ * infcmd.c (post_create_inferior): Use get_thread_regcache
+ instead of get_current_regcache.
+
2020-01-14 Tom Tromey <tom@tromey.com>
PR symtab/12535:
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index cf8b312..3e7c43f 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -441,7 +441,8 @@ post_create_inferior (struct target_ops *target, int from_tty)
thr->suspend.stop_pc = 0;
try
{
- thr->suspend.stop_pc = regcache_read_pc (get_current_regcache ());
+ regcache *rc = get_thread_regcache (thr);
+ thr->suspend.stop_pc = regcache_read_pc (rc);
}
catch (const gdb_exception_error &ex)
{
More information about the Gdb-cvs
mailing list