aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2011-10-07 17:15:15 +0000
committerPedro Alves <palves@redhat.com>2011-10-07 17:15:15 +0000
commit4c38200f7dda423c701d01639596df606b96433c (patch)
treee057fcf2b7f60fe320e546b5d8868de5eec50ec7 /gdb
parentb7ff339d9ed68980660d58409c226d6d9b83e70e (diff)
downloadgdb-4c38200f7dda423c701d01639596df606b96433c.zip
gdb-4c38200f7dda423c701d01639596df606b96433c.tar.gz
gdb-4c38200f7dda423c701d01639596df606b96433c.tar.bz2
2011-10-07 Pedro Alves <pedro@codesourcery.com>
* linux-nat.h (ALL_LWPS): Remove the ptid parameter. * amd64-linux-nat.c (amd64_linux_dr_set_control) (amd64_linux_dr_set_addr, amd64_linux_dr_unset_status): Adjust. * arm-linux-nat.c (arm_linux_insert_hw_breakpoint) (arm_linux_remove_hw_breakpoint, arm_linux_insert_watchpoint) (arm_linux_remove_watchpoint): Adjust. * i386-linux-nat.c (i386_linux_dr_set_control) (i386_linux_dr_set_addr, i386_linux_dr_unset_status): Adjust. * ia64-linux-nat.c (ia64_linux_insert_watchpoint) (ia64_linux_remove_watchpoint): Adjust. * mips-linux-nat.c (write_watchpoint_regs): Adjust. * ppc-linux-nat.c (ppc_linux_insert_hw_breakpoint) (ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint) (ppc_linux_insert_mask_watchpoint) (ppc_linux_remove_mask_watchpoint, ppc_linux_insert_watchpoint) (ppc_linux_remove_watchpoint): Adjust. * s390-nat.c (s390_insert_watchpoint, s390_remove_watchpoint): Adjust.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog21
-rw-r--r--gdb/amd64-linux-nat.c17
-rw-r--r--gdb/arm-linux-nat.c20
-rw-r--r--gdb/i386-linux-nat.c19
-rw-r--r--gdb/ia64-linux-nat.c12
-rw-r--r--gdb/linux-nat.h9
-rw-r--r--gdb/mips-linux-nat.c5
-rw-r--r--gdb/ppc-linux-nat.c38
-rw-r--r--gdb/s390-nat.c10
9 files changed, 75 insertions, 76 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 6fce328..44928e9 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,24 @@
+2011-10-07 Pedro Alves <pedro@codesourcery.com>
+
+ * linux-nat.h (ALL_LWPS): Remove the ptid parameter.
+ * amd64-linux-nat.c (amd64_linux_dr_set_control)
+ (amd64_linux_dr_set_addr, amd64_linux_dr_unset_status): Adjust.
+ * arm-linux-nat.c (arm_linux_insert_hw_breakpoint)
+ (arm_linux_remove_hw_breakpoint, arm_linux_insert_watchpoint)
+ (arm_linux_remove_watchpoint): Adjust.
+ * i386-linux-nat.c (i386_linux_dr_set_control)
+ (i386_linux_dr_set_addr, i386_linux_dr_unset_status): Adjust.
+ * ia64-linux-nat.c (ia64_linux_insert_watchpoint)
+ (ia64_linux_remove_watchpoint): Adjust.
+ * mips-linux-nat.c (write_watchpoint_regs): Adjust.
+ * ppc-linux-nat.c (ppc_linux_insert_hw_breakpoint)
+ (ppc_linux_insert_hw_breakpoint, ppc_linux_remove_hw_breakpoint)
+ (ppc_linux_insert_mask_watchpoint)
+ (ppc_linux_remove_mask_watchpoint, ppc_linux_insert_watchpoint)
+ (ppc_linux_remove_watchpoint): Adjust.
+ * s390-nat.c (s390_insert_watchpoint, s390_remove_watchpoint):
+ Adjust.
+
2011-10-07 Corinna Vinschen <vinschen@redhat.com>
* windows-nat.c: Include wchar.h to avoid compiler warnings.
diff --git a/gdb/amd64-linux-nat.c b/gdb/amd64-linux-nat.c
index a869f85..caf2e96 100644
--- a/gdb/amd64-linux-nat.c
+++ b/gdb/amd64-linux-nat.c
@@ -319,11 +319,10 @@ static void
amd64_linux_dr_set_control (unsigned long control)
{
struct lwp_info *lp;
- ptid_t ptid;
amd64_linux_dr[DR_CONTROL] = control;
- ALL_LWPS (lp, ptid)
- amd64_linux_dr_set (ptid, DR_CONTROL, control);
+ ALL_LWPS (lp)
+ amd64_linux_dr_set (lp->ptid, DR_CONTROL, control);
}
/* Set address REGNUM (zero based) to ADDR in all LWPs of LWP_LIST. */
@@ -332,13 +331,12 @@ static void
amd64_linux_dr_set_addr (int regnum, CORE_ADDR addr)
{
struct lwp_info *lp;
- ptid_t ptid;
gdb_assert (regnum >= 0 && regnum <= DR_LASTADDR - DR_FIRSTADDR);
amd64_linux_dr[DR_FIRSTADDR + regnum] = addr;
- ALL_LWPS (lp, ptid)
- amd64_linux_dr_set (ptid, DR_FIRSTADDR + regnum, addr);
+ ALL_LWPS (lp)
+ amd64_linux_dr_set (lp->ptid, DR_FIRSTADDR + regnum, addr);
}
/* Set address REGNUM (zero based) to zero in all LWPs of LWP_LIST. */
@@ -363,15 +361,14 @@ static void
amd64_linux_dr_unset_status (unsigned long mask)
{
struct lwp_info *lp;
- ptid_t ptid;
- ALL_LWPS (lp, ptid)
+ ALL_LWPS (lp)
{
unsigned long value;
- value = amd64_linux_dr_get (ptid, DR_STATUS);
+ value = amd64_linux_dr_get (lp->ptid, DR_STATUS);
value &= ~mask;
- amd64_linux_dr_set (ptid, DR_STATUS, value);
+ amd64_linux_dr_set (lp->ptid, DR_STATUS, value);
}
}
diff --git a/gdb/arm-linux-nat.c b/gdb/arm-linux-nat.c
index f64c37c..5b0b5ce 100644
--- a/gdb/arm-linux-nat.c
+++ b/gdb/arm-linux-nat.c
@@ -1075,7 +1075,6 @@ static int
arm_linux_insert_hw_breakpoint (struct gdbarch *gdbarch,
struct bp_target_info *bp_tgt)
{
- ptid_t ptid;
struct lwp_info *lp;
struct arm_linux_hw_breakpoint p;
@@ -1083,8 +1082,8 @@ arm_linux_insert_hw_breakpoint (struct gdbarch *gdbarch,
return -1;
arm_linux_hw_breakpoint_initialize (gdbarch, bp_tgt, &p);
- ALL_LWPS (lp, ptid)
- arm_linux_insert_hw_breakpoint1 (&p, TIDGET (ptid), 0);
+ ALL_LWPS (lp)
+ arm_linux_insert_hw_breakpoint1 (&p, TIDGET (lp->ptid), 0);
return 0;
}
@@ -1094,7 +1093,6 @@ static int
arm_linux_remove_hw_breakpoint (struct gdbarch *gdbarch,
struct bp_target_info *bp_tgt)
{
- ptid_t ptid;
struct lwp_info *lp;
struct arm_linux_hw_breakpoint p;
@@ -1102,8 +1100,8 @@ arm_linux_remove_hw_breakpoint (struct gdbarch *gdbarch,
return -1;
arm_linux_hw_breakpoint_initialize (gdbarch, bp_tgt, &p);
- ALL_LWPS (lp, ptid)
- arm_linux_remove_hw_breakpoint1 (&p, TIDGET (ptid), 0);
+ ALL_LWPS (lp)
+ arm_linux_remove_hw_breakpoint1 (&p, TIDGET (lp->ptid), 0);
return 0;
}
@@ -1146,7 +1144,6 @@ static int
arm_linux_insert_watchpoint (CORE_ADDR addr, int len, int rw,
struct expression *cond)
{
- ptid_t ptid;
struct lwp_info *lp;
struct arm_linux_hw_breakpoint p;
@@ -1154,8 +1151,8 @@ arm_linux_insert_watchpoint (CORE_ADDR addr, int len, int rw,
return -1;
arm_linux_hw_watchpoint_initialize (addr, len, rw, &p);
- ALL_LWPS (lp, ptid)
- arm_linux_insert_hw_breakpoint1 (&p, TIDGET (ptid), 1);
+ ALL_LWPS (lp)
+ arm_linux_insert_hw_breakpoint1 (&p, TIDGET (lp->ptid), 1);
return 0;
}
@@ -1165,7 +1162,6 @@ static int
arm_linux_remove_watchpoint (CORE_ADDR addr, int len, int rw,
struct expression *cond)
{
- ptid_t ptid;
struct lwp_info *lp;
struct arm_linux_hw_breakpoint p;
@@ -1173,8 +1169,8 @@ arm_linux_remove_watchpoint (CORE_ADDR addr, int len, int rw,
return -1;
arm_linux_hw_watchpoint_initialize (addr, len, rw, &p);
- ALL_LWPS (lp, ptid)
- arm_linux_remove_hw_breakpoint1 (&p, TIDGET (ptid), 1);
+ ALL_LWPS (lp)
+ arm_linux_remove_hw_breakpoint1 (&p, TIDGET (lp->ptid), 1);
return 0;
}
diff --git a/gdb/i386-linux-nat.c b/gdb/i386-linux-nat.c
index 6257931..187c49d 100644
--- a/gdb/i386-linux-nat.c
+++ b/gdb/i386-linux-nat.c
@@ -707,11 +707,10 @@ static void
i386_linux_dr_set_control (unsigned long control)
{
struct lwp_info *lp;
- ptid_t ptid;
i386_linux_dr[DR_CONTROL] = control;
- ALL_LWPS (lp, ptid)
- i386_linux_dr_set (ptid, DR_CONTROL, control);
+ ALL_LWPS (lp)
+ i386_linux_dr_set (lp->ptid, DR_CONTROL, control);
}
/* Set address REGNUM (zero based) to ADDR in all LWPs of LWP_LIST. */
@@ -720,13 +719,12 @@ static void
i386_linux_dr_set_addr (int regnum, CORE_ADDR addr)
{
struct lwp_info *lp;
- ptid_t ptid;
gdb_assert (regnum >= 0 && regnum <= DR_LASTADDR - DR_FIRSTADDR);
i386_linux_dr[DR_FIRSTADDR + regnum] = addr;
- ALL_LWPS (lp, ptid)
- i386_linux_dr_set (ptid, DR_FIRSTADDR + regnum, addr);
+ ALL_LWPS (lp)
+ i386_linux_dr_set (lp->ptid, DR_FIRSTADDR + regnum, addr);
}
/* Set address REGNUM (zero based) to zero in all LWPs of LWP_LIST. */
@@ -751,15 +749,14 @@ static void
i386_linux_dr_unset_status (unsigned long mask)
{
struct lwp_info *lp;
- ptid_t ptid;
- ALL_LWPS (lp, ptid)
+ ALL_LWPS (lp)
{
unsigned long value;
-
- value = i386_linux_dr_get (ptid, DR_STATUS);
+
+ value = i386_linux_dr_get (lp->ptid, DR_STATUS);
value &= ~mask;
- i386_linux_dr_set (ptid, DR_STATUS, value);
+ i386_linux_dr_set (lp->ptid, DR_STATUS, value);
}
}
diff --git a/gdb/ia64-linux-nat.c b/gdb/ia64-linux-nat.c
index 0f88e14..65e077b 100644
--- a/gdb/ia64-linux-nat.c
+++ b/gdb/ia64-linux-nat.c
@@ -535,7 +535,6 @@ ia64_linux_insert_watchpoint (CORE_ADDR addr, int len, int rw,
struct expression *cond)
{
struct lwp_info *lp;
- ptid_t ptid;
int idx;
long dbr_addr, dbr_mask;
int max_watchpoints = 4;
@@ -576,10 +575,10 @@ ia64_linux_insert_watchpoint (CORE_ADDR addr, int len, int rw,
debug_registers[2 * idx] = dbr_addr;
debug_registers[2 * idx + 1] = dbr_mask;
- ALL_LWPS (lp, ptid)
+ ALL_LWPS (lp)
{
- store_debug_register_pair (ptid, idx, &dbr_addr, &dbr_mask);
- enable_watchpoints_in_psr (ptid);
+ store_debug_register_pair (lp->ptid, idx, &dbr_addr, &dbr_mask);
+ enable_watchpoints_in_psr (lp->ptid);
}
return 0;
@@ -603,15 +602,14 @@ ia64_linux_remove_watchpoint (CORE_ADDR addr, int len, int type,
if ((dbr_mask & (0x3UL << 62)) && addr == (CORE_ADDR) dbr_addr)
{
struct lwp_info *lp;
- ptid_t ptid;
debug_registers[2 * idx] = 0;
debug_registers[2 * idx + 1] = 0;
dbr_addr = 0;
dbr_mask = 0;
- ALL_LWPS (lp, ptid)
- store_debug_register_pair (ptid, idx, &dbr_addr, &dbr_mask);
+ ALL_LWPS (lp)
+ store_debug_register_pair (lp->ptid, idx, &dbr_addr, &dbr_mask);
return 0;
}
diff --git a/gdb/linux-nat.h b/gdb/linux-nat.h
index 6175f3a..1fa94ce 100644
--- a/gdb/linux-nat.h
+++ b/gdb/linux-nat.h
@@ -118,12 +118,11 @@ struct lwp_info
native target is active. */
extern struct lwp_info *lwp_list;
-/* Iterate over the PTID each active thread (light-weight process). There
- must be at least one. */
-#define ALL_LWPS(LP, PTID) \
- for ((LP) = lwp_list, (PTID) = (LP)->ptid; \
+/* Iterate over each active thread (light-weight process). */
+#define ALL_LWPS(LP) \
+ for ((LP) = lwp_list; \
(LP) != NULL; \
- (LP) = (LP)->next, (PTID) = (LP) ? (LP)->ptid : (PTID))
+ (LP) = (LP)->next)
#define GET_LWP(ptid) ptid_get_lwp (ptid)
#define GET_PID(ptid) ptid_get_pid (ptid)
diff --git a/gdb/mips-linux-nat.c b/gdb/mips-linux-nat.c
index 2b90113..2602e2d 100644
--- a/gdb/mips-linux-nat.c
+++ b/gdb/mips-linux-nat.c
@@ -871,12 +871,11 @@ static int
write_watchpoint_regs (void)
{
struct lwp_info *lp;
- ptid_t ptid;
int tid;
- ALL_LWPS (lp, ptid)
+ ALL_LWPS (lp)
{
- tid = ptid_get_lwp (ptid);
+ tid = ptid_get_lwp (lp->ptid);
if (ptrace (PTRACE_SET_WATCH_REGS, tid, &watch_mirror) == -1)
perror_with_name (_("Couldn't write debug register"));
}
diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c
index 275de78..94cfbf8 100644
--- a/gdb/ppc-linux-nat.c
+++ b/gdb/ppc-linux-nat.c
@@ -1654,7 +1654,6 @@ static int
ppc_linux_insert_hw_breakpoint (struct gdbarch *gdbarch,
struct bp_target_info *bp_tgt)
{
- ptid_t ptid;
struct lwp_info *lp;
struct ppc_hw_breakpoint p;
@@ -1681,8 +1680,8 @@ ppc_linux_insert_hw_breakpoint (struct gdbarch *gdbarch,
p.addr2 = 0;
}
- ALL_LWPS (lp, ptid)
- booke_insert_point (&p, TIDGET (ptid));
+ ALL_LWPS (lp)
+ booke_insert_point (&p, TIDGET (lp->ptid));
return 0;
}
@@ -1691,7 +1690,6 @@ static int
ppc_linux_remove_hw_breakpoint (struct gdbarch *gdbarch,
struct bp_target_info *bp_tgt)
{
- ptid_t ptid;
struct lwp_info *lp;
struct ppc_hw_breakpoint p;
@@ -1718,8 +1716,8 @@ ppc_linux_remove_hw_breakpoint (struct gdbarch *gdbarch,
p.addr2 = 0;
}
- ALL_LWPS (lp, ptid)
- booke_remove_point (&p, TIDGET (ptid));
+ ALL_LWPS (lp)
+ booke_remove_point (&p, TIDGET (lp->ptid));
return 0;
}
@@ -1748,7 +1746,6 @@ static int
ppc_linux_insert_mask_watchpoint (struct target_ops *ops, CORE_ADDR addr,
CORE_ADDR mask, int rw)
{
- ptid_t ptid;
struct lwp_info *lp;
struct ppc_hw_breakpoint p;
@@ -1762,8 +1759,8 @@ ppc_linux_insert_mask_watchpoint (struct target_ops *ops, CORE_ADDR addr,
p.addr2 = mask;
p.condition_value = 0;
- ALL_LWPS (lp, ptid)
- booke_insert_point (&p, TIDGET (ptid));
+ ALL_LWPS (lp)
+ booke_insert_point (&p, TIDGET (lp->ptid));
return 0;
}
@@ -1777,7 +1774,6 @@ static int
ppc_linux_remove_mask_watchpoint (struct target_ops *ops, CORE_ADDR addr,
CORE_ADDR mask, int rw)
{
- ptid_t ptid;
struct lwp_info *lp;
struct ppc_hw_breakpoint p;
@@ -1791,8 +1787,8 @@ ppc_linux_remove_mask_watchpoint (struct target_ops *ops, CORE_ADDR addr,
p.addr2 = mask;
p.condition_value = 0;
- ALL_LWPS (lp, ptid)
- booke_remove_point (&p, TIDGET (ptid));
+ ALL_LWPS (lp)
+ booke_remove_point (&p, TIDGET (lp->ptid));
return 0;
}
@@ -2059,7 +2055,6 @@ ppc_linux_insert_watchpoint (CORE_ADDR addr, int len, int rw,
struct expression *cond)
{
struct lwp_info *lp;
- ptid_t ptid;
int ret = -1;
if (have_ptrace_booke_interface ())
@@ -2068,8 +2063,8 @@ ppc_linux_insert_watchpoint (CORE_ADDR addr, int len, int rw,
create_watchpoint_request (&p, addr, len, rw, cond, 1);
- ALL_LWPS (lp, ptid)
- booke_insert_point (&p, TIDGET (ptid));
+ ALL_LWPS (lp)
+ booke_insert_point (&p, TIDGET (lp->ptid));
ret = 0;
}
@@ -2112,8 +2107,8 @@ ppc_linux_insert_watchpoint (CORE_ADDR addr, int len, int rw,
saved_dabr_value = dabr_value;
- ALL_LWPS (lp, ptid)
- if (ptrace (PTRACE_SET_DEBUGREG, TIDGET (ptid), 0,
+ ALL_LWPS (lp)
+ if (ptrace (PTRACE_SET_DEBUGREG, TIDGET (lp->ptid), 0,
saved_dabr_value) < 0)
return -1;
@@ -2128,7 +2123,6 @@ ppc_linux_remove_watchpoint (CORE_ADDR addr, int len, int rw,
struct expression *cond)
{
struct lwp_info *lp;
- ptid_t ptid;
int ret = -1;
if (have_ptrace_booke_interface ())
@@ -2137,16 +2131,16 @@ ppc_linux_remove_watchpoint (CORE_ADDR addr, int len, int rw,
create_watchpoint_request (&p, addr, len, rw, cond, 0);
- ALL_LWPS (lp, ptid)
- booke_remove_point (&p, TIDGET (ptid));
+ ALL_LWPS (lp)
+ booke_remove_point (&p, TIDGET (lp->ptid));
ret = 0;
}
else
{
saved_dabr_value = 0;
- ALL_LWPS (lp, ptid)
- if (ptrace (PTRACE_SET_DEBUGREG, TIDGET (ptid), 0,
+ ALL_LWPS (lp)
+ if (ptrace (PTRACE_SET_DEBUGREG, TIDGET (lp->ptid), 0,
saved_dabr_value) < 0)
return -1;
diff --git a/gdb/s390-nat.c b/gdb/s390-nat.c
index b412fda..5bc88a9 100644
--- a/gdb/s390-nat.c
+++ b/gdb/s390-nat.c
@@ -339,7 +339,6 @@ s390_insert_watchpoint (CORE_ADDR addr, int len, int type,
struct expression *cond)
{
struct lwp_info *lp;
- ptid_t ptid;
struct watch_area *area = xmalloc (sizeof (struct watch_area));
if (!area)
@@ -351,8 +350,8 @@ s390_insert_watchpoint (CORE_ADDR addr, int len, int type,
area->next = watch_base;
watch_base = area;
- ALL_LWPS (lp, ptid)
- s390_fix_watch_points (ptid);
+ ALL_LWPS (lp)
+ s390_fix_watch_points (lp->ptid);
return 0;
}
@@ -361,7 +360,6 @@ s390_remove_watchpoint (CORE_ADDR addr, int len, int type,
struct expression *cond)
{
struct lwp_info *lp;
- ptid_t ptid;
struct watch_area *area, **parea;
for (parea = &watch_base; *parea; parea = &(*parea)->next)
@@ -380,8 +378,8 @@ s390_remove_watchpoint (CORE_ADDR addr, int len, int type,
*parea = area->next;
xfree (area);
- ALL_LWPS (lp, ptid)
- s390_fix_watch_points (ptid);
+ ALL_LWPS (lp)
+ s390_fix_watch_points (lp->ptid);
return 0;
}