From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31444 invoked by alias); 22 Feb 2011 23:00:28 -0000 Mailing-List: contact archer-commits-help@sourceware.org; run by ezmlm Sender: Precedence: bulk List-Post: List-Help: List-Subscribe: Received: (qmail 31383 invoked by uid 9674); 22 Feb 2011 23:00:26 -0000 Date: Tue, 22 Feb 2011 23:00:00 -0000 Message-ID: <20110222230026.31368.qmail@sourceware.org> From: jkratoch@sourceware.org To: archer-commits@sourceware.org Subject: [SCM] archer-tromey-python: Merge remote-tracking branch 'origin/master' into archer-tromey-python X-Git-Refname: refs/heads/archer-tromey-python X-Git-Reftype: branch X-Git-Oldrev: 7b8ddd06ebf96750bc5f72a1d295d0282b80facf X-Git-Newrev: e3a8b33d279ceefec3d9400ea27604a65dcaf34d X-SW-Source: 2011-q1/txt/msg00148.txt.bz2 List-Id: The branch, archer-tromey-python has been updated via e3a8b33d279ceefec3d9400ea27604a65dcaf34d (commit) via d937037301e40716bd65b32d0296d91824874bbd (commit) via e6401d52cc93dad698d924a430ebdc1295851fba (commit) via 9edef16cec41bc434dbae109ddba50c4bebe1ff4 (commit) via 6eea50e56d1513d7bd3ce4b6fcef7b04655865d9 (commit) via 365d63b832aa8b2453ae06f0d683abb1cb41afa9 (commit) via ffe0466834c4e5186560451ed14f8f8ce5d2b4b3 (commit) via 49001b4fddfcffcce7479969494f421af203fe6c (commit) via 8cbcaaf7074652836d7180d09a672217b8c7f830 (commit) via 7970371c5937ee3eba41b8fc72cde55bb5dab216 (commit) via 3aaec028253ae8efaab36e9d25cb1cd33aaf9ec3 (commit) via fcbfed09c4cf9172c609ba576004ceccf6fb4240 (commit) via f8328c019fa3d1289cba7638622f23f6a243ecb5 (commit) via fee1c4201a04318909d343e5494a1d2be0537789 (commit) via 2e7b883f5e066072662904d0c17a6297655f3033 (commit) via 51663a8310713580f59e3a222bfe73e6096236dc (commit) via 8c12a273d73786c32a8a0dd2a3f8f352f8b687a6 (commit) via f49c3f2f3973e0f6b0c639efff4120799ef4f647 (commit) via 745bf96b0bd2b2dc7dc6526e938de3713d4ae093 (commit) via e19abaa89e01e07b3cb0cc16b822f232e39e415c (commit) via 30aedc58ccd6255776ad3831284f1e5b19d4e01b (commit) via dd3f1356fc2e6ddae18b8b6546f1917044d69869 (commit) via 0c45489a6b7c9326056f264e12f9492e126ea51f (commit) via 4d92d16206a7d0b937a99e411f4736211b721170 (commit) via a952e3efc0bfe5a411d1ab1d5cd9cd4481a018e3 (commit) via 516f41a9b45b2e850451281b99845e7d8715eb51 (commit) via c2a331df48eb76888a60c8598ec85396089eed73 (commit) via 2b9e872152e4d85fd7a8dd15cd8375ada410c5d8 (commit) via 0bc3930dd359f4e7d15ef37e806d84719529a108 (commit) via 0b0b05ff3863e6c52f28c6d1a7ee29d49349eddd (commit) via 8124578162a4eb352cc0e837b7f62e0297a99b33 (commit) from 7b8ddd06ebf96750bc5f72a1d295d0282b80facf (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit e3a8b33d279ceefec3d9400ea27604a65dcaf34d Merge: 7b8ddd0 d937037 Author: Jan Kratochvil Date: Wed Feb 23 00:00:06 2011 +0100 Merge remote-tracking branch 'origin/master' into archer-tromey-python ----------------------------------------------------------------------- Summary of changes: bfd/ChangeLog | 5 + bfd/elf32-m68k.c | 7 +- bfd/version.h | 2 +- gdb/ChangeLog | 145 +++++ gdb/Makefile.in | 17 +- gdb/arm-linux-nat.c | 580 ++++++++++++++++++++ gdb/arm-tdep.c | 5 +- gdb/arm-tdep.h | 4 + gdb/breakpoint.c | 232 +------- gdb/breakpoint.h | 4 - gdb/cli/cli-dump.c | 11 +- gdb/cli/cli-dump.h | 2 - gdb/cli/cli-utils.c | 212 +++++++ gdb/cli/cli-utils.h | 68 +++ gdb/common/Makefile.in | 7 +- gdb/frame-unwind.h | 4 +- gdb/gdbthread.h | 2 +- gdb/language.c | 7 +- gdb/mi/mi-main.c | 11 +- gdb/opencl-lang.c | 186 ++----- gdb/printcmd.c | 11 +- gdb/remote.c | 6 +- gdb/reverse.c | 1 + gdb/ser-mingw.c | 26 +- gdb/symfile.c | 10 - gdb/symfile.h | 9 - gdb/testsuite/ChangeLog | 90 +++ gdb/testsuite/Makefile.in | 12 +- gdb/testsuite/gdb.ada/Makefile.in | 3 +- gdb/testsuite/gdb.arch/Makefile.in | 8 +- gdb/testsuite/gdb.asm/Makefile.in | 4 +- gdb/testsuite/gdb.base/Makefile.in | 65 ++- gdb/testsuite/gdb.base/hbreak.exp | 8 +- gdb/testsuite/gdb.base/pr11022.exp | 6 +- gdb/testsuite/gdb.base/watch-read.exp | 5 +- gdb/testsuite/gdb.base/watch_thread_num.exp | 4 +- gdb/testsuite/gdb.base/watchpoint-hw-hit-once.exp | 8 +- gdb/testsuite/gdb.base/watchpoint-hw.exp | 9 +- gdb/testsuite/gdb.base/watchpoint.exp | 8 +- gdb/testsuite/gdb.cell/Makefile.in | 2 +- gdb/testsuite/gdb.cp/Makefile.in | 17 +- gdb/testsuite/gdb.disasm/Makefile.in | 2 +- gdb/testsuite/gdb.dwarf2/Makefile.in | 5 +- gdb/testsuite/gdb.fortran/Makefile.in | 2 +- gdb/testsuite/gdb.gdbtk/ChangeLog | 367 ------------- gdb/testsuite/gdb.gdbtk/browser.exp | 39 -- gdb/testsuite/gdb.gdbtk/c_variable.exp | 40 -- gdb/testsuite/gdb.gdbtk/console.exp | 40 -- gdb/testsuite/gdb.gdbtk/cpp_variable.exp | 46 -- gdb/testsuite/gdb.gdbtk/srcwin.exp | 69 --- gdb/testsuite/gdb.gdbtk/windows.exp | 39 -- gdb/testsuite/gdb.hp/Makefile.in | 2 +- gdb/testsuite/gdb.java/Makefile.in | 4 +- gdb/testsuite/gdb.mi/Makefile.in | 17 +- gdb/testsuite/gdb.modula2/Makefile.in | 4 +- gdb/testsuite/gdb.multi/Makefile.in | 2 +- gdb/testsuite/gdb.objc/Makefile.in | 2 +- gdb/testsuite/gdb.opencl/Makefile.in | 2 +- gdb/testsuite/gdb.opt/Makefile.in | 2 +- gdb/testsuite/gdb.pascal/Makefile.in | 2 +- gdb/testsuite/gdb.python/Makefile.in | 7 +- gdb/testsuite/gdb.python/py-block.exp | 20 +- gdb/testsuite/gdb.python/py-breakpoint.exp | 9 +- gdb/testsuite/gdb.reverse/Makefile.in | 2 +- gdb/testsuite/gdb.server/Makefile.in | 4 +- gdb/testsuite/gdb.stabs/Makefile.in | 4 +- gdb/testsuite/gdb.threads/Makefile.in | 15 +- .../gdb.threads/local-watch-wrong-thread.exp | 4 +- gdb/testsuite/gdb.threads/thread-find.exp | 57 ++- gdb/testsuite/gdb.threads/watchthreads-reorder.exp | 5 +- gdb/testsuite/gdb.threads/watchthreads.exp | 4 +- gdb/testsuite/gdb.threads/watchthreads2.exp | 4 +- gdb/testsuite/gdb.trace/Makefile.in | 8 +- gdb/testsuite/gdb.xml/Makefile.in | 2 +- gdb/testsuite/lib/gdb.exp | 73 +++ gdb/thread.c | 36 +- gdb/version.in | 2 +- opcodes/ChangeLog | 8 + opcodes/bfin-dis.c | 10 +- 79 files changed, 1554 insertions(+), 1229 deletions(-) create mode 100644 gdb/cli/cli-utils.c create mode 100644 gdb/cli/cli-utils.h delete mode 100644 gdb/testsuite/gdb.gdbtk/ChangeLog delete mode 100644 gdb/testsuite/gdb.gdbtk/browser.exp delete mode 100644 gdb/testsuite/gdb.gdbtk/c_variable.exp delete mode 100644 gdb/testsuite/gdb.gdbtk/console.exp delete mode 100644 gdb/testsuite/gdb.gdbtk/cpp_variable.exp delete mode 100644 gdb/testsuite/gdb.gdbtk/srcwin.exp delete mode 100644 gdb/testsuite/gdb.gdbtk/windows.exp First 500 lines of diff: diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 1ab968c..a8907a0 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2011-02-22 Andreas Schwab + + * elf32-m68k.c (elf_m68k_finish_dynamic_symbol): For a TLS_GD + relocation read the value from the second GOT slot. + 2011-02-15 Tristan Gingold * vms-alpha.c (alpha_vms_link_add_archive_symbols): Add a comment. diff --git a/bfd/elf32-m68k.c b/bfd/elf32-m68k.c index 1d9d6a4..b4f7bc2 100644 --- a/bfd/elf32-m68k.c +++ b/bfd/elf32-m68k.c @@ -1,6 +1,6 @@ /* Motorola 68k series support for 32-bit ELF Copyright 1993, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, - 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. + 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -4390,6 +4390,11 @@ elf_m68k_finish_dynamic_symbol (output_bfd, info, h, sym) break; case R_68K_TLS_GD32: + /* The value for this relocation is actually put in + the second GOT slot. */ + relocation = bfd_get_signed_32 (output_bfd, + (sgot->contents + + got_entry_offset + 4)); relocation += dtpoff_base (info); break; diff --git a/bfd/version.h b/bfd/version.h index 765f220..8301ca0 100644 --- a/bfd/version.h +++ b/bfd/version.h @@ -1,4 +1,4 @@ -#define BFD_VERSION_DATE 20110221 +#define BFD_VERSION_DATE 20110222 #define BFD_VERSION @bfd_version@ #define BFD_VERSION_STRING @bfd_version_package@ @bfd_version_string@ #define REPORT_BUGS_TO @report_bugs_to@ diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 84256b9..79fd478 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,148 @@ +2011-02-22 Tom Tromey + + * language.c (language_class_name_from_physname): Rename + 'curr_language' argument to 'lang'; use in body. + +2011-02-22 Michael Snyder + + * cli/cli-utils.c (number_is_in_list): Check for zero return. + +2011-02-22 Pedro Alves + + * frame-unwind.h: Fix comment to mention the this frame, not the + next. + +2011-02-22 Tom Tromey + + * symfile.c (auto_solib_limit): Remove. + * symfile.h (auto_solib_limit): Remove. + +2011-02-22 Joel Brobecker + + * Makefile.in (INSTALLED_LIBS): Delete. Update comment. + +2011-02-21 Michael Snyder + + * gdbthread.h (print_thread_info): Change prototype. + * thread.c (print_thread_info): Accept char* instead of int for + requested_threads argument. Use new function number_is_in_list + to determine which threads to list. + (info_threads_command): Pass char* to print_thread_info. + * cli/cli-utils.c (number_is_in_list): New function. + * cli/cli-utils.h (number_is_in_list): Export. + * mi/mi-main.c (mi_cmd_thread_info): Pass char* to + print_thread_info. + (print_one_inferior): Ditto. + (mi_cmd_list_thread_groups): Ditto. + +2011-02-21 Jan Kratochvil + + * common/Makefile.in (CFLAGS): New. + (COMPILE): Add $(CFLAGS). + +2011-02-21 Tom Tromey + + * breakpoint.c (catch_syscall_command_1): Fix typo. + +2011-02-21 Tom Tromey + + * reverse.c: Include cli-utils.h. + * printcmd.c: Include cli-utils.h. + (string_printf): Use skip_spaces. + * cli/cli-utils.h: New file. + * cli/cli-utils.c: New file. + * cli/cli-dump.h (skip_spaces): Move to cli-utils.h. + * cli/cli-dump.c (skip_spaces): Move to cli-utils.c. + * breakpoint.h (get_number, get_number_or_range): Move to + cli-utils.h. + * breakpoint.c: Include cli-utils.h. + (get_number_trailer, get_number, get_number_or_range) + (ep_skip_leading_whitespace): Move to cli-utils.c. + (create_breakpoint_sal, find_condition_and_thread) + (decode_static_tracepoint_spec, watch_command_1) + (watch_maybe_just_location, ep_parse_optional_if_clause) + (catch_fork_command_1, catch_exec_command_1) + (catch_syscall_command_1): Use skip_spaces, skip_to_space. + * Makefile.in (SUBDIR_CLI_OBS): Add cli-utils.o. + (SUBDIR_CLI_SRCS): Add cli-utils.c. + (HFILES_NO_SRCDIR): Add cli-utils.h. + (cli-utils.o): New target. + +2011-02-18 Pierre Muller + + * remote.c (remote_close): Reset INFERIOR_PTID to NULL_PTID + before calling discard_all_inferiors. + +2011-02-21 Ulrich Weigand + + * opencl-lang.c (STRUCT_OCL_TYPE): Remove. + (struct builtin_opencl_type): Remove. + (builtin_opencl_type): Change return type to "struct type **". + (lookup_opencl_vector_type): Update caller. + (opencl_language_arch_info): Copy primitive type vector from gdbarch. + (build_opencl_types): Install plain array of "struct type *" + instead of "struct builtin_opencl_type". + +2011-02-21 Matthew Gretton-Dann + Ulrich Weigand + + * arm-linux-nat.c: Include "observer.h" and "gdbthread.h". + (PTRACE_GETHBPREGS, PTRACE_SETHBPREGS): Define. + (struct arm_linux_hwbp_cap): New type. + (arm_linux_get_hwbp_cap): New function. + (arm_linux_get_hw_breakpoint_count): Likewise. + (arm_linux_get_hw_watchpoint_count): Likewise. + (arm_linux_can_use_hw_breakpoint): Likewise. + (arm_hwbp_type): New type. + (arm_hwbp_control_t): Likewise. + (struct arm_linux_hw_breakpoint): Likewise. + (struct arm_linux_thread_points): Likewise. + (arm_threads): New global variable. + (arm_linux_find_breakpoints_by_tid): New function. + (arm_hwbp_control_initialize): Likewise. + (arm_hwbp_control_is_enabled): Likewise. + (arm_hwbp_control_disable): Likewise. + (arm_linux_hw_breakpoint_initialize): Likewise. + (arm_linux_get_hwbp_type): Likewise. + (arm_linux_hw_watchpoint_initialize): Likewise. + (arm_linux_hw_breakpoint_equal): Likewise. + (arm_linux_insert_hw_breakpoint1): Likewise. + (arm_linux_remove_hw_breakpoint1): Likewise. + (arm_linux_insert_hw_breakpoint): Likewise. + (arm_linux_remove_hw_breakpoint): Likewise. + (arm_linux_region_ok_for_hw_watchpoint): Likewise. + (arm_linux_insert_watchpoint): Likewise. + (arm_linux_remove_watchpoint): Likewise. + (arm_linux_stopped_data_address): Likewise. + (arm_linux_stopped_by_watchpoint): Likewise. + (arm_linux_watchpoint_addr_within_range): Likewise. + (arm_linux_new_thread): Likewise. + (arm_linux_thread_exit): Likewise. + (_initialize_arm_linux_nat): Install hardware breakpoint/watchpoint + related target callbacks. Register arm_linux_new_thread and + arm_linux_thread_exit. + * arm-tdep.h (arm_pc_is_thumb): Add prototype. + * arm-tdep.c (arm_pc_is_thumb): Make global. + (arm_gdbarch_init): Call set_gdbarch_have_nonsteppable_watchpoint. + +2011-02-21 Ulrich Weigand + + * breakpoint.c (update_watchpoint): Do not attempt to recreate + per-frame locations while within a function epilogue. + +2011-02-21 Pierre Muller + + * ser-mingw.c (ser_windows_close): Reformat comment to better conform + to GNU coding standards. + +2011-02-21 Pierre Muller + + Allow use of mingw native on Windows 95 OS. + * ser-mingw.c (CancelIo): New macro for dynamically loaded DLL entry. + (ser_windows_close): Only call CancelIo if function exists. + (_initialize_ser_windows): Use LoadLirary/GetProcAddress + to check for existence of CancelIo function in kernel32 DLL. + 2011-02-21 Hui Zhu * Makefile.in (HFILES_NO_SRCDIR): Add printcmd.h. diff --git a/gdb/Makefile.in b/gdb/Makefile.in index 1f50964..7bd1020 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -193,12 +193,12 @@ SUBDIR_CLI_OBS = \ cli-dump.o \ cli-decode.o cli-script.o cli-cmds.o cli-setshow.o \ cli-logging.o \ - cli-interp.o + cli-interp.o cli-utils.o SUBDIR_CLI_SRCS = \ cli/cli-dump.c \ cli/cli-decode.c cli/cli-script.c cli/cli-cmds.c cli/cli-setshow.c \ cli/cli-logging.c \ - cli/cli-interp.c + cli/cli-interp.c cli/cli-utils.c SUBDIR_CLI_DEPS = SUBDIR_CLI_LDFLAGS= SUBDIR_CLI_CFLAGS= @@ -468,13 +468,8 @@ INTERNAL_LDFLAGS = $(CFLAGS) $(GLOBAL_CFLAGS) $(MH_LDFLAGS) $(LDFLAGS) $(CONFIG_ # it doesn't work, then refer to libiberty. # Libraries and corresponding dependencies for compiling gdb. -# {X,T}M_CLIBS, defined in *config files, have host- and target-dependent libs. +# XM_CLIBS, defined in *config files, have host-dependent libs. # LIBIBERTY appears twice on purpose. -# If you have the Cygnus libraries installed, -# you can use 'CLIBS=$(INSTALLED_LIBS)' 'CDEPS=' -INSTALLED_LIBS=-lbfd -lreadline -lopcodes -liberty -ldecnumber \ - $(XM_CLIBS) $(NAT_CLIBS) $(GDBTKLIBS) @LIBS@ @PYTHON_LIBS@ \ - -lintl -liberty $(LIBGNU) CLIBS = $(SIM) $(READLINE) $(OPCODES) $(BFD) $(INTL) $(LIBIBERTY) $(LIBDECNUMBER) \ $(XM_CLIBS) $(NAT_CLIBS) $(GDBTKLIBS) @LIBS@ @PYTHON_LIBS@ \ $(LIBEXPAT) \ @@ -767,7 +762,7 @@ exec.h m32r-tdep.h osabi.h gdbcore.h solib-som.h \ i386bsd-nat.h xml-support.h xml-tdesc.h alphabsd-tdep.h gdb_obstack.h \ ia64-tdep.h ada-lang.h varobj.h frv-tdep.h nto-tdep.h serial.h \ c-lang.h d-lang.h frame.h event-loop.h block.h cli/cli-setshow.h \ -cli/cli-decode.h cli/cli-cmds.h cli/cli-dump.h \ +cli/cli-decode.h cli/cli-cmds.h cli/cli-dump.h cli/cli-utils.h \ cli/cli-script.h macrotab.h symtab.h version.h gnulib/wchar.in.h \ gnulib/string.in.h gnulib/str-two-way.h \ gnulib/stdint.in.h remote.h gdb.h sparc-nat.h gdbserver/win32-low.h \ @@ -1763,6 +1758,10 @@ cli-setshow.o: $(srcdir)/cli/cli-setshow.c $(COMPILE) $(srcdir)/cli/cli-setshow.c $(POSTCOMPILE) +cli-utils.o: $(srcdir)/cli/cli-utils.c + $(COMPILE) $(srcdir)/cli/cli-utils.c + $(POSTCOMPILE) + # # GDBTK sub-directory diff --git a/gdb/arm-linux-nat.c b/gdb/arm-linux-nat.c index e501882..43f4fde 100644 --- a/gdb/arm-linux-nat.c +++ b/gdb/arm-linux-nat.c @@ -26,6 +26,8 @@ #include "linux-nat.h" #include "target-descriptions.h" #include "auxv.h" +#include "observer.h" +#include "gdbthread.h" #include "arm-tdep.h" #include "arm-linux-tdep.h" @@ -61,6 +63,11 @@ #define PTRACE_SETVFPREGS 28 #endif +#ifndef PTRACE_GETHBPREGS +#define PTRACE_GETHBPREGS 29 +#define PTRACE_SETHBPREGS 30 +#endif + /* These are in in current kernels. */ #define HWCAP_VFP 64 #define HWCAP_IWMMXT 512 @@ -739,6 +746,564 @@ arm_linux_read_description (struct target_ops *ops) return NULL; } +/* Information describing the hardware breakpoint capabilities. */ +struct arm_linux_hwbp_cap +{ + gdb_byte arch; + gdb_byte max_wp_length; + gdb_byte wp_count; + gdb_byte bp_count; +}; + +/* Get hold of the Hardware Breakpoint information for the target we are + attached to. Returns NULL if the kernel doesn't support Hardware + breakpoints at all, or a pointer to the information structure. */ +static const struct arm_linux_hwbp_cap * +arm_linux_get_hwbp_cap (void) +{ + /* The info structure we return. */ + static struct arm_linux_hwbp_cap info; + + /* Is INFO in a good state? -1 means that no attempt has been made to + initialize INFO; 0 means an attempt has been made, but it failed; 1 + means INFO is in an initialized state. */ + static int available = -1; + + if (available == -1) + { + int tid; + unsigned int val; + + tid = GET_THREAD_ID (inferior_ptid); + if (ptrace (PTRACE_GETHBPREGS, tid, 0, &val) < 0) + available = 0; + else + { + info.arch = (gdb_byte)((val >> 24) & 0xff); + info.max_wp_length = (gdb_byte)((val >> 16) & 0xff); + info.wp_count = (gdb_byte)((val >> 8) & 0xff); + info.bp_count = (gdb_byte)(val & 0xff); + available = (info.arch != 0); + } + } + + return available == 1 ? &info : NULL; +} + +/* How many hardware breakpoints are available? */ +static int +arm_linux_get_hw_breakpoint_count (void) +{ + const struct arm_linux_hwbp_cap *cap = arm_linux_get_hwbp_cap (); + return cap != NULL ? cap->bp_count : 0; +} + +/* How many hardware watchpoints are available? */ +static int +arm_linux_get_hw_watchpoint_count (void) +{ + const struct arm_linux_hwbp_cap *cap = arm_linux_get_hwbp_cap (); + return cap != NULL ? cap->wp_count : 0; +} + +/* Have we got a free break-/watch-point available for use? Returns -1 if + there is not an appropriate resource available, otherwise returns 1. */ +static int +arm_linux_can_use_hw_breakpoint (int type, int cnt, int ot) +{ + if (type == bp_hardware_watchpoint || type == bp_read_watchpoint + || type == bp_access_watchpoint || type == bp_watchpoint) + { + if (cnt + ot > arm_linux_get_hw_watchpoint_count ()) + return -1; + } + else if (type == bp_hardware_breakpoint) + { + if (cnt > arm_linux_get_hw_breakpoint_count ()) + return -1; + } + else + gdb_assert (FALSE); + + return 1; +} + +/* Enum describing the different types of ARM hardware break-/watch-points. */ +typedef enum +{ + arm_hwbp_break = 0, + arm_hwbp_load = 1, + arm_hwbp_store = 2, + arm_hwbp_access = 3 +} arm_hwbp_type; + +/* Type describing an ARM Hardware Breakpoint Control register value. */ +typedef unsigned int arm_hwbp_control_t; + +/* Structure used to keep track of hardware break-/watch-points. */ +struct arm_linux_hw_breakpoint +{ + /* Address to break on, or being watched. */ + unsigned int address; + /* Control register for break-/watch- point. */ + arm_hwbp_control_t control; +}; + +/* Structure containing arrays of the break and watch points which are have + active in each thread. + + The Linux ptrace interface to hardware break-/watch-points presents the + values in a vector centred around 0 (which is used fo generic information). + Positive indicies refer to breakpoint addresses/control registers, negative + indices to watchpoint addresses/control registers. + + The Linux vector is indexed as follows: + -((i << 1) + 2): Control register for watchpoint i. + -((i << 1) + 1): Address register for watchpoint i. + 0: Information register. + ((i << 1) + 1): Address register for breakpoint i. + ((i << 1) + 2): Control register for breakpoint i. + + This structure is used as a per-thread cache of the state stored by the + kernel, so that we don't need to keep calling into the kernel to find a + free breakpoint. + + We treat break-/watch-points with their enable bit clear as being deleted. + */ +typedef struct arm_linux_thread_points +{ + /* Thread ID. */ + int tid; + /* Breakpoints for thread. */ + struct arm_linux_hw_breakpoint *bpts; + /* Watchpoint for threads. */ + struct arm_linux_hw_breakpoint *wpts; +} *arm_linux_thread_points_p; +DEF_VEC_P (arm_linux_thread_points_p); + +/* Vector of hardware breakpoints for each thread. */ +VEC(arm_linux_thread_points_p) *arm_threads = NULL; + +/* Find the list of hardware break-/watch-points for a thread with id TID. + If no list exists for TID we return NULL if ALLOC_NEW is 0, otherwise we + create a new list and return that. */ +static struct arm_linux_thread_points * +arm_linux_find_breakpoints_by_tid (int tid, int alloc_new) +{ + int i; + struct arm_linux_thread_points *t; + + for (i = 0; VEC_iterate (arm_linux_thread_points_p, arm_threads, i, t); ++i) + { + if (t->tid == tid) + return t; + } + + t = NULL; + + if (alloc_new) + { + t = xmalloc (sizeof (struct arm_linux_thread_points)); + t->tid = tid; + t->bpts = xzalloc (arm_linux_get_hw_breakpoint_count () + * sizeof (struct arm_linux_hw_breakpoint)); + t->wpts = xzalloc (arm_linux_get_hw_watchpoint_count () + * sizeof (struct arm_linux_hw_breakpoint)); + VEC_safe_push (arm_linux_thread_points_p, arm_threads, t); + } + + return t; +} + +/* Initialize an ARM hardware break-/watch-point control register value. + BYTE_ADDRESS_SELECT is the mask of bytes to trigger on; HWBP_TYPE is the + type of break-/watch-point; ENABLE indicates whether the point is enabled. + */ +static arm_hwbp_control_t +arm_hwbp_control_initialize (unsigned byte_address_select, + arm_hwbp_type hwbp_type, + int enable) +{ + gdb_assert ((byte_address_select & ~0xffU) == 0); + gdb_assert (hwbp_type != arm_hwbp_break + || ((byte_address_select & 0xfU) != 0)); + + return (byte_address_select << 5) | (hwbp_type << 3) | (3 << 1) | enable; +} + +/* Does the breakpoint control value CONTROL have the enable bit set? */ +static int +arm_hwbp_control_is_enabled (arm_hwbp_control_t control) +{ + return control & 0x1; +} + +/* Change a breakpoint control word so that it is in the disabled state. */ +static arm_hwbp_control_t +arm_hwbp_control_disable (arm_hwbp_control_t control) +{ + return control & ~0x1; +} + +/* Initialise the hardware breakpoint structure P. The breakpoint will be + enabled, and will point to the placed address of BP_TGT. */ +static void +arm_linux_hw_breakpoint_initialize (struct gdbarch *gdbarch, + struct bp_target_info *bp_tgt, + struct arm_linux_hw_breakpoint *p) +{ + unsigned mask; + CORE_ADDR address = bp_tgt->placed_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. */ + if (arm_pc_is_thumb (gdbarch, address)) + mask = 0x3 << (address & 2); + else + mask = 0xf; + + p->address = (unsigned int) (address & ~3); hooks/post-receive -- Repository for Project Archer.