On 30 Oct 2008, at 13:31, Josef Weidendorfer wrote:
>> 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)
>
> Hmm... if your C++ code is in foo.cpp, you get the assembler file with
> g++ -S foo.cpp -o foo.s
> then, the binary with
> gcc -g foo.s -o foo
Thanks very much Nick and Josef, that sequence works for me.
I think the docs could be made clearer on this - I read sec 5.2.4 as
definitely saying that gcc _won't_ work in this way, and that you
have to use 'as' instead. I assume that comment actually applies only
to code originally written as assembly...
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