gprof with C and C++ not working

gprof with C and C++ not working

Post by Ale » Sat, 05 Jul 2003 00:59:10



Hello,
Need your help, second day can't get this working.
I need to compile a program with gprof.
Program compiles, but doesnt generate information I need.

Program consists of C and C++ code, and is compiled on SunOS 2.6.
For C compiler we use "cc: WorkShop Compilers 4.2 30 Oct 1996 C 4.2"
For C++ compiler we use "gcc version 2.95.2 19991024 (release)"
The link stage we use the same C++ compiler (gcc).

I am not compiling entire souce with gprof options.  Only the major
part of what I want to analize.
For cc I used -xpg option
and for gcc I used -pg option
link line does: gcc -pg
and links C and C++ code.

To me it looks like only the C++ code gets profiled.  I see some
references to "main", but nothing I am interested in.
The program creates children processes, so I figured to set PROFDIR.
When I set it, no profile file gets generated at all (I tried a simple
a.out, that generates a file exactly where I want it).

So something bad is happening.
Please let me know if you have any suggestions.
Thank you.
Alex

 
 
 

gprof with C and C++ not working

Post by llewell » Sat, 05 Jul 2003 01:39:48



> Hello,
> Need your help, second day can't get this working.
> I need to compile a program with gprof.
> Program compiles, but doesnt generate information I need.

> Program consists of C and C++ code, and is compiled on SunOS 2.6.
> For C compiler we use "cc: WorkShop Compilers 4.2 30 Oct 1996 C 4.2"
> For C++ compiler we use "gcc version 2.95.2 19991024 (release)"
> The link stage we use the same C++ compiler (gcc).

> I am not compiling entire souce with gprof options.  Only the major
> part of what I want to analize.
> For cc I used -xpg option
> and for gcc I used -pg option
> link line does: gcc -pg
> and links C and C++ code.

> To me it looks like only the C++ code gets profiled.  I see some
> references to "main", but nothing I am interested in.
> The program creates children processes, so I figured to set PROFDIR.
> When I set it, no profile file gets generated at all (I tried a simple
> a.out, that generates a file exactly where I want it).

IIRC, the profiling info generated by using Sun cc -xpg is not
    readable by gprof. My only suggestion is to use gcc -pg to compile
    your C code instead of Sun cc.

 
 
 

gprof with C and C++ not working

Post by Oleg Goldshmid » Sun, 06 Jul 2003 06:35:29




> > Hello,
> > Need your help, second day can't get this working.
> > I need to compile a program with gprof.
> > Program compiles, but doesnt generate information I need.

> > Program consists of C and C++ code, and is compiled on SunOS 2.6.
> > For C compiler we use "cc: WorkShop Compilers 4.2 30 Oct 1996 C 4.2"
> > For C++ compiler we use "gcc version 2.95.2 19991024 (release)"
> > The link stage we use the same C++ compiler (gcc).

> > I am not compiling entire souce with gprof options.  Only the major
> > part of what I want to analize.
> > For cc I used -xpg option
> > and for gcc I used -pg option
> > link line does: gcc -pg
> > and links C and C++ code.

> > To me it looks like only the C++ code gets profiled.  I see some
> > references to "main", but nothing I am interested in.
> > The program creates children processes, so I figured to set PROFDIR.
> > When I set it, no profile file gets generated at all (I tried a simple
> > a.out, that generates a file exactly where I want it).

> IIRC, the profiling info generated by using Sun cc -xpg is not
>     readable by gprof. My only suggestion is to use gcc -pg to compile
>     your C code instead of Sun cc.

Also, hopefully you use g++ to compile C++, not gcc.

--

 
 
 

gprof with C and C++ not working

Post by Ale » Wed, 09 Jul 2003 00:22:39





> > > Hello,
> > > Need your help, second day can't get this working.
> > > I need to compile a program with gprof.
> > > Program compiles, but doesnt generate information I need.

> > > Program consists of C and C++ code, and is compiled on SunOS 2.6.
> > > For C compiler we use "cc: WorkShop Compilers 4.2 30 Oct 1996 C 4.2"
> > > For C++ compiler we use "gcc version 2.95.2 19991024 (release)"
> > > The link stage we use the same C++ compiler (gcc).

> > > I am not compiling entire souce with gprof options.  Only the major
> > > part of what I want to analize.
> > > For cc I used -xpg option
> > > and for gcc I used -pg option
> > > link line does: gcc -pg
> > > and links C and C++ code.

> > > To me it looks like only the C++ code gets profiled.  I see some
> > > references to "main", but nothing I am interested in.
> > > The program creates children processes, so I figured to set PROFDIR.
> > > When I set it, no profile file gets generated at all (I tried a simple
> > > a.out, that generates a file exactly where I want it).

> > IIRC, the profiling info generated by using Sun cc -xpg is not
> >     readable by gprof. My only suggestion is to use gcc -pg to compile
> >     your C code instead of Sun cc.

> Also, hopefully you use g++ to compile C++, not gcc.

Yes, sorry I am compiling C++ code with g++.
I just wrote gcc, because doing g++ -v produced messages about gcc.
I got a little farther, by compiling more code with profiling.
But now if I compile one of our C libraries with profiling and run
routines from it, the whole thing coredumps.  Running same library
without profiling works fine.
I will try compiling with gcc, I was using cc.

Thank you.
Alex

 
 
 

gprof with C and C++ not working

Post by Wim Lauwer » Wed, 09 Jul 2003 16:30:34






>>>>Hello,
>>>>Need your help, second day can't get this working.
>>>>I need to compile a program with gprof.
>>>>Program compiles, but doesnt generate information I need.

>>>>Program consists of C and C++ code, and is compiled on SunOS 2.6.
>>>>For C compiler we use "cc: WorkShop Compilers 4.2 30 Oct 1996 C 4.2"
>>>>For C++ compiler we use "gcc version 2.95.2 19991024 (release)"
>>>>The link stage we use the same C++ compiler (gcc).

>>>>I am not compiling entire souce with gprof options.  Only the major
>>>>part of what I want to analize.
>>>>For cc I used -xpg option
>>>>and for gcc I used -pg option
>>>>link line does: gcc -pg
>>>>and links C and C++ code.

>>>>To me it looks like only the C++ code gets profiled.  I see some
>>>>references to "main", but nothing I am interested in.
>>>>The program creates children processes, so I figured to set PROFDIR.
>>>>When I set it, no profile file gets generated at all (I tried a simple
>>>>a.out, that generates a file exactly where I want it).

>>>IIRC, the profiling info generated by using Sun cc -xpg is not
>>>    readable by gprof. My only suggestion is to use gcc -pg to compile
>>>    your C code instead of Sun cc.

>>Also, hopefully you use g++ to compile C++, not gcc.

> Yes, sorry I am compiling C++ code with g++.
> I just wrote gcc, because doing g++ -v produced messages about gcc.
> I got a little farther, by compiling more code with profiling.
> But now if I compile one of our C libraries with profiling and run
> routines from it, the whole thing coredumps.  Running same library
> without profiling works fine.
> I will try compiling with gcc, I was using cc.

> Thank you.
> Alex

Is it a shared library? Might not work, try linking it as a static one (.a).

Wim

 
 
 

gprof with C and C++ not working

Post by Ale » Thu, 10 Jul 2003 03:53:48


I have another problem now.
I was able to build and run with gprof on the machine successfully.
Problem occurs when I try to run the program from a different machine.
I build on SunOS 2.6, and try to run on 2.8.
I get lots of these lines:
libc: warning: libc/libthread interface mismatch: unknown tag value
ignored

than it coredumps.

I tried something crazy: I copied the whole /usr/lib from my 2.6
machine to 2.8 machine, and set LD_LIBRARY_PATH to first point there.
The program starts, but it seems that the threads fail, and everything
which is not threaded works.

Do you know if building with gprof and then compying to a different
machine (and OS level) is supported?

Thank you.
Alex

 
 
 

1. gprof does not work with gcc 3.2 (solved)

Hello,

Just in case someone has or will have the same problem:

With gcc 3.2.0 and GNU gprof version 2.11.92.0.10 (that comes with
Suse 8.0),

/usr/bin/gprof a.out

may give

BFD: Dwarf Error: Invalid or unhandled FORM value: 14.
BFD: Dwarf Error: Invalid or unhandled FORM value: 14.
BFD: Dwarf Error: Invalid or unhandled FORM value: 14.
BFD: Dwarf Error: Invalid or unhandled FORM value: 14.
BFD: Dwarf Error: Invalid or unhandled FORM value: 14.
BFD: Dwarf Error: Invalid or unhandled FORM value: 14.
...
Segmentation fault

Gprof version 2.13.2.1 from binutils 2.13.2.1 works fine.

Moritz

--
Dipl.-Phys. Moritz Franosch
http://Franosch.org

2. more rows and columns

3. *HELP* Gprof not working

4. iptables

5. HP-UX 10.2 Trying to use gprof with C++ - No Luck!

6. 3.3. Badly Broken?

7. Matrox Mystique ands X.

8. "ar" command security

9. have a c++ file, which work on visualc++ but not on linux

10. gettimer works in C code, not in C++ code!!

11. Syslog call from a C++ program is not working

12. DOSEMU not working w/ Turbo C++

13. gprof: gmon.out has not been created