Skip to content
amiilka edited this page Mar 18, 2022 · 20 revisions

Troubleshooting

The code works on some other computer, but not on mine

  • Deactivate any optimisation flag, such as -O3, -O2 and so on.
  • Check the OS architecture. Are you both working on 64 or 32 bits?
  • Protect your asm code with volatile like this:
__asm__ __volatile__(
  /* Your code here */
  );

The debugger does not work, what can I do?

  • Make sure the path is correct, it should point to gdb.exe or a similar file. This setting is located in Settings > Debugger... > Default > Executable path
  • Make sure you don't have accented characters in you project path, such as éèêçàâ, etc.
  • To have more info on why the debugging does not work, enable full logs in Settings > > Debugger... > Common > Full (Debug) log
  • Make sure you're compiling with the -g flag.
  • If you have multiple installations of MinGW, uninstall all those not necessary.

My image output is shifted at some point

Check that you read/write in binary by specifying rb and wb in fread and fwrite.

I get Exception code c0000005, what's up with that?

On Windows, "Exception code c0000005 is the code for an access violation".

Most probable reasons:

  1. You are using an instruction that reads 128 bits of aligned memory, but the operand you provide is unaligned. Use a memory operand that is aligned or use an instruction that do not require aligned memory

  2. You are reading/writing outside of allocated memory (eg. you have an array of 3 elements, and you read/write to array[3])

My code works in "Debug" mode, but not in "Release"

Check that the compilation flags are not the culprits here. Disable them all and check their influence one by one. Don't forget to clean your build between each compilation.

Also, in CodeBlocks, "Optimize even more (for speed) [-O2]" and "-O2" are not exactly the same. The first one applies the flag at an earlier stage than the second, sometimes leading to malfunctions in the compiled executable.

AT&T syntax

Instruction list

The list of available instructions and their description can be found at: https://www.felixcloutier.com/x86/

Registers

Two different types of registers should be used in this lab

Clone this wiki locally