From 9c742269ec8507d924d7a0c815155ca5aa21467a Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Sun, 5 Nov 2023 04:47:26 +0000 Subject: gdb: remove get_current_regcache Remove get_current_regcache, inlining the call to get_thread_regcache in callers. When possible, pass the right thread_info object known from the local context. Otherwise, fall back to passing `inferior_thread ()`. This makes the reference to global context bubble up one level, a small step towards the long term goal of reducing the number of references to global context (or rather, moving those references as close as possible to the top of the call tree). No behavior change expected. Change-Id: Ifa6980c88825d803ea586546b6b4c633c33be8d6 --- gdb/stack.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'gdb/stack.c') diff --git a/gdb/stack.c b/gdb/stack.c index 39dcefa..ef56544 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -2798,13 +2798,13 @@ return_command (const char *retval_exp, int from_tty) if (return_value != NULL) { struct type *return_type = return_value->type (); - struct gdbarch *cache_arch = get_current_regcache ()->arch (); + regcache *regcache = get_thread_regcache (inferior_thread ()); + struct gdbarch *cache_arch = regcache->arch (); gdb_assert (rv_conv != RETURN_VALUE_STRUCT_CONVENTION && rv_conv != RETURN_VALUE_ABI_RETURNS_ADDRESS); gdbarch_return_value_as_value - (cache_arch, function, return_type, - get_current_regcache (), NULL /*read*/, + (cache_arch, function, return_type, regcache, NULL /*read*/, return_value->contents ().data () /*write*/); } -- cgit v1.1