|
From: <Woe...@on...> - 2005-08-07 16:11:54
Attachments:
vg_format_check.diff
|
Hi, now with 64 bit support shouldn't you check the format strings (see=20 attached patch, I'm sure there're more places) to avoid i.e. symtab.c: In function 'read_symtab': symtab.c:1043: warning: format '%d' expects type 'int', but argument 3 has = type 'long unsigned int' symtab.c:1076: warning: format '%p' expects type 'void *', but argument 2 h= as type 'Addr' symtab.c:1076: warning: format '%d' expects type 'int', but argument 3 has = type 'Elf64_Xword' symtab.c: In function 'read_lib_symbols': symtab.c:1443: warning: format '%d' expects type 'int', but argument 2 has = type 'Elf64_Off' symtab.c:1443: warning: format '%d' expects type 'int', but argument 4 has = type 'long unsigned int' Otherwise tools could break, if their output is parsed (i.e. callgrind). Cheers, Andr=E9 |
|
From: Tom H. <to...@co...> - 2005-08-07 16:20:17
|
In message <200...@on...>
André Wöbbeking <Woe...@on...> wrote:
> now with 64 bit support shouldn't you check the format strings (see
> attached patch, I'm sure there're more places) to avoid i.e.
>
> symtab.c: In function 'read_symtab':
> symtab.c:1043: warning: format '%d' expects type 'int', but argument 3 has type 'long unsigned int'
> symtab.c:1076: warning: format '%p' expects type 'void *', but argument 2 has type 'Addr'
> symtab.c:1076: warning: format '%d' expects type 'int', but argument 3 has type 'Elf64_Xword'
> symtab.c: In function 'read_lib_symbols':
> symtab.c:1443: warning: format '%d' expects type 'int', but argument 2 has type 'Elf64_Off'
> symtab.c:1443: warning: format '%d' expects type 'int', but argument 4 has type 'long unsigned int'
>
> Otherwise tools could break, if their output is parsed (i.e. callgrind).
Your patch is only correct if VG_(printf) uses the same format
characters as printf and with the exact same meaning. I'm not sure
that is necessarily true as VG_(printf) uses it's own formatter
so I would have to check if they do match fully.
Tom
--
Tom Hughes (to...@co...)
http://www.compton.nu/
|
|
From: Tom H. <to...@co...> - 2005-08-07 16:24:00
|
In message <470...@lo...>
Tom Hughes <to...@co...> wrote:
> In message <200...@on...>
> André Wöbbeking <Woe...@on...> wrote:
>
> > now with 64 bit support shouldn't you check the format strings (see
> > attached patch, I'm sure there're more places) to avoid i.e.
> >
> > symtab.c: In function 'read_symtab':
> > symtab.c:1043: warning: format '%d' expects type 'int', but argument 3 has type 'long unsigned int'
> > symtab.c:1076: warning: format '%p' expects type 'void *', but argument 2 has type 'Addr'
> > symtab.c:1076: warning: format '%d' expects type 'int', but argument 3 has type 'Elf64_Xword'
> > symtab.c: In function 'read_lib_symbols':
> > symtab.c:1443: warning: format '%d' expects type 'int', but argument 2 has type 'Elf64_Off'
> > symtab.c:1443: warning: format '%d' expects type 'int', but argument 4 has type 'long unsigned int'
> >
> > Otherwise tools could break, if their output is parsed (i.e. callgrind).
>
> Your patch is only correct if VG_(printf) uses the same format
> characters as printf and with the exact same meaning. I'm not sure
> that is necessarily true as VG_(printf) uses it's own formatter
> so I would have to check if they do match fully.
It looks like VG_(printf) is a superset of printf - the %t format
is extra and there are extra flags (command and open parenthesis).
Tom
--
Tom Hughes (to...@co...)
http://www.compton.nu/
|
|
From: <Woe...@on...> - 2005-08-07 20:15:46
|
On Sunday 07 August 2005 18:23, Tom Hughes wrote: > > Your patch is only correct if VG_(printf) uses the same format > > characters as printf and with the exact same meaning. I'm not sure > > that is necessarily true as VG_(printf) uses it's own formatter > > so I would have to check if they do match fully. > > It looks like VG_(printf) is a superset of printf - the %t format > is extra and there are extra flags (command and open parenthesis). Is there another way to catch wrong format strings? Andr=E9 |