aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog40
-rw-r--r--gdb/aarch64-linux-nat.c4
-rw-r--r--gdb/arm-linux-nat.c2
-rw-r--r--gdb/breakpoint.c23
-rw-r--r--gdb/breakpoint.h13
-rw-r--r--gdb/ia64-tdep.c2
-rw-r--r--gdb/m32r-tdep.c2
-rw-r--r--gdb/mem-break.c22
-rw-r--r--gdb/microblaze-linux-tdep.c2
-rw-r--r--gdb/monitor.c2
-rw-r--r--gdb/nto-procfs.c2
-rw-r--r--gdb/ppc-linux-nat.c2
-rw-r--r--gdb/ppc-linux-tdep.c2
-rw-r--r--gdb/remote-m32r-sdi.c2
-rw-r--r--gdb/remote-mips.c7
-rw-r--r--gdb/remote.c14
-rw-r--r--gdb/x86-nat.c3
17 files changed, 99 insertions, 45 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index e4004fe..757cc69 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,43 @@
+2014-10-03 Maciej W. Rozycki <macro@codesourcery.com>
+
+ * breakpoint.h (bp_target_info): Add `reqstd_address' member,
+ update comments.
+ * breakpoint.c (one_breakpoint_xfer_memory): Use `reqstd_address'
+ for the breakpoint's address. Don't preinitialize `placed_size'.
+ (insert_bp_location): Set `reqstd_address' rather than
+ `placed_address'.
+ (bp_target_info_copy_insertion_state): Also copy `placed_address'.
+ (bkpt_insert_location): Use `reqstd_address' for the breakpoint's
+ address.
+ (bkpt_remove_location): Likewise.
+ (deprecated_insert_raw_breakpoint): Likewise.
+ (deprecated_remove_raw_breakpoint): Likewise.
+ (find_single_step_breakpoint): Likewise.
+ * mem-break.c (default_memory_insert_breakpoint): Use
+ `reqstd_address' for the breakpoint's address. Don't set
+ `placed_address' or `placed_size' if breakpoint contents couldn't
+ have been determined.
+ * remote.c (remote_insert_breakpoint): Use `reqstd_address' for
+ the breakpoint's address.
+ (remote_insert_hw_breakpoint): Likewise. Don't set
+ `placed_address' or `placed_size' if breakpoint couldn't have been
+ set.
+ * aarch64-linux-nat.c (aarch64_linux_insert_hw_breakpoint): Use
+ `reqstd_address' for the breakpoint's address.
+ * arm-linux-nat.c (arm_linux_hw_breakpoint_initialize): Likewise.
+ * ia64-tdep.c (ia64_memory_insert_breakpoint): Likewise.
+ * m32r-tdep.c (m32r_memory_insert_breakpoint): Likewise.
+ * microblaze-linux-tdep.c
+ (microblaze_linux_memory_remove_breakpoint): Likewise.
+ * monitor.c (monitor_insert_breakpoint): Likewise.
+ * nto-procfs.c (procfs_insert_breakpoint): Likewise.
+ (procfs_insert_hw_breakpoint): Likewise.
+ * ppc-linux-nat.c (ppc_linux_insert_hw_breakpoint): Likewise.
+ * ppc-linux-tdep.c (ppc_linux_memory_remove_breakpoint): Likewise.
+ * remote-m32r-sdi.c (m32r_insert_breakpoint): Likewise.
+ * remote-mips.c (mips_insert_breakpoint): Likewise.
+ * x86-nat.c (x86_insert_hw_breakpoint): Likewise.
+
2014-10-03 Luis Machado <lgustavo@codesourcery.com>
* valops.c (value_assign): Check for bit field assignments
diff --git a/gdb/aarch64-linux-nat.c b/gdb/aarch64-linux-nat.c
index 1c1832f..48a6378 100644
--- a/gdb/aarch64-linux-nat.c
+++ b/gdb/aarch64-linux-nat.c
@@ -1183,7 +1183,7 @@ aarch64_handle_breakpoint (int type, CORE_ADDR addr, int len, int is_insert)
return aarch64_dr_state_remove_one_point (state, type, addr, len);
}
-/* Insert a hardware-assisted breakpoint at BP_TGT->placed_address.
+/* Insert a hardware-assisted breakpoint at BP_TGT->reqstd_address.
Return 0 on success, -1 on failure. */
static int
@@ -1192,7 +1192,7 @@ aarch64_linux_insert_hw_breakpoint (struct target_ops *self,
struct bp_target_info *bp_tgt)
{
int ret;
- CORE_ADDR addr = bp_tgt->placed_address;
+ CORE_ADDR addr = bp_tgt->placed_address = bp_tgt->reqstd_address;
const int len = 4;
const int type = hw_execute;
diff --git a/gdb/arm-linux-nat.c b/gdb/arm-linux-nat.c
index 96c67a8..b9b9996 100644
--- a/gdb/arm-linux-nat.c
+++ b/gdb/arm-linux-nat.c
@@ -975,7 +975,7 @@ arm_linux_hw_breakpoint_initialize (struct gdbarch *gdbarch,
struct arm_linux_hw_breakpoint *p)
{
unsigned mask;
- CORE_ADDR address = bp_tgt->placed_address;
+ CORE_ADDR address = bp_tgt->placed_address = bp_tgt->reqstd_address;
/* We have to create a mask for the control register which says which bits
of the word pointed to by address to break on. */
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 7da88b0..e2170b4 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -1544,8 +1544,8 @@ one_breakpoint_xfer_memory (gdb_byte *readbuf, gdb_byte *writebuf,
else
{
const unsigned char *bp;
- CORE_ADDR placed_address = target_info->placed_address;
- int placed_size = target_info->placed_size;
+ CORE_ADDR addr = target_info->reqstd_address;
+ int placed_size;
/* Update the shadow with what we want to write to memory. */
memcpy (target_info->shadow_contents + bptoffset,
@@ -1553,7 +1553,7 @@ one_breakpoint_xfer_memory (gdb_byte *readbuf, gdb_byte *writebuf,
/* Determine appropriate breakpoint contents and size for this
address. */
- bp = gdbarch_breakpoint_from_pc (gdbarch, &placed_address, &placed_size);
+ bp = gdbarch_breakpoint_from_pc (gdbarch, &addr, &placed_size);
/* Update the final write buffer with this inserted
breakpoint's INSN. */
@@ -2601,7 +2601,7 @@ insert_bp_location (struct bp_location *bl,
we have a breakpoint inserted at that address and thus
read the breakpoint instead of returning the data saved in
the breakpoint location's shadow contents. */
- bl->target_info.placed_address = bl->address;
+ bl->target_info.reqstd_address = bl->address;
bl->target_info.placed_address_space = bl->pspace->aspace;
bl->target_info.length = bl->length;
@@ -2642,7 +2642,7 @@ insert_bp_location (struct bp_location *bl,
program, but it's not going to work anyway with current
gdb. */
struct mem_region *mr
- = lookup_mem_region (bl->target_info.placed_address);
+ = lookup_mem_region (bl->target_info.reqstd_address);
if (mr)
{
@@ -2722,7 +2722,7 @@ insert_bp_location (struct bp_location *bl,
bl->section);
/* Set a software (trap) breakpoint at the LMA. */
bl->overlay_target_info = bl->target_info;
- bl->overlay_target_info.placed_address = addr;
+ bl->overlay_target_info.reqstd_address = addr;
/* No overlay handling: just set the breakpoint. */
TRY_CATCH (e, RETURN_MASK_ALL)
@@ -13301,6 +13301,7 @@ bp_target_info_copy_insertion_state (struct bp_target_info *dest,
{
dest->shadow_len = src->shadow_len;
memcpy (dest->shadow_contents, src->shadow_contents, src->shadow_len);
+ dest->placed_address = src->placed_address;
dest->placed_size = src->placed_size;
}
@@ -13319,7 +13320,7 @@ bkpt_insert_location (struct bp_location *bl)
/* There is no need to insert a breakpoint if an unconditional
raw/sss breakpoint is already inserted at that location. */
sss_slot = find_single_step_breakpoint (bp_tgt->placed_address_space,
- bp_tgt->placed_address);
+ bp_tgt->reqstd_address);
if (sss_slot >= 0)
{
struct bp_target_info *sss_bp_tgt = single_step_breakpoints[sss_slot];
@@ -13341,7 +13342,7 @@ bkpt_remove_location (struct bp_location *bl)
{
struct bp_target_info *bp_tgt = &bl->target_info;
struct address_space *aspace = bp_tgt->placed_address_space;
- CORE_ADDR address = bp_tgt->placed_address;
+ CORE_ADDR address = bp_tgt->reqstd_address;
/* Only remove the breakpoint if there is no raw/sss breakpoint
still inserted at this location. Otherwise, we would be
@@ -15364,7 +15365,7 @@ deprecated_insert_raw_breakpoint (struct gdbarch *gdbarch,
bp_tgt = XCNEW (struct bp_target_info);
bp_tgt->placed_address_space = aspace;
- bp_tgt->placed_address = pc;
+ bp_tgt->reqstd_address = pc;
/* If an unconditional non-raw breakpoint is already inserted at
that location, there's no need to insert another. However, with
@@ -15401,7 +15402,7 @@ deprecated_remove_raw_breakpoint (struct gdbarch *gdbarch, void *bp)
{
struct bp_target_info *bp_tgt = bp;
struct address_space *aspace = bp_tgt->placed_address_space;
- CORE_ADDR address = bp_tgt->placed_address;
+ CORE_ADDR address = bp_tgt->reqstd_address;
struct bp_location *bl;
int ret;
@@ -15543,7 +15544,7 @@ find_single_step_breakpoint (struct address_space *aspace,
struct bp_target_info *bp_tgt = single_step_breakpoints[i];
if (bp_tgt
&& breakpoint_address_match (bp_tgt->placed_address_space,
- bp_tgt->placed_address,
+ bp_tgt->reqstd_address,
aspace, pc))
return i;
}
diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h
index d65405f..b611057 100644
--- a/gdb/breakpoint.h
+++ b/gdb/breakpoint.h
@@ -235,13 +235,16 @@ struct bp_target_info
/* Address space at which the breakpoint was placed. */
struct address_space *placed_address_space;
- /* Address at which the breakpoint was placed. This is normally the
- same as ADDRESS from the bp_location, except when adjustment
- happens in gdbarch_breakpoint_from_pc. The most common form of
- adjustment is stripping an alternate ISA marker from the PC which
- is used to determine the type of breakpoint to insert. */
+ /* Address at which the breakpoint was placed. This is normally
+ the same as REQUESTED_ADDRESS, except when adjustment happens in
+ gdbarch_breakpoint_from_pc. The most common form of adjustment
+ is stripping an alternate ISA marker from the PC which is used
+ to determine the type of breakpoint to insert. */
CORE_ADDR placed_address;
+ /* Address at which the breakpoint was requested. */
+ CORE_ADDR reqstd_address;
+
/* If this is a ranged breakpoint, then this field contains the
length of the range that will be watched for execution. */
int length;
diff --git a/gdb/ia64-tdep.c b/gdb/ia64-tdep.c
index 776a8be..85f2b9a 100644
--- a/gdb/ia64-tdep.c
+++ b/gdb/ia64-tdep.c
@@ -637,7 +637,7 @@ static int
ia64_memory_insert_breakpoint (struct gdbarch *gdbarch,
struct bp_target_info *bp_tgt)
{
- CORE_ADDR addr = bp_tgt->placed_address;
+ CORE_ADDR addr = bp_tgt->placed_address = bp_tgt->reqstd_address;
gdb_byte bundle[BUNDLE_LEN];
int slotnum = (int) (addr & 0x0f) / SLOT_MULTIPLIER, shadow_slotnum;
long long instr_breakpoint;
diff --git a/gdb/m32r-tdep.c b/gdb/m32r-tdep.c
index 067ff99..5b6af4b 100644
--- a/gdb/m32r-tdep.c
+++ b/gdb/m32r-tdep.c
@@ -79,7 +79,7 @@ static int
m32r_memory_insert_breakpoint (struct gdbarch *gdbarch,
struct bp_target_info *bp_tgt)
{
- CORE_ADDR addr = bp_tgt->placed_address;
+ CORE_ADDR addr = bp_tgt->placed_address = bp_tgt->reqstd_address;
int val;
gdb_byte buf[4];
gdb_byte contents_cache[4];
diff --git a/gdb/mem-break.c b/gdb/mem-break.c
index 095b81f..f772f56 100644
--- a/gdb/mem-break.c
+++ b/gdb/mem-break.c
@@ -37,27 +37,29 @@ int
default_memory_insert_breakpoint (struct gdbarch *gdbarch,
struct bp_target_info *bp_tgt)
{
- int val;
+ CORE_ADDR addr = bp_tgt->reqstd_address;
const unsigned char *bp;
gdb_byte *readbuf;
+ int bplen;
+ int val;
/* Determine appropriate breakpoint contents and size for this address. */
- bp = gdbarch_breakpoint_from_pc
- (gdbarch, &bp_tgt->placed_address, &bp_tgt->placed_size);
+ bp = gdbarch_breakpoint_from_pc (gdbarch, &addr, &bplen);
if (bp == NULL)
error (_("Software breakpoints not implemented for this target."));
+ bp_tgt->placed_address = addr;
+ bp_tgt->placed_size = bplen;
+
/* Save the memory contents in the shadow_contents buffer and then
write the breakpoint instruction. */
- bp_tgt->shadow_len = bp_tgt->placed_size;
- readbuf = alloca (bp_tgt->placed_size);
- val = target_read_memory (bp_tgt->placed_address, readbuf,
- bp_tgt->placed_size);
+ bp_tgt->shadow_len = bplen;
+ readbuf = alloca (bplen);
+ val = target_read_memory (addr, readbuf, bplen);
if (val == 0)
{
- memcpy (bp_tgt->shadow_contents, readbuf, bp_tgt->placed_size);
- val = target_write_raw_memory (bp_tgt->placed_address, bp,
- bp_tgt->placed_size);
+ memcpy (bp_tgt->shadow_contents, readbuf, bplen);
+ val = target_write_raw_memory (addr, bp, bplen);
}
return val;
diff --git a/gdb/microblaze-linux-tdep.c b/gdb/microblaze-linux-tdep.c
index 8d360eb..d5334cb 100644
--- a/gdb/microblaze-linux-tdep.c
+++ b/gdb/microblaze-linux-tdep.c
@@ -41,7 +41,7 @@ static int
microblaze_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
struct bp_target_info *bp_tgt)
{
- CORE_ADDR addr = bp_tgt->placed_address;
+ CORE_ADDR addr = bp_tgt->reqstd_address;
const gdb_byte *bp;
int val;
int bplen;
diff --git a/gdb/monitor.c b/gdb/monitor.c
index b880ff2..f7e331b 100644
--- a/gdb/monitor.c
+++ b/gdb/monitor.c
@@ -2103,7 +2103,7 @@ static int
monitor_insert_breakpoint (struct target_ops *ops, struct gdbarch *gdbarch,
struct bp_target_info *bp_tgt)
{
- CORE_ADDR addr = bp_tgt->placed_address;
+ CORE_ADDR addr = bp_tgt->placed_address = bp_tgt->reqstd_address;
int i;
int bplen;
diff --git a/gdb/nto-procfs.c b/gdb/nto-procfs.c
index 7903210..7a96cc9 100644
--- a/gdb/nto-procfs.c
+++ b/gdb/nto-procfs.c
@@ -928,6 +928,7 @@ static int
procfs_insert_breakpoint (struct target_ops *ops, struct gdbarch *gdbarch,
struct bp_target_info *bp_tgt)
{
+ bp_tgt->placed_address = bp_tgt->reqstd_address;
return procfs_breakpoint (bp_tgt->placed_address, _DEBUG_BREAK_EXEC, 0);
}
@@ -942,6 +943,7 @@ static int
procfs_insert_hw_breakpoint (struct target_ops *self, struct gdbarch *gdbarch,
struct bp_target_info *bp_tgt)
{
+ bp_tgt->placed_address = bp_tgt->reqstd_address;
return procfs_breakpoint (bp_tgt->placed_address,
_DEBUG_BREAK_EXEC | _DEBUG_BREAK_HW, 0);
}
diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c
index 0d03936..496c4e7 100644
--- a/gdb/ppc-linux-nat.c
+++ b/gdb/ppc-linux-nat.c
@@ -1690,7 +1690,7 @@ ppc_linux_insert_hw_breakpoint (struct target_ops *self,
p.version = PPC_DEBUG_CURRENT_VERSION;
p.trigger_type = PPC_BREAKPOINT_TRIGGER_EXECUTE;
p.condition_mode = PPC_BREAKPOINT_CONDITION_NONE;
- p.addr = (uint64_t) bp_tgt->placed_address;
+ p.addr = (uint64_t) (bp_tgt->placed_address = bp_tgt->reqstd_address);
p.condition_value = 0;
if (bp_tgt->length)
diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c
index 4d7d051..d232f7f 100644
--- a/gdb/ppc-linux-tdep.c
+++ b/gdb/ppc-linux-tdep.c
@@ -211,7 +211,7 @@ static int
ppc_linux_memory_remove_breakpoint (struct gdbarch *gdbarch,
struct bp_target_info *bp_tgt)
{
- CORE_ADDR addr = bp_tgt->placed_address;
+ CORE_ADDR addr = bp_tgt->reqstd_address;
const unsigned char *bp;
int val;
int bplen;
diff --git a/gdb/remote-m32r-sdi.c b/gdb/remote-m32r-sdi.c
index 3d6b0c6..d1d07c2 100644
--- a/gdb/remote-m32r-sdi.c
+++ b/gdb/remote-m32r-sdi.c
@@ -1172,7 +1172,7 @@ m32r_insert_breakpoint (struct target_ops *ops,
struct gdbarch *gdbarch,
struct bp_target_info *bp_tgt)
{
- CORE_ADDR addr = bp_tgt->placed_address;
+ CORE_ADDR addr = bp_tgt->placed_address = bp_tgt->reqstd_address;
int ib_breakpoints;
unsigned char buf[13];
int i, c;
diff --git a/gdb/remote-mips.c b/gdb/remote-mips.c
index 19ac30f..9e4039d 100644
--- a/gdb/remote-mips.c
+++ b/gdb/remote-mips.c
@@ -2375,8 +2375,11 @@ mips_insert_breakpoint (struct target_ops *ops, struct gdbarch *gdbarch,
struct bp_target_info *bp_tgt)
{
if (monitor_supports_breakpoints)
- return mips_set_breakpoint (bp_tgt->placed_address, MIPS_INSN32_SIZE,
- BREAK_FETCH);
+ {
+ bp_tgt->placed_address = bp_tgt->reqstd_address;
+ return mips_set_breakpoint (bp_tgt->placed_address, MIPS_INSN32_SIZE,
+ BREAK_FETCH);
+ }
else
return memory_insert_breakpoint (ops, gdbarch, bp_tgt);
}
diff --git a/gdb/remote.c b/gdb/remote.c
index 41ea012..3d55e41 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -8076,7 +8076,7 @@ remote_insert_breakpoint (struct target_ops *ops,
if (packet_support (PACKET_Z0) != PACKET_DISABLE)
{
- CORE_ADDR addr = bp_tgt->placed_address;
+ CORE_ADDR addr = bp_tgt->reqstd_address;
struct remote_state *rs;
char *p, *endbuf;
int bpsize;
@@ -8348,16 +8348,16 @@ static int
remote_insert_hw_breakpoint (struct target_ops *self, struct gdbarch *gdbarch,
struct bp_target_info *bp_tgt)
{
- CORE_ADDR addr;
+ CORE_ADDR addr = bp_tgt->reqstd_address;
struct remote_state *rs;
char *p, *endbuf;
char *message;
+ int bpsize;
/* The length field should be set to the size of a breakpoint
instruction, even though we aren't inserting one ourselves. */
- gdbarch_remote_breakpoint_from_pc
- (gdbarch, &bp_tgt->placed_address, &bp_tgt->placed_size);
+ gdbarch_remote_breakpoint_from_pc (gdbarch, &addr, &bpsize);
if (packet_support (PACKET_Z1) == PACKET_DISABLE)
return -1;
@@ -8375,9 +8375,9 @@ remote_insert_hw_breakpoint (struct target_ops *self, struct gdbarch *gdbarch,
*(p++) = '1';
*(p++) = ',';
- addr = remote_address_masked (bp_tgt->placed_address);
+ addr = remote_address_masked (addr);
p += hexnumstr (p, (ULONGEST) addr);
- xsnprintf (p, endbuf - p, ",%x", bp_tgt->placed_size);
+ xsnprintf (p, endbuf - p, ",%x", bpsize);
if (remote_supports_cond_breakpoints (self))
remote_add_target_side_condition (gdbarch, bp_tgt, p, endbuf);
@@ -8401,6 +8401,8 @@ remote_insert_hw_breakpoint (struct target_ops *self, struct gdbarch *gdbarch,
case PACKET_UNKNOWN:
return -1;
case PACKET_OK:
+ bp_tgt->placed_address = addr;
+ bp_tgt->placed_size = bpsize;
return 0;
}
internal_error (__FILE__, __LINE__,
diff --git a/gdb/x86-nat.c b/gdb/x86-nat.c
index a016e60..00274d3 100644
--- a/gdb/x86-nat.c
+++ b/gdb/x86-nat.c
@@ -211,7 +211,7 @@ x86_stopped_by_watchpoint (struct target_ops *ops)
return x86_dr_stopped_by_watchpoint (state);
}
-/* Insert a hardware-assisted breakpoint at BP_TGT->placed_address.
+/* Insert a hardware-assisted breakpoint at BP_TGT->reqstd_address.
Return 0 on success, EBUSY on failure. */
static int
@@ -221,6 +221,7 @@ x86_insert_hw_breakpoint (struct target_ops *self, struct gdbarch *gdbarch,
struct x86_debug_reg_state *state
= x86_debug_reg_state (ptid_get_pid (inferior_ptid));
+ bp_tgt->placed_address = bp_tgt->reqstd_address;
return x86_dr_insert_watchpoint (state, hw_execute,
bp_tgt->placed_address, 1) ? EBUSY : 0;
}