Mail Archives: djgpp/2000/02/29/14:19:57
Eric Rudd wrote:
> Kalum Somaratna aka Grendel wrote:
>
> > If you want to see the C code together with the assembly it was converted to,
> > use a command line like this:
> >
> > gcc -c -Wa,-a,-ad [other GCC options] foo.c > foo.lst
> >
> > which will output the combined C/assembly listing to the file `foo.lst'.
>
> I read this posting with interest, because I have often wanted an assembly output
> listing similar to what Borland produces with the -S option, with each C
> statement interleaved with the assembler code it generates. Unfortunately, the
> above options do not do this, as was claimed -- I only get assembler, binary, and
> cross references; no C source. Is it possible to get interleaved C and assembly
> output?
> My apologies for the previous posting. I must have been typing something in
> wrong, because the next time I tried it, it worked as advertised.
There's not as much egg on my face as I thought. I repeatedly tried running gcc
2.95.2 with the above options, and saw it work twice. (I am using v2.8.1 of
binutils.) The other times, I only got an assembly listing (no C source). However,
I have been able to get it to work consistently with the following options:
gcc -g -Wa,-adhl foo.c >foo.lst
The -g option seems to be necessary, but I'm still puzzled by those two runs earlier
this morning -- they came out in a different format. With the -g -Wa,-adhl
technique, the C source comes out with **** to the left of each statement, but the
two times that -Wa,-a,-ad worked, I got the C source in between assembly directives
like this:
/APP
C statement
/NO_APP
Does anyone have an idea why I am getting inconsistent results here? Is there some
file sitting in the current directory that is affecting the output?
-Eric Rudd
rudd AT cyberoptics DOT com
- Raw text -