GDB printf command
Andrew STUBBS
andrew.stubbs@st.com
Tue Oct 17 14:10:00 GMT 2006
Daniel Jacobowitz wrote:
>> Specifically '%lf' is not permitted. This used to work and is permitted
>> by both C90 and C99.
>
> I don't remember what reference I used, but in C99 I see that this is
> deliberately ignored and the same as %f. Seems dumb to me, but there
> you go.
Sorry, I opened my C90 standard at the wrong page and read that '%lf' is
accepted for scanf by mistake - C90 says it is undefined for printf. C99
however ignores it, as you say, but that is not 'bad' as defined by GDB
at present. It should be either passed through or converted to '%f'.
> It seems to me, as I wrote earlier, that the right thing to do would be
> to change it to work on target types rather than host types. It also
> seems to me that the right way to do this would be to reuse the printf
> format string parser from gnulib. We will have to map target types on
> to host types to get that to work, which will be a little hokey, but it
> should be doable for all interesting cases.
The expression parser/evaluator must use host types at some level. Does
this not have similar horrors hidden away? If this can convert target
types to host types (of at least the same precision) can the printf not
be implemented with the same mapping somehow?
Andrew
More information about the Gdb
mailing list