From: "Alex Bennée" <alex.bennee@linaro.org>
To: "Philippe Mathieu-Daudé" <philmd@redhat.com>
Cc: "qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>,
"Sid Manning" <sidneym@quicinc.com>,
"Paolo Bonzini" <pbonzini@redhat.com>
Subject: Re: [gdbstub] redirecting qemu console output to a debugger
Date: Thu, 21 Oct 2021 15:51:55 +0100 [thread overview]
Message-ID: <87ilxqtogk.fsf@linaro.org> (raw)
In-Reply-To: <fad02feb-09f3-4ef8-a2eb-bec76e2ee968@redhat.com>
Philippe Mathieu-Daudé <philmd@redhat.com> writes:
> Hi Sid,
>
> Cc'ing maintainers:
>
> $ ./scripts/get_maintainer.pl -f chardev/char.c
> "Marc-André Lureau" <marcandre.lureau@redhat.com> (maintainer:chardev)
> Paolo Bonzini <pbonzini@redhat.com> (reviewer:Character device...)
>
> $ ./scripts/get_maintainer.pl -f gdbstub.c
> "Alex Bennée" <alex.bennee@linaro.org> (maintainer:GDB stub)
> "Philippe Mathieu-Daudé" <philmd@redhat.com> (reviewer:GDB stub)
>
> On 10/21/21 14:37, Sid Manning wrote:
>> Currently when I attach a debugger (lldb) to my qemu session all of the output goes to the shell running qemu not to the debugger. Fixing this meant that I needed to point the semi-hosting output to the gdb chardev. I started qemu like this:
>>
>> -s -S -semihosting-config target=auto,chardev=ch0 -chardev gdb,id=ch0
Mixing up semihosting and gdb is not going to end well. We do already
re-direct semihosting output to the debugger when it's attached. To
specify a socket for gdb to connect to you need:
-chardev socket,path=/tmp/gdb-socket,server=on,wait=off,id=gdb0 -gdb chardev:gdb0
The -chardev specifies the details of the socket and the -gdb tells gdb
where it should make the gdbserver port visible. The only
semihosting-config variable you may want to tweak is the target.
<snip>
>
> I'm not sure why "chardev-gdb" is internal, maybe because it uses
> static state as singleton, so can't be TYPE_USER_CREATABLE?
>
> static GDBState gdbserver_state;
One good reason - we don't support multiple connections.
>
> But TYPE_DBUS_VMSTATE is TYPE_USER_CREATABLE and have:
>
> static void
> dbus_vmstate_complete(UserCreatable *uc, Error **errp)
> {
> DBusVMState *self = DBUS_VMSTATE(uc);
> g_autoptr(GError) err = NULL;
>
> if (!object_resolve_path_type("", TYPE_DBUS_VMSTATE, NULL)) {
> error_setg(errp, "There is already an instance of %s",
> TYPE_DBUS_VMSTATE);
> return;
> }
> ...
>
> So it should be possible to have TYPE_CHARDEV_GDB implement
> TYPE_USER_CREATABLE and check for singleton the same way,
> then remove the ChardevClass::internal field IMO...
>
> But let see what the maintainers prefer :)
>
> Regards,
>
> Phil.
--
Alex Bennée
next prev parent reply other threads:[~2021-10-21 14:58 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-21 12:37 [gdbstub] redirecting qemu console output to a debugger Sid Manning
2021-10-21 13:11 ` Philippe Mathieu-Daudé
2021-10-21 14:51 ` Alex Bennée [this message]
2021-10-21 22:08 ` Sid Manning
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=87ilxqtogk.fsf@linaro.org \
--to=alex.bennee@linaro.org \
--cc=marcandre.lureau@redhat.com \
--cc=pbonzini@redhat.com \
--cc=philmd@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=sidneym@quicinc.com \
/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 NNTP newsgroup(s).