From: Michael Snyder <msnyder@redhat.com>
To: tromey@redhat.com
Cc: gdb-patches@sources.redhat.com
Subject: Re: Patch: printing java `char' values
Date: Wed, 08 May 2002 12:12:00 -0000 [thread overview]
Message-ID: <3CD9756D.F0AE4AF@redhat.com> (raw)
In-Reply-To: <873cx3vdhy.fsf@creche.redhat.com>
Tom Tromey wrote:
>
> >>>>> "Michael" == Michael Snyder <msnyder@redhat.com> writes:
>
> Michael> D'oh. I just remembered -- GDB always labels chars as
> Michael> "TYPE_CODE_INT". Sorry I didn't think about it earlier.
>
> Don't worry -- I'm just happy anybody read the patch.
>
> Michael> TYPE_CODE_INT is more of a class than a type. It includes
> Michael> all integer-like types, including char, short, int, long, and
> Michael> long long.
>
> Michael> I've no idea what context TYPE_CODE_CHAR might be used in.
>
> Ok. Does this mean my patch is ok? Or is there something better way
> to do it?
Hmmm, looking at it now.
I see that none of the symbol readers except for stabsread.c will ever
create a TYPE_CODE_CHAR node. And stabs does it only in a special
circumstance (and only for the RS/6000). So you're unlikely to get
symbol info that says that your variable is a TYPE_CODE_CHAR.
That's probably why you're seeing it as TYPE_CODE_INT (which in my
experience is normal).
I recommend that you emulate what C does, and whenever you have a
TYPE_CODE_INT whose length is the length of a char (which for Java
appears to be two bytes), you look at the type_name and see if it is
"char" -- in which case you print it as a char. Umm, which appears
to be exactly what you're doing -- except that I'd be inclined to
put the test within the
case TYPE_CODE_INT:
block, rather than meddle with state before the switch statement.
That appears to be what the other language modules do.
Michael
next prev parent reply other threads:[~2002-05-08 19:12 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-05-06 10:11 Tom Tromey
2002-05-06 17:05 ` Michael Snyder
2002-05-07 13:29 ` Tom Tromey
2002-05-07 15:45 ` Andrew Cagney
2002-05-07 13:43 ` Daniel Jacobowitz
2002-05-07 14:22 ` Michael Snyder
2002-05-07 14:35 ` Tom Tromey
2002-05-08 12:12 ` Michael Snyder [this message]
2002-05-08 12:47 ` Daniel Jacobowitz
2002-05-08 13:32 ` Tom Tromey
2002-05-08 13:46 ` Daniel Jacobowitz
2002-05-08 14:10 ` Michael Snyder
2002-05-08 14:20 ` Daniel Jacobowitz
2002-05-08 15:39 ` Michael Snyder
2002-05-08 15:42 ` Tom Tromey
2002-05-08 16:52 ` Michael Snyder
2002-05-08 21:09 ` Tom Tromey
2002-05-09 11:09 ` Michael Snyder
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=3CD9756D.F0AE4AF@redhat.com \
--to=msnyder@redhat.com \
--cc=gdb-patches@sources.redhat.com \
--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