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/breakpoint.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/breakpoint.c')
-rw-r--r-- | gdb/breakpoint.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index db7d2e6..2edcbf6 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -597,7 +597,7 @@ show_debug_breakpoint (struct ui_file *file, int from_tty, int breakpoints_should_be_inserted_now (void) { - if (gdbarch_has_global_breakpoints (target_gdbarch ())) + if (gdbarch_has_global_breakpoints (current_inferior ()->arch ())) { /* If breakpoints are global, they should be inserted even if no thread under gdb's control is running, or even if there are @@ -3224,7 +3224,7 @@ update_inserted_breakpoint_locations (void) to select an inferior to insert breakpoint to. In fact, even if we aren't attached to any process yet, we should still insert breakpoints. */ - if (!gdbarch_has_global_breakpoints (target_gdbarch ()) + if (!gdbarch_has_global_breakpoints (current_inferior ()->arch ()) && (inferior_ptid == null_ptid || !target_has_execution ())) continue; @@ -3284,7 +3284,7 @@ insert_breakpoint_locations (void) to select an inferior to insert breakpoint to. In fact, even if we aren't attached to any process yet, we should still insert breakpoints. */ - if (!gdbarch_has_global_breakpoints (target_gdbarch ()) + if (!gdbarch_has_global_breakpoints (current_inferior ()->arch ()) && (inferior_ptid == null_ptid || !target_has_execution ())) continue; @@ -4243,7 +4243,7 @@ breakpoint_init_inferior (enum inf_context context) /* If breakpoint locations are shared across processes, then there's nothing to do. */ - if (gdbarch_has_global_breakpoints (target_gdbarch ())) + if (gdbarch_has_global_breakpoints (current_inferior ()->arch ())) return; mark_breakpoints_out (); @@ -6615,7 +6615,7 @@ print_one_breakpoint_location (struct breakpoint *b, /* For backward compatibility, don't display inferiors in CLI unless there are several. Always display for MI. */ if (allflag - || (!gdbarch_has_global_breakpoints (target_gdbarch ()) + || (!gdbarch_has_global_breakpoints (current_inferior ()->arch ()) && (program_spaces.size () > 1 || number_of_inferiors () > 1) /* LOC is for existing B, it cannot be in @@ -7299,7 +7299,7 @@ int breakpoint_address_match (const address_space *aspace1, CORE_ADDR addr1, const address_space *aspace2, CORE_ADDR addr2) { - return ((gdbarch_has_global_breakpoints (target_gdbarch ()) + return ((gdbarch_has_global_breakpoints (current_inferior ()->arch ()) || aspace1 == aspace2) && addr1 == addr2); } @@ -7315,7 +7315,7 @@ breakpoint_address_match_range (const address_space *aspace1, int len1, const address_space *aspace2, CORE_ADDR addr2) { - return ((gdbarch_has_global_breakpoints (target_gdbarch ()) + return ((gdbarch_has_global_breakpoints (current_inferior ()->arch ()) || aspace1 == aspace2) && addr2 >= addr1 && addr2 < addr1 + len1); } @@ -7349,7 +7349,7 @@ breakpoint_location_address_range_overlap (struct bp_location *bl, const address_space *aspace, CORE_ADDR addr, int len) { - if (gdbarch_has_global_breakpoints (target_gdbarch ()) + if (gdbarch_has_global_breakpoints (current_inferior ()->arch ()) || bl->pspace->aspace == aspace) { int bl_len = bl->length != 0 ? bl->length : 1; |