+2020-01-10 Pedro Alves <palves@redhat.com>
+
+ * corelow.c (core_target::has_execution): Change parameter type to
+ inferior pointer.
+ * inferior.c (number_of_live_inferiors): Use
+ inferior::has_execution instead of target_has_execution_1.
+ * inferior.h (inferior::has_execution): New.
+ * linux-thread-db.c (thread_db_target::update_thread_list): Use
+ inferior::has_execution instead of target_has_execution_1.
+ * process-stratum-target.c
+ (process_stratum_target::has_execution): Change parameter type to
+ inferior pointer. Check the inferior's PID instead of
+ inferior_ptid.
+ * process-stratum-target.h
+ (process_stratum_target::has_execution): Change parameter type to
+ inferior pointer.
+ * record-full.c (record_full_core_target::has_execution): Change
+ parameter type to inferior pointer.
+ * target.c (target_has_execution_1): Change parameter type to
+ inferior pointer.
+ (target_has_execution_current): Adjust.
+ * target.h (target_ops::has_execution): Change parameter type to
+ inferior pointer.
+ (target_has_execution_1): Change parameter type to inferior
+ pointer. Change return type to bool.
+ * tracefile.h (tracefile_target::has_execution): Change parameter
+ type to inferior pointer.
+
2020-01-10 Pedro Alves <palves@redhat.com>
* exceptions.c (print_flush): Remove current_top_target() check.
bool has_memory () override;
bool has_stack () override;
bool has_registers () override;
- bool has_execution (ptid_t) override { return false; }
+ bool has_execution (inferior *inf) override { return false; }
bool info_proc (const char *, enum info_proc_what) override;
int num_inf = 0;
for (inferior *inf : all_non_exited_inferiors ())
- if (target_has_execution_1 (ptid_t (inf->pid)))
+ if (inf->has_execution ())
for (thread_info *tp ATTRIBUTE_UNUSED : inf->non_exited_threads ())
{
/* Found a live thread in this inferior, go to the next
/* Returns true if we can delete this inferior. */
bool deletable () const { return refcount () == 0; }
+ bool has_execution ()
+ { return target_has_execution_1 (this); }
+
/* Pointer to next inferior in singly-linked list of inferiors. */
struct inferior *next = NULL;
stop. That uses thread_db entry points that do not walk
libpthread's thread list, so should be safe, as well as more
efficient. */
- if (target_has_execution_1 (thread->ptid))
+ if (thread->inf->has_execution ())
continue;
thread_db_find_new_threads_1 (thread);
}
bool
-process_stratum_target::has_execution (ptid_t the_ptid)
+process_stratum_target::has_execution (inferior *inf)
{
- /* If there's no thread selected, then we can't make it run through
- hoops. */
- return the_ptid != null_ptid;
+ /* If there's a process running already, we can't make it run
+ through hoops. */
+ return inf->pid != 0;
}
bool has_memory () override;
bool has_stack () override;
bool has_registers () override;
- bool has_execution (ptid_t the_ptid) override;
+ bool has_execution (inferior *inf) override;
};
#endif /* !defined (PROCESS_STRATUM_TARGET_H) */
struct bp_target_info *,
enum remove_bp_reason) override;
- bool has_execution (ptid_t) override;
+ bool has_execution (inferior *inf) override;
};
static record_full_target record_full_ops;
/* "has_execution" method for prec over corefile. */
bool
-record_full_core_target::has_execution (ptid_t the_ptid)
+record_full_core_target::has_execution (inferior *inf)
{
return true;
}
return 0;
}
-int
-target_has_execution_1 (ptid_t the_ptid)
+bool
+target_has_execution_1 (inferior *inf)
{
for (target_ops *t = current_top_target (); t != NULL; t = t->beneath ())
- if (t->has_execution (the_ptid))
- return 1;
+ if (t->has_execution (inf))
+ return true;
- return 0;
+ return false;
}
int
target_has_execution_current (void)
{
- return target_has_execution_1 (inferior_ptid);
+ return target_has_execution_1 (current_inferior ());
}
/* This is used to implement the various target commands. */
virtual bool has_memory () { return false; }
virtual bool has_stack () { return false; }
virtual bool has_registers () { return false; }
- virtual bool has_execution (ptid_t) { return false; }
+ virtual bool has_execution (inferior *inf) { return false; }
/* Control thread execution. */
virtual thread_control_capabilities get_thread_control_capabilities ()
case this will become true after to_create_inferior or
to_attach. */
-extern int target_has_execution_1 (ptid_t);
+extern bool target_has_execution_1 (inferior *inf);
-/* Like target_has_execution_1, but always passes inferior_ptid. */
+/* Like target_has_execution_1, but always passes
+ current_inferior(). */
extern int target_has_execution_current (void);
bool has_memory () override;
bool has_stack () override;
bool has_registers () override;
- bool has_execution (ptid_t) override { return false; }
+ bool has_execution (inferior *inf) override { return false; }
bool thread_alive (ptid_t ptid) override;
};