From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8031 invoked by alias); 6 Apr 2002 19:18:26 -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 8008 invoked from network); 6 Apr 2002 19:17:51 -0000 Received: from unknown (HELO localhost.redhat.com) (24.112.240.27) by sources.redhat.com with SMTP; 6 Apr 2002 19:17:51 -0000 Received: from cygnus.com (localhost [127.0.0.1]) by localhost.redhat.com (Postfix) with ESMTP id 647753CB7 for ; Sat, 6 Apr 2002 14:17:42 -0500 (EST) Message-ID: <3CAF49D6.9020904@cygnus.com> Date: Sat, 06 Apr 2002 11:18:00 -0000 From: Andrew Cagney User-Agent: Mozilla/5.0 (X11; U; NetBSD macppc; en-US; rv:0.9.9) Gecko/20020328 X-Accept-Language: en-us, en MIME-Version: 1.0 To: gdb-patches@sources.redhat.com Subject: [patch/rfc] Zap old style standard register $fp, fix gdb/251 Content-Type: multipart/mixed; boundary="------------090205060300090803060302" X-SW-Source: 2002-04/txt/msg00227.txt.bz2 This is a multi-part message in MIME format. --------------090205060300090803060302 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Content-length: 356 Hello, Following on from my previous patch, this zaps the old way of handling $fp ($pc, ...). This in turn removes any confusion between $fp (the register) and $fp (the frame->base). There is still more work though, targets are still required to define FP_REGNUM when they don't even have an FP register (see MIPS). That is next. Comments? Andrew --------------090205060300090803060302 Content-Type: text/plain; name="diffs" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="diffs" Content-length: 6970 2002-04-06 Andrew Cagney * frame.c (read_relative_register_raw_bytes_for_frame): Do not override FP_REGNUM with frame->fp. * parse.c (num_std_regs, std_regs): Delete. (target_map_name_to_register): Do not search std_regs. Update function description. * parser-defs.h (num_std_regs, std_regs, struct std_regs): Delete declarations. Update copyright. Fix PR gdb/251. diff --exclude *CVS* --exclude *#* --exclude *~* --exclude *%* --exclude *.orig --exclude *.rej --exclude *diffs --exclude new-* --exclude old-* --exclude *-new --exclude *-old -u /home/scratch/PENDING/2002-02-09-builtin-regs/src/gdb/frame.c /home/scratch/PENDING/2002-04-05-zap-std-regs/src/gdb/frame.c --- /home/scratch/PENDING/2002-02-09-builtin-regs/src/gdb/frame.c Fri May 4 00:15:24 2001 +++ /home/scratch/PENDING/2002-04-05-zap-std-regs/src/gdb/frame.c Sat Apr 6 14:00:02 2002 @@ -182,24 +182,12 @@ Returns 1 if could not be read, 0 if could. */ -/* FIXME: This function increases the confusion between FP_REGNUM - and the virtual/pseudo-frame pointer. */ - static int read_relative_register_raw_bytes_for_frame (int regnum, char *myaddr, struct frame_info *frame) { int optim; - if (regnum == FP_REGNUM && frame) - { - /* Put it back in target format. */ - store_address (myaddr, REGISTER_RAW_SIZE (FP_REGNUM), - (LONGEST) FRAME_FP (frame)); - - return 0; - } - get_saved_register (myaddr, &optim, (CORE_ADDR *) NULL, frame, regnum, (enum lval_type *) NULL); diff --exclude *CVS* --exclude *#* --exclude *~* --exclude *%* --exclude *.orig --exclude *.rej --exclude *diffs --exclude new-* --exclude old-* --exclude *-new --exclude *-old -u /home/scratch/PENDING/2002-02-09-builtin-regs/src/gdb/parse.c /home/scratch/PENDING/2002-04-05-zap-std-regs/src/gdb/parse.c --- /home/scratch/PENDING/2002-02-09-builtin-regs/src/gdb/parse.c Sat Apr 6 08:39:35 2002 +++ /home/scratch/PENDING/2002-04-05-zap-std-regs/src/gdb/parse.c Sat Apr 6 13:39:06 2002 @@ -104,15 +104,9 @@ static struct funcall *funcall_chain; -/* Assign machine-independent names to certain registers - (unless overridden by the REGISTER_NAMES table) */ - -unsigned num_std_regs = 0; -struct std_regs *std_regs; - /* The generic method for targets to specify how their registers are - named. The mapping can be derived from three sources: - REGISTER_NAME; std_regs; or a target specific alias hook. */ + named. The mapping can be derived from two sources: REGISTER_NAME; + or builtin regs. */ int target_map_name_to_register (char *str, int len) @@ -127,14 +121,6 @@ return i; } - /* Try standard aliases. */ - for (i = 0; i < num_std_regs; i++) - if (std_regs[i].name && len == strlen (std_regs[i].name) - && STREQN (str, std_regs[i].name, len)) - { - return std_regs[i].regnum; - } - /* Try builtin registers. */ i = builtin_reg_map_name_to_regnum (str, len); if (i >= 0) @@ -1361,63 +1347,6 @@ init_type (TYPE_CODE_INT, 1, 0, "", NULL); - - /* create the std_regs table */ - - num_std_regs = 0; -#ifdef PC_REGNUM - if (PC_REGNUM >= 0) - num_std_regs++; -#endif -#ifdef FP_REGNUM - if (FP_REGNUM >= 0) - num_std_regs++; -#endif -#ifdef SP_REGNUM - if (SP_REGNUM >= 0) - num_std_regs++; -#endif -#ifdef PS_REGNUM - if (PS_REGNUM >= 0) - num_std_regs++; -#endif - /* create an empty table */ - std_regs = xmalloc ((num_std_regs + 1) * sizeof *std_regs); - i = 0; - /* fill it in */ -#ifdef PC_REGNUM - if (PC_REGNUM >= 0) - { - std_regs[i].name = "pc"; - std_regs[i].regnum = PC_REGNUM; - i++; - } -#endif -#ifdef FP_REGNUM - if (FP_REGNUM >= 0) - { - std_regs[i].name = "fp"; - std_regs[i].regnum = FP_REGNUM; - i++; - } -#endif -#ifdef SP_REGNUM - if (SP_REGNUM >= 0) - { - std_regs[i].name = "sp"; - std_regs[i].regnum = SP_REGNUM; - i++; - } -#endif -#ifdef PS_REGNUM - if (PS_REGNUM >= 0) - { - std_regs[i].name = "ps"; - std_regs[i].regnum = PS_REGNUM; - i++; - } -#endif - memset (&std_regs[i], 0, sizeof (std_regs[i])); } void @@ -1437,8 +1366,6 @@ register_gdbarch_swap (&msym_data_symbol_type, sizeof (msym_data_symbol_type), NULL); register_gdbarch_swap (&msym_unknown_symbol_type, sizeof (msym_unknown_symbol_type), NULL); - register_gdbarch_swap (&num_std_regs, sizeof (std_regs), NULL); - register_gdbarch_swap (&std_regs, sizeof (std_regs), NULL); register_gdbarch_swap (NULL, 0, build_parse); add_show_from_set ( diff --exclude *CVS* --exclude *#* --exclude *~* --exclude *%* --exclude *.orig --exclude *.rej --exclude *diffs --exclude new-* --exclude old-* --exclude *-new --exclude *-old -u /home/scratch/PENDING/2002-02-09-builtin-regs/src/gdb/parser-defs.h /home/scratch/PENDING/2002-04-05-zap-std-regs/src/gdb/parser-defs.h --- /home/scratch/PENDING/2002-02-09-builtin-regs/src/gdb/parser-defs.h Wed Nov 14 21:22:39 2001 +++ /home/scratch/PENDING/2002-04-05-zap-std-regs/src/gdb/parser-defs.h Sat Apr 6 13:40:15 2002 @@ -1,6 +1,8 @@ /* Parser definitions for GDB. - Copyright 1986, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, - 1998, 1999, 2000 Free Software Foundation, Inc. + + Copyright 1986, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, + 1997, 1998, 1999, 2000, 2002 Free Software Foundation, Inc. + Modified from expread.y by the Department of Computer Science at the State University of New York at Buffalo. @@ -26,15 +28,6 @@ #include "doublest.h" -struct std_regs - { - char *name; - int regnum; - }; - -extern struct std_regs *std_regs; -extern unsigned num_std_regs; - extern struct expression *expout; extern int expout_size; extern int expout_ptr; @@ -208,8 +201,8 @@ }; /* The generic method for targets to specify how their registers are - named. The mapping can be derived from three sources: - REGISTER_NAME; std_regs; or a target specific alias hook. */ + named. The mapping can be derived from two sources: REGISTER_NAME; + and builtin regs. */ extern int target_map_name_to_register (char *, int); diff --exclude *CVS* --exclude *#* --exclude *~* --exclude *%* --exclude *.orig --exclude *.rej --exclude *diffs --exclude new-* --exclude old-* --exclude *-new --exclude *-old -u /home/scratch/PENDING/2002-02-09-builtin-regs/src/gdb/symtab.c /home/scratch/PENDING/2002-04-05-zap-std-regs/src/gdb/symtab.c --- /home/scratch/PENDING/2002-02-09-builtin-regs/src/gdb/symtab.c Sat Apr 6 08:39:39 2002 +++ /home/scratch/PENDING/2002-04-05-zap-std-regs/src/gdb/symtab.c Sat Apr 6 13:51:27 2002 @@ -181,7 +181,7 @@ if (real_path != NULL) { - const char *rp = gdb_realpath (symtab_to_filename (s)); + char *rp = gdb_realpath (symtab_to_filename (s)); make_cleanup (xfree, rp); if (FILENAME_CMP (real_path, rp) == 0) { --------------090205060300090803060302--