From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24080 invoked by alias); 2 Jun 2002 17:39:05 -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 24043 invoked from network); 2 Jun 2002 17:39:00 -0000 Received: from unknown (HELO localhost.redhat.com) (24.112.240.27) by sources.redhat.com with SMTP; 2 Jun 2002 17:39:00 -0000 Received: from cygnus.com (localhost [127.0.0.1]) by localhost.redhat.com (Postfix) with ESMTP id 975223E79; Sun, 2 Jun 2002 13:39:11 -0400 (EDT) Message-ID: <3CFA583F.2030809@cygnus.com> Date: Sun, 02 Jun 2002 10:39:00 -0000 From: Andrew Cagney User-Agent: Mozilla/5.0 (X11; U; NetBSD macppc; en-US; rv:1.0rc3) Gecko/20020530 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Daniel Jacobowitz Cc: gdb-patches@sources.redhat.com Subject: Re: [patch/rfc] Make default generic_unwind_get_saved_register() References: <3CF9535E.9000508@cygnus.com> <20020602171930.GB9027@branoic.them.org> Content-Type: multipart/mixed; boundary="------------060100010209000506010801" X-SW-Source: 2002-06/txt/msg00026.txt.bz2 This is a multi-part message in MIME format. --------------060100010209000506010801 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Content-length: 712 > On Sat, Jun 01, 2002 at 07:06:06PM -0400, Andrew Cagney wrote: > >> Hello, >> >> Since most of the significant targets are now multi-arch, I'm putting >> forward the attached patch. >> >> It changes things so that: >> >> - the default GET_SAVED_REGSTER is generic_unwind_get_saved_register >> - an architecture no longer needs to set a default >> >> Previously the default was ``default_get_saved_register'' (which no one >> used). That has been deleted. >> >> Since all multi-arch targets have so far explicitly set >> GET_SAVED_REGISTER they are not affected. >> >> I'll look to commit this soon (unless someone protests). > > > No objection, but you missed the patch. Oops, attached. Andrew --------------060100010209000506010801 Content-Type: text/plain; name="diffs" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="diffs" Content-length: 8198 2002-06-01 Andrew Cagney * frame.c (GET_SAVED_REGISTER): Delete macro definition. (default_get_saved_register): Delete function. * gdbarch.sh (GET_SAVED_REGISTER): Set default to generic_unwind_get_saved_register. * gdbarch.h, gdbarch.c: Re-generate. Index: frame.c =================================================================== RCS file: /cvs/src/src/gdb/frame.c,v retrieving revision 1.11 diff -u -r1.11 frame.c --- frame.c 1 Jun 2002 20:44:21 -0000 1.11 +++ frame.c 1 Jun 2002 22:55:37 -0000 @@ -63,71 +63,6 @@ return addr; } -/* DEFAULT_GET_SAVED_REGISTER () - - Find register number REGNUM relative to FRAME and put its (raw, - target format) contents in *RAW_BUFFER. Set *OPTIMIZED if the - variable was optimized out (and thus can't be fetched). Set *LVAL - to lval_memory, lval_register, or not_lval, depending on whether - the value was fetched from memory, from a register, or in a strange - and non-modifiable way (e.g. a frame pointer which was calculated - rather than fetched). Set *ADDRP to the address, either in memory - on as a REGISTER_BYTE offset into the registers array. - - Note that this implementation never sets *LVAL to not_lval. But - it can be replaced by defining GET_SAVED_REGISTER and supplying - your own. - - The argument RAW_BUFFER must point to aligned memory. */ - -static void -default_get_saved_register (char *raw_buffer, - int *optimized, - CORE_ADDR *addrp, - struct frame_info *frame, - int regnum, - enum lval_type *lval) -{ - CORE_ADDR addr; - - if (!target_has_registers) - error ("No registers."); - - /* Normal systems don't optimize out things with register numbers. */ - if (optimized != NULL) - *optimized = 0; - addr = find_saved_register (frame, regnum); - if (addr != 0) - { - if (lval != NULL) - *lval = lval_memory; - if (regnum == SP_REGNUM) - { - if (raw_buffer != NULL) - { - /* Put it back in target format. */ - store_address (raw_buffer, REGISTER_RAW_SIZE (regnum), - (LONGEST) addr); - } - if (addrp != NULL) - *addrp = 0; - return; - } - if (raw_buffer != NULL) - target_read_memory (addr, raw_buffer, REGISTER_RAW_SIZE (regnum)); - } - else - { - if (lval != NULL) - *lval = lval_register; - addr = REGISTER_BYTE (regnum); - if (raw_buffer != NULL) - read_register_gen (regnum, raw_buffer); - } - if (addrp != NULL) - *addrp = addr; -} - void frame_register_unwind (struct frame_info *frame, int regnum, int *optimizedp, enum lval_type *lvalp, @@ -216,11 +151,6 @@ frame_register_unwind (frame->next, regnum, optimizedp, lvalp, addrp, &realnumx, raw_buffer); } - -#if !defined (GET_SAVED_REGISTER) -#define GET_SAVED_REGISTER(raw_buffer, optimized, addrp, frame, regnum, lval) \ - default_get_saved_register(raw_buffer, optimized, addrp, frame, regnum, lval) -#endif void get_saved_register (char *raw_buffer, Index: gdbarch.c =================================================================== RCS file: /cvs/src/src/gdb/gdbarch.c,v retrieving revision 1.129 diff -u -r1.129 gdbarch.c --- gdbarch.c 29 May 2002 16:39:54 -0000 1.129 +++ gdbarch.c 1 Jun 2002 22:55:41 -0000 @@ -344,7 +344,7 @@ 0, 0, 0, - generic_get_saved_register, + 0, 0, 0, 0, @@ -503,6 +503,7 @@ current_gdbarch->init_frame_pc_first = init_frame_pc_noop; current_gdbarch->init_frame_pc = init_frame_pc_default; current_gdbarch->coerce_float_to_double = default_coerce_float_to_double; + current_gdbarch->get_saved_register = generic_unwind_get_saved_register; current_gdbarch->register_convertible = generic_register_convertible_not; current_gdbarch->convert_register_p = legacy_convert_register_p; current_gdbarch->register_to_value = legacy_register_to_value; @@ -681,9 +682,7 @@ /* Skip verify of init_frame_pc_first, invalid_p == 0 */ /* Skip verify of init_frame_pc, invalid_p == 0 */ /* Skip verify of coerce_float_to_double, invalid_p == 0 */ - if ((GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) - && (gdbarch->get_saved_register == 0)) - fprintf_unfiltered (log, "\n\tget_saved_register"); + /* Skip verify of get_saved_register, invalid_p == 0 */ /* Skip verify of register_convertible, invalid_p == 0 */ /* Skip verify of register_convert_to_virtual, invalid_p == 0 */ /* Skip verify of register_convert_to_raw, invalid_p == 0 */ Index: gdbarch.h =================================================================== RCS file: /cvs/src/src/gdb/gdbarch.h,v retrieving revision 1.96 diff -u -r1.96 gdbarch.h --- gdbarch.h 29 May 2002 01:51:16 -0000 1.96 +++ gdbarch.h 1 Jun 2002 22:55:44 -0000 @@ -40,7 +40,6 @@ /* Pull in function declarations refered to, indirectly, via macros. */ #include "value.h" /* For default_coerce_float_to_double which is referenced by a macro. */ #include "inferior.h" /* For unsigned_address_to_pointer(). */ -#include "sim-regno.h" /* For legacy_register_sim_regno(). */ #endif struct frame_info; @@ -1185,18 +1184,19 @@ #endif #endif -/* GET_SAVED_REGISTER is like DUMMY_FRAMES. It is at level one as the - old code has strange #ifdef interaction. So far no one has found - that default_get_saved_register() is the default they are after. */ +/* Default (function) for non- multi-arch platforms. */ +#if (!GDB_MULTI_ARCH) && !defined (GET_SAVED_REGISTER) +#define GET_SAVED_REGISTER(raw_buffer, optimized, addrp, frame, regnum, lval) (generic_unwind_get_saved_register (raw_buffer, optimized, addrp, frame, regnum, lval)) +#endif typedef void (gdbarch_get_saved_register_ftype) (char *raw_buffer, int *optimized, CORE_ADDR *addrp, struct frame_info *frame, int regnum, enum lval_type *lval); extern void gdbarch_get_saved_register (struct gdbarch *gdbarch, char *raw_buffer, int *optimized, CORE_ADDR *addrp, struct frame_info *frame, int regnum, enum lval_type *lval); extern void set_gdbarch_get_saved_register (struct gdbarch *gdbarch, gdbarch_get_saved_register_ftype *get_saved_register); -#if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) && defined (GET_SAVED_REGISTER) +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (GET_SAVED_REGISTER) #error "Non multi-arch definition of GET_SAVED_REGISTER" #endif #if GDB_MULTI_ARCH -#if (GDB_MULTI_ARCH >= GDB_MULTI_ARCH_PARTIAL) || !defined (GET_SAVED_REGISTER) +#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (GET_SAVED_REGISTER) #define GET_SAVED_REGISTER(raw_buffer, optimized, addrp, frame, regnum, lval) (gdbarch_get_saved_register (current_gdbarch, raw_buffer, optimized, addrp, frame, regnum, lval)) #endif #endif Index: gdbarch.sh =================================================================== RCS file: /cvs/src/src/gdb/gdbarch.sh,v retrieving revision 1.140 diff -u -r1.140 gdbarch.sh --- gdbarch.sh 29 May 2002 16:39:55 -0000 1.140 +++ gdbarch.sh 1 Jun 2002 22:55:51 -0000 @@ -505,10 +505,7 @@ v:2:BELIEVE_PCC_PROMOTION:int:believe_pcc_promotion::::::: v:2:BELIEVE_PCC_PROMOTION_TYPE:int:believe_pcc_promotion_type::::::: f:2:COERCE_FLOAT_TO_DOUBLE:int:coerce_float_to_double:struct type *formal, struct type *actual:formal, actual:::default_coerce_float_to_double::0 -# GET_SAVED_REGISTER is like DUMMY_FRAMES. It is at level one as the -# old code has strange #ifdef interaction. So far no one has found -# that default_get_saved_register() is the default they are after. -f:1:GET_SAVED_REGISTER:void:get_saved_register:char *raw_buffer, int *optimized, CORE_ADDR *addrp, struct frame_info *frame, int regnum, enum lval_type *lval:raw_buffer, optimized, addrp, frame, regnum, lval::generic_get_saved_register:0 +f:2:GET_SAVED_REGISTER:void:get_saved_register:char *raw_buffer, int *optimized, CORE_ADDR *addrp, struct frame_info *frame, int regnum, enum lval_type *lval:raw_buffer, optimized, addrp, frame, regnum, lval:::generic_unwind_get_saved_register::0 # f:2:REGISTER_CONVERTIBLE:int:register_convertible:int nr:nr:::generic_register_convertible_not::0 f:2:REGISTER_CONVERT_TO_VIRTUAL:void:register_convert_to_virtual:int regnum, struct type *type, char *from, char *to:regnum, type, from, to:::0::0 --------------060100010209000506010801--