On 30 Oct 2008, at 02:34, Nicholas Nethercote wrote:
On Wed, 29 Oct 2008, Jonny Taylor wrote:
This is probably a basic question, but I can't find any information in the docs or through web searches. How can I get cachegrind to annotate
my code at the instruction level when the source is C code? I can get
C code annotated at source level, and the docs describe how to get
assembly code annotated at instruction level, but can't work out how
to get an instruction-level annotation for what was originally C code.

What would the annotated code look like? I think you'll just have to annotate the assembly code, and then mentally map that back to the C code.
...
I'm confused by some of your terminology, particularly "disassembly", as in "with debugs symbols disabled when doing the disassembly".

Apologies for not being clear - I talked a lot about what I'd tried and failed with, but what I want to achieve is very simple I think. Probably best to ignore what I wrote the first time if I was unclear.

I have a program written in C++, which is normally compiled with gcc to object files and then linked (with gcc). I can get cachegrind/ cg_annotate to display source-level output like this:

. . . . . . . . . void init_hash_table(char *file_name, Word_Node *table[])
3 1 1  . . .  1 0 0  {
. . .  . . .  . . .      FILE *file_ptr;
. . .  . . .  . . .      Word_Info *data;
1 0 0  . . .  1 1 1      int line = 1, i;
. . .  . . .  . . .
5 0 0  . . .  3 0 0      data = (Word_Info *) create(sizeof(Word_Info));

but I would like to see instruction-level output something like this

                     init_hash_table:
1 0 0  . . .  . . .    leal -12(%ebp),%eax
1 0 0  . . .  1 0 0    movl %eax,84(%ebx)
1 0 0  0 0 0  1 0 0    movl $1,-20(%ebp)
1 0 0  . . .  . . .    movl $.LnrB,%eax
1 0 0  . . .  1 0 0    movl %eax,-16(%ebp)

Any advice on how to achieve that would be very helpful!
Cheers
Jonny
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Valgrind-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to