Bug 12468

Summary: Missing functions and call counts
Product: binutils Reporter: Vincent Rivière <vincent.riviere>
Component: gprofAssignee: Alan Modra <amodra>
Status: RESOLVED FIXED    
Severity: normal CC: amodra
Priority: P2    
Version: 2.22   
Target Milestone: ---   
Host: Target: m68k-aout
Build: Last reconfirmed:

Description Vincent Rivière 2011-02-05 14:53:50 UTC
There has been a regression between the binutils 2.19.1 and 2.20.
Now gprof sees only functions having "self seconds" greater than 0. Other functions are not shown at all.
Also, for the visible functions, the the "calls" column is empty.

Given a correct gmon.out, gprof-2.19.1 displays it fine, while gprof-2.20 and higher have the problem described above.

I believe this bug affects all a.out targets.
I have tested this on the unofficial m68k-atari-mint target, since it is the only one for which I can run executables and produce a suitable gmon.out.
Comment 1 Vincent Rivière 2011-02-05 14:58:23 UTC
This bug comes from gprof/corefile.c, in the function core_create_function_syms().

Old code was:
symtab.limit->is_func = TRUE;

But the new code is:
symtab.limit->is_func = (core_syms[i]->flags & BSF_FUNCTION) != 0;

If I'm not wrong, the BSF_FUNCTION flag is not available on a.out targets, so the symbols are never considered as functions.

It works fine when I revert to TRUE unconditionally.
Ideally, the BSF_FUNCTION flag should be tested only if it is available on the target.
Comment 2 Sourceware Commits 2011-02-06 23:38:40 UTC
CVSROOT:	/cvs/src
Module name:	src
Changes by:	amodra@sourceware.org	2011-02-06 23:38:38

Modified files:
	gprof          : ChangeLog corefile.c 

Log message:
	PR gprof/12468
	* corefile.c (core_create_function_syms): Set is_func for targets
	that have no BSF_FUNCTION syms.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gprof/ChangeLog.diff?cvsroot=src&r1=1.296&r2=1.297
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gprof/corefile.c.diff?cvsroot=src&r1=1.40&r2=1.41
Comment 3 Sourceware Commits 2011-02-06 23:39:56 UTC
CVSROOT:	/cvs/src
Module name:	src
Branch: 	binutils-2_21-branch
Changes by:	amodra@sourceware.org	2011-02-06 23:39:54

Modified files:
	gprof          : ChangeLog corefile.c 

Log message:
	PR gprof/12468
	* corefile.c (core_create_function_syms): Set is_func for targets
	that have no BSF_FUNCTION syms.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gprof/ChangeLog.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.290.2.4&r2=1.290.2.5
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gprof/corefile.c.diff?cvsroot=src&only_with_tag=binutils-2_21-branch&r1=1.40&r2=1.40.2.1
Comment 4 Alan Modra 2011-02-06 23:42:42 UTC
fixed
Comment 5 Vincent Rivière 2011-02-09 20:19:04 UTC
Thanks, it works :-)