diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2021-03-24 18:08:12 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@polymtl.ca> | 2021-03-24 18:08:24 -0400 |
commit | 328d42d87e97c75d6e52800bfd4bc1bfdfb745d2 (patch) | |
tree | 4dee500fe0bf6acd7dcb8153aabebaa27936c564 /gdb/remote.c | |
parent | d777bf0df22f1048fd24999ae563e30abcbcfbe7 (diff) | |
download | gdb-328d42d87e97c75d6e52800bfd4bc1bfdfb745d2.zip gdb-328d42d87e97c75d6e52800bfd4bc1bfdfb745d2.tar.gz gdb-328d42d87e97c75d6e52800bfd4bc1bfdfb745d2.tar.bz2 |
gdb: remove current_top_target function
The current_top_target function is a hidden dependency on the current
inferior. Since I'd like to slowly move towards reducing our dependency
on the global current state, remove this function and make callers use
current_inferior ()->top_target ()
There is no expected change in behavior, but this one step towards
making those callers use the inferior from their context, rather than
refer to the global current inferior.
gdb/ChangeLog:
* target.h (current_top_target): Remove, make callers use the
current inferior instead.
* target.c (current_top_target): Remove.
Change-Id: Iccd457036f84466cdaa3865aa3f9339a24ea001d
Diffstat (limited to 'gdb/remote.c')
-rw-r--r-- | gdb/remote.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/gdb/remote.c b/gdb/remote.c index 6ccfa33..ff1366e 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -5079,9 +5079,8 @@ remote_target::remote_check_symbols () /* If this is a function address, return the start of code instead of any data function descriptor. */ - sym_addr = gdbarch_convert_from_func_ptr_addr (target_gdbarch (), - sym_addr, - current_top_target ()); + sym_addr = gdbarch_convert_from_func_ptr_addr + (target_gdbarch (), sym_addr, current_inferior ()->top_target ()); xsnprintf (msg.data (), get_remote_packet_size (), "qSymbol:%s:%s", phex_nz (sym_addr, addr_size), &reply[8]); @@ -11463,7 +11462,8 @@ remote_target::memory_map () { std::vector<mem_region> result; gdb::optional<gdb::char_vector> text - = target_read_stralloc (current_top_target (), TARGET_OBJECT_MEMORY_MAP, NULL); + = target_read_stralloc (current_inferior ()->top_target (), + TARGET_OBJECT_MEMORY_MAP, NULL); if (text) result = parse_memory_map (text->data ()); @@ -13694,7 +13694,8 @@ traceframe_info_up remote_target::traceframe_info () { gdb::optional<gdb::char_vector> text - = target_read_stralloc (current_top_target (), TARGET_OBJECT_TRACEFRAME_INFO, + = target_read_stralloc (current_inferior ()->top_target (), + TARGET_OBJECT_TRACEFRAME_INFO, NULL); if (text) return parse_traceframe_info (text->data ()); @@ -13923,7 +13924,8 @@ static void btrace_read_config (struct btrace_config *conf) { gdb::optional<gdb::char_vector> xml - = target_read_stralloc (current_top_target (), TARGET_OBJECT_BTRACE_CONF, ""); + = target_read_stralloc (current_inferior ()->top_target (), + TARGET_OBJECT_BTRACE_CONF, ""); if (xml) parse_xml_btrace_conf (conf, xml->data ()); } @@ -14124,7 +14126,8 @@ remote_target::read_btrace (struct btrace_data *btrace, } gdb::optional<gdb::char_vector> xml - = target_read_stralloc (current_top_target (), TARGET_OBJECT_BTRACE, annex); + = target_read_stralloc (current_inferior ()->top_target (), + TARGET_OBJECT_BTRACE, annex); if (!xml) return BTRACE_ERR_UNKNOWN; @@ -14180,7 +14183,7 @@ remote_target::pid_to_exec_file (int pid) xsnprintf (annex, annex_size, "%x", pid); } - filename = target_read_stralloc (current_top_target (), + filename = target_read_stralloc (current_inferior ()->top_target (), TARGET_OBJECT_EXEC_FILE, annex); return filename ? filename->data () : nullptr; |