Parsing the gcc assembly output

Sreekumar <>
Sun, 20 Apr 2008 00:34:18 -0700 (PDT)

          From comp.compilers

Related articles
Parsing the gcc assembly output (Sreekumar) (2008-04-20)
| List of all articles for this month |

From: Sreekumar <>
Newsgroups: comp.compilers
Date: Sun, 20 Apr 2008 00:34:18 -0700 (PDT)
Organization: Compilers Central
Keywords: assembler, question
Posted-Date: 20 Apr 2008 14:27:34 EDT

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

Thanks in advance

[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]

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.