aboutsummaryrefslogtreecommitdiff
path: root/gdb/breakpoint.c
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2008-11-26 05:27:48 +0000
committerJan Kratochvil <jan.kratochvil@redhat.com>2008-11-26 05:27:48 +0000
commit939c61faffc518af588365f5d39a69da78211578 (patch)
tree7f36b385b3160f5cad5b7265097ede82dcb21a96 /gdb/breakpoint.c
parenta655d4241122ccebd491f8149759ab926766cb0c (diff)
downloadgdb-939c61faffc518af588365f5d39a69da78211578.zip
gdb-939c61faffc518af588365f5d39a69da78211578.tar.gz
gdb-939c61faffc518af588365f5d39a69da78211578.tar.bz2
Fix automatic restoration of breakpoints memory for ia64.
* ia64-tdep.c: New #if check on BREAKPOINT_MAX vs. BUNDLE_LEN. (ia64_memory_insert_breakpoint): New comment part for SHADOW_CONTENTS content. Remove variable instr. New variable cleanup. Force automatic breakpoints restoration. PLACED_SIZE and SHADOW_LEN are now set larger, to BUNDLE_LEN - 2. Variable `bundle' type update. Return error if even just final target_write_memory has failed. (ia64_memory_remove_breakpoint): Rename variables bundle to bundle_mem and instr to instr_saved. New variables bundle_saved and instr_breakpoint. Comment new reasons why we need to disable automatic restoration of breakpoints. Assert PLACED_SIZE and SHADOW_LEN. New check of the original memory content. Return error if even just final target_write_memory has failed. (ia64_breakpoint_from_pc): Implement the emulation of permanent breakpoints compatible with current bp_loc_is_permanent. (template_encoding_table): Make it `const'. * breakpoint.c (bp_loc_is_permanent): Support unsupported software breakpoints. New variables `cleanup' and `retval'. * monitor.c (monitor_insert_breakpoint): Remove unused variable `bp'.
Diffstat (limited to 'gdb/breakpoint.c')
-rw-r--r--gdb/breakpoint.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 07a9619..617a538 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -5010,19 +5010,32 @@ bp_loc_is_permanent (struct bp_location *loc)
CORE_ADDR addr;
const gdb_byte *brk;
gdb_byte *target_mem;
+ struct cleanup *cleanup;
+ int retval = 0;
gdb_assert (loc != NULL);
addr = loc->address;
brk = gdbarch_breakpoint_from_pc (current_gdbarch, &addr, &len);
+ /* Software breakpoints unsupported? */
+ if (brk == NULL)
+ return 0;
+
target_mem = alloca (len);
+ /* Enable the automatic memory restoration from breakpoints while
+ we read the memory. Otherwise we could say about our temporary
+ breakpoints they are permanent. */
+ cleanup = make_show_memory_breakpoints_cleanup (0);
+
if (target_read_memory (loc->address, target_mem, len) == 0
&& memcmp (target_mem, brk, len) == 0)
- return 1;
+ retval = 1;
- return 0;
+ do_cleanups (cleanup);
+
+ return retval;
}