aboutsummaryrefslogtreecommitdiff
path: root/gdb/darwin-nat-info.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/darwin-nat-info.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/darwin-nat-info.c')
-rw-r--r--gdb/darwin-nat-info.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/gdb/darwin-nat-info.c b/gdb/darwin-nat-info.c
index d5f633b..07b06b3 100644
--- a/gdb/darwin-nat-info.c
+++ b/gdb/darwin-nat-info.c
@@ -570,9 +570,10 @@ darwin_debug_regions (task_t task, mach_vm_address_t address, int max)
if (print)
{
+ gdbarch *arch = current_inferior ()->arch ();
gdb_printf (_("%s-%s %s/%s %s %s %s"),
- paddress (target_gdbarch (), prev_address),
- paddress (target_gdbarch (), prev_address + prev_size),
+ paddress (arch, prev_address),
+ paddress (arch, prev_address + prev_size),
unparse_protection (prev_info.protection),
unparse_protection (prev_info.max_protection),
unparse_inheritance (prev_info.inheritance),
@@ -618,7 +619,7 @@ darwin_debug_regions_recurse (task_t task)
ui_out_emit_table table_emitter (uiout, 9, -1, "regions");
- if (gdbarch_addr_bit (target_gdbarch ()) <= 32)
+ if (gdbarch_addr_bit (current_inferior ()->arch ()) <= 32)
{
uiout->table_header (10, ui_left, "start", "Start");
uiout->table_header (10, ui_left, "end", "End");
@@ -654,9 +655,10 @@ darwin_debug_regions_recurse (task_t task)
{
ui_out_emit_tuple tuple_emitter (uiout, "regions-row");
+ gdbarch *arch = current_inferior ()->arch ();
- uiout->field_core_addr ("start", target_gdbarch (), r_start);
- uiout->field_core_addr ("end", target_gdbarch (), r_start + r_size);
+ uiout->field_core_addr ("start", arch, r_start);
+ uiout->field_core_addr ("end", arch, r_start + r_size);
uiout->field_string ("min-prot",
unparse_protection (r_info.protection));
uiout->field_string ("max-prot",