Re: [patch] add support for debugging fixed-point numbers

Tom Tromey
2009-01-07T19:56:24Z

>>>>> "Sean" == Sean D'Epagnier <geckosenator@gmail.com> writes:

Sean> Thanks so much for reviewing my patch. I am sorry for all the
Sean> inconsistencies, I will do my best to correct them, more comments
Sean> below.

Oh, don't be sorry... the coding standard is just a little hurdle
everybody has to get over when they first contribute, not a big deal.

Tom> I am not really that familiar with the fixed-point extension to C. My
Tom> understanding is that some of the types saturate -- but I didn't see
Tom> any code here related to saturation. Am I missing something?

Sean> If the type is _Sat, then it is a saturating type. I did not have any
Sean> support for this, however there is currently no way for me to know if
Sean> a variable is a saturating type (nothing in the dwarf format
Sean> specifying it) So gdb might be inconsistent in the sense that if you
Sean> add a number to a saturating variable ie: "p x+.5" and x saturates,
Sean> then gdb won't know to saturate it, but unless we add more fields to
Sean> dwarf specifying this. What do you suggest we do about this? At
Sean> least you can examine saturating values correctly.

This sounds like a Dwarf oversight to me. Perhaps we can either get
something officially defined here (I don't know how to do that,
though), or define a GNU extension. I think that, at least, this
ought to be filed as a GCC bug, and maybe a GDB bug as well, once your
patch goes in.

IMO, the absence of this information should not block your patch.

Sean> I also noticed what seems to be a quirk in gdb. Maybe you have some
Sean> insight. If you launch gdb and type something like:
Sean> (gdb) p ((unsigned _Accum)- 1)
Sean> $7 = -1
Sean> (gdb) p ((unsigned int)- 1)
Sean> $8 = 65535
[...]

Offhand, I have no idea what is going on here, sorry.

Sean> I'm not sure which is best, to try to add fixed-point support to stabs
Sean> format too, or to make gdb read the types from the dwarf format in
Sean> this case (or maybe both)

I also have no idea about this :). I don't know anything about stabs,
I'm afraid.

Tom