how to pass params to inline functions by reference or value?

Tony Wetmore
Thu Apr 10 21:39:00 GMT 2008

Vincent Mayeski wrote:
 > I'm using the -S flag. Is there a better way to map assembler
 > code back to C source?


I have used the following command-line in the past to generate assembly 
alisting files (with integrated source):

   gcc -c -g -O3 -Wa,-adhls=func.list func.c

As part of the assembly process, the "func.list" file is generated, 
containing the source and assembly, like so:

    1                            .file   "func.c"
    4                            .text
    5                    Ltext0:
   28                            .p2align 4,,15
   32                    .globl _func
   34                    _func:
    1:func.c        **** float func( float a, float b )
    2:func.c        **** {
   36                    LM1:
   37 0000 55                    pushl   %ebp
   38 0001 89E5                  movl    %esp, %ebp
   40                    LM2:
   41 0003 D9450C                flds    12(%ebp)
    3:func.c        ****   return a * b;
   43                    LM3:
   44 0006 D84D08                fmuls   8(%ebp)
    4:func.c        **** }
   46                    LM4:
   47 0009 5D                    popl    %ebp
   48 000a C3                    ret
   50                    Lscope0:
   52                            .text
   54 000b 90909090      Letext:
   54      90

It is not the easiest thing in the world to read, but it might help.

Another alternative would be to step through the code in a debugger that 
can show the source and assembly code together, such as the Insight 
graphical debugger front end for gdb.

Tony Wetmore

More information about the Gcc-help mailing list