mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-29 08:24:05 +08:00
gdb: make lwp_info non-POD
Initialize all fields in the class declaration directly. This opens the door to using intrusive_list, done in the following patch. Change-Id: I38bb27410cd9ebf511d310bb86fe2ea1872c3b05
This commit is contained in:
@ -845,19 +845,10 @@ purge_lwp_list (int pid)
|
|||||||
static struct lwp_info *
|
static struct lwp_info *
|
||||||
add_initial_lwp (ptid_t ptid)
|
add_initial_lwp (ptid_t ptid)
|
||||||
{
|
{
|
||||||
struct lwp_info *lp;
|
|
||||||
|
|
||||||
gdb_assert (ptid.lwp_p ());
|
gdb_assert (ptid.lwp_p ());
|
||||||
|
|
||||||
lp = XNEW (struct lwp_info);
|
lwp_info *lp = new lwp_info (ptid);
|
||||||
|
|
||||||
memset (lp, 0, sizeof (struct lwp_info));
|
|
||||||
|
|
||||||
lp->last_resume_kind = resume_continue;
|
|
||||||
lp->waitstatus.kind = TARGET_WAITKIND_IGNORE;
|
|
||||||
|
|
||||||
lp->ptid = ptid;
|
|
||||||
lp->core = -1;
|
|
||||||
|
|
||||||
/* Add to sorted-by-reverse-creation-order list. */
|
/* Add to sorted-by-reverse-creation-order list. */
|
||||||
lwp_list_add (lp);
|
lwp_list_add (lp);
|
||||||
@ -893,16 +884,13 @@ add_lwp (ptid_t ptid)
|
|||||||
static void
|
static void
|
||||||
delete_lwp (ptid_t ptid)
|
delete_lwp (ptid_t ptid)
|
||||||
{
|
{
|
||||||
struct lwp_info *lp;
|
lwp_info dummy (ptid);
|
||||||
void **slot;
|
|
||||||
struct lwp_info dummy;
|
|
||||||
|
|
||||||
dummy.ptid = ptid;
|
void **slot = htab_find_slot (lwp_lwpid_htab, &dummy, NO_INSERT);
|
||||||
slot = htab_find_slot (lwp_lwpid_htab, &dummy, NO_INSERT);
|
|
||||||
if (slot == NULL)
|
if (slot == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
lp = *(struct lwp_info **) slot;
|
lwp_info *lp = *(struct lwp_info **) slot;
|
||||||
gdb_assert (lp != NULL);
|
gdb_assert (lp != NULL);
|
||||||
|
|
||||||
htab_clear_slot (lwp_lwpid_htab, slot);
|
htab_clear_slot (lwp_lwpid_htab, slot);
|
||||||
@ -920,18 +908,15 @@ delete_lwp (ptid_t ptid)
|
|||||||
static struct lwp_info *
|
static struct lwp_info *
|
||||||
find_lwp_pid (ptid_t ptid)
|
find_lwp_pid (ptid_t ptid)
|
||||||
{
|
{
|
||||||
struct lwp_info *lp;
|
|
||||||
int lwp;
|
int lwp;
|
||||||
struct lwp_info dummy;
|
|
||||||
|
|
||||||
if (ptid.lwp_p ())
|
if (ptid.lwp_p ())
|
||||||
lwp = ptid.lwp ();
|
lwp = ptid.lwp ();
|
||||||
else
|
else
|
||||||
lwp = ptid.pid ();
|
lwp = ptid.pid ();
|
||||||
|
|
||||||
dummy.ptid = ptid_t (0, lwp);
|
lwp_info dummy (ptid_t (0, lwp));
|
||||||
lp = (struct lwp_info *) htab_find (lwp_lwpid_htab, &dummy);
|
return (struct lwp_info *) htab_find (lwp_lwpid_htab, &dummy);
|
||||||
return lp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* See nat/linux-nat.h. */
|
/* See nat/linux-nat.h. */
|
||||||
|
@ -202,20 +202,26 @@ struct arch_lwp_info;
|
|||||||
|
|
||||||
struct lwp_info
|
struct lwp_info
|
||||||
{
|
{
|
||||||
|
lwp_info (ptid_t ptid)
|
||||||
|
: ptid (ptid)
|
||||||
|
{
|
||||||
|
waitstatus.kind = TARGET_WAITKIND_IGNORE;
|
||||||
|
}
|
||||||
|
|
||||||
/* The process id of the LWP. This is a combination of the LWP id
|
/* The process id of the LWP. This is a combination of the LWP id
|
||||||
and overall process id. */
|
and overall process id. */
|
||||||
ptid_t ptid;
|
ptid_t ptid;
|
||||||
|
|
||||||
/* If this flag is set, we need to set the event request flags the
|
/* If this flag is set, we need to set the event request flags the
|
||||||
next time we see this LWP stop. */
|
next time we see this LWP stop. */
|
||||||
int must_set_ptrace_flags;
|
int must_set_ptrace_flags = 0;
|
||||||
|
|
||||||
/* Non-zero if we sent this LWP a SIGSTOP (but the LWP didn't report
|
/* Non-zero if we sent this LWP a SIGSTOP (but the LWP didn't report
|
||||||
it back yet). */
|
it back yet). */
|
||||||
int signalled;
|
int signalled = 0;
|
||||||
|
|
||||||
/* Non-zero if this LWP is stopped. */
|
/* Non-zero if this LWP is stopped. */
|
||||||
int stopped;
|
int stopped = 0;
|
||||||
|
|
||||||
/* Non-zero if this LWP will be/has been resumed. Note that an LWP
|
/* Non-zero if this LWP will be/has been resumed. Note that an LWP
|
||||||
can be marked both as stopped and resumed at the same time. This
|
can be marked both as stopped and resumed at the same time. This
|
||||||
@ -223,38 +229,38 @@ struct lwp_info
|
|||||||
pending. We shouldn't let the LWP run until that wait status has
|
pending. We shouldn't let the LWP run until that wait status has
|
||||||
been processed, but we should not report that wait status if GDB
|
been processed, but we should not report that wait status if GDB
|
||||||
didn't try to let the LWP run. */
|
didn't try to let the LWP run. */
|
||||||
int resumed;
|
int resumed = 0;
|
||||||
|
|
||||||
/* The last resume GDB requested on this thread. */
|
/* The last resume GDB requested on this thread. */
|
||||||
enum resume_kind last_resume_kind;
|
resume_kind last_resume_kind = resume_continue;
|
||||||
|
|
||||||
/* If non-zero, a pending wait status. */
|
/* If non-zero, a pending wait status. */
|
||||||
int status;
|
int status = 0;
|
||||||
|
|
||||||
/* When 'stopped' is set, this is where the lwp last stopped, with
|
/* When 'stopped' is set, this is where the lwp last stopped, with
|
||||||
decr_pc_after_break already accounted for. If the LWP is
|
decr_pc_after_break already accounted for. If the LWP is
|
||||||
running and stepping, this is the address at which the lwp was
|
running and stepping, this is the address at which the lwp was
|
||||||
resumed (that is, it's the previous stop PC). If the LWP is
|
resumed (that is, it's the previous stop PC). If the LWP is
|
||||||
running and not stepping, this is 0. */
|
running and not stepping, this is 0. */
|
||||||
CORE_ADDR stop_pc;
|
CORE_ADDR stop_pc = 0;
|
||||||
|
|
||||||
/* Non-zero if we were stepping this LWP. */
|
/* Non-zero if we were stepping this LWP. */
|
||||||
int step;
|
int step = 0;
|
||||||
|
|
||||||
/* The reason the LWP last stopped, if we need to track it
|
/* The reason the LWP last stopped, if we need to track it
|
||||||
(breakpoint, watchpoint, etc.). */
|
(breakpoint, watchpoint, etc.). */
|
||||||
enum target_stop_reason stop_reason;
|
target_stop_reason stop_reason = TARGET_STOPPED_BY_NO_REASON;
|
||||||
|
|
||||||
/* On architectures where it is possible to know the data address of
|
/* On architectures where it is possible to know the data address of
|
||||||
a triggered watchpoint, STOPPED_DATA_ADDRESS_P is non-zero, and
|
a triggered watchpoint, STOPPED_DATA_ADDRESS_P is non-zero, and
|
||||||
STOPPED_DATA_ADDRESS contains such data address. Otherwise,
|
STOPPED_DATA_ADDRESS contains such data address. Otherwise,
|
||||||
STOPPED_DATA_ADDRESS_P is false, and STOPPED_DATA_ADDRESS is
|
STOPPED_DATA_ADDRESS_P is false, and STOPPED_DATA_ADDRESS is
|
||||||
undefined. Only valid if STOPPED_BY_WATCHPOINT is true. */
|
undefined. Only valid if STOPPED_BY_WATCHPOINT is true. */
|
||||||
int stopped_data_address_p;
|
int stopped_data_address_p = 0;
|
||||||
CORE_ADDR stopped_data_address;
|
CORE_ADDR stopped_data_address = 0;
|
||||||
|
|
||||||
/* Non-zero if we expect a duplicated SIGINT. */
|
/* Non-zero if we expect a duplicated SIGINT. */
|
||||||
int ignore_sigint;
|
int ignore_sigint = 0;
|
||||||
|
|
||||||
/* If WAITSTATUS->KIND != TARGET_WAITKIND_SPURIOUS, the waitstatus
|
/* If WAITSTATUS->KIND != TARGET_WAITKIND_SPURIOUS, the waitstatus
|
||||||
for this LWP's last event. This may correspond to STATUS above,
|
for this LWP's last event. This may correspond to STATUS above,
|
||||||
@ -269,15 +275,15 @@ struct lwp_info
|
|||||||
enum target_waitkind syscall_state;
|
enum target_waitkind syscall_state;
|
||||||
|
|
||||||
/* The processor core this LWP was last seen on. */
|
/* The processor core this LWP was last seen on. */
|
||||||
int core;
|
int core = -1;
|
||||||
|
|
||||||
/* Arch-specific additions. */
|
/* Arch-specific additions. */
|
||||||
struct arch_lwp_info *arch_private;
|
struct arch_lwp_info *arch_private = nullptr;
|
||||||
|
|
||||||
/* Previous and next pointers in doubly-linked list of known LWPs,
|
/* Previous and next pointers in doubly-linked list of known LWPs,
|
||||||
sorted by reverse creation order. */
|
sorted by reverse creation order. */
|
||||||
struct lwp_info *prev;
|
struct lwp_info *prev = nullptr;
|
||||||
struct lwp_info *next;
|
struct lwp_info *next = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* The global list of LWPs, for ALL_LWPS. Unlike the threads list,
|
/* The global list of LWPs, for ALL_LWPS. Unlike the threads list,
|
||||||
|
Reference in New Issue
Block a user