aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2009-05-01 14:43:21 +0000
committerJan Kratochvil <jan.kratochvil@redhat.com>2009-05-01 14:43:21 +0000
commit323427d1cbb214ea9710ff62581b5635bebb32f3 (patch)
tree22fd41a78745dd0e5dd51f0ebfe9f989da5a7133
parent00adf2d4698cba8b2829652c2bc38c23df3d0ac0 (diff)
downloadgdb-323427d1cbb214ea9710ff62581b5635bebb32f3.zip
gdb-323427d1cbb214ea9710ff62581b5635bebb32f3.tar.gz
gdb-323427d1cbb214ea9710ff62581b5635bebb32f3.tar.bz2
gdb/
Make specifiable the make_function_type type memory ownership. * gdbtypes.c (make_function_type): New parameter `objfile', use it explicitely instead of TYPE-initialized removed local variable `objfile'. Describe `objfile' it in the function comment. (lookup_function_type): Update make_function_type callers. * gdbtypes.h (make_function_type): Update the prototype. * jv-lang.c (java_link_class_type): Update make_function_type callers. * dwarf2read.c (read_subroutine_type): Likewise. * stabsread.c (read_type): Likewise.
-rw-r--r--gdb/ChangeLog12
-rw-r--r--gdb/dwarf2read.c2
-rw-r--r--gdb/gdbtypes.c12
-rw-r--r--gdb/gdbtypes.h3
-rw-r--r--gdb/jv-lang.c3
-rw-r--r--gdb/stabsread.c5
6 files changed, 26 insertions, 11 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index df72f17..7ba0f86 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,15 @@
+2009-05-01 Jan Kratochvil <jan.kratochvil@redhat.com>
+
+ Make specifiable the make_function_type type memory ownership.
+ * gdbtypes.c (make_function_type): New parameter `objfile', use it
+ explicitely instead of TYPE-initialized removed local variable
+ `objfile'. Describe `objfile' it in the function comment.
+ (lookup_function_type): Update make_function_type callers.
+ * gdbtypes.h (make_function_type): Update the prototype.
+ * jv-lang.c (java_link_class_type): Update make_function_type callers.
+ * dwarf2read.c (read_subroutine_type): Likewise.
+ * stabsread.c (read_type): Likewise.
+
2009-05-01 Eli Zaretskii <eliz@gnu.org>
* go32-nat.c (go32_pid_to_str): Call normal_pid_to_str instead of
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index ee1490d..6ddaecd 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -5110,7 +5110,7 @@ read_subroutine_type (struct die_info *die, struct dwarf2_cu *cu)
struct attribute *attr;
type = die_type (die, cu);
- ftype = make_function_type (type, (struct type **) 0);
+ ftype = make_function_type (type, (struct type **) 0, cu->objfile);
/* All functions in C++, Pascal and Java have prototypes. */
attr = dwarf2_attr (die, DW_AT_prototyped, cu);
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index fb52e1a..f415773 100644
--- a/gdb/gdbtypes.c
+++ b/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 if needed. */
+ function type we return. We allocate new memory from OBJFILE if needed; use
+ NULL for permanent types. */
struct type *
-make_function_type (struct type *type, struct type **typeptr)
+make_function_type (struct type *type, struct type **typeptr,
+ struct objfile *objfile)
{
struct type *ntype; /* New type */
- struct objfile *objfile;
if (typeptr == 0 || *typeptr == 0) /* We'll need to allocate one. */
{
- ntype = alloc_type (TYPE_OBJFILE (type));
+ ntype = alloc_type (objfile);
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, struct type **typeptr)
struct type *
lookup_function_type (struct type *type)
{
- return make_function_type (type, (struct type **) 0);
+ return make_function_type (type, (struct type **) 0, TYPE_OBJFILE (type));
}
/* Identify address space identifier by name --
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index 3c4e948..fc54acc 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -1165,7 +1165,8 @@ extern struct type *make_pointer_type (struct type *, struct type **);
extern struct type *lookup_pointer_type (struct type *);
-extern struct type *make_function_type (struct type *, struct type **);
+extern struct type *make_function_type (struct type *, struct type **,
+ struct objfile *);
extern struct type *lookup_function_type (struct type *);
diff --git a/gdb/jv-lang.c b/gdb/jv-lang.c
index 0d0f4bc..ce17a28 100644
--- a/gdb/jv-lang.c
+++ b/gdb/jv-lang.c
@@ -557,7 +557,8 @@ java_link_class_type (struct type *type, struct value *clas)
}
fn_fields[k].physname = "";
fn_fields[k].is_stub = 1;
- fn_fields[k].type = make_function_type (java_void_type, NULL); /* FIXME */
+ /* FIXME */
+ fn_fields[k].type = make_function_type (java_void_type, NULL, objfile);
TYPE_CODE (fn_fields[k].type) = TYPE_CODE_METHOD;
}
diff --git a/gdb/stabsread.c b/gdb/stabsread.c
index 5ce53e3..20bc4f5 100644
--- a/gdb/stabsread.c
+++ b/gdb/stabsread.c
@@ -1685,7 +1685,7 @@ again:
case 'f': /* Function returning another type */
type1 = read_type (pp, objfile);
- type = make_function_type (type1, dbx_lookup_type (typenums));
+ type = make_function_type (type1, dbx_lookup_type (typenums), objfile);
break;
case 'g': /* Prototyped function. (Sun) */
@@ -1708,7 +1708,8 @@ again:
const char *type_start = (*pp) - 1;
struct type *return_type = read_type (pp, objfile);
struct type *func_type
- = make_function_type (return_type, dbx_lookup_type (typenums));
+ = make_function_type (return_type, dbx_lookup_type (typenums),
+ objfile);
struct type_list {
struct type *type;
struct type_list *next;