From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22123 invoked by alias); 4 Oct 2003 00:28:21 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 22116 invoked from network); 4 Oct 2003 00:28:20 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sources.redhat.com with SMTP; 4 Oct 2003 00:28:20 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.11.6/8.11.6) with ESMTP id h940SJ123846 for ; Fri, 3 Oct 2003 20:28:19 -0400 Received: from pobox.corp.redhat.com (pobox.corp.redhat.com [172.16.52.156]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id h940SJc24895 for ; Fri, 3 Oct 2003 20:28:19 -0400 Received: from localhost.localdomain (vpn50-46.rdu.redhat.com [172.16.50.46]) by pobox.corp.redhat.com (8.12.8/8.12.8) with ESMTP id h940SIbe021895 for ; Fri, 3 Oct 2003 20:28:19 -0400 Received: (from kev@localhost) by localhost.localdomain (8.11.6/8.11.6) id h940SD624547 for gdb-patches@sources.redhat.com; Fri, 3 Oct 2003 17:28:13 -0700 Date: Sat, 04 Oct 2003 00:28:00 -0000 From: Kevin Buettner Message-Id: <1031004002813.ZM24546@localhost.localdomain> To: gdb-patches@sources.redhat.com Subject: [RFC] TARGET_ADJUST_BREAKPOINT_ADDRESS - patch 1 of 4 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2003-10/txt/msg00070.txt.bz2 I've recently revisited a patch that I submitted a long time ago. Here are the relevant links to the original TARGET_ADJUST_BREAKPOINT_ADDRESS patch submission and discussion: http://sources.redhat.com/ml/gdb-patches/2000-06/msg00257.html (+) http://sources.redhat.com/ml/gdb-patches/2000-06/msg00260.html http://sources.redhat.com/ml/gdb-patches/2000-06/msg00270.html (+) http://sources.redhat.com/ml/gdb-patches/2000-06/msg00274.html (*) http://sources.redhat.com/ml/gdb-patches/2000-09/msg00156.html http://sources.redhat.com/ml/gdb-patches/2000-09/msg00158.html The link marked with (*) is Andrew's approval so long as Eli's concerns marked with (+) are addressed. The patch below should be non-controversial. It merely adds the TARGET_ADJUST_BREAKPOINT_ADDRESS method. Code which uses it (the possibly controversial bit) will come in patch #3. Documentation will be in the next patch, #2. Finally, target specific code which requires TARGET_ADJUST_BREAKPOINT_ADDRESS will be posted in patch #4. Kevin * arch-utils.h (default_target_adjust_breakpoint_address): New function declaration. * arch-utils.c (default_target_adjust_breakpoint_address): New function. * gdbarch.sh (TARGET_ADJUST_BREAKPOINT_ADDRESS): New method. * gdbarch.h, gdbarch.c: Regenerate. Index: arch-utils.c =================================================================== RCS file: /cvs/src/src/gdb/arch-utils.c,v retrieving revision 1.97 diff -u -p -r1.97 arch-utils.c --- arch-utils.c 30 Sep 2003 13:29:43 -0000 1.97 +++ arch-utils.c 3 Oct 2003 23:38:23 -0000 @@ -82,6 +82,21 @@ legacy_register_sim_regno (int regnum) return LEGACY_SIM_REGNO_IGNORE; } +/* Some architectures have constraints about where a breakpoint may be + placed. TARGET_ADJUST_BREAKPOINT_ADDRESS is given an address that is + adjusted (and returned) to conform to the constraints imposed by + the architecture. + + Targets which have no architectural constraints on breakpoint placement + should use default_target_adjust_breakpoint_address which merely returns + the breakpoint address unadjusted */ + +CORE_ADDR +default_target_adjust_breakpoint_address (CORE_ADDR bpaddr) +{ + return bpaddr; +} + int generic_frameless_function_invocation_not (struct frame_info *fi) { Index: arch-utils.h =================================================================== RCS file: /cvs/src/src/gdb/arch-utils.h,v retrieving revision 1.57 diff -u -p -r1.57 arch-utils.h --- arch-utils.h 27 Sep 2003 15:51:02 -0000 1.57 +++ arch-utils.h 3 Oct 2003 23:38:23 -0000 @@ -47,6 +47,11 @@ extern gdbarch_store_return_value_ftype address passed as an invisible first argument to the function. */ extern gdbarch_use_struct_convention_ftype always_use_struct_convention; +/* Identity function for targets which don't have architectural constraints + on placement of breakpoints. */ +extern gdbarch_target_adjust_breakpoint_address_ftype + default_target_adjust_breakpoint_address; + /* Frameless functions not identifable. */ extern gdbarch_frameless_function_invocation_ftype generic_frameless_function_invocation_not; Index: gdbarch.sh =================================================================== RCS file: /cvs/src/src/gdb/gdbarch.sh,v retrieving revision 1.275 diff -u -p -r1.275 gdbarch.sh --- gdbarch.sh 2 Oct 2003 20:28:29 -0000 1.275 +++ gdbarch.sh 3 Oct 2003 23:38:27 -0000 @@ -614,6 +614,7 @@ f:2:SKIP_PROLOGUE:CORE_ADDR:skip_prologu f:2:PROLOGUE_FRAMELESS_P:int:prologue_frameless_p:CORE_ADDR ip:ip::0:generic_prologue_frameless_p::0 f:2:INNER_THAN:int:inner_than:CORE_ADDR lhs, CORE_ADDR rhs:lhs, rhs::0:0 f::BREAKPOINT_FROM_PC:const unsigned char *:breakpoint_from_pc:CORE_ADDR *pcptr, int *lenptr:pcptr, lenptr:::0: +f:2:TARGET_ADJUST_BREAKPOINT_ADDRESS:CORE_ADDR:target_adjust_breakpoint_address:CORE_ADDR bpaddr:bpaddr:::default_target_adjust_breakpoint_address::0 f:2:MEMORY_INSERT_BREAKPOINT:int:memory_insert_breakpoint:CORE_ADDR addr, char *contents_cache:addr, contents_cache::0:default_memory_insert_breakpoint::0 f:2:MEMORY_REMOVE_BREAKPOINT:int:memory_remove_breakpoint:CORE_ADDR addr, char *contents_cache:addr, contents_cache::0:default_memory_remove_breakpoint::0 v:2:DECR_PC_AFTER_BREAK:CORE_ADDR:decr_pc_after_break::::0:-1