gprof with C and C++ not working

Ask a Question related to UNIX Programming, Design and Development.

  1. #1

    Default gprof with C and C++ not working

    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
    Alex Guest

  2. Similar Questions and Discussions

    1. HELP PLEASE ITS NOT WORKING
      After you uninstall Flash Player from all user accounts make sure that all files from C:\WINDOWS\system32\Macromed\ are removed. Instructions for...
    2. #38816 [Opn]: PHP code that was working perfectly recently stopped working.
      ID: 38816 User updated by: mtoohee at gmail dot com -Summary: PHP code that was working perfectly recently stopped....
    3. Macromedia Flash Player installed and working properly suddenlys stops working..
      No idea what has caused the Flash player to stop working. This is not my machine but a relatives who has asked for help over the T'giving...
    4. Data not working on Label but is working in Datagrid
      I am creating a simple website in Flex. I want to show different content from the database for home, about us, contact us, etc. I am using a CFC as...
    5. Working TableStyle Not Working on a Second DataGrid
      I am having difficulty getting Tablestyles to work on a datagrid. I have 2 datasets, 1 filled and the other not. The first contains customer, stock...
  3. #2

    Default Re: gprof with C and C++ not working

    [email]abeylin@yahoo.com[/email] (Alex) writes:
    > 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.
    llewelly Guest

  4. #3

    Default Re: gprof with C and C++ not working

    Oleg Goldshmidt <pub@NOSPAM.goldshmidt.org> wrote in message news:<m3fzlmrn4u.fsf@zaphod.goldshmidt.org>...
    > llewelly <llewelly.at@xmission.dot.com> writes:
    >
    > > [email]abeylin@yahoo.com[/email] (Alex) writes:
    > >
    > > > 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
    Alex Guest

  5. #4

    Default Re: gprof with C and C++ not working

    Alex wrote:
    > Oleg Goldshmidt <pub@NOSPAM.goldshmidt.org> wrote in message news:<m3fzlmrn4u.fsf@zaphod.goldshmidt.org>...
    >
    >>llewelly <llewelly.at@xmission.dot.com> writes:
    >>
    >>
    >>>abeylin@yahoo.com (Alex) writes:
    >>>
    >>>
    >>>>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

    Wim Lauwers Guest

  6. #5

    Default Re: gprof with C and C++ not working

    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
    Alex Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139