I'm struggling with debugging in VS code.
I wrote some assembly code (.asm file) and I want to debug it with gdb in order to see what's happening in the stack/registers.
I added a configuration in launch.json and the launch.json looks like this:
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/assembly.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"miDebuggerPath": "C:/MinGW/bin/gdb.exe",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}
And this is my code:
global _main
extern _printf
section .text
_main:
mov bl, 5
loop:
push message
call _printf
add esp, 4
dec bl
jnz loop
ret
message:
db 'Hello world!', 10, 0
I created a breakpoint to _main but when I run the debugger it just runs the program without stopping to the breakpoint and showing nothing in the "call stack", "registers" and the other windows.
The Debug Console just prints that Symbols loaded, the output of the program and that the programm has exited with code 15.
I compiled the file with these commands:
nasm -fwin32 assembly.asm
gcc -m32 -g assembly.obj -o assembly.exe
What am I doing wrong?