User forums > Help
How to debug assembly piece of code
(1/1)
skirby:
Hello,
I would like to know if it is possible to debug a piece of code written in assembly?
If a put a break point in the assembly code, it is ignored.
Tracing the code with F7 or Shift+F7 does not enter in the assembly code.
Here is a simple piece of code if someone want to make a test.
--- Code: ---#include <stdio.h>
int A = 5;
int B = 10;
int C = 0;
int main() {
C = A + B;
printf("C : %d\n", C);
C = 0;
__asm (
".intel_syntax noprefix \n"
"mov eax, dword ptr [_A] \n"
"add eax, dword ptr [_B] \n"
"mov dword ptr [_C], EAX \n"
".att_syntax \n"
);
printf("C : %d\n", C);
return 0;
}
--- End code ---
So, is there a way to debug assembly code?
Thanks and have a nice day.
tiwag:
use the disassembly window and step through your code with Alt-F7
mandrav:
Works fine here. But you have to put the breakpoint on the _asm line (or earlier in the file). Then, to debug the assembly, use Debug->Next instruction (Alt-F7). This should also open the disassembly window automatically...
[attachment deleted by admin]
skirby:
Thank you very much tiwag and mandrav.
I didn't know this functionnality.
It will help me a lot in the futur.
Decidedly, Code::Blocks is really the best Open Source, Cross-platform, Free C/C++ IDE.
Have a nice day.
Navigation
[0] Message Index
Go to full version