News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

How to debug assembly piece of code

Started by skirby, August 17, 2006, 12:07:41 PM

Previous topic - Next topic

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.
#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;
}


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

#2
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]
Be patient!
This bug will be fixed soon...

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.