This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Patch: printing java `char' values


On Mon, May 06, 2002 at 11:20:44AM -0600, Tom Tromey wrote:
> Compile the appended java program with `gcj -g'.  Run gdb on it, and
> run it with the argument "abc".  Put a breakpoint on main and step
> past the assignment.  Then do `p c'.
> 
> I get:
> 
>     (gdb) p c
>     $1 = 97
> 
> This is wrong.  Debugging gdb a little, I found that in java_val_print
> we are seeint a TYPE_CODE_INT and not a TYPE_CODE_CHAR.
> 
> The appended hack fixes the problem for me.  I'm sure there is some
> better way to handle this, but I don't know what.  Why would I end up
> with a TYPE_CODE_INT here?

Hmm...

$2 = {code = TYPE_CODE_INT, name = 0x82eeb88 "char", tag_name = 0x0,
...

So there is a created type named "char" with TYPE_CODE_INT.  Where does
it come from?  It comes from the DWARF-2: the DW_TAG_base_type entry
for "char" appears twice, once marked as "signed" and once as "unsigned
char".  "signed" is an integer.

You've gotta figure out where that's coming from.  It sounds like it
might be worthwhile to spend some time reading over gcj's DWARF-2
output and trying to figure out where some of the oddities come from.

-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]