This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] Add external symbol table file support for gprof


Hi, Matthias,

    I am sorry for the mistake I made. 
    I cannot regenerate the ``expects type long unsigned int *'' warning on my computer with gcc 4.4.0. But I guess this warning is caused by '%lx'. I wish that the following patch will take out the warning.

    Best Regards,
    Homer
    

diff -rup binutils-2.19.51.origin/gprof/corefile.c binutils-2.19.51/gprof/corefile.c
--- binutils-2.19.51.origin/gprof/corefile.c	2009-06-14 21:00:29.000000000 +0800
+++ binutils-2.19.51/gprof/corefile.c	2009-06-14 21:04:35.000000000 +0800
@@ -509,7 +509,7 @@ core_create_syms_from (const char * sym_
 
       sym_init (symtab.limit);
 
-      sscanf (address, "%lx", &(symtab.limit->addr) );
+      sscanf (address, "%" BFD_VMA_FMT "x", &(symtab.limit->addr) );
 
       symtab.limit->name = (char *) xmalloc (strlen (name) + 1);
       strcpy ((char *) symtab.limit->name, name);


--- On Sat, 6/13/09, Matthias Klose <doko@ubuntu.com> wrote:

> From: Matthias Klose
>
> Dongsheng Xing schrieb:
> > diff -rup binutils-2.19.51.origin/gprof/corefile.c
> binutils-2.19.51/gprof/corefile.c
> > ---
> binutils-2.19.51.origin/gprof/corefile.c???
> 2009-05-01 13:28:01.000000000 +0800
> > +++
> binutils-2.19.51/gprof/corefile.c???
> 2009-05-05 19:13:47.000000000 +0800
> 
> > +? while (!feof (f) && fgets (buf, sizeof
> (buf), f))
> > +? ? {
> > +? ? ? if(sscanf (buf, "%s %c %s",
> address, &type, name) == 3)
> > +? ? ? ? if (type != 't'
> && type != 'T')
> > +? ? ? ? ? continue;
> > +
> > +? ? ? sym_init (symtab.limit);
> > +
> > +? ? ? sscanf (address, "%lx",
> &(symtab.limit->addr) );
> 
> using gcc-4.4 -Werror:
> 
> gcc -DHAVE_CONFIG_H -I. -I../../gprof -I. -DDEBUG -I../bfd
> -I../../gprof/../include -I../../gprof/../bfd? -I.
> -DLOCALEDIR="\"/usr/share/locale\""???-W
> -Wall -Wstrict-prototypes
> -Wmissing-prototypes -Werror -g -O2 -c
> ../../gprof/corefile.c
> cc1: warnings being treated as errors
> ../../gprof/corefile.c: In function
> 'core_create_syms_from':
> ../../gprof/corefile.c:512: error: format '%lx' expects
> type 'long unsigned int
> *', but argument 3 has type 'bfd_vma *'
> make[4]: *** [corefile.o] Error 1
> 
> 





Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]