Debugging kernel with gdb

Paul Lalonde <[email protected]> Thu, 5 Jun 2025 10:00:25 -0700
Newsgroups gmane.os.9front.general,gmane.os.plan9.general
Message-ID <CA+POUVj_dHxMWDcZ9wZ+KR6Q7U+UmEP+-NHBVE1E8LB-i1PNNA@mail.gmail.com>
--0000000000006cc41c0636d60d06
Content-Type: text/plain; charset="UTF-8"

I'm debugging Nix's reboot code.  The good news is that a straight reboot
now works.  The bad news is that jumping to a new kernel does not.  It
looks like it's dying in the reboot trampoline, which points to some
mis-managed expectation about machine state (page table, gdt?).

I'm trying to debug this with qemu and gdb, but though the elf generated by
'mk 9pc64.elf' is enough to run gdb and connect to the qemu-hosted kernel,
it has no debug symbols.  Operating with addresses gleaned from a .lst file
is less than pleasant.

Is there a way to generate symbols for functions in the .elf?

Thanks,
  Paul

--0000000000006cc41c0636d60d06
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">I&#39;m debugging Nix&#39;s reboot code.=C2=A0 The good ne=
ws is that a straight reboot now works.=C2=A0 The bad news is that jumping =
to a new kernel does not.=C2=A0 It looks like it&#39;s dying in the reboot =
trampoline, which points to some mis-managed expectation about machine stat=
e (page table, gdt?).<div><br>I&#39;m trying to debug this with qemu and gd=
b, but though the elf generated by &#39;mk 9pc64.elf&#39; is enough to run =
gdb and connect to the qemu-hosted kernel, it has no debug symbols.=C2=A0 O=
perating with addresses gleaned from a .lst file is less than pleasant.</di=
v><div><br>Is there a way to generate symbols for functions in the .elf?</d=
iv><div><br>Thanks,</div><div>=C2=A0 Paul</div></div>

--0000000000006cc41c0636d60d06--