Parsing the gcc assembly output



Hi All,

I would like to parse the assembly output of gcc (the *.s file that we
get when we compile the file with -s flag) to identify function calls,
function definitions and loops. I was wondering if there is a grammar
file for the assembly format printed out by gcc. Any suggestions that
might be a cleaner way to parse the assembly file would be very
helpful.

Thanks in advance

Sreekumar
[The assembler syntax is of course specific to the architecture of
your computer, but since most gcc output is assembled by the GNU
assembler gas, that's one place to start. Some architectures use .y
files, some hand coded parsers. On the other hand, for this sort of
analysis I suspect that some perl or python adhockery would work just
as well and be a lot easier. -John]

.



Relevant Pages

  • Re: FORTH levels
    ... prepared to colonize a new space would be to an '86 assembler based ... I could eliminate gas from my tools, but gcc is harder. ... this freedom of the toolchain from C means that the gforth ... model is no longer restricted to a subspace of what gcc can colonize. ...
    (comp.lang.forth)
  • Re: Best Compiler
    ... But the GCC compiler actually itself uses the GAS assembler to do ... "GAS with a few extra complications"...GAS syntax and sent to GAS for it ...
    (alt.lang.asm)
  • Re: How do I make my own custom C compiler?
    ... to fix a bug. ... Macros everywhere hide from you what is going on. ... has been taken to ridiculous extremes (the assembler, ... For instance I am trying to understand the way gcc generates the ...
    (comp.lang.c)
  • Re: 64-bit AES
    ... Though even if you have windows assembler ... does on a 64-bit GCC compiler since I don't have a way of running GCC ... work [much like the GMP plugin for instance]. ... I guess I could package a makefile as the easiest option as I don't want ...
    (sci.crypt)
  • Re: Linux Security
    ... > This program functions when run from a prompt. ... > strictly assembler. ... http://www.phrack.org/show.php?p=49&a=14 is the definitive essay on buffer ... "The Definitive Guide to GCC," by Kurt Wall and William von Hagen, ...
    (comp.os.linux.questions)