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/regcache-dump.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/regcache-dump.c')
-rw-r--r-- | gdb/regcache-dump.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/gdb/regcache-dump.c b/gdb/regcache-dump.c index 9387cfd..5f43895 100644 --- a/gdb/regcache-dump.c +++ b/gdb/regcache-dump.c @@ -24,6 +24,7 @@ #include "reggroups.h" #include "target.h" #include "gdbarch.h" +#include "inferior.h" /* Dump registers from regcache, used for dumping raw registers and cooked registers. */ @@ -234,7 +235,7 @@ regcache_print (const char *args, enum regcache_dump_what what_to_dump) if (target_has_registers ()) gdbarch = get_current_regcache ()->arch (); else - gdbarch = target_gdbarch (); + gdbarch = current_inferior ()->arch (); switch (what_to_dump) { @@ -260,8 +261,7 @@ regcache_print (const char *args, enum regcache_dump_what what_to_dump) /* For the benefit of "maint print registers" & co when debugging an executable, allow dumping a regcache even when there is no thread selected / no registers. */ - dump.reset (new register_dump_reg_buffer (target_gdbarch (), - dump_pseudo)); + dump.reset (new register_dump_reg_buffer (gdbarch, dump_pseudo)); } } break; |