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
318 stars 40 forks source link

How about using WinUAE 4.4.0's logger? #18

Open tehKaiN opened 4 years ago

tehKaiN commented 4 years ago

I hope you don't have enough of me and my issues. ;)

The WinUAE 4.4.0 was released recently. It comes with printf-like logging, which works almost the same as your vscode-bound logger. Quoting the WinUAE release topic from EAB:

New easy to use and transparent printf()-like debug logging method for developers: simply write parameters to address $bfff00 (byte, word and long accepted) one by one, then format string to $bfff04 (must be long) and formatted log message will appear in log window. Address may change, currently only active if 128k UAE boot rom mode is enabled and accepts only %d, %u, %x, %p, %s and %b (BSTR). Quickly made for quick and easy UAESND AHI driver debug logging..

I think it'd be cool to be consistent and use same interface to pass the debug messages to vscode. This way, I can use same code to send messages to vscode and later give the exact same build to betatesters with uae logger enabled. It can be done with an ifdef and two code variants, which I already do, but having unified interface is better, I think. ;)

BartmanAbyss commented 4 years ago

Will have a look.

BartmanAbyss commented 4 years ago

I have now updated to WinUAE 4.4.0 so you can try to use it. Let me know if it works okay.

tehKaiN commented 4 years ago

Yeah, it kinda works, with a bit of help. The text in debugger log is always red. UAE also uses this log for printing its internal stuff - perhaps there's a collision with some kind of your error printing?

Also, default.uae needs adding: debug_mem=true.

You can check the result using this fn:

static inline void uaeWrite(const char *szMsg) {
    volatile ULONG * const s_pUaeFmt = (ULONG *)0xBFFF04;
    *s_pUaeFmt = (ULONG)((UBYTE*)szMsg);
}

What do you think about it? Is merging with this serial interface worthwhile or does it collide with too many things?