FW: Help with GDB analyzing assembler code

Matthew Woehlke mw_triad@users.sourceforge.net
Tue Jun 19 17:08:00 GMT 2007


Navarro, Sylvia wrote:
> I have searched the web with no luck in finding an answer to my question
> and am hoping someone here can answer it or point me in the direction of
> someone who can.
> 
> We are using RHEL 4.0 AS on an Opteron machine.  I am searching for a
> way to count the number of divides, logs, exponentials, etc.  used
> during a C++ program.  One suggested way, was to use GDB to debug the
> program/assembly code generated and count the number of interested
> instructions.
> 
> I see that GDB offers a way to print out the program code in assembly
> language.  I also see that GDB can output things to a file (default
> gdb.txt).  I have also looked at the DDD tool.
> 
> My question is this:
> Is there a way to execute the program with GDB and print every assembler
> line generated and used?  This way - I can output all the lines to a
> file, and simply count the number of instructions that were used during
> the execution.
> 
> Suggestions/ideas?

It sounds more like valgrind+callgrind is what you are looking for.

-- 
Matthew
"Five is right out!"
   -- Cleric (from Monty Python's Quest for the Holy Grail)



More information about the Gcc-help mailing list