target_ops::beneath -> target_ops::beneath()
This changes target_ops::beneath from a pointer to a method, and adjusts all references throughout. The idea here is to make it easier to change the target stack representation from an intrusive singly linked list to something else without leaking implementation details throughout. The commit does not change the representation yet, that will be done in a following patch. That is why a new target_ops::m_beneath field appears here. That new field isn't really documented properly or made private, simply because it will be removed shortly. Note that target_ops::beneath() is essentially the same as the current find_target_beneath routine. The following patch will eliminate the latter. gdb/ChangeLog: 2018-06-07 Pedro Alves <palves@redhat.com> * target.h (target_ops) <beneath>: Now a method. All references updated. (target_ops) <m_beneath>: New. * target.c (target_ops::beneath): New. * corelow.c: Adjust all references to target_ops::beneath. * linux-thread-db.c: Likewise. * make-target-delegates: Likewise. * record-btrace.c: Likewise. * record-full.c: Likewise. * remote.c: Likewise. * target.c: Likewise. * target-delegates.c: Regenerate.
This commit is contained in:
parent
8b88a78e63
commit
b6a8c27bb8
10 changed files with 747 additions and 747 deletions
|
@ -1,3 +1,18 @@
|
|||
2018-06-07 Pedro Alves <palves@redhat.com>
|
||||
|
||||
* target.h (target_ops) <beneath>: Now a method. All references
|
||||
updated.
|
||||
(target_ops) <m_beneath>: New.
|
||||
* target.c (target_ops::beneath): New.
|
||||
* corelow.c: Adjust all references to target_ops::beneath.
|
||||
* linux-thread-db.c: Likewise.
|
||||
* make-target-delegates: Likewise.
|
||||
* record-btrace.c: Likewise.
|
||||
* record-full.c: Likewise.
|
||||
* remote.c: Likewise.
|
||||
* target.c: Likewise.
|
||||
* target-delegates.c: Regenerate.
|
||||
|
||||
2018-06-07 Pedro Alves <palves@redhat.com>
|
||||
|
||||
* target.h (target_stack): Delete.
|
||||
|
|
|
@ -950,7 +950,7 @@ core_target::xfer_partial (enum target_object object, const char *annex,
|
|||
return TARGET_XFER_E_IO;
|
||||
|
||||
default:
|
||||
return this->beneath->xfer_partial (object, annex, readbuf,
|
||||
return this->beneath ()->xfer_partial (object, annex, readbuf,
|
||||
writebuf, offset, len,
|
||||
xfered_len);
|
||||
}
|
||||
|
@ -987,7 +987,7 @@ core_target::read_description ()
|
|||
return result;
|
||||
}
|
||||
|
||||
return this->beneath->read_description ();
|
||||
return this->beneath ()->read_description ();
|
||||
}
|
||||
|
||||
const char *
|
||||
|
|
|
@ -1369,7 +1369,7 @@ thread_db_target::update_thread_list ()
|
|||
}
|
||||
|
||||
/* Give the beneath target a chance to do extra processing. */
|
||||
this->beneath->update_thread_list ();
|
||||
this->beneath ()->update_thread_list ();
|
||||
}
|
||||
|
||||
const char *
|
||||
|
|
|
@ -225,7 +225,7 @@ sub write_delegator($$@) {
|
|||
if ($return_type ne 'void') {
|
||||
print "return ";
|
||||
}
|
||||
print "this->beneath->" . $name . " (";
|
||||
print "this->beneath ()->" . $name . " (";
|
||||
print join (', ', @names);
|
||||
print ");\n";
|
||||
print "}\n\n";
|
||||
|
@ -309,19 +309,19 @@ sub write_debugmethod($$$@) {
|
|||
print " $return_type result;\n";
|
||||
}
|
||||
|
||||
print " fprintf_unfiltered (gdb_stdlog, \"-> %s->$name (...)\\n\", this->beneath->shortname ());\n";
|
||||
print " fprintf_unfiltered (gdb_stdlog, \"-> %s->$name (...)\\n\", this->beneath ()->shortname ());\n";
|
||||
|
||||
# Delegate to the beneath target.
|
||||
print " ";
|
||||
if ($return_type ne 'void') {
|
||||
print "result = ";
|
||||
}
|
||||
print "this->beneath->" . $name . " (";
|
||||
print "this->beneath ()->" . $name . " (";
|
||||
print join (', ', @names);
|
||||
print ");\n";
|
||||
|
||||
# Now print the arguments.
|
||||
print " fprintf_unfiltered (gdb_stdlog, \"<- %s->$name (\", this->beneath->shortname ());\n";
|
||||
print " fprintf_unfiltered (gdb_stdlog, \"<- %s->$name (\", this->beneath ()->shortname ());\n";
|
||||
for my $i (0 .. $#argtypes) {
|
||||
if ($i > 0) {
|
||||
print " fputs_unfiltered (\", \", gdb_stdlog);\n"
|
||||
|
|
|
@ -423,7 +423,7 @@ void
|
|||
record_btrace_target::disconnect (const char *args,
|
||||
int from_tty)
|
||||
{
|
||||
struct target_ops *beneath = this->beneath;
|
||||
struct target_ops *beneath = this->beneath ();
|
||||
|
||||
/* Do not stop recording, just clean up GDB side. */
|
||||
unpush_target (this);
|
||||
|
@ -462,7 +462,7 @@ record_btrace_target::async (int enable)
|
|||
else
|
||||
clear_async_event_handler (record_btrace_async_inferior_event_handler);
|
||||
|
||||
this->beneath->async (enable);
|
||||
this->beneath ()->async (enable);
|
||||
}
|
||||
|
||||
/* Adjusts the size and returns a human readable size suffix. */
|
||||
|
@ -1463,7 +1463,7 @@ record_btrace_target::xfer_partial (enum target_object object,
|
|||
}
|
||||
|
||||
/* Forward the request. */
|
||||
return this->beneath->xfer_partial (object, annex, readbuf, writebuf,
|
||||
return this->beneath ()->xfer_partial (object, annex, readbuf, writebuf,
|
||||
offset, len, xfered_len);
|
||||
}
|
||||
|
||||
|
@ -1484,7 +1484,7 @@ record_btrace_target::insert_breakpoint (struct gdbarch *gdbarch,
|
|||
ret = 0;
|
||||
TRY
|
||||
{
|
||||
ret = this->beneath->insert_breakpoint (gdbarch, bp_tgt);
|
||||
ret = this->beneath ()->insert_breakpoint (gdbarch, bp_tgt);
|
||||
}
|
||||
CATCH (except, RETURN_MASK_ALL)
|
||||
{
|
||||
|
@ -1515,7 +1515,7 @@ record_btrace_target::remove_breakpoint (struct gdbarch *gdbarch,
|
|||
ret = 0;
|
||||
TRY
|
||||
{
|
||||
ret = this->beneath->remove_breakpoint (gdbarch, bp_tgt, reason);
|
||||
ret = this->beneath ()->remove_breakpoint (gdbarch, bp_tgt, reason);
|
||||
}
|
||||
CATCH (except, RETURN_MASK_ALL)
|
||||
{
|
||||
|
@ -1561,7 +1561,7 @@ record_btrace_target::fetch_registers (struct regcache *regcache, int regno)
|
|||
regcache->raw_supply (regno, &insn->pc);
|
||||
}
|
||||
else
|
||||
this->beneath->fetch_registers (regcache, regno);
|
||||
this->beneath ()->fetch_registers (regcache, regno);
|
||||
}
|
||||
|
||||
/* The store_registers method of target record-btrace. */
|
||||
|
@ -1577,7 +1577,7 @@ record_btrace_target::store_registers (struct regcache *regcache, int regno)
|
|||
|
||||
gdb_assert (may_write_registers != 0);
|
||||
|
||||
this->beneath->store_registers (regcache, regno);
|
||||
this->beneath ()->store_registers (regcache, regno);
|
||||
}
|
||||
|
||||
/* The prepare_to_store method of target record-btrace. */
|
||||
|
@ -1589,7 +1589,7 @@ record_btrace_target::prepare_to_store (struct regcache *regcache)
|
|||
&& record_is_replaying (regcache->ptid ()))
|
||||
return;
|
||||
|
||||
this->beneath->prepare_to_store (regcache);
|
||||
this->beneath ()->prepare_to_store (regcache);
|
||||
}
|
||||
|
||||
/* The branch trace frame cache. */
|
||||
|
@ -2161,7 +2161,7 @@ record_btrace_target::resume (ptid_t ptid, int step, enum gdb_signal signal)
|
|||
if ((::execution_direction != EXEC_REVERSE)
|
||||
&& !record_is_replaying (minus_one_ptid))
|
||||
{
|
||||
this->beneath->resume (ptid, step, signal);
|
||||
this->beneath ()->resume (ptid, step, signal);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2216,7 +2216,7 @@ record_btrace_target::commit_resume ()
|
|||
{
|
||||
if ((::execution_direction != EXEC_REVERSE)
|
||||
&& !record_is_replaying (minus_one_ptid))
|
||||
beneath->commit_resume ();
|
||||
beneath ()->commit_resume ();
|
||||
}
|
||||
|
||||
/* Cancel resuming TP. */
|
||||
|
@ -2556,7 +2556,7 @@ record_btrace_target::wait (ptid_t ptid, struct target_waitstatus *status,
|
|||
if ((::execution_direction != EXEC_REVERSE)
|
||||
&& !record_is_replaying (minus_one_ptid))
|
||||
{
|
||||
return this->beneath->wait (ptid, status, options);
|
||||
return this->beneath ()->wait (ptid, status, options);
|
||||
}
|
||||
|
||||
/* Keep a work list of moving threads. */
|
||||
|
@ -2685,7 +2685,7 @@ record_btrace_target::stop (ptid_t ptid)
|
|||
if ((::execution_direction != EXEC_REVERSE)
|
||||
&& !record_is_replaying (minus_one_ptid))
|
||||
{
|
||||
this->beneath->stop (ptid);
|
||||
this->beneath ()->stop (ptid);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2720,7 +2720,7 @@ record_btrace_target::stopped_by_sw_breakpoint ()
|
|||
return tp->btrace.stop_reason == TARGET_STOPPED_BY_SW_BREAKPOINT;
|
||||
}
|
||||
|
||||
return this->beneath->stopped_by_sw_breakpoint ();
|
||||
return this->beneath ()->stopped_by_sw_breakpoint ();
|
||||
}
|
||||
|
||||
/* The supports_stopped_by_sw_breakpoint method of target
|
||||
|
@ -2732,7 +2732,7 @@ record_btrace_target::supports_stopped_by_sw_breakpoint ()
|
|||
if (record_is_replaying (minus_one_ptid))
|
||||
return true;
|
||||
|
||||
return this->beneath->supports_stopped_by_sw_breakpoint ();
|
||||
return this->beneath ()->supports_stopped_by_sw_breakpoint ();
|
||||
}
|
||||
|
||||
/* The stopped_by_sw_breakpoint method of target record-btrace. */
|
||||
|
@ -2747,7 +2747,7 @@ record_btrace_target::stopped_by_hw_breakpoint ()
|
|||
return tp->btrace.stop_reason == TARGET_STOPPED_BY_HW_BREAKPOINT;
|
||||
}
|
||||
|
||||
return this->beneath->stopped_by_hw_breakpoint ();
|
||||
return this->beneath ()->stopped_by_hw_breakpoint ();
|
||||
}
|
||||
|
||||
/* The supports_stopped_by_hw_breakpoint method of target
|
||||
|
@ -2759,7 +2759,7 @@ record_btrace_target::supports_stopped_by_hw_breakpoint ()
|
|||
if (record_is_replaying (minus_one_ptid))
|
||||
return true;
|
||||
|
||||
return this->beneath->supports_stopped_by_hw_breakpoint ();
|
||||
return this->beneath ()->supports_stopped_by_hw_breakpoint ();
|
||||
}
|
||||
|
||||
/* The update_thread_list method of target record-btrace. */
|
||||
|
@ -2772,7 +2772,7 @@ record_btrace_target::update_thread_list ()
|
|||
return;
|
||||
|
||||
/* Forward the request. */
|
||||
this->beneath->update_thread_list ();
|
||||
this->beneath ()->update_thread_list ();
|
||||
}
|
||||
|
||||
/* The thread_alive method of target record-btrace. */
|
||||
|
@ -2785,7 +2785,7 @@ record_btrace_target::thread_alive (ptid_t ptid)
|
|||
return find_thread_ptid (ptid) != NULL;
|
||||
|
||||
/* Forward the request. */
|
||||
return this->beneath->thread_alive (ptid);
|
||||
return this->beneath ()->thread_alive (ptid);
|
||||
}
|
||||
|
||||
/* Set the replay branch trace instruction iterator. If IT is NULL, replay
|
||||
|
|
|
@ -1039,7 +1039,7 @@ record_full_base_target::async (int enable)
|
|||
else
|
||||
clear_async_event_handler (record_full_async_inferior_event_token);
|
||||
|
||||
beneath->async (enable);
|
||||
beneath ()->async (enable);
|
||||
}
|
||||
|
||||
static int record_full_resume_step = 0;
|
||||
|
@ -1104,7 +1104,7 @@ record_full_target::resume (ptid_t ptid, int step, enum gdb_signal signal)
|
|||
/* Make sure the target beneath reports all signals. */
|
||||
target_pass_signals (0, NULL);
|
||||
|
||||
this->beneath->resume (ptid, step, signal);
|
||||
this->beneath ()->resume (ptid, step, signal);
|
||||
}
|
||||
|
||||
/* We are about to start executing the inferior (or simulate it),
|
||||
|
@ -1119,7 +1119,7 @@ void
|
|||
record_full_target::commit_resume ()
|
||||
{
|
||||
if (!RECORD_FULL_IS_REPLAY)
|
||||
beneath->commit_resume ();
|
||||
beneath ()->commit_resume ();
|
||||
}
|
||||
|
||||
static int record_full_get_sig = 0;
|
||||
|
@ -1201,7 +1201,7 @@ record_full_wait_1 (struct target_ops *ops,
|
|||
if (record_full_resume_step)
|
||||
{
|
||||
/* This is a single step. */
|
||||
return ops->beneath->wait (ptid, status, options);
|
||||
return ops->beneath ()->wait (ptid, status, options);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1214,7 +1214,7 @@ record_full_wait_1 (struct target_ops *ops,
|
|||
{
|
||||
struct thread_info *tp;
|
||||
|
||||
ret = ops->beneath->wait (ptid, status, options);
|
||||
ret = ops->beneath ()->wait (ptid, status, options);
|
||||
if (status->kind == TARGET_WAITKIND_IGNORE)
|
||||
{
|
||||
if (record_debug)
|
||||
|
@ -1290,8 +1290,8 @@ record_full_wait_1 (struct target_ops *ops,
|
|||
"Process record: record_full_wait "
|
||||
"issuing one more step in the "
|
||||
"target beneath\n");
|
||||
ops->beneath->resume (ptid, step, GDB_SIGNAL_0);
|
||||
ops->beneath->commit_resume ();
|
||||
ops->beneath ()->resume (ptid, step, GDB_SIGNAL_0);
|
||||
ops->beneath ()->commit_resume ();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -1478,7 +1478,7 @@ record_full_base_target::stopped_by_watchpoint ()
|
|||
if (RECORD_FULL_IS_REPLAY)
|
||||
return record_full_stop_reason == TARGET_STOPPED_BY_WATCHPOINT;
|
||||
else
|
||||
return beneath->stopped_by_watchpoint ();
|
||||
return beneath ()->stopped_by_watchpoint ();
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -1487,7 +1487,7 @@ record_full_base_target::stopped_data_address (CORE_ADDR *addr_p)
|
|||
if (RECORD_FULL_IS_REPLAY)
|
||||
return false;
|
||||
else
|
||||
return this->beneath->stopped_data_address (addr_p);
|
||||
return this->beneath ()->stopped_data_address (addr_p);
|
||||
}
|
||||
|
||||
/* The stopped_by_sw_breakpoint method of target record-full. */
|
||||
|
@ -1622,7 +1622,7 @@ record_full_target::store_registers (struct regcache *regcache, int regno)
|
|||
|
||||
record_full_registers_change (regcache, regno);
|
||||
}
|
||||
this->beneath->store_registers (regcache, regno);
|
||||
this->beneath ()->store_registers (regcache, regno);
|
||||
}
|
||||
|
||||
/* "xfer_partial" method. Behavior is conditional on
|
||||
|
@ -1687,8 +1687,8 @@ record_full_target::xfer_partial (enum target_object object,
|
|||
record_full_insn_num++;
|
||||
}
|
||||
|
||||
return this->beneath->xfer_partial (object, annex, readbuf, writebuf, offset,
|
||||
len, xfered_len);
|
||||
return this->beneath ()->xfer_partial (object, annex, readbuf, writebuf,
|
||||
offset, len, xfered_len);
|
||||
}
|
||||
|
||||
/* This structure represents a breakpoint inserted while the record
|
||||
|
@ -1769,7 +1769,7 @@ record_full_target::insert_breakpoint (struct gdbarch *gdbarch,
|
|||
scoped_restore restore_operation_disable
|
||||
= record_full_gdb_operation_disable_set ();
|
||||
|
||||
int ret = this->beneath->insert_breakpoint (gdbarch, bp_tgt);
|
||||
int ret = this->beneath ()->insert_breakpoint (gdbarch, bp_tgt);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
|
||||
|
@ -1823,7 +1823,7 @@ record_full_target::remove_breakpoint (struct gdbarch *gdbarch,
|
|||
scoped_restore restore_operation_disable
|
||||
= record_full_gdb_operation_disable_set ();
|
||||
|
||||
int ret = this->beneath->remove_breakpoint (gdbarch, bp_tgt,
|
||||
int ret = this->beneath ()->remove_breakpoint (gdbarch, bp_tgt,
|
||||
reason);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
|
@ -2203,7 +2203,7 @@ record_full_core_target::xfer_partial (enum target_object object,
|
|||
else
|
||||
{
|
||||
if (!entry)
|
||||
return this->beneath->xfer_partial (object, annex,
|
||||
return this->beneath ()->xfer_partial (object, annex,
|
||||
readbuf, writebuf,
|
||||
offset, len,
|
||||
xfered_len);
|
||||
|
@ -2223,7 +2223,7 @@ record_full_core_target::xfer_partial (enum target_object object,
|
|||
error (_("You can't do that without a process to debug."));
|
||||
}
|
||||
|
||||
return this->beneath->xfer_partial (object, annex,
|
||||
return this->beneath ()->xfer_partial (object, annex,
|
||||
readbuf, writebuf, offset, len,
|
||||
xfered_len);
|
||||
}
|
||||
|
|
|
@ -11794,7 +11794,7 @@ remote_target::read_description ()
|
|||
/* Do not try this during initial connection, when we do not know
|
||||
whether there is a running but stopped thread. */
|
||||
if (!target_has_execution || ptid_equal (inferior_ptid, null_ptid))
|
||||
return beneath->read_description ();
|
||||
return beneath ()->read_description ();
|
||||
|
||||
if (!VEC_empty (remote_g_packet_guess_s, data->guesses))
|
||||
{
|
||||
|
@ -11813,7 +11813,7 @@ remote_target::read_description ()
|
|||
an architecture, but it's too tricky to do safely. */
|
||||
}
|
||||
|
||||
return beneath->read_description ();
|
||||
return beneath ()->read_description ();
|
||||
}
|
||||
|
||||
/* Remote file transfer support. This is host-initiated I/O, not
|
||||
|
|
File diff suppressed because it is too large
Load diff
91
gdb/target.c
91
gdb/target.c
|
@ -268,9 +268,7 @@ default_child_has_execution (ptid_t the_ptid)
|
|||
int
|
||||
target_has_all_memory_1 (void)
|
||||
{
|
||||
struct target_ops *t;
|
||||
|
||||
for (t = current_top_target (); t != NULL; t = t->beneath)
|
||||
for (target_ops *t = current_top_target (); t != NULL; t = t->beneath ())
|
||||
if (t->has_all_memory ())
|
||||
return 1;
|
||||
|
||||
|
@ -280,9 +278,7 @@ target_has_all_memory_1 (void)
|
|||
int
|
||||
target_has_memory_1 (void)
|
||||
{
|
||||
struct target_ops *t;
|
||||
|
||||
for (t = current_top_target (); t != NULL; t = t->beneath)
|
||||
for (target_ops *t = current_top_target (); t != NULL; t = t->beneath ())
|
||||
if (t->has_memory ())
|
||||
return 1;
|
||||
|
||||
|
@ -292,9 +288,7 @@ target_has_memory_1 (void)
|
|||
int
|
||||
target_has_stack_1 (void)
|
||||
{
|
||||
struct target_ops *t;
|
||||
|
||||
for (t = current_top_target (); t != NULL; t = t->beneath)
|
||||
for (target_ops *t = current_top_target (); t != NULL; t = t->beneath ())
|
||||
if (t->has_stack ())
|
||||
return 1;
|
||||
|
||||
|
@ -304,9 +298,7 @@ target_has_stack_1 (void)
|
|||
int
|
||||
target_has_registers_1 (void)
|
||||
{
|
||||
struct target_ops *t;
|
||||
|
||||
for (t = current_top_target (); t != NULL; t = t->beneath)
|
||||
for (target_ops *t = current_top_target (); t != NULL; t = t->beneath ())
|
||||
if (t->has_registers ())
|
||||
return 1;
|
||||
|
||||
|
@ -316,9 +308,7 @@ target_has_registers_1 (void)
|
|||
int
|
||||
target_has_execution_1 (ptid_t the_ptid)
|
||||
{
|
||||
struct target_ops *t;
|
||||
|
||||
for (t = current_top_target (); t != NULL; t = t->beneath)
|
||||
for (target_ops *t = current_top_target (); t != NULL; t = t->beneath ())
|
||||
if (t->has_execution (the_ptid))
|
||||
return 1;
|
||||
|
||||
|
@ -654,7 +644,7 @@ push_target (struct target_ops *t)
|
|||
struct target_ops **cur;
|
||||
|
||||
/* Find the proper stratum to install this target in. */
|
||||
for (cur = &g_current_top_target; (*cur) != NULL; cur = &(*cur)->beneath)
|
||||
for (cur = &g_current_top_target; (*cur) != NULL; cur = &(*cur)->m_beneath)
|
||||
{
|
||||
if ((int) (t->to_stratum) >= (int) (*cur)->to_stratum)
|
||||
break;
|
||||
|
@ -669,13 +659,13 @@ push_target (struct target_ops *t)
|
|||
and un-hook it from the stack. */
|
||||
struct target_ops *tmp = (*cur);
|
||||
|
||||
(*cur) = (*cur)->beneath;
|
||||
tmp->beneath = NULL;
|
||||
(*cur) = (*cur)->m_beneath;
|
||||
tmp->m_beneath = NULL;
|
||||
target_close (tmp);
|
||||
}
|
||||
|
||||
/* We have removed all targets in our stratum, now add the new one. */
|
||||
t->beneath = (*cur);
|
||||
t->m_beneath = (*cur);
|
||||
(*cur) = t;
|
||||
}
|
||||
|
||||
|
@ -695,7 +685,7 @@ unpush_target (struct target_ops *t)
|
|||
/* Look for the specified target. Note that we assume that a target
|
||||
can only occur once in the target stack. */
|
||||
|
||||
for (cur = &g_current_top_target; (*cur) != NULL; cur = &(*cur)->beneath)
|
||||
for (cur = &g_current_top_target; (*cur) != NULL; cur = &(*cur)->m_beneath)
|
||||
{
|
||||
if ((*cur) == t)
|
||||
break;
|
||||
|
@ -708,8 +698,8 @@ unpush_target (struct target_ops *t)
|
|||
|
||||
/* Unchain the target. */
|
||||
tmp = (*cur);
|
||||
(*cur) = (*cur)->beneath;
|
||||
tmp->beneath = NULL;
|
||||
(*cur) = (*cur)->m_beneath;
|
||||
tmp->m_beneath = NULL;
|
||||
|
||||
/* Finally close the target. Note we do this after unchaining, so
|
||||
any target method calls from within the target_close
|
||||
|
@ -761,9 +751,9 @@ pop_all_targets (void)
|
|||
int
|
||||
target_is_pushed (struct target_ops *t)
|
||||
{
|
||||
struct target_ops *cur;
|
||||
|
||||
for (cur = current_top_target (); cur != NULL; cur = cur->beneath)
|
||||
for (target_ops *cur = current_top_target ();
|
||||
cur != NULL;
|
||||
cur = cur->beneath ())
|
||||
if (cur == t)
|
||||
return 1;
|
||||
|
||||
|
@ -1060,7 +1050,7 @@ raw_memory_xfer_partial (struct target_ops *ops, gdb_byte *readbuf,
|
|||
if (ops->has_all_memory ())
|
||||
break;
|
||||
|
||||
ops = ops->beneath;
|
||||
ops = ops->beneath ();
|
||||
}
|
||||
while (ops != NULL);
|
||||
|
||||
|
@ -1968,14 +1958,13 @@ target_remove_breakpoint (struct gdbarch *gdbarch,
|
|||
static void
|
||||
info_target_command (const char *args, int from_tty)
|
||||
{
|
||||
struct target_ops *t;
|
||||
int has_all_mem = 0;
|
||||
|
||||
if (symfile_objfile != NULL)
|
||||
printf_unfiltered (_("Symbols from \"%s\".\n"),
|
||||
objfile_name (symfile_objfile));
|
||||
|
||||
for (t = current_top_target (); t != NULL; t = t->beneath)
|
||||
for (target_ops *t = current_top_target (); t != NULL; t = t->beneath ())
|
||||
{
|
||||
if (!t->has_memory ())
|
||||
continue;
|
||||
|
@ -2405,9 +2394,7 @@ target_search_memory (CORE_ADDR start_addr, ULONGEST search_space_len,
|
|||
void
|
||||
target_require_runnable (void)
|
||||
{
|
||||
struct target_ops *t;
|
||||
|
||||
for (t = current_top_target (); t != NULL; t = t->beneath)
|
||||
for (target_ops *t = current_top_target (); t != NULL; t = t->beneath ())
|
||||
{
|
||||
/* If this target knows how to create a new program, then
|
||||
assume we will still be able to after killing the current
|
||||
|
@ -2497,7 +2484,7 @@ struct target_ops *
|
|||
find_attach_target (void)
|
||||
{
|
||||
/* If a target on the current stack can attach, use it. */
|
||||
for (target_ops *t = current_top_target (); t != NULL; t = t->beneath)
|
||||
for (target_ops *t = current_top_target (); t != NULL; t = t->beneath ())
|
||||
{
|
||||
if (t->can_attach ())
|
||||
return t;
|
||||
|
@ -2513,7 +2500,7 @@ struct target_ops *
|
|||
find_run_target (void)
|
||||
{
|
||||
/* If a target on the current stack can run, use it. */
|
||||
for (target_ops *t = current_top_target (); t != NULL; t = t->beneath)
|
||||
for (target_ops *t = current_top_target (); t != NULL; t = t->beneath ())
|
||||
{
|
||||
if (t->can_create_inferior ())
|
||||
return t;
|
||||
|
@ -2543,7 +2530,7 @@ target_info_proc (const char *args, enum info_proc_what what)
|
|||
if (t == NULL)
|
||||
t = find_default_run_target (NULL);
|
||||
|
||||
for (; t != NULL; t = t->beneath)
|
||||
for (; t != NULL; t = t->beneath ())
|
||||
{
|
||||
if (t->info_proc (args, what))
|
||||
{
|
||||
|
@ -2633,6 +2620,14 @@ target_thread_address_space (ptid_t ptid)
|
|||
return aspace;
|
||||
}
|
||||
|
||||
/* See target.h. */
|
||||
|
||||
target_ops *
|
||||
target_ops::beneath () const
|
||||
{
|
||||
return m_beneath;
|
||||
}
|
||||
|
||||
void
|
||||
target_ops::close ()
|
||||
{
|
||||
|
@ -2672,9 +2667,7 @@ target_ops::can_run ()
|
|||
int
|
||||
target_can_run ()
|
||||
{
|
||||
struct target_ops *t;
|
||||
|
||||
for (t = current_top_target (); t != NULL; t = t->beneath)
|
||||
for (target_ops *t = current_top_target (); t != NULL; t = t->beneath ())
|
||||
{
|
||||
if (t->can_run ())
|
||||
return 1;
|
||||
|
@ -2856,9 +2849,7 @@ target_fileio_open_1 (struct inferior *inf, const char *filename,
|
|||
int flags, int mode, int warn_if_slow,
|
||||
int *target_errno)
|
||||
{
|
||||
struct target_ops *t;
|
||||
|
||||
for (t = default_fileio_target (); t != NULL; t = t->beneath)
|
||||
for (target_ops *t = default_fileio_target (); t != NULL; t = t->beneath ())
|
||||
{
|
||||
int fd = t->fileio_open (inf, filename, flags, mode,
|
||||
warn_if_slow, target_errno);
|
||||
|
@ -3014,9 +3005,7 @@ int
|
|||
target_fileio_unlink (struct inferior *inf, const char *filename,
|
||||
int *target_errno)
|
||||
{
|
||||
struct target_ops *t;
|
||||
|
||||
for (t = default_fileio_target (); t != NULL; t = t->beneath)
|
||||
for (target_ops *t = default_fileio_target (); t != NULL; t = t->beneath ())
|
||||
{
|
||||
int ret = t->fileio_unlink (inf, filename, target_errno);
|
||||
|
||||
|
@ -3042,9 +3031,7 @@ gdb::optional<std::string>
|
|||
target_fileio_readlink (struct inferior *inf, const char *filename,
|
||||
int *target_errno)
|
||||
{
|
||||
struct target_ops *t;
|
||||
|
||||
for (t = default_fileio_target (); t != NULL; t = t->beneath)
|
||||
for (target_ops *t = default_fileio_target (); t != NULL; t = t->beneath ())
|
||||
{
|
||||
gdb::optional<std::string> ret
|
||||
= t->fileio_readlink (inf, filename, target_errno);
|
||||
|
@ -3231,7 +3218,7 @@ default_thread_architecture (struct target_ops *ops, ptid_t ptid)
|
|||
struct target_ops *
|
||||
find_target_beneath (struct target_ops *t)
|
||||
{
|
||||
return t->beneath;
|
||||
return t->beneath ();
|
||||
}
|
||||
|
||||
/* See target.h. */
|
||||
|
@ -3239,9 +3226,7 @@ find_target_beneath (struct target_ops *t)
|
|||
struct target_ops *
|
||||
find_target_at (enum strata stratum)
|
||||
{
|
||||
struct target_ops *t;
|
||||
|
||||
for (t = current_top_target (); t != NULL; t = t->beneath)
|
||||
for (target_ops *t = current_top_target (); t != NULL; t = t->beneath ())
|
||||
if (t->to_stratum == stratum)
|
||||
return t;
|
||||
|
||||
|
@ -3370,7 +3355,7 @@ dummy_target::info () const
|
|||
const target_info &
|
||||
debug_target::info () const
|
||||
{
|
||||
return beneath->info ();
|
||||
return beneath ()->info ();
|
||||
}
|
||||
|
||||
|
||||
|
@ -3906,11 +3891,9 @@ flash_erase_command (const char *cmd, int from_tty)
|
|||
static void
|
||||
maintenance_print_target_stack (const char *cmd, int from_tty)
|
||||
{
|
||||
struct target_ops *t;
|
||||
|
||||
printf_filtered (_("The current target stack is:\n"));
|
||||
|
||||
for (t = current_top_target (); t != NULL; t = t->beneath)
|
||||
for (target_ops *t = current_top_target (); t != NULL; t = t->beneath ())
|
||||
{
|
||||
if (t->to_stratum == debug_stratum)
|
||||
continue;
|
||||
|
|
|
@ -424,7 +424,9 @@ struct target_info
|
|||
|
||||
struct target_ops
|
||||
{
|
||||
struct target_ops *beneath; /* To the target under this one. */
|
||||
/* To the target under this one. */
|
||||
target_ops *m_beneath;
|
||||
target_ops *beneath () const;
|
||||
|
||||
/* Free resources associated with the target. Note that singleton
|
||||
targets, like e.g., native targets, are global objects, not
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue