gdb: use intrusive_list for linux-nat lwp_list

Replace the manually maintained linked list of lwp_info objects with
intrusive_list.  Replace the ALL_LWPS macro with all_lwps, which returns
a range.  Add all_lwps_safe as well, for use in iterate_over_lwps, which
currently iterates in a safe manner.

Change-Id: I355313502510acc0103f5eaf2fbde80897d6376c
This commit is contained in:
Simon Marchi 2021-08-28 10:58:45 -04:00
parent 676362df18
commit 901b98215e
5 changed files with 46 additions and 53 deletions

View file

@ -589,7 +589,6 @@ ia64_linux_nat_target::insert_watchpoint (CORE_ADDR addr, int len,
enum target_hw_bp_type type,
struct expression *cond)
{
struct lwp_info *lp;
int idx;
long dbr_addr, dbr_mask;
int max_watchpoints = 4;
@ -630,7 +629,8 @@ ia64_linux_nat_target::insert_watchpoint (CORE_ADDR addr, int len,
debug_registers[2 * idx] = dbr_addr;
debug_registers[2 * idx + 1] = dbr_mask;
ALL_LWPS (lp)
for (const lwp_info *lp : all_lwps ())
{
store_debug_register_pair (lp->ptid, idx, &dbr_addr, &dbr_mask);
enable_watchpoints_in_psr (lp->ptid);
@ -657,14 +657,12 @@ ia64_linux_nat_target::remove_watchpoint (CORE_ADDR addr, int len,
dbr_mask = debug_registers[2 * idx + 1];
if ((dbr_mask & (0x3UL << 62)) && addr == (CORE_ADDR) dbr_addr)
{
struct lwp_info *lp;
debug_registers[2 * idx] = 0;
debug_registers[2 * idx + 1] = 0;
dbr_addr = 0;
dbr_mask = 0;
ALL_LWPS (lp)
for (const lwp_info *lp : all_lwps ())
store_debug_register_pair (lp->ptid, idx, &dbr_addr, &dbr_mask);
return 0;