From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29673 invoked by alias); 9 May 2002 04:09:54 -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 29666 invoked from network); 9 May 2002 04:09:53 -0000 Received: from unknown (HELO gash2.peakpeak.com) (207.174.178.17) by sources.redhat.com with SMTP; 9 May 2002 04:09:53 -0000 Received: from creche.cygnus.com (ta0203.peakpeak.com [204.144.244.203]) by gash2.peakpeak.com (8.9.3/8.9.3) with ESMTP id WAA06160; Wed, 8 May 2002 22:09:50 -0600 Received: (from tromey@localhost) by creche.cygnus.com (8.9.3/8.9.3) id WAA24276; Wed, 8 May 2002 22:19:59 -0600 To: Michael Snyder 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> <3CD9756D.F0AE4AF@redhat.com> <87sn52l0at.fsf@creche.redhat.com> <3CD9B721.6207C70@redhat.com> From: Tom Tromey Reply-To: tromey@redhat.com X-Attribution: Tom X-Zippy: I wish I was on a Cincinnati street corner holding a clean dog! Date: Wed, 08 May 2002 21:09:00 -0000 In-Reply-To: Michael Snyder's message of "Wed, 08 May 2002 16:39:13 -0700" Message-ID: <87661ykl5c.fsf@creche.redhat.com> X-SW-Source: 2002-05/txt/msg00261.txt.bz2 >>>>> "Michael" == Michael Snyder writes: Michael> Yes, that's the idea. I wouldn't even bother with the temp Michael> variable-- I would just call TYPE_CODE (type) twice. It's a Michael> macro, and not expensive to evaluate. Then you don't need Michael> the brackets. Ok. I've made this change and another one suggested by Andrew Cagney privately. Is this one ok to commit? Tom Index: ChangeLog from Tom Tromey * jv-valprint.c (java_val_print): Handle `char' as a special case of TYPE_CODE_INT. Index: jv-valprint.c =================================================================== RCS file: /cvs/src/src/gdb/jv-valprint.c,v retrieving revision 1.9 diff -u -r1.9 jv-valprint.c --- jv-valprint.c 21 Oct 2001 01:57:42 -0000 1.9 +++ jv-valprint.c 9 May 2002 04:05:49 -0000 @@ -497,18 +498,17 @@ return i; case TYPE_CODE_CHAR: - format = format ? format : output_format; - if (format) - print_scalar_formatted (valaddr, type, format, 0, stream); - else - LA_PRINT_CHAR ((int) unpack_long (type, valaddr), stream); - break; - case TYPE_CODE_INT: - /* Can't just call c_val_print because that print bytes as C chars. */ + /* Can't just call c_val_print because that prints bytes as C + chars. */ format = format ? format : output_format; if (format) print_scalar_formatted (valaddr, type, format, 0, stream); + else if (TYPE_CODE (type) == TYPE_CODE_CHAR + || (TYPE_CODE (type) == TYPE_CODE_INT + && TYPE_LENGTH (type) == 2 + && strcmp (TYPE_NAME (type), "char") == 0)) + LA_PRINT_CHAR ((int) unpack_long (type, valaddr), stream); else val_print_type_code_int (type, valaddr, stream); break;