Author Topic: debugging inline asm in C::B  (Read 1971 times)

Offline reverser

  • Multiple posting newcomer
  • *
  • Posts: 17
debugging inline asm in C::B
« on: April 26, 2022, 07:25:30 am »
hi all

i am trying to learn inline asm coding in C/C++. i cant step into the asm codes and trace them one by one. is there any options to enable or any plugins to install? i want to debug the asm like what you can do in VS.

also it would be great help if you know any good tips about inlining asm code.
« Last Edit: April 26, 2022, 07:39:31 am by reverser »

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: debugging inline asm in C::B
« Reply #1 on: April 26, 2022, 10:49:47 am »
I have no idea how it is done in VS, but you can do disassembly steps in codeblocks...
What operating system are you using? The debugger shipped with the default installation of codeblocks on windows has a bug where disassembly will crash gdb. So if you are using the
official codeblocks installation file on windows you will have to install and use a newer compiler, for example
https://www.winlibs.com/
or you uses MSYS2
https://www.youtube.com/watch?v=G3QguXOVJM4

Then if, you have everything set up you show the assembler and cpu register windows:
Debug->Debugging windows->Dissasembly
Debug->Debugging windows->CPU register

Then you put a break point in front of your inline assembler, run the debugger, whait until it hits the breakpoint and use the "next instruction" button near the debugger run button (or you use Debug->Next instruction)

You can reaarange the windows in your liking, if you want to dock them to the main window, you drag them near the border of the place you want to place them and wait until a blue shadow appears and let the mouse go.

the final result should look like in the attached picture

Offline reverser

  • Multiple posting newcomer
  • *
  • Posts: 17
Re: debugging inline asm in C::B
« Reply #2 on: April 27, 2022, 10:57:26 am »
I have no idea how it is done in VS, but you can do disassembly steps in codeblocks...
.
.
.

the final result should look like in the attached picture
thanks. this solved my issue.