aboutsummaryrefslogtreecommitdiff
path: root/gdb/compile/compile-cplus-symbols.c
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@efficios.com>2023-09-29 14:24:38 -0400
committerSimon Marchi <simon.marchi@efficios.com>2023-10-10 10:44:35 -0400
commit99d9c3b92ca96a7425cbb6b1bf453ede9477a2ee (patch)
tree7f642c989f7c7b49bd40ab5873fc12be632e6ea9 /gdb/compile/compile-cplus-symbols.c
parent72c4529c85907a5e1e04960ff1362a5a185553a0 (diff)
downloadbinutils-99d9c3b92ca96a7425cbb6b1bf453ede9477a2ee.zip
binutils-99d9c3b92ca96a7425cbb6b1bf453ede9477a2ee.tar.gz
binutils-99d9c3b92ca96a7425cbb6b1bf453ede9477a2ee.tar.bz2
gdb: remove target_gdbarch
This function is just a wrapper around the current inferior's gdbarch. I find that having that wrapper just obscures where the arch is coming from, and that it's often used as "I don't know which arch to use so I'll use this magical target_gdbarch function that gets me an arch" when the arch should in fact come from something in the context (a thread, objfile, symbol, etc). I think that removing it and inlining `current_inferior ()->arch ()` everywhere will make it a bit clearer where that arch comes from and will trigger people into reflecting whether this is the right place to get the arch or not. Change-Id: I79f14b4e4934c88f91ca3a3155f5fc3ea2fadf6b Reviewed-By: John Baldwin <jhb@FreeBSD.org> Approved-By: Andrew Burgess <aburgess@redhat.com>
Diffstat (limited to 'gdb/compile/compile-cplus-symbols.c')
-rw-r--r--gdb/compile/compile-cplus-symbols.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/gdb/compile/compile-cplus-symbols.c b/gdb/compile/compile-cplus-symbols.c
index ab18e63..1edbf8f 100644
--- a/gdb/compile/compile-cplus-symbols.c
+++ b/gdb/compile/compile-cplus-symbols.c
@@ -34,6 +34,7 @@
#include "cp-support.h"
#include "gdbcmd.h"
#include "compile-c.h"
+#include "inferior.h"
/* Convert a given symbol, SYM, to the compiler's representation.
INSTANCE is the compiler instance. IS_GLOBAL is true if the
@@ -89,7 +90,8 @@ convert_one_symbol (compile_cplus_instance *instance,
kind = GCC_CP_SYMBOL_FUNCTION;
addr = sym.symbol->value_block()->start ();
if (is_global && sym.symbol->type ()->is_gnu_ifunc ())
- addr = gnu_ifunc_resolve_addr (target_gdbarch (), addr);
+ addr = gnu_ifunc_resolve_addr (current_inferior ()->arch (),
+ addr);
}
break;
@@ -300,7 +302,7 @@ convert_symbol_bmsym (compile_cplus_instance *instance,
function return type cannot be function */
type = builtin_type (objfile)->nodebug_text_symbol;
kind = GCC_CP_SYMBOL_FUNCTION;
- addr = gnu_ifunc_resolve_addr (target_gdbarch (), addr);
+ addr = gnu_ifunc_resolve_addr (current_inferior ()->arch (), addr);
break;
case mst_data:
@@ -445,7 +447,8 @@ gcc_cplus_symbol_address (void *datum, struct gcc_cp_context *gcc_context,
identifier);
result = sym->value_block ()->start ();
if (sym->type ()->is_gnu_ifunc ())
- result = gnu_ifunc_resolve_addr (target_gdbarch (), result);
+ result = gnu_ifunc_resolve_addr (current_inferior ()->arch (),
+ result);
found = 1;
}
else
@@ -462,7 +465,8 @@ gcc_cplus_symbol_address (void *datum, struct gcc_cp_context *gcc_context,
identifier);
result = msym.value_address ();
if (msym.minsym->type () == mst_text_gnu_ifunc)
- result = gnu_ifunc_resolve_addr (target_gdbarch (), result);
+ result = gnu_ifunc_resolve_addr (current_inferior ()->arch (),
+ result);
found = 1;
}
}