public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: "A. M. Miera" <ammiera@hotmail.com>
To: gdb@sourceware.org
Subject: debugger-only log on Linux, equivalent of OutputDebugString
Date: Thu, 17 Sep 2020 10:48:00 +0200	[thread overview]
Message-ID: <AM0PR04MB53783BD905AFB5BC5D93D907B13E0@AM0PR04MB5378.eurprd04.prod.outlook.com> (raw)

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

             reply	other threads:[~2020-09-17  8:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-17  8:48 A. M. Miera [this message]
2020-09-17 17:10 ` Tom Tromey
2020-09-17 19:01   ` Simon Marchi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AM0PR04MB53783BD905AFB5BC5D93D907B13E0@AM0PR04MB5378.eurprd04.prod.outlook.com \
    --to=ammiera@hotmail.com \
    --cc=gdb@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).