BartmanAbyss / vscode-amiga-debug

One-stop Visual Studio Code Extension to compile, debug and profile Amiga C/C++ programs compiled by the bundled gcc 12.2 with the bundled WinUAE/FS-UAE.
GNU General Public License v3.0
314 stars 39 forks source link

Debugging values incorrect #76

Closed resom-d closed 2 years ago

resom-d commented 3 years ago

I find a lot of times when watching variables the values do show up weired, sepecially on structs. Also when I try to output stuff to io the values written do not match. regards hank

BartmanAbyss commented 3 years ago

Hi, you got any simple repro code/project to share?

rjobling commented 3 years ago

In the watch window this is probably due to the optimizer confusing the debugger. You can mostly fix this by changing the makefile so optimization is set to -Og instead of -Ofast.

If you're outputting values using KPrintF then you might be using "%d" which expects 16bit shorts. You typically have to use "%ld" to output 32bit ints correctly.

resom-d commented 3 years ago

Hello, the hint you gave about optimization does not work in my case. But about the io you were right, that's good now. Besides, I'm using the template you have on github and since I use this (because of the p61 player) gcc throws a lot of warnings. You can check my little project at https://github.com/resom-d/Hank_2021 The io issues is in a small intuition app "game of life" also on github. I just started coding again for the amiga since the 90's - don't expect much...

Thanks anyway Hank

rjobling commented 3 years ago

For the -Og makefile change to work you need to make sure you delete all the .obj files, forcing them to rebuild. But even then it's not always possible for the debugger to show you everything.