gprof command line arguments to profiled program?

Stefan Berglund
Thu Nov 16 09:33:00 GMT 2006


I'm trying to run gprof on openldap:s slapd daemon on sun solaris2.8,
however, I can't get command line arguments sent to slapd, for example:

"gprof ./slapd -h" gives me the usage of gprof. But the -h switch was
meant to slapd, not to gprof.

I have built binutils-2.17 on sparc, solaris.. I added a -m64 flag in
the configure script for making it 64bit, other than that, I ran
./configure and make. gcc version 3.4.2.

From what I have read, gprof should support sending arguments to the
profiled program? But I can't see how it's done from looking in the code
(I'm no expert at all though).

From gprof.c, it does "expandargv()" - I don't really know what this one
does.. Maybe this one should take care of the command line arguments
aimed for the profiled program somehow..?

And later on.. 

 a_out_name = argv[optind++];

I guess that line should get "slapd" as a_out_name .. or can/should it
get "slapd -h" ?

And then, later on, a_out_name is passed to core_init .. etc. 

I'd really apprecciate some hints on how to invoke command line
arguments to the binary, or some workaround.. Anything! :)


Stefan Berglund

More information about the Binutils mailing list