From: Denis PILAT <denis.pilat@st.com>
To: gdb-patches <gdb-patches@sourceware.org>
Subject: [RFC] DW_AT_type missing from DW_TAG_subrange_type
Date: Tue, 03 Apr 2007 13:24:00 -0000 [thread overview]
Message-ID: <4612556C.1080709@st.com> (raw)
For the global variable declared like that
int array[] = {1, 2, 3, 4};
the dwarf information generated by our specific compiler is missing
DW_AT_type missing from DW_TAG_subrange_type.
Usually in dwarf2 information (ie like the bellow example for gcc4 under
linux), the DW_AT_type exists for subranges :
< 175 (0xaf) > DW_TAG_array_type
| DW_AT_sibling : < 191 (0xbf) >
| DW_AT_type : < 168 (0xa8) >
`--------------------------
< 184 (0xb8) > DW_TAG_subrange_type
* | DW_AT_type : < 191 (0xbf) >* <<<<<-------- missing from
my elf file
| DW_AT_upper_bound : DW_AT_upper_bound(DW_FORM_data1) : 3
`--------------------------
Therefore we go thru the code "base_type = alloc_type (NULL)" (in
read_subrange_type of dwarf2read.c) and gdb prints the following if "set
print array-indexes on": (all indexes are set to 0):
(gdb) p array
$1 = {[0] = 1, [0] = 2, [0] = 3, [0] = 4}
Could we have a *builtin_type_int* as the default type instead of
alloc_type (NULL) ?
*Attach is a patch in that sense.*
I'm also wondering about the code:
base_type = die_type (die, cu);
if (base_type == NULL)
{
complaint (&symfile_complaints,
_("DW_AT_type missing from DW_TAG_subrange_type"));
return;
}
It seems we'll never have (base_type == NULL). Am I right ?
May be it's time to remove that as well. The complaints seems to be in a
better place in my patch.
For information, this testcase is present in gdb.base/arrayidx.exp where
we have "set print array-indexes on"
No regression for this patch for i386-linux target
--
Denis
Index: dwarf2read.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2read.c,v
retrieving revision 1.216
diff -u -p -r1.216 dwarf2read.c
--- dwarf2read.c 30 Mar 2007 17:21:47 -0000 1.216
+++ dwarf2read.c 3 Apr 2007 09:41:07 -0000
@@ -4921,7 +4921,11 @@ read_subrange_type (struct die_info *die
}
if (TYPE_CODE (base_type) == TYPE_CODE_VOID)
- base_type = alloc_type (NULL);
+ {
+ complaint (&symfile_complaints,
+ _("DW_AT_type missing from DW_TAG_subrange_type"));
+ base_type = builtin_type_int;
+ }
if (cu->language == language_fortran)
{
next reply other threads:[~2007-04-03 13:24 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-03 13:24 Denis PILAT [this message]
2007-04-10 15:31 ` Daniel Jacobowitz
2007-04-18 12:55 ` Denis PILAT
2007-04-18 13:06 ` Daniel Jacobowitz
2007-04-18 13:17 ` Denis PILAT
2007-04-18 13:30 ` Daniel Jacobowitz
2007-04-18 14:21 ` Denis PILAT
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=4612556C.1080709@st.com \
--to=denis.pilat@st.com \
--cc=gdb-patches@sourceware.org \
/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