From: Pedro Alves <pedro@codesourcery.com>
To: gdb-patches@sourceware.org
Cc: "Pierre Muller" <pierre.muller@ics-cnrs.unistra.fr>, tromey@redhat.com
Subject: Re: [RFA]dwarf reader: Avoid complaint on const type
Date: Wed, 16 Jun 2010 16:08:00 -0000 [thread overview]
Message-ID: <201006161708.41089.pedro@codesourcery.com> (raw)
In-Reply-To: <001001caf925$2c771bb0$85655310$@muller@ics-cnrs.unistra.fr>
On Friday 21 May 2010 21:35:37, Pierre Muller wrote:
> > Pierre> 2010-05-21 Pierre Muller <muller@ics.u-strasbg.fr>
> > Pierre> * dwarf2read.c (process_die): Also allow DW_TAG_const_type
> > Pierre> and DW_TAG_volatile_type.
> > Pierre> (new_symbol): Likewise.
This caused
@@ -7385,16 +7385,16 @@ PASS: gdb.base/sigaltstack.exp: handle S
PASS: gdb.base/sigaltstack.exp: handle SIGVTALRM print pass nostop
PASS: gdb.base/sigaltstack.exp: handle SIGPROF print pass nostop
PASS: gdb.base/sigaltstack.exp: break catcher if level == INNER
-PASS: gdb.base/sigaltstack.exp: continue to catch
+FAIL: gdb.base/sigaltstack.exp: continue to catch (the program exited)
PASS: gdb.base/sigaltstack.exp: next
-PASS: gdb.base/sigaltstack.exp: backtrace
-PASS: gdb.base/sigaltstack.exp: finish from catch LEAF
-PASS: gdb.base/sigaltstack.exp: finish to throw INNER
-PASS: gdb.base/sigaltstack.exp: finish to catch INNER
-PASS: gdb.base/sigaltstack.exp: finish from catch INNER
-PASS: gdb.base/sigaltstack.exp: finish to OUTER
-PASS: gdb.base/sigaltstack.exp: finish to catch MAIN
-PASS: gdb.base/sigaltstack.exp: finish to MAIN
+FAIL: gdb.base/sigaltstack.exp: backtrace (pattern 1)
+FAIL: gdb.base/sigaltstack.exp: finish from catch LEAF (the program is no longer running)
+FAIL: gdb.base/sigaltstack.exp: finish to throw INNER (the program is no longer running)
+FAIL: gdb.base/sigaltstack.exp: finish to catch INNER (the program is no longer running)
+FAIL: gdb.base/sigaltstack.exp: finish from catch INNER (the program is no longer running)
+FAIL: gdb.base/sigaltstack.exp: finish to OUTER (the program is no longer running)
+FAIL: gdb.base/sigaltstack.exp: finish to catch MAIN (the program is no longer running)
+FAIL: gdb.base/sigaltstack.exp: finish to MAIN (the program is no longer running)
for me.
The problem is in the `level' variable in the test.
(gdb) break catcher if level == INNER
A syntax error in expression, near `== INNER'.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
(gdb) PASS: gdb.base/sigaltstack.exp: break catcher if level == INNER
continue
Continuing.
Program received signal SIGALRM, Alarm clock.
Program received signal SIGVTALRM, Virtual timer expired.
Program exited with code 03.
(gdb) FAIL: gdb.base/sigaltstack.exp: continue to catch (the program exited)
...
Note that the variable has the same name as the enum:
enum level { MAIN, OUTER, INNER, LEAF, NR_LEVELS };
/* Levels completed flag. */
volatile enum level level = NR_LEVELS;
It boils down to this --- before the patch, running sigaltstack
under gdb (run to main):
(gdb) p level
$1 = NR_LEVELS
(gdb) ptype level
type = volatile enum level {MAIN, OUTER, INNER, LEAF, NR_LEVELS}
and after the patch:
(gdb) p level
Attempt to use a type name as an expression
(gdb) ptype level
type = volatile enum level {MAIN, OUTER, INNER, LEAF, NR_LEVELS}
Here's the relevant dwarf:
<1><44d>: Abbrev Number: 20 (DW_TAG_enumeration_type)
<44e> DW_AT_name : (indirect string, offset: 0xe3): level
<452> DW_AT_byte_size : 4
<453> DW_AT_decl_file : 1
<454> DW_AT_decl_line : 24
<455> DW_AT_sibling : <0x478>
<2><459>: Abbrev Number: 21 (DW_TAG_enumerator)
<45a> DW_AT_name : (indirect string, offset: 0x2be): MAIN
<45e> DW_AT_const_value : 0
<2><45f>: Abbrev Number: 21 (DW_TAG_enumerator)
<460> DW_AT_name : (indirect string, offset: 0x281): OUTER
<464> DW_AT_const_value : 1
...
<1><5b7>: Abbrev Number: 31 (DW_TAG_variable)
<5b8> DW_AT_name : (indirect string, offset: 0xe3): level
<5bc> DW_AT_decl_file : 1
<5bd> DW_AT_decl_line : 27
<5be> DW_AT_type : <0x5cd>
<5c2> DW_AT_external : 1
<5c3> DW_AT_location : 9 byte block: 3 48 10 60 0 0 0 0 0 (DW_OP_addr: 601048)
<1><5cd>: Abbrev Number: 32 (DW_TAG_volatile_type)
<5ce> DW_AT_name : (indirect string, offset: 0xe3): level
<5d2> DW_AT_type : <0x44d>
Below's the patch again: It's not clear to me why is it correct to
treat DW_TAG_const_type and DW_TAG_volatile_type qualifiers as
typedefs, though I haven't investigated this much yet. FYI, or
in case it rings a bell...
> Index: src/gdb/dwarf2read.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/dwarf2read.c,v
> retrieving revision 1.386
> diff -u -p -r1.386 dwarf2read.c
> --- src/gdb/dwarf2read.c 17 May 2010 15:55:01 -0000 1.386
> +++ src/gdb/dwarf2read.c 21 May 2010 14:40:59 -0000
> @@ -3194,6 +3194,8 @@ process_die (struct die_info *die, struc
> case DW_TAG_base_type:
> case DW_TAG_subrange_type:
> case DW_TAG_typedef:
> + case DW_TAG_const_type:
> + case DW_TAG_volatile_type:
> /* Add a typedef symbol for the type definition, if it has a
> DW_AT_name. */
> new_symbol (die, read_type_die (die, cu), cu);
> @@ -8742,6 +8744,8 @@ new_symbol (struct die_info *die, struct
> break;
> case DW_TAG_base_type:
> case DW_TAG_subrange_type:
> + case DW_TAG_const_type:
> + case DW_TAG_volatile_type:
> SYMBOL_CLASS (sym) = LOC_TYPEDEF;
> SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
> add_symbol_to_list (sym, cu->list_in_scope);
--
Pedro Alves
next prev parent reply other threads:[~2010-06-16 16:08 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <41597.7287375883$1274454923@news.gmane.org>
2010-05-21 17:20 ` Tom Tromey
2010-05-21 20:46 ` Pierre Muller
2010-06-16 16:08 ` Pedro Alves [this message]
2010-06-20 22:39 ` Pierre Muller
[not found] ` <3752333521215815628@unknownmsgid>
2010-06-28 20:27 ` Doug Evans
2010-06-29 13:09 ` Pierre Muller
2010-07-01 17:09 ` Pedro Alves
2010-07-01 17:13 ` Joel Brobecker
2010-07-21 17:16 ` Pedro Alves
[not found] ` <29342.6726283089$1277816998@news.gmane.org>
2010-07-02 21:47 ` Tom Tromey
2010-05-21 15:31 Pierre Muller
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=201006161708.41089.pedro@codesourcery.com \
--to=pedro@codesourcery.com \
--cc=gdb-patches@sourceware.org \
--cc=pierre.muller@ics-cnrs.unistra.fr \
--cc=tromey@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).