From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26065 invoked by alias); 8 May 2002 19:12:03 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 26054 invoked from network); 8 May 2002 19:12:01 -0000 Received: from unknown (HELO cygnus.com) (205.180.83.203) by sources.redhat.com with SMTP; 8 May 2002 19:12:01 -0000 Received: from redhat.com (reddwarf.sfbay.redhat.com [172.16.24.50]) by runyon.cygnus.com (8.8.7-cygnus/8.8.7) with ESMTP id MAA13028; Wed, 8 May 2002 12:11:58 -0700 (PDT) Message-ID: <3CD9756D.F0AE4AF@redhat.com> Date: Wed, 08 May 2002 12:12:00 -0000 From: Michael Snyder Organization: Red Hat, Inc. X-Accept-Language: en MIME-Version: 1.0 To: tromey@redhat.com CC: gdb-patches@sources.redhat.com Subject: Re: Patch: printing java `char' values References: <877kmh8a6r.fsf@creche.redhat.com> <3CD8429E.DA6D6BC7@redhat.com> <873cx3vdhy.fsf@creche.redhat.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-SW-Source: 2002-05/txt/msg00220.txt.bz2 Tom Tromey wrote: > > >>>>> "Michael" == Michael Snyder 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