#7621 - Lupin - Sat Jun 21, 2003 3:36 pm
is there an way to get the ASM code wich GCC produces? I want to know how I could use the swi 0xe0000-Instruction in pure asm
#7627 - loading - Sat Jun 21, 2003 4:16 pm
If you have a C file you want to translate to asm use
gcc (-mthumb) -S main.c -lm
with that you'll get main.s an asm version of main.c
#7665 - Lupin - Sun Jun 22, 2003 7:12 pm
do you know how I could get the C-code into between the ASM instructions? So I would know what's going on :)
#7818 - loading - Wed Jun 25, 2003 5:27 pm
no way to do that - i tend to add a few ionline assemblys in my c++ files (like shift left 0 or crap like that) to be able to read the output
#7851 - dragor - Thu Jun 26, 2003 5:26 pm
when you compile your file use a line like this:
Code: |
gcc -g -S main.c -o main.s
|
The -S option, as mentioned before, tells the compiler to stop at the asm level.
The -g option tells the compiler to generate debugging information. If you look at the .s file after, you'll notice labels like: .L1, .L2, .L3, ... These are line numbers. These are what IDEs use for source level debugging. They'll telling you exactly what the compiler is doing with each line of your .c file.
_________________
Sum Ergo Cogito
#7857 - Jason Wilkins - Thu Jun 26, 2003 9:34 pm
The .L## labels are not line numbers, they are labels produced by the compiler to implement loops and if statements. If you have no branches in a function, it will contain no .L## labels.
The .LM# are labels which correspond to the .stabn directives, which contain the line number among other things. They do corrrespond to each line, as you say. I think the line number is the 3 argument of the .stabn directive which goes with the LM# label. The forth argument is the offset from the beginning of the function in bytes, and is were you will find the LM# label.
_________________
http://devkitadv.sourceforge.net