From: Andreas Schwab <schwab@suse.de>
To: gdb-patches@sources.redhat.com
Subject: [PATCH] Handle DW_TAG_subrange_type
Date: Sat, 22 Nov 2003 20:08:00 -0000 [thread overview]
Message-ID: <je1xs0p3nd.fsf@sykes.suse.de> (raw)
When trying to debug Ada code you often get a DW_TAG_subrange_type, which
gdb can't handle yet.
Andreas.
2003-11-22 Andreas Schwab <schwab@suse.de>
* dwarf2read.c (dwarf2_non_const_array_bound_ignored_complaint):
New function.
(read_subrange_type): New function.
(process_die): Handle DW_TAG_subrange_type.
(read_type_die): Likewise.
--- gdb/dwarf2read.c.~1.114.~ 2003-11-21 12:51:28.000000000 +0100
+++ gdb/dwarf2read.c 2003-11-22 16:52:42.000000000 +0100
@@ -610,6 +610,13 @@ dwarf2_non_const_array_bound_ignored_com
}
static void
+dwarf2_non_const_subrange_bound_ignored_complaint (const char *arg1)
+{
+ complaint (&symfile_complaints, "non-constant subrange bounds form '%s' ignored",
+ arg1);
+}
+
+static void
dwarf2_statement_list_fits_in_line_number_section_complaint (void)
{
complaint (&symfile_complaints,
@@ -844,6 +851,8 @@ static void read_tag_string_type (struct
static void read_subroutine_type (struct die_info *, struct dwarf2_cu *);
+static void read_subrange_type (struct die_info *, struct dwarf2_cu *);
+
static struct die_info *read_comp_unit (char *, bfd *, struct dwarf2_cu *);
static struct die_info *read_die_and_children (char *info_ptr, bfd *abfd,
@@ -1908,6 +1917,9 @@ process_die (struct die_info *die, struc
new_symbol (die, die->type, cu);
}
break;
+ case DW_TAG_subrange_type:
+ read_subrange_type (die, cu);
+ break;
case DW_TAG_common_block:
read_common_block (die, cu);
break;
@@ -3732,6 +3744,72 @@ read_base_type (struct die_info *die, st
die->type = type;
}
+static void
+read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
+{
+ struct type *element_type;
+ struct attribute *attr;
+ unsigned int low, high;
+
+ /* Return if we've already decoded this type. */
+ if (die->type)
+ {
+ return;
+ }
+
+ element_type = die_type (die, cu);
+ low = 0;
+ high = -1;
+ if (cu_language == language_fortran)
+ {
+ /* FORTRAN implies a lower bound of 1, if not given. */
+ low = 1;
+ }
+ attr = dwarf_attr (die, DW_AT_lower_bound);
+ if (attr)
+ {
+ if (attr->form == DW_FORM_sdata)
+ low = DW_SND (attr);
+ else if (attr->form == DW_FORM_udata
+ || attr->form == DW_FORM_data1
+ || attr->form == DW_FORM_data2
+ || attr->form == DW_FORM_data4
+ || attr->form == DW_FORM_data8)
+ {
+ low = DW_UNSND (attr);
+ }
+ else
+ {
+ dwarf2_non_const_subrange_bound_ignored_complaint
+ (dwarf_form_name (attr->form));
+ low = 0;
+ }
+ }
+ attr = dwarf_attr (die, DW_AT_upper_bound);
+ if (attr)
+ {
+ if (attr->form == DW_FORM_sdata)
+ {
+ high = DW_SND (attr);
+ }
+ else if (attr->form == DW_FORM_udata
+ || attr->form == DW_FORM_data1
+ || attr->form == DW_FORM_data2
+ || attr->form == DW_FORM_data4
+ || attr->form == DW_FORM_data8)
+ {
+ high = DW_UNSND (attr);
+ }
+ else
+ {
+ dwarf2_non_const_subrange_bound_ignored_complaint
+ (dwarf_form_name (attr->form));
+ high = 1;
+ }
+ }
+ die->type = create_range_type (NULL, element_type, low, high);
+}
+
/* Read a whole compilation unit into a linked list of dies. */
static struct die_info *
@@ -5674,6 +5752,9 @@ read_type_die (struct die_info *die, str
case DW_TAG_base_type:
read_base_type (die, cu);
break;
+ case DW_TAG_subrange_type:
+ read_subrange_type (die, cu);
+ break;
default:
complaint (&symfile_complaints, "unexepected tag in read_type_die: '%s'",
dwarf_tag_name (die->tag));
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
next reply other threads:[~2003-11-22 20:08 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-11-22 20:08 Andreas Schwab [this message]
2003-11-24 9:51 ` Joel Brobecker
2003-11-24 12:16 ` Andreas Schwab
2003-12-04 16:51 ` Elena Zannoni
2003-12-04 17:29 ` Andreas Schwab
2003-12-04 17:49 ` Joel Brobecker
2003-12-04 18:16 ` Elena Zannoni
2004-01-08 23:33 Elena Zannoni
2004-01-14 17:28 ` Joel Brobecker
2004-01-15 17:11 ` Elena Zannoni
2004-01-17 5:37 ` Joel Brobecker
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=je1xs0p3nd.fsf@sykes.suse.de \
--to=schwab@suse.de \
--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