From: Fred Fish <fnf@fishpond.ninemoons.com>
To: gdb-patches@sources.redhat.com
Cc: fnf@redhat.com
Subject: RFA: use init_type() in dwarf2read.c
Date: Sat, 08 Dec 2001 22:47:00 -0000 [thread overview]
Message-ID: <200112090641.fB96fCx13479@fishpond.ninemoons.com> (raw)
The dwarf2read.c file sometimes handcrafts new types and sometimes
calls init_type(). This patch eliminates one of the unnecessary
handcraftings.
-Fred
2001-12-08 Fred Fish <fnf@redhat.com>
* dwarf2read.c (read_typedef): Replace hand crafted type
initialization with a call to the init_type() function, which
is how the rest of gdb creates types.
Index: dwarf2read.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2read.c,v
retrieving revision 1.38
diff -u -p -r1.38 dwarf2read.c
--- dwarf2read.c 2001/12/07 22:11:51 1.38
+++ dwarf2read.c 2001/12/09 01:28:00
@@ -2886,26 +2882,15 @@ static void
read_typedef (struct die_info *die, struct objfile *objfile,
const struct comp_unit_head *cu_header)
{
- struct type *type;
+ struct attribute *attr;
+ char *name;
if (!die->type)
{
- struct attribute *attr;
- struct type *xtype;
-
- xtype = die_type (die, objfile, cu_header);
-
- type = alloc_type (objfile);
- TYPE_CODE (type) = TYPE_CODE_TYPEDEF;
- TYPE_FLAGS (type) |= TYPE_FLAG_TARGET_STUB;
- TYPE_TARGET_TYPE (type) = xtype;
attr = dwarf_attr (die, DW_AT_name);
- if (attr && DW_STRING (attr))
- TYPE_NAME (type) = obsavestring (DW_STRING (attr),
- strlen (DW_STRING (attr)),
- &objfile->type_obstack);
-
- die->type = type;
+ name = (attr && DW_STRING (attr)) ? DW_STRING (attr) : NULL;
+ die->type = init_type (TYPE_CODE_TYPEDEF, 0, TYPE_FLAG_TARGET_STUB, name, objfile);
+ TYPE_TARGET_TYPE (die->type) = die_type (die, objfile, cu_header);
}
}
next reply other threads:[~2001-12-09 6:47 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-12-08 22:47 Fred Fish [this message]
2001-12-09 11:06 ` Elena Zannoni
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200112090641.fB96fCx13479@fishpond.ninemoons.com \
--to=fnf@fishpond.ninemoons.com \
--cc=fnf@redhat.com \
--cc=gdb-patches@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox