--enable-64-bit-bfd. Basically the issue happens when dealing with "bl"
instructions: GDB does branch destination calculation and (wrongly)
sign-extends the PC. Here is a piece of his original message explaining
the problem:
> next_pc = arm_get_next_pc (frame, get_frame_pc (frame));
>
> /* The Linux kernel offers some user-mode helpers in a high page. We can
> not read this page (as of 2.6.23), and even if we could then we couldn't
> set breakpoints in it, and even if we could then the atomic operations
> would fail when interrupted. They are all called as functions and return
> to the address in LR, so step to there instead. */
> if (next_pc > 0xffff0000)
> next_pc = get_frame_register_unsigned (frame, ARM_LR_REGNUM);
>
> arm_insert_single_step_breakpoint (gdbarch, aspace, next_pc);
>
> Unfortunately, branch destination addresses are SIGN EXTENDED to 64
> bits. So,
>
> (top-gdb) p/x next_pc
> $14 = 0xffffffffb6df2864
>
> Which triggers the next_pc = get_frame_register_unsigned(), and we
> cannot step into any branches because the destination PC is wrong.
Anyway, the fix is simple and Andrew himself provided it for us. It
took a while for me to figure out how to trigger the bug (in order to
write a testcase for it), but I finally made it.
The attached patch fixes the problem (by casting to `unsigned long'
instead of just `long'), and also includes a testcase to reproduce the
issue.
gdb/ChangeLog:
2013-04-22 Andrew Haley <aph@redhat.com>
* arm-tdep.c (BranchDest): Cast result as "unsigned long",
instead of "long".
gdb/testsuite/ChangeLog:
2013-04-22 Sergio Durigan Junior <sergiodj@redhat.com>
* gdb.arch/arm-bl-branch-dest.c: New file.
* gdb.arch/arm-bl-branch-dest.exp: Likewise.
Consider the following simple program:
.globl _start
.text
_start:
fldt val
.data
val: .byte 0x00,0x00,0x45,0x07,0x11,0x19,0x22,0xe9,0xfe,0xbf
With current GDB on x86-64 GNU/Linux hosts, after the moment the fldt
command has been executed the register st(0) looks like this,
according to the “info regs” output (TOP=7):
R7: Valid 0xffffffbffffffffeffffffe922191107450000 -0.910676542908976927
which is clearly wrong (just count its length). The problem is due to
the printf statement (see patch) printing a promoted integer value of
a char argument "raw[i]", and, since char is signed on x86-64
GNU/Linux, the erroneous “ffffff” are printed for the first three
bytes which turn out to be "negative". The fix is to use gdb_byte
instead which is unsigned (and is the type of value_contents(), the
type to be used for raw target bytes anyway). After the fix the value
will be printed correctly:
R7: Valid 0xbffee922191107450000 -0.910676542908976927
gdb/
2013-04-19 Vladimir Kargov <kargov@gmail.com>
Pedro Alves <palves@redhat.com>
* i387-tdep.c (i387_print_float_info): Use gdb_byte for pointer to
value contents.
gdb/testsuite/
2013-04-19 Vladimir Kargov <kargov@gmail.com>
Pedro Alves <palves@redhat.com>
* gdb.arch/i386-float.S: New file.
* gdb.arch/i386-float.exp: New file.
Fix entry-values if the callee called a noreturn function.
* dwarf2-frame-tailcall.c (dwarf2_tailcall_sniffer_first): Use
get_frame_address_in_block. Add new comment.
gdb/testsuite/
Fix entry-values if the callee called a noreturn function.
* gdb.arch/amd64-tailcall-noret.S: New file.
* gdb.arch/amd64-tailcall-noret.c: New file.
* gdb.arch/amd64-tailcall-noret.exp: New file.
Fix entry-values in C++ across CUs.
* dwarf2loc.c (call_site_to_target_addr) <FIELD_LOC_KIND_PHYSNAME>: Use
lookup_minimal_symbol. Add a comment.
* dwarf2read.c
(read_call_site_scope) <is_ref_attr> <die_is_declaration>: Prefer
DW_AT_linkage_name.
gdb/testsuite/
Fix entry-values in C++ across CUs.
* gdb.arch/amd64-tailcall-cxx.exp: New file.
* gdb.arch/amd64-tailcall-cxx1.S: New file.
* gdb.arch/amd64-tailcall-cxx1.cc: New file.
* gdb.arch/amd64-tailcall-cxx2.S: New file.
* gdb.arch/amd64-tailcall-cxx2.cc: New file.
Two modifications:
1. The addition of 2013 to the copyright year range for every file;
2. The use of a single year range, instead of potentially multiple
year ranges, as approved by the FSF.
Update some files in GDB that were accidently left with a GPL v2
copyright header.
Update some files where the copyright notice still provides the
old contact info, using the approach for providing the FSF's contact
info.
gdb/ChangeLog:
* acinclude.m4: Update contact info in copyright notice.
gdb/doc/ChangeLog:
* refcard.tex: Update copyright notice to GPL v3 or later.
Update contact info.
gdb/testsuite/ChangeLog:
* dg-extract-results.sh: Update contact info in copyright notice.
* gdb.arch/mips-octeon-bbit.exp: Update copyright notice to
GPL v3 or later. Update contact info.
* gdb.fortran/logical.f90, gdb.threads/watchpoint-fork-child.c,
gdb.threads/watchpoint-fork-mt.c,
gdb.threads/watchpoint-fork-parent.c,
gdb.threads/watchpoint-fork-st.c,
gdb.threads/watchpoint-fork.h: Likewise.
* gdb.python/py-strfns.exp (test_strfns_core_file): Use
gdb_gcore_cmd.
* gdb.cell/gcore.exp: Use gdb_gcore_cmd.
* gdb.base/gcore.exp: Use gdb_gcore_cmd.
* gdb.base/gcore-relro.exp: Use gdb_gcore_cmd.
* gdb.base/gcore-buffer-overflow.exp: Use gdb_gcore_cmd.
* gdb.base/auxv.exp: Use gdb_gcore_cmd.
* gdb.arch/vsx-regs.exp: Use gdb_gcore_cmd.
* gdb.arch/system-gcore.exp: Use gdb_gcore_cmd.
* gdb.arch/pa-nullify.exp (test_core_bt): Use gdb_gcore_cmd.
* lib/gdb.exp (gdb_gcore_cmd): New proc.
Fix disassemble without parameters in tailcall frame.
* cli/cli-cmds.c (disassemble_current_function): Use
get_frame_address_in_block.
gdb/testsuite/
Fix disassemble without parameters in tailcall frame.
* gdb.arch/amd64-entry-value.exp (down, disassemble): New tests.
PR 14119
* frame.c (skip_inlined_frames): Skip also TAILCALL_FRAME frames.
(frame_pop): Drop also TAILCALL_FRAME frames.
* infcmd.c (finish_command): Ignore also TAILCALL_FRAME frames.
gdb/testsuite/
PR 14119
* gdb.arch/amd64-tailcall-ret.S: New file.
* gdb.arch/amd64-tailcall-ret.c: New file.
* gdb.arch/amd64-tailcall-ret.exp: New file.
* gdb.reverse/amd64-tailcall-reverse.S: New file.
* gdb.reverse/amd64-tailcall-reverse.c: New file.
* gdb.reverse/amd64-tailcall-reverse.exp: New file.
* gdb.ada/rdv_wait.exp (set debug-file-directory): New command.
* gdb.arch/i386-cfi-notcurrent.S: New file.
* gdb.arch/i386-cfi-notcurrent.exp: New file.
* dwarf2expr.c (execute_stack_op): Support DW_OP_GNU_parameter_ref.
* dwarf2loc.c (call_site_parameter_matches): Support
CALL_SITE_PARAMETER_PARAM_OFFSET.
(needs_dwarf_reg_entry_value): Push stub value.
* dwarf2read.c (read_call_site_scope): New variable origin. Support
CALL_SITE_PARAMETER_PARAM_OFFSET and its DW_AT_abstract_origin.
* gdbtypes.h (enum call_site_parameter_kind): New item
CALL_SITE_PARAMETER_PARAM_OFFSET.
(struct call_site.parameter.u): New field param_offset.
gdb/testsuite/
* gdb.arch/amd64-entry-value-param.S: New file.
* gdb.arch/amd64-entry-value-param.c: New file.
* gdb.arch/amd64-entry-value-param.exp: New file.
* infrun.c (handle_inferior_event): Move the check for return
trampolines ahead of the check for function trampolines.
* mips-tdep.h (MIPS_S2_REGNUM, MIPS_GP_REGNUM): New macros.
* mips-tdep.c (mips_str_mips16_call_stub): New variable.
(mips_str_mips16_ret_stub): Likewise.
(mips_str_call_fp_stub): Likewise.
(mips_str_call_stub): Likewise.
(mips_str_fn_stub): Likewise.
(mips_str_pic): Likewise.
(mips_in_frame_stub): New function.
(mips_unwind_pc): Return the return address rather than the PC
if the PC of an intermediate frame is inside a call thunk.
(mips_is_stub_suffix): New function.
(mips_is_stub_mode): Likewise.
(mips_get_mips16_fn_stub_pc): Likewise.
(mips_skip_mips16_trampoline_code): Update to handle all the
currently generated stub types. Don't recurse into __fn_stub
thunks. Remove heuristics to handle stubs beyond etext/_etext.
Use cooked register accesses.
(mips_in_return_stub): Reintroduce function.
(mips_skip_trampoline_code): Traverse trampolines recursively.
(mips_gdbarch_init): Handle MIPS16 return trampolines.
gdb/testsuite/
* gdb.arch/mips16-thunks-inmain.c: New file.
* gdb.arch/mips16-thunks-main.c: New file.
* gdb.arch/mips16-thunks-sin.c: New file.
* gdb.arch/mips16-thunks-sinfrob.c: New file.
* gdb.arch/mips16-thunks-sinfrob16.c: New file.
* gdb.arch/mips16-thunks-sinmain.c: New file.
* gdb.arch/mips16-thunks-sinmips16.c: New file.
* gdb.arch/mips16-thunks.exp: New file.
Tom Tromey <tromey@redhat.com>
* lib/gdb.exp: Add description of test prefixes.
(with_test_prefix): New procedure.
* gdb.arch/altivec-abi.exp: Use with_test_prefix.
* gdb.base/attach-pie-misread.exp: Use with_test_prefix.
* gdb.base/break-interp.exp: Use with_test_prefix. Use append
instead of lappend to append to pf_prefix.
* gdb.base/catch-load.exp: Use with_test_prefix.
* gdb.base/disp-step-syscall.exp: Use with_test_prefix.
* gdb.base/jit-so.exp: Use with_test_prefix.
* gdb.base/jit.exp: Use with_test_prefix.
* gdb.base/return-nodebug.exp (do_test): Use append instead of
lappend to append to pf_prefix.
* gdb.base/sepdebug.exp: Use with_test_prefix.
* gdb.base/solib-display.exp: Use with_test_prefix.
* gdb.base/solib-overlap.exp: Use with_test_prefix.
* gdb.base/watch-cond-infcall.exp: Use with_test_prefix.
* gdb.base/watchpoint.exp: Use with_test_prefix.
* gdb.dwarf2/dw2-noloc.exp: Use with_test_prefix.
* gdb.mi/mi-watch.exp: Use with_test_prefix.
* gdb.mi/mi2-watch.exp: Use with_test_prefix.
* gdb.threads/non-ldr-exc-1.exp: Use with_test_prefix.
* gdb.threads/non-ldr-exc-2.exp: Use with_test_prefix.
* gdb.threads/non-ldr-exc-3.exp: Use with_test_prefix.
* gdb.threads/non-ldr-exc-4.exp: Use with_test_prefix.
* gdb.threads/watchpoint-fork.exp: Use with_test_prefix. Use
append instead of lappend to append to pf_prefix.
* gdb.threads/watchthreads-reorder.exp: Use with_test_prefix.
* gdb.trace/change-loc.exp: Use with_test_prefix.
* gdb.trace/pending.exp: Use with_test_prefix.
* gdb.trace/status-stop.exp: Use with_test_prefix.
* gdb.trace/strace.exp: Use with_test_prefix.
* gdb.trace/trace-break.exp: Use with_test_prefix.
* gdb.trace/unavailable.exp: Use with_test_prefix. Use append
instead of lappend to append to pf_prefix.
* arm-tdep.c (thumb_analyze_prologue): Always fallback on the SP
register when the frame can't be determined.
* arm-tdep.c (arm_analyze_prologue): Ditto.
gdb/testsuite/
* gdb.arch/thumb-prologue.c (switch_stack_to_same): New test function.
(switch_stack_to_other): New test function.
* gdb.arch/thumb-prologue.exp: New test cases.
Display @entry parameter values even for references.
* ada-valprint.c (ada_val_print_1) <TYPE_CODE_REF>: Try also
coerce_ref_if_computed.
* c-valprint.c (c_val_print) <TYPE_CODE_REF>: Likewise.
* dwarf2expr.c (dwarf_block_to_dwarf_reg_deref): New function.
(execute_stack_op) <DW_OP_GNU_entry_value>: Add -1 deref_size to the
existing push_dwarf_reg_entry_value call. Add new detection calling
dwarf_block_to_dwarf_reg_deref. Update the error message.
(ctx_no_push_dwarf_reg_entry_value): New parameter deref_size.
* dwarf2expr.h
(struct dwarf_expr_context_funcs) <push_dwarf_reg_entry_value>: Add new
parameter deref_size, describe it in the comment.
(ctx_no_push_dwarf_reg_entry_value): Add new parameter deref_size.
(dwarf_block_to_dwarf_reg_deref): New declaration.
* dwarf2loc.c (dwarf_entry_parameter_to_value): Add new parameter
deref_size, describe it in the function comment. New variables
data_src and size, fetch the alternative block accoring to DEREF_SIZE.
(dwarf_expr_push_dwarf_reg_entry_value): Add new parameter deref_size,
describe it in the function comment. Fetch the alternative block
accoring to DEREF_SIZE.
(entry_data_value_coerce_ref, entry_data_value_copy_closure)
(entry_data_value_free_closure, entry_data_value_funcs): New.
(value_of_dwarf_reg_entry): New variables checked_type, target_type,
outer_val, target_val, val and addr. Try to fetch and create also
referenced value content.
(pieced_value_funcs): NULL value for coerce_ref.
(needs_dwarf_reg_entry_value): Add new parameter deref_size.
* f-valprint.c (f_val_print) <TYPE_CODE_REF>: Try also
coerce_ref_if_computed.
* opencl-lang.c (opencl_value_funcs): NULL value for coerce_ref.
* p-valprint.c (pascal_val_print) <TYPE_CODE_REF>: Likewise.
* stack.c (read_frame_arg): Compare also dereferenced values.
* value.c (value_computed_funcs): Make the parameter v const, use
value_lval_const for it.
(value_lval_const, coerce_ref_if_computed): New function.
(coerce_ref): New variable retval. Call also coerce_ref_if_computed.
* value.h (struct lval_funcs): New field coerce_ref.
(value_computed_funcs): Make the parameter v const.
(value_lval_const, coerce_ref_if_computed): New declarations.
gdb/testsuite/
Display @entry parameter values even for references.
* gdb.arch/amd64-entry-value.cc (reference, datap, datap_input): New
functions.
(main): New variables regvar, nodatavarp, stackvar1, stackvar2. Call
reference and datap_input.
* gdb.arch/amd64-entry-value.exp (reference, breakhere_reference): New
breakpoints.
(continue to breakpoint: entry_reference: reference)
(entry_reference: bt at entry)
(continue to breakpoint: entry_reference: breakhere_reference)
(entry_reference: bt, entry_reference: ptype regparam)
(entry_reference: p regparam, entry_reference: ptype regparam@entry)
(entry_reference: p regparam@entry, entry_reference: p ®param@entry)
(entry_reference: p regcopy, entry_reference: p nodataparam)
(entry_reference: p nodataparam@entry): New tests.
Display @entry parameter values (without references).
* dwarf2expr.c (dwarf_block_to_fb_offset, dwarf_block_to_sp_offset):
New functions.
* dwarf2expr.h (dwarf_block_to_fb_offset, dwarf_block_to_sp_offset):
New declarations.
* dwarf2loc.c (dwarf2_find_location_expression): Support location list
entry record.
(dwarf_entry_parameter_to_value, value_of_dwarf_reg_entry)
(value_of_dwarf_block_entry, locexpr_read_variable_at_entry): New
functions.
(dwarf2_locexpr_funcs): Install locexpr_read_variable_at_entry.
(loclist_read_variable_at_entry): New function.
(dwarf2_loclist_funcs): Install loclist_read_variable_at_entry.
* dwarf2read.c (read_call_site_scope): Support also DW_OP_fbreg in
DW_AT_location, call dwarf_block_to_sp_offset for it.
* frame.h (print_entry_values_no, print_entry_values_only)
(print_entry_values_preferred, print_entry_values_if_needed)
(print_entry_values_both, print_entry_values_compact)
(print_entry_values_default, print_entry_values): New declarations.
(struct frame_arg): New field entry_kind.
(read_frame_arg): New parameter entryargp.
* mi/mi-cmd-stack.c (list_arg_or_local): New gdb_assert for
arg->entry_kind. Optionally print the `@entry' suffix.
(list_args_or_locals): New variable entryarg, initialize it.
Initialize also entry_kind of arg and entryarg. Conditionalize
list_arg_or_local for arg, add list_arg_or_local for entryarg. Call
xfree for entryarg.error.
* stack.c (print_entry_values_no, print_entry_values_only)
(print_entry_values_preferred, print_entry_values_if_needed)
(print_entry_values_both, print_entry_values_compact)
(print_entry_values_default, print_entry_values_choices)
(print_entry_values): New variables.
(print_frame_arg): New gdb_assert for arg->entry_kind. Optionally
print the `@entry' suffix, possibly in combination for
print_entry_values_compact.
(read_frame_arg): New parameter entryargp, new variables entryval,
entryval_error and val_equal. Read in also entryargp, respect
print_entry_values, compare the values using val_equal, fill in also
argp->entry_kind (together with entryargp->entry_kind).
(print_frame_args): New variable entryarg, initialize it.
Conditionalize print_frame_arg for arg, add print_frame_arg for
entryarg. Call xfree for entryarg.error.
(_initialize_stack): Call add_setshow_enum_cmd for `entry-values'.
* symtab.h (struct symbol_computed_ops): New field
read_variable_at_entry.
gdb/doc/
Display @entry parameter values (without references).
* gdb.texinfo (Tail Call Frames): Add anchor. Add self tail call
example.
(Print Settings): New description of set print entry-values and show
print entry-values.
gdb/testsuite/
Display @entry parameter values (without references).
* gdb.arch/amd64-entry-value.cc (locexpr, stacktest, data, data2)
(different, validity, invalid): New functions.
(main): Call them.
* gdb.arch/amd64-entry-value.exp: New breakpoints breakhere_locexpr,
stacktest, breakhere_stacktest, different, breakhere_different,
breakhere_validity and breakhere_invalid.
(entry: bt): Update for @entry.
(entry_locexpr: *, entry_stack: *, entry_equal: *, entry_different: *)
(entry_validity: *, entry_invalid: *): Many new tests.
* gdb.base/break.exp
(run until breakpoint set at small function, optimized file): Accept
also the @entry suffix.
* gdb.mi/Makefile.in (PROGS): Add mi2-amd64-entry-value.
* gdb.mi/mi2-amd64-entry-value.c: New files.
* gdb.mi/mi2-amd64-entry-value.exp: New files.
Implement basic support for DW_TAG_GNU_call_site.
* block.c: Include gdbtypes.h and exceptions.h.
(call_site_for_pc): New function.
* block.h (call_site_for_pc): New declaration.
* defs.h: Include hashtab.h.
(make_cleanup_htab_delete, core_addr_hash, core_addr_eq): New
declarations.
* dwarf2-frame.c (dwarf2_frame_ctx_funcs): Install
ctx_no_push_dwarf_reg_entry_value.
* dwarf2expr.c (read_uleb128, read_sleb128): Support R as NULL.
(dwarf_block_to_dwarf_reg): New function.
(execute_stack_op) <DW_OP_GNU_entry_value>: Implement it.
(ctx_no_push_dwarf_reg_entry_value): New function.
* dwarf2expr.h (struct dwarf_expr_context_funcs): New field
push_dwarf_reg_entry_value.
(ctx_no_push_dwarf_reg_entry_value, dwarf_block_to_dwarf_reg): New
declarations.
* dwarf2loc.c: Include gdbcmd.h.
(dwarf_expr_ctx_funcs): New forward declaration.
(entry_values_debug, show_entry_values_debug, call_site_to_target_addr)
(dwarf_expr_reg_to_entry_parameter)
(dwarf_expr_push_dwarf_reg_entry_value): New.
(dwarf_expr_ctx_funcs): Install dwarf_expr_push_dwarf_reg_entry_value.
(dwarf2_evaluate_loc_desc_full): Handle NO_ENTRY_VALUE_ERROR.
(needs_dwarf_reg_entry_value): New function.
(needs_frame_ctx_funcs): Install it.
(_initialize_dwarf2loc): New function.
* dwarf2loc.h (entry_values_debug): New declaration.
* dwarf2read.c (struct dwarf2_cu): New field call_site_htab.
(read_call_site_scope): New forward declaration.
(process_full_comp_unit): Copy call_site_htab.
(process_die): Support DW_TAG_GNU_call_site.
(read_call_site_scope): New function.
(dwarf2_get_pc_bounds): Support NULL HIGHPC.
(dwarf_tag_name): Support DW_TAG_GNU_call_site.
(cleanup_htab): Delete.
(write_psymtabs_to_index): Use make_cleanup_htab_delete instead of it.
* exceptions.h (enum errors): New NO_ENTRY_VALUE_ERROR.
* gdb-gdb.py (StructMainTypePrettyPrinter): Support
FIELD_LOC_KIND_DWARF_BLOCK.
* gdbtypes.h (enum field_loc_kind): New entry
FIELD_LOC_KIND_DWARF_BLOCK.
(struct main_type): New loc entry dwarf_block.
(struct call_site, FIELD_DWARF_BLOCK, SET_FIELD_DWARF_BLOCK)
(TYPE_FIELD_DWARF_BLOCK): New.
* python/py-type.c: Include dwarf2loc.h.
(check_types_equal): Support FIELD_LOC_KIND_DWARF_BLOCK. New
internal_error call on unknown FIELD_LOC_KIND.
* symtab.h (struct symtab): New field call_site_htab.
* utils.c (do_htab_delete_cleanup, make_cleanup_htab_delete)
(core_addr_hash, core_addr_eq): New functions.
gdb/testsuite/
Implement basic support for DW_TAG_GNU_call_site.
* gdb.arch/Makefile.in (EXECUTABLES): Add amd64-entry-value.
* gdb.arch/amd64-entry-value.cc: New file.
* gdb.arch/amd64-entry-value.exp: New file.
PR breakpoints/12435
* amd64-tdep.c (amd64_skip_prologue): New variables start_pc_sal,
next_sal, buf, offset and xmmreg. Advance PC if it sees the PR.
* dwarf2read.c (process_full_comp_unit): Initialize
amd64_prologue_line_bug.
* symtab.h (struct symtab): New field amd64_prologue_line_bug.
gdb/testsuite/
PR breakpoints/12435
* gdb.arch/amd64-prologue-xmm.c: New file.
* gdb.arch/amd64-prologue-xmm.exp: New file.
* gdb.arch/amd64-prologue-xmm.s: New file.
gdb/testsuite/
* gdb.arch/i386-dr3-watch.exp: Test that the i386 watchpoints
backend doesn't leave used debug registers behind.
gdb/gdbserver/
* i386-low.c (i386_insert_aligned_watchpoint): Don't pass the info
to the inferior here.
(i386_remove_aligned_watchpoint): Ditto.
(i386_handle_nonaligned_watchpoint): Return immediate on fail to
fit part of the watchpoint in the debug registers.
(i386_update_inferior_debug_regs): New.
(i386_low_insert_watchpoint): Work on a local mirror of the debug
registers, and only update the inferior on success.
(i386_low_remove_watchpoint): Ditto.
gdb/
* i386-nat.c (I386_DR_VACANT, I386_DR_LOCAL_ENABLE)
(I386_DR_GLOBAL_ENABLE, I386_DR_DISABLE, I386_DR_SET_RW_LEN)
(I386_DR_GET_RW_LEN, I386_DR_WATCH_HIT): Add state parameter and
adjust.
(dr_mirror, dr_status_mirror, dr_control_mirror): Delete.
(struct i386_debug_reg_state): New.
(i386_init_dregs): New.
(dr_mirror): New.
(i386_cleanup_dregs): Use i386_init_dregs.
(i386_show_dr): Add state parameter and adjust.
(i386_insert_aligned_watchpoint): Ditto. Don't pass the info to
the inferior here.
(i386_remove_aligned_watchpoint): Likewise.
(i386_handle_nonaligned_watchpoint): Add state parameter and adjust.
(i386_update_inferior_debug_regs): New.
(i386_insert_watchpoint): Work on a local mirror of the debug
registers, and only update the inferior on success.
(i386_remove_watchpoint): Ditto.
(i386_region_ok_for_watchpoint): Adjust.
(i386_stopped_data_address): Adjust.
(i386_insert_hw_breakpoint): Adjust.
(i386_remove_hw_breakpoint): Adjust.
gdb/gdbserver/
* linux-x86-low.c (i386_dr_low_get_addr): Fix off by one in
assertion.
* win32-i386-low.c (i386_dr_low_get_addr): Ditto.
gdb/testsuite/
* gdb.arch/i386-dr3-watch.c: New file.
* gdb.arch/i386-dr3-watch.exp: New file.
gdb/testsuite/
* gdb.ada/start.exp: Call untested with the correct test filename.
* gdb.arch/i386-bp_permanent.exp: Call untested with the correct
test filename. Make the test's binary unique.
* gdb.arch/i386-signal.exp: Call untested with the correct test
filename.
* gdb.arch/i386-size-overlap.exp: Ditto.
* gdb.arch/Makefile.in (EXECUTABLES): Update.
* gdb.base/gcore-buffer-overflow.exp: Ditto.
* gdb.cp/call-c.exp: Ditto.
* gdb.mi/mi-reverse.exp: Call untested with the correct test
filename. Make the test's binary unique.
* gdb.mi/Makefile.in (EXECUTABLES): Update.
* gdb.python/py-mi.exp: Ditto.
* gdb.python/Makefile.in (EXECUTABLES): Update.
* gdb.reverse/i386-precsave.exp: Ditto.
* gdb.reverse/i387-env-reverse.exp: Call untested with the correct
test filename.
* gdb.reverse/i387-stack-reverse.exp: Ditto.
* gdb.reverse/sigall-precsave.exp: Ditto. Make the test's binary
unique.
* gdb.reverse/sigall-reverse.exp: Call untested with the correct
test filename.
* gdb.reverse/Makefile.in (EXECUTABLES): Update.
* gdb.trace/tfile.exp: Ditto.