Re: KGDB on virt68k?

Chris Hanson <[email protected]> Mon, 27 Apr 2026 15:45:17 -0700
Newsgroups gmane.os.netbsd.ports.m68k
Message-ID <[email protected]>
On Apr 26, 2026, at 1:32=E2=80=AFPM, Chris Hanson =
<[email protected]> wrote:
>=20
> On Apr 26, 2026, at 4:56=E2=80=AFAM, Jason Thorpe <[email protected]> =
wrote:
>>=20
>> On Apr 26, 2026, at 4:47=E2=80=AFAM, Chris Hanson =
<[email protected]> wrote:
>>>=20
>>> Anyone have any suggestions for how I should adjust GENERIC.local in =
virt68k for kernel debugging via KGDB?
>>=20
>> Hm, that would need a separate serial port, and I don=E2=80=99t think =
Qemu provides one other than the one Goldfish virtual serial (unless =
there=E2=80=99s a Qemu arg that allows you to create an additional one; =
I never tried).  In any case, KGDB glue would have to be added to gftty.
>=20
> I=E2=80=99ll take a look at QEMU to see if this is feasible.

I don't know the syntax to create another Goldfish tty on the QEMU =
command line, but it looks like it should be possible: The Android docs =
for the QEMU Goldfish devices say that serial device IDs are "0 to N" =
and that the Android emulator reserves the first *two* ports. I think =
that's expected to be passed to the kernel via the device tree; I don't =
know whether that's supported by the QEMU virt platform, or by NetBSD =
virt68k.

I do know I can one or more pairs like this

    -serial tcp:localhost:4000,server,nowait,id=3D"kgdb" \
    -device virtio-serial-device,id=3D"kgdb" \

on the QEMU command line and VirtIO consoles are detected

    [   1.0000000] virtio0 at mainbus0 addr 0xff01f600
    [   1.0000000] virtio0: VirtIO-MMIO-v2
    [   1.0000000] virtio0: console device (id 3, rev. 0x01)
    [   1.0000000] viocon0 at virtio0: features: =
0x110000000<V1,INDIRECT_DESC>
    [   1.0000000] virtio0: interrupting at gfpic4 irq 28 (IPL 5)

and I can connect to the port via telnet or nc. So maybe VirtIO serial =
might be a better approach for KGDB. (I assume if I create an =
appropriate node in /dev and run getty on it that I'd be able to connect =
to that port and get a login...)

  -- Chris