UNSTAB(LOCAL) UNSTAB(LOCAL)
NAME
unstab - insert C source code into compiled assembly lan-
guage
SYNOPSIS
cc -g -S [-O] file.c; unstab file.s
DESCRIPTION
unstab allows you to more easily see what assembly lan-
guage is generated from your C code by intermingling the C
source code and the generated assembly language into a
single output file (for reading only).
Even if you can't fully understand the generated assembly
language, it can be quite helpful to see how much (or how
little) your C code is generating. If you have a program
which must run as fast as possible, looking at the code
generated in its innermost loops can be very helpful.
Note in the example below, putc is not the macro you might
think it should be.
EXAMPLE
% cat -n foo.c
1 #include <stdio.h>
2 main(){
3 putc('a', stdout);
4 fputc('b', stdout);
5 }
% cc -g -O -S foo.c
% unstab foo.s
(some initial cruft omitted)
main:
1:#include <stdio.h>
2:main(){
.LM1:
pushl %ebp
movl %esp, %ebp
subl $16, %esp
3: putc('a', stdout);
.LM2:
pushl stdout
pushl $97
call _IO_putc
4: fputc('b', stdout);
.LM3:
addl $8, %esp
pushl stdout
pushl $98
call fputc
5:}
.LM4:
leave
ret
(some trailing cruft omitted)
SEE ALSO
cc(1)
AUTHOR
Corey Satten - corey @ cac.washington.edu
BUGS
The more optimization used in compilation, the less
ordered the output.
A source line which appears out of sequence in the unstab
output is only flagged with a negative line number.
UNSTAB(LOCAL)