aboutsummaryrefslogtreecommitdiff
path: root/gdb/mi/mi-interp.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/mi/mi-interp.c
parent72c4529c85907a5e1e04960ff1362a5a185553a0 (diff)
downloadgdb-99d9c3b92ca96a7425cbb6b1bf453ede9477a2ee.zip
gdb-99d9c3b92ca96a7425cbb6b1bf453ede9477a2ee.tar.gz
gdb-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/mi/mi-interp.c')
-rw-r--r--gdb/mi/mi-interp.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c
index b3b0f5b..0d3c823 100644
--- a/gdb/mi/mi-interp.c
+++ b/gdb/mi/mi-interp.c
@@ -726,13 +726,13 @@ mi_interp::on_target_resumed (ptid_t ptid)
void
mi_output_solib_attribs (ui_out *uiout, struct so_list *solib)
{
- struct gdbarch *gdbarch = target_gdbarch ();
+ gdbarch *gdbarch = current_inferior ()->arch ();
uiout->field_string ("id", solib->so_original_name);
uiout->field_string ("target-name", solib->so_original_name);
uiout->field_string ("host-name", solib->so_name);
uiout->field_signed ("symbols-loaded", solib->symbols_loaded);
- if (!gdbarch_has_global_solist (target_gdbarch ()))
+ if (!gdbarch_has_global_solist (current_inferior ()->arch ()))
uiout->field_fmt ("thread-group", "i%d", current_inferior ()->num);
ui_out_emit_list list_emitter (uiout, "ranges");
@@ -776,7 +776,7 @@ mi_interp::on_solib_unloaded (so_list *solib)
uiout->field_string ("id", solib->so_original_name);
uiout->field_string ("target-name", solib->so_original_name);
uiout->field_string ("host-name", solib->so_name);
- if (!gdbarch_has_global_solist (target_gdbarch ()))
+ if (!gdbarch_has_global_solist (current_inferior ()->arch ()))
uiout->field_fmt ("thread-group", "i%d", current_inferior ()->num);
gdb_flush (this->event_channel);
@@ -821,7 +821,7 @@ mi_interp::on_memory_changed (inferior *inferior, CORE_ADDR memaddr,
ui_out_redirect_pop redir (mi_uiout, this->event_channel);
mi_uiout->field_fmt ("thread-group", "i%d", inferior->num);
- mi_uiout->field_core_addr ("addr", target_gdbarch (), memaddr);
+ mi_uiout->field_core_addr ("addr", current_inferior ()->arch (), memaddr);
mi_uiout->field_string ("len", hex_string (len));
/* Append 'type=code' into notification if MEMADDR falls in the range of