debugger-only log on Linux, equivalent of OutputDebugString
A. M. Miera
ammiera@hotmail.com
Thu Sep 17 08:48:00 GMT 2020
Hello,
I've been recently looking for sth equivalent of Windows's
OutputDebugString for Linux.
Fiddling with built-in python, I have managed to create a named pipe
that GDB would read in the background (via python), while the inferior
writes to it (using some simple API, which I have currently implemented
as a shared lib).
Despite being in early prototype stage (with all its problems) my code
works.
The main question I'd like to ask though, is this: is that actually the
right way to go, or can this be done better in terms of operation
principles? I have several concerns here:
a. this might be very system-specific, e.g. for bare-metal Cortex-Mx
targets there's sth called "semihosting", which effectively does the
same (though is something different in principle). Windows already its
own call, too, etc.
b. most likely a simple pipe-based solution is not going to work with
remote targets, e.g. gdbserver? Should it be added?
c. and last but not least: maybe a mechanism already exists and I'm
reinventing the wheel now?
If someone wants to have a look, the code's here (again, please keep in
mind it's just proof of concept, not production quality):
https://gitlab.com/alagner/gdbprint
Looking forward to hear all the criticism on the idea.
Best regards,
Aleksander "Alagner" Miera
More information about the Gdb
mailing list