Thread: Confusing output from Kcachegrind.

  1. #1
    Registered User
    Join Date
    Feb 2011
    Posts
    11

    Question Confusing output from Kcachegrind.

    Confusing output from Kcachegrind.-crm_all_sourcefile_grouping-jpg

    Hi,
    I am profiling my code with Kcachegrind. But I am confused with the output tree-map view of the call graph (attached).

    1. Above the main() function, u will see a "below main()" and 0x08049140 functions. What r these?

    2. In the lower part of the tree, u will also see a lot of functions with hexadecimal numbers instead of names. Why is this?

    3. Are these hexadecimal numbers absolute addresses (i.e. not offset) of the code section of these functions? or not?

    4. Do these hexadecimal numbers have something to do with "debugging information"?

    Bye.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    Well the OS doesn't just load your program image and jump to main.

    Normally, the program starts at a symbol called _start, which will do some stuff before calling into the clib startup routine. This in turn eventually calls main.

    You should probably compile with "-g" flag to get more symbol information. Functions declared static for example might only show as hex addresses otherwise.

    > 3. Are these hexadecimal numbers absolute addresses (i.e. not offset) of the code section of these functions? or not?
    They will be "absolute" within the virtual address space assigned to the process.

    > 4. Do these hexadecimal numbers have something to do with "debugging information"?
    Add the debug flag to the compile and link steps.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Feb 2011
    Posts
    11
    Quote Originally Posted by Salem View Post
    Well the OS doesn't just load your program image and jump to main.

    Normally, the program starts at a symbol called _start, which will do some stuff before calling into the clib startup routine. This in turn eventually calls main.

    You should probably compile with "-g" flag to get more symbol information. Functions declared static for example might only show as hex addresses otherwise.

    > 3. Are these hexadecimal numbers absolute addresses (i.e. not offset) of the code section of these functions? or not?
    They will be "absolute" within the virtual address space assigned to the process.

    > 4. Do these hexadecimal numbers have something to do with "debugging information"?
    Add the debug flag to the compile and link steps.
    Hi, I have compiled the code with -g option (in Ubuntu 10.10) to generate this output.

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    If you do "nm myprog", (read the man page for nm for lots of interesting options), you should get a nice list of function names and addresses.

    Are the addresses reported by the tools the actual start addresses of functions, or do they correspond to some small offset from the true start of the function?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C++ jargons: Really CONFUSING
    By cavestine in forum C++ Programming
    Replies: 3
    Last Post: 10-15-2007, 04:19 PM
  2. Confusing!!!
    By csreddy in forum C Programming
    Replies: 10
    Last Post: 06-26-2007, 07:00 AM
  3. Really confusing error
    By Ganoosh in forum C++ Programming
    Replies: 5
    Last Post: 07-11-2005, 11:07 AM
  4. COnfuSing PoIntErS
    By anamol12 in forum C++ Programming
    Replies: 2
    Last Post: 03-13-2003, 01:16 AM
  5. Confusing
    By John in forum C Programming
    Replies: 10
    Last Post: 08-19-2002, 02:01 PM