diff options
author | Simon Marchi <simon.marchi@efficios.com> | 2023-09-29 14:24:38 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@efficios.com> | 2023-10-10 10:44:35 -0400 |
commit | 99d9c3b92ca96a7425cbb6b1bf453ede9477a2ee (patch) | |
tree | 7f642c989f7c7b49bd40ab5873fc12be632e6ea9 /gdb/symfile.c | |
parent | 72c4529c85907a5e1e04960ff1362a5a185553a0 (diff) | |
download | gdb-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/symfile.c')
-rw-r--r-- | gdb/symfile.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/gdb/symfile.c b/gdb/symfile.c index dc2f625..5eb1638 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -1959,7 +1959,8 @@ load_progress (ULONGEST bytes, void *untyped_arg) current_uiout->message ("Loading section %s, size %s lma %s\n", args->section_name, hex_string (args->section_size), - paddress (target_gdbarch (), args->lma)); + paddress (current_inferior ()->arch (), + args->lma)); return; } @@ -1976,10 +1977,10 @@ load_progress (ULONGEST bytes, void *untyped_arg) if (target_read_memory (args->lma, check.data (), bytes) != 0) error (_("Download verify read failed at %s"), - paddress (target_gdbarch (), args->lma)); + paddress (current_inferior ()->arch (), args->lma)); if (memcmp (args->buffer, check.data (), bytes) != 0) error (_("Download verify compare failed at %s"), - paddress (target_gdbarch (), args->lma)); + paddress (current_inferior ()->arch (), args->lma)); } totals->data_count += bytes; args->lma += bytes; @@ -2091,9 +2092,9 @@ generic_load (const char *args, int from_tty) steady_clock::time_point end_time = steady_clock::now (); CORE_ADDR entry = bfd_get_start_address (loadfile_bfd.get ()); - entry = gdbarch_addr_bits_remove (target_gdbarch (), entry); + entry = gdbarch_addr_bits_remove (current_inferior ()->arch (), entry); uiout->text ("Start address "); - uiout->field_core_addr ("address", target_gdbarch (), entry); + uiout->field_core_addr ("address", current_inferior ()->arch (), entry); uiout->text (", load size "); uiout->field_unsigned ("load-size", total_progress.data_count); uiout->text ("\n"); |