debugger-only log on Linux, equivalent of OutputDebugString

"A. M. Miera via Gdb" <[email protected]>
Newsgroups gmane.comp.gdb.devel
Message-ID <AM0PR04MB53783BD905AFB5BC5D93D907B13E0@AM0PR04MB5378.eurprd04.prod.outlook.com>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.