From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18654 invoked by alias); 8 Jun 2007 23:17:05 -0000 Received: (qmail 18644 invoked by uid 22791); 8 Jun 2007 23:17:04 -0000 X-Spam-Check-By: sourceware.org Received: from mtagate7.de.ibm.com (HELO mtagate7.de.ibm.com) (195.212.29.156) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 08 Jun 2007 23:17:02 +0000 Received: from d12nrmr1607.megacenter.de.ibm.com (d12nrmr1607.megacenter.de.ibm.com [9.149.167.49]) by mtagate7.de.ibm.com (8.13.8/8.13.8) with ESMTP id l58NGxPH198860 for ; Fri, 8 Jun 2007 23:16:59 GMT Received: from d12av02.megacenter.de.ibm.com (d12av02.megacenter.de.ibm.com [9.149.165.228]) by d12nrmr1607.megacenter.de.ibm.com (8.13.8/8.13.8/NCO v8.3) with ESMTP id l58NGxfL4042922 for ; Sat, 9 Jun 2007 01:16:59 +0200 Received: from d12av02.megacenter.de.ibm.com (loopback [127.0.0.1]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id l58NGxLT017805 for ; Sat, 9 Jun 2007 01:16:59 +0200 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.12.11) with SMTP id l58NGxdb017802 for ; Sat, 9 Jun 2007 01:16:59 +0200 Message-Id: <200706082316.l58NGxdb017802@d12av02.megacenter.de.ibm.com> Received: by tuxmaker.boeblingen.de.ibm.com (sSMTP sendmail emulation); Sat, 9 Jun 2007 01:16:59 +0200 Subject: [7/10] Remove unused builtin_type_frame_reg To: gdb-patches@sourceware.org Date: Fri, 08 Jun 2007 23:17:00 -0000 From: "Ulrich Weigand" X-Mailer: ELM [version 2.5 PL2] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2007-06/txt/msg00119.txt.bz2 Hello, another instance of gdbarch-swapped types is the msym_.._type variables used to represent the contents of variables without debug information. This patch replace those variables by a per-gdbarch data structure to hold the types, completely analogous to the main builtin_type. (The types could have been added to builtin_type, but I prefer this way as it keeps the parse.c file self-contained.) Bye, Ulrich ChangeLog: * parse.c (struct msym_type): New data type. (msym_data): New global variable. (msym_type): New function. (msym_post_init): Likewise. (msym_text_symbol_type, msym_data_symbol_type, msym_unknown_symbol_type, msym_tls_symbol_type): Remove. (write_exp_msymbol): Call msym_type instead of using global variables. (build_parse): Remove. (_initialize_parse): Do not call build_parse. Do not swap variables. Register msym_data per-gdbarch data. diff -urNp gdb-orig/gdb/parse.c gdb-head/gdb/parse.c --- gdb-orig/gdb/parse.c 2007-06-08 22:17:44.812130679 +0200 +++ gdb-head/gdb/parse.c 2007-06-08 22:21:55.621046338 +0200 @@ -377,6 +377,52 @@ write_exp_bitstring (struct stoken str) write_exp_elt_longcst ((LONGEST) bits); } + +/* Default data types used for minimal symbols. */ + +struct msym_type + { + struct type *text_symbol; + struct type *data_symbol; + struct type *unknown_symbol; + struct type *tls_symbol; + }; + +static struct gdbarch_data *msym_data; + +static const struct msym_type * +msym_type (struct gdbarch *gdbarch) +{ + return gdbarch_data (gdbarch, msym_data); +} + +static void * +msym_post_init (struct gdbarch *gdbarch) +{ + struct msym_type *msym_type + = GDBARCH_OBSTACK_ZALLOC (gdbarch, struct msym_type); + + msym_type->text_symbol = + init_type (TYPE_CODE_FUNC, 1, 0, "", NULL); + TYPE_TARGET_TYPE (msym_type->text_symbol) = + init_type (TYPE_CODE_INT, TARGET_INT_BIT / HOST_CHAR_BIT, 0, "int", NULL); + + msym_type->data_symbol = + init_type (TYPE_CODE_INT, TARGET_INT_BIT / HOST_CHAR_BIT, 0, + "", NULL); + + msym_type->unknown_symbol = + init_type (TYPE_CODE_INT, 1, 0, + "", + NULL); + + msym_type->tls_symbol = + init_type (TYPE_CODE_INT, TARGET_INT_BIT / HOST_CHAR_BIT, 0, + "", NULL); + + return msym_type; +} + /* Add the appropriate elements for a minimal symbol to the end of the expression. The rationale behind passing in text_symbol_type and data_symbol_type was so that Modula-2 could pass in WORD for @@ -384,11 +430,6 @@ write_exp_bitstring (struct stoken str) based on the language, but they no longer have names like "int", so the initial rationale is gone. */ -static struct type *msym_text_symbol_type; -static struct type *msym_data_symbol_type; -static struct type *msym_unknown_symbol_type; -static struct type *msym_tls_symbol_type; - void write_exp_msymbol (struct minimal_symbol *msymbol, struct type *text_symbol_type, @@ -419,7 +460,7 @@ write_exp_msymbol (struct minimal_symbol write_exp_elt_opcode (UNOP_MEMVAL_TLS); write_exp_elt_objfile (ofp); - write_exp_elt_type (msym_tls_symbol_type); + write_exp_elt_type (msym_type (current_gdbarch)->tls_symbol); write_exp_elt_opcode (UNOP_MEMVAL_TLS); return; } @@ -430,18 +471,18 @@ write_exp_msymbol (struct minimal_symbol case mst_text: case mst_file_text: case mst_solib_trampoline: - write_exp_elt_type (msym_text_symbol_type); + write_exp_elt_type (msym_type (current_gdbarch)->text_symbol); break; case mst_data: case mst_file_data: case mst_bss: case mst_file_bss: - write_exp_elt_type (msym_data_symbol_type); + write_exp_elt_type (msym_type (current_gdbarch)->data_symbol); break; default: - write_exp_elt_type (msym_unknown_symbol_type); + write_exp_elt_type (msym_type (current_gdbarch)->unknown_symbol); break; } write_exp_elt_opcode (UNOP_MEMVAL); @@ -1175,28 +1216,6 @@ follow_types (struct type *follow_type) return follow_type; } -static void build_parse (void); -static void -build_parse (void) -{ - int i; - - msym_text_symbol_type = - init_type (TYPE_CODE_FUNC, 1, 0, "", NULL); - TYPE_TARGET_TYPE (msym_text_symbol_type) = builtin_type_int; - msym_data_symbol_type = - init_type (TYPE_CODE_INT, TARGET_INT_BIT / HOST_CHAR_BIT, 0, - "", NULL); - msym_unknown_symbol_type = - init_type (TYPE_CODE_INT, 1, 0, - "", - NULL); - - msym_tls_symbol_type = - init_type (TYPE_CODE_INT, TARGET_INT_BIT / HOST_CHAR_BIT, 0, - "", NULL); -} - /* This function avoids direct calls to fprintf in the parser generated debug code. */ void @@ -1222,15 +1241,7 @@ _initialize_parse (void) type_stack = (union type_stack_elt *) xmalloc (type_stack_size * sizeof (*type_stack)); - build_parse (); - - /* FIXME - For the moment, handle types by swapping them in and out. - Should be using the per-architecture data-pointer and a large - struct. */ - DEPRECATED_REGISTER_GDBARCH_SWAP (msym_text_symbol_type); - DEPRECATED_REGISTER_GDBARCH_SWAP (msym_data_symbol_type); - DEPRECATED_REGISTER_GDBARCH_SWAP (msym_unknown_symbol_type); - deprecated_register_gdbarch_swap (NULL, 0, build_parse); + msym_data = gdbarch_data_register_post_init (msym_post_init); add_setshow_zinteger_cmd ("expression", class_maintenance, &expressiondebug, _("\ -- Dr. Ulrich Weigand GNU Toolchain for Linux on System z and Cell BE Ulrich.Weigand@de.ibm.com