Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Wu Zhou <woodzltc@cn.ibm.com>
To: Daniel Jacobowitz <drow@false.org>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFC] decimal float point patch based on libdecnumber: gdb 	patch
Date: Sun, 23 Jul 2006 05:48:00 -0000	[thread overview]
Message-ID: <20060723014758.9rm87choaoc8cw08@imap.linux.ibm.com> (raw)

Hi Daniel,

Thanks for reviewing this patch.

Quoting Daniel Jacobowitz <drow@false.org>:

> On Thu, Jun 22, 2006 at 07:36:17AM +0800, Wu Zhou wrote:
>>
>> Appended is the patch.  I had tested it with the latest gcc-4.2 cvs tree
>> on x86, with option "--enable-decimal-float". All the 121 tests passed.
>> Please review and comment.  Thanks a lot.
>
> Sometimes you use DECDBL and sometimes you use DECDOUBLE and sometimes
> you use DECFLOAT and sometimes you use DECFLT.  Let's pick one or the
> other and use it everywhere.  This makes it easier to search for
> code that knows about decimal float.  "decfloat" might be more
> readable?

I was using these different names because I wa simulating what  
float/double/long double are using.

DECDBL is not used anywhere, but decdbl is. :-)
It is only used in write_exp_elt_decdblcst and its reference.  That is  
to simulate write_exp_elt_dblcst. I am not very sure why gdb named it  
dbl though.

DECDOUBLE is used in OP_DECDOUBLE and value_from_decdouble.  This is  
to simulate OP_DOUBLE and value_from_double. All three kinds of float  
constants and variables are handled by them.  So I am using them for  
DECDOUBLE too.

DECFLT is only used in TYPE_CODE_DECFLT.  This is to simulate  
TYPE_CODE_FLT, which is used to refer to types of float, double, long  
double at the same time. The length can differentiate them.

DECFLOAT is used in parsing and fundamental type representation  
dwarf2read.c and C language handling.  such as FT_DECFLOAT,  
FT_DBL_PREC_DECFLOAT  and FT_EXT_PREC_DECFLOAT.  This is the same what  
FLOAT is used in these scanario.

My point is to keep these usage so as they are consistent with how  
flaot/double is handled.  What is your idea on this?

> Why is reverse_dfp necessary?  It says GDB uses the opposite endianness
> from decNumber, but I don't see why.  This might be a related problem,
> but are you accomodating target endianness when you read values from
> the target?  If not, a cross debugger will do the wrong thing.

We are using an array of gdb_byte to represent decimal values.  The  
first byte is the most significant. This might be not the same as the  
underlying byte order of the architecuture.  In this kind of  
situation, reverse_dfp is needed to do conversion.

But in big-endian machine, this might be not needed. I will try a test  
on ppc64.

I am now also thinking that the place where reverse_dfp is defined is  
not very good. Maybe we can put them into decimal_to_string /  
decimal_from_string. Then other gdb code don't need to know the  
existence of that.

BTW, I am not very sure what you means by saying "are you accomodating  
target endianness when you read values from the target?". I guess you  
mean that I _need_ to accommodate the endianness when reading values  
from the target, right? Then putting some code into  
decimal_from_string / decimal_to_string to convert the byte order if  
needed is right what you want to see, right?  Any advices?

>> Index: expression.h
>> ===================================================================
>> RCS file: /cvs/src/src/gdb/expression.h,v
>> retrieving revision 1.18
>> diff -u -r1.18 expression.h
>> --- expression.h	17 Dec 2005 22:33:59 -0000	1.18
>> +++ expression.h	21 Jun 2006 23:08:51 -0000
>> @@ -327,6 +327,11 @@
>>      /* A F90 array range operator (for "exp:exp", "exp:", ":exp"   
>> and ":").  */
>>      OP_F90_RANGE,
>>
>> +    /* OP_DECDOUBLE is followed by a type pointer in the next exp_element
>> +       and a dec long constant value in the following exp_element.
>> +       Then comes another OP_DECDOUBLE.  */
>> +    OP_DECDOUBLE,
>> +
>
> A comment on the format of the data would be nice here.  Is it in
> target byte order?

The first byte is the most significant byte.  I don't have code to  
make it into the target byte order yet.  reverse_dfp can partially do  
that.  But it need to be more general. And I am planning to add some  
code into decimal_to_string / decimal_from_string to test the target  
byte order and determine if the conversion is needed. What is your  
thought?

>> Index: c-valprint.c
>> ===================================================================
>> RCS file: /cvs/src/src/gdb/c-valprint.c,v
>> retrieving revision 1.39
>> diff -u -r1.39 c-valprint.c
>> --- c-valprint.c	18 Jan 2006 21:24:19 -0000	1.39
>> +++ c-valprint.c	21 Jun 2006 23:08:52 -0000
>> @@ -442,6 +442,17 @@
>>  	}
>>        break;
>>
>> +    case TYPE_CODE_DECFLT:
>> +      if (format)
>> +	{
>> +	  print_scalar_formatted (valaddr + embedded_offset, type,   
>> format, 0, stream);
>> +	}
>> +      else
>> +	{
>> +	  print_decimal_floating (valaddr + embedded_offset, type, stream);
>> +	}
>> +      break;
>> +
>>      case TYPE_CODE_METHOD:
>>        {
>>  	struct value *v = value_at (type, address);
>
> You don't need the braces in this; please omit them when you don't need
> to.  It saves a level of indentation, which generally makes them easier
> to read.

Thanks.  I will delete them when I update my patch.

Regards
- Wu Zhou


             reply	other threads:[~2006-07-23  5:48 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-23  5:48 Wu Zhou [this message]
2006-07-23 14:02 ` Daniel Jacobowitz
  -- strict thread matches above, loose matches on Subject: below --
2006-08-21 16:08 Wu Zhou
2006-08-21 18:30 ` Daniel Jacobowitz
2006-08-21 18:34   ` Wu Zhou
2006-08-22  1:31     ` Daniel Jacobowitz
2006-09-03  8:53       ` Wu Zhou
2006-09-03 16:44         ` Daniel Jacobowitz
2006-09-05  2:34           ` Wu Zhou
2006-08-01  9:55 Wu Zhou
2006-08-01 10:51 ` Wu Zhou
2006-08-08 18:16   ` Daniel Jacobowitz
2006-06-21 21:03 [RFC] decimal float point patch based on libdecnumber: testcase Wu Zhou
2006-06-21 23:36 ` [RFC] decimal float point patch based on libdecnumber: gdb patch Wu Zhou
2006-06-22  3:27   ` Eli Zaretskii
2006-06-22 14:18     ` Wu Zhou
2006-07-12 20:39   ` Daniel Jacobowitz

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=20060723014758.9rm87choaoc8cw08@imap.linux.ibm.com \
    --to=woodzltc@cn.ibm.com \
    --cc=drow@false.org \
    --cc=gdb-patches@sourceware.org \
    /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