From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18462 invoked by alias); 26 Jun 2009 13:29:22 -0000 Received: (qmail 18450 invoked by uid 22791); 26 Jun 2009 13:29:21 -0000 X-SWARE-Spam-Status: No, hits=-1.6 required=5.0 tests=AWL,BAYES_00,MSGID_FROM_MTA_HEADER,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mtagate4.de.ibm.com (HELO mtagate4.de.ibm.com) (195.212.29.153) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 26 Jun 2009 13:29:14 +0000 Received: from d12nrmr1607.megacenter.de.ibm.com (d12nrmr1607.megacenter.de.ibm.com [9.149.167.49]) by mtagate4.de.ibm.com (8.14.3/8.13.8) with ESMTP id n5QDT9QR049666 for ; Fri, 26 Jun 2009 13:29:09 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 v9.2) with ESMTP id n5QDT9Zv3219610 for ; Fri, 26 Jun 2009 15:29:09 +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 n5QDT9TU008211 for ; Fri, 26 Jun 2009 15:29:09 +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 n5QDT8bn008178; Fri, 26 Jun 2009 15:29:08 +0200 Message-Id: <200906261329.n5QDT8bn008178@d12av02.megacenter.de.ibm.com> Received: by tuxmaker.boeblingen.de.ibm.com (sSMTP sendmail emulation); Fri, 26 Jun 2009 15:29:08 +0200 Subject: [rfc] Fix Java type allocation and revert make_function_type change To: gdb-patches@sourceware.org Date: Fri, 26 Jun 2009 13:29:00 -0000 From: "Ulrich Weigand" Cc: jan.kratochvil@redhat.com (Jan Kratochvil), tromey@redhat.com (Tom Tromey) In-Reply-To: <200906261323.n5QDN0Xi000973@d12av02.megacenter.de.ibm.com> from "Ulrich Weigand" at Jun 26, 2009 03:23:00 PM 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: 2009-06/txt/msg00708.txt.bz2 Hello, as mentioned in http://sourceware.org/ml/gdb-patches/2009-06/msg00706.html this patch changes jv-lang.c to not allocate temporary class types on the "fake" dynamics objfile, and then reverts the change to add an objfile parameter to make_function_type. Tested together with the previous patch on amd64-linux and powerpc64-linux (also with stabs). Bye, Ulrich ChangeLog: * gdbtypes.h (make_function_type): Remove OBJFILE parameter. * gdbtypes.c (make_function_type): Remove OBJFILE parameter. (lookup_function_type): Update call. * stabsread.c (read_type): Likewise. * dwarf2read.c (read_subroutine_type): Use lookup_function_type instead of make_function_type. * jv-lang.c (type_from_class): Likewise. Do not allocate types on the fake "dynamics" objfile. Index: gdb-head/gdb/dwarf2read.c =================================================================== --- gdb-head.orig/gdb/dwarf2read.c +++ gdb-head/gdb/dwarf2read.c @@ -5281,7 +5281,7 @@ read_subroutine_type (struct die_info *d struct attribute *attr; type = die_type (die, cu); - ftype = make_function_type (type, (struct type **) 0, cu->objfile); + ftype = lookup_function_type (type); /* All functions in C++, Pascal and Java have prototypes. */ attr = dwarf2_attr (die, DW_AT_prototyped, cu); Index: gdb-head/gdb/gdbtypes.c =================================================================== --- gdb-head.orig/gdb/gdbtypes.c +++ gdb-head/gdb/gdbtypes.c @@ -378,24 +378,24 @@ lookup_reference_type (struct type *type /* Lookup a function type that returns type TYPE. TYPEPTR, if nonzero, points to a pointer to memory where the function type should be stored. If *TYPEPTR is zero, update it to point to the - function type we return. We allocate new memory from OBJFILE if needed; use - NULL for permanent types. */ + function type we return. We allocate new memory if needed. */ struct type * -make_function_type (struct type *type, struct type **typeptr, - struct objfile *objfile) +make_function_type (struct type *type, struct type **typeptr) { struct type *ntype; /* New type */ + struct objfile *objfile; if (typeptr == 0 || *typeptr == 0) /* We'll need to allocate one. */ { - ntype = alloc_type (objfile); + ntype = alloc_type (TYPE_OBJFILE (type)); if (typeptr) *typeptr = ntype; } else /* We have storage, but need to reset it. */ { ntype = *typeptr; + objfile = TYPE_OBJFILE (ntype); smash_type (ntype); TYPE_OBJFILE (ntype) = objfile; } @@ -415,7 +415,7 @@ make_function_type (struct type *type, s struct type * lookup_function_type (struct type *type) { - return make_function_type (type, (struct type **) 0, TYPE_OBJFILE (type)); + return make_function_type (type, (struct type **) 0); } /* Identify address space identifier by name -- Index: gdb-head/gdb/gdbtypes.h =================================================================== --- gdb-head.orig/gdb/gdbtypes.h +++ gdb-head/gdb/gdbtypes.h @@ -1186,8 +1186,7 @@ extern struct type *make_pointer_type (s extern struct type *lookup_pointer_type (struct type *); -extern struct type *make_function_type (struct type *, struct type **, - struct objfile *); +extern struct type *make_function_type (struct type *, struct type **); extern struct type *lookup_function_type (struct type *); Index: gdb-head/gdb/stabsread.c =================================================================== --- gdb-head.orig/gdb/stabsread.c +++ gdb-head/gdb/stabsread.c @@ -1682,8 +1682,7 @@ again: case 'f': /* Function returning another type */ type1 = read_type (pp, objfile); - type = make_function_type (type1, dbx_lookup_type (typenums, objfile), - objfile); + type = make_function_type (type1, dbx_lookup_type (typenums, objfile)); break; case 'g': /* Prototyped function. (Sun) */ @@ -1707,7 +1706,7 @@ again: struct type *return_type = read_type (pp, objfile); struct type *func_type = make_function_type (return_type, - dbx_lookup_type (typenums, objfile), objfile); + dbx_lookup_type (typenums, objfile)); struct type_list { struct type *type; struct type_list *next; Index: gdb-head/gdb/jv-lang.c =================================================================== --- gdb-head.orig/gdb/jv-lang.c +++ gdb-head/gdb/jv-lang.c @@ -302,7 +302,10 @@ type_from_class (struct value *clas) if (type != NULL) return type; - type = alloc_type (objfile); + /* Do not use the "fake" dynamics objfile to own dynamically generated + types, as it does not provide an architecture, and it would not help + manage the lifetime of these types anyway. */ + type = alloc_type (NULL); TYPE_CODE (type) = TYPE_CODE_STRUCT; INIT_CPLUS_SPECIFIC (type); @@ -560,7 +563,7 @@ java_link_class_type (struct type *type, fn_fields[k].physname = ""; fn_fields[k].is_stub = 1; /* FIXME */ - fn_fields[k].type = make_function_type (java_void_type, NULL, objfile); + fn_fields[k].type = lookup_function_type (java_void_type); TYPE_CODE (fn_fields[k].type) = TYPE_CODE_METHOD; } -- Dr. Ulrich Weigand GNU Toolchain for Linux on System z and Cell BE Ulrich.Weigand@de.ibm.com