PPC e500, snprintf and valist
claude vittoria
vittoric@wanadoo.fr
Mon Sep 15 11:59:00 GMT 2008
claude vittoria wrote:
>>
>> Hi,
>>
>> I get a problem when I try to display a float or a double with newlib on 8572 board. The value is always 0 (%d and %p is right).
>>
>> I debug the snprintf and vfprintf. But I get a wall. How and where is the valist done ?
>> The pointer on double or float seems to be wrong. The fmt is right.
>>
>>
>> I m looking for where is builtin_vastart and builtin_va_arg and tips to debug.
>>
>> Thanks,
>> Claude
>>
>
>The valist is handled by the compiler.
>
>Verify that you have included <stdio.h> in your test program so that the compiler properly knows about the >prototype for the variable argument stdio functions.
>
>
>-- Jeff J.
My include seems good.
Breakpoint 2, snprintf (str=0x3ffffa8 "", size=60,
fmt=0x180f830 "hello world %d\n")
at /home/cvittoria/people/people/cvittoria/script/debug/gcc-4.3.2/newlib/libc/stdio/snprintf.c:110
110 ret = _vfprintf_r (ptr, &f, fmt, ap);
(gdb) s
_vfprintf_r (data=0x1810088, fp=0x3fffeec, fmt0=0x180f830 "hello world %f\n",
ap=0x3fffee0)
at /home/cvittoria/people/people/cvittoria/script/debug/gcc-4.3.2/newlib/libc/stdio/vfprintf.c:403
403 char *decimal_point = _localeconv_r (data)->decimal_point;
(gdb) p ap
$1 = (struct __va_list_tag *) 0x3fffee0
(gdb) p *ap
$2 = {
gpr = 3 '\003',
fpr = 0 '\0',
reserved = 0,
overflow_arg_area = 0x3ffff88,
reg_save_area = 0x3ffff48
}
(gdb) x/40x 0x3ffff48
0x3ffff48: 0x03ffffa8 0x0000003c 0x00000000 0x01810088
0x3ffff58: 0x00000000 0x0000000e 0x01810000 0x00000000
0x3ffff68: 0x0180f844 0x0000003b 0x0180f841 0x018000a8
0x01810088 is not the right pointer to my double, the pointed value is null.
I don't get the problem with gcc+glibc. I continue to debug. My board is a e500v2 core.
Claude
More information about the Newlib
mailing list