[syslinux] How do I debug com32 modules with GDB using DWARF format?

Gene Cumm gene.cumm at gmail.com
Mon Oct 9 10:11:19 PDT 2017


On Thu, Oct 5, 2017 at 11:48 AM, Tu Do via Syslinux <syslinux at zytor.com> wrote:
> Hi list,
>
> I ran a syslinux drive on a QEMU machine with a gdbstub opened. I tried the simplest modules: the hello.c in com32/samples/ directory, which is compiled into hello.c32 in bios/com32/samples/. I already compiled the module with debug info attached via -g option added to CFLAGS in the Makefile.

I can't say I've ever tried using gdb against COM32 modules.

> However, the problem is that the generated module is a shared dynamic module, which only contains relative address. Because of this, the generated debug info is also wrong because the actual addresses are absolute addresses and the debug info must match them.

SYSLINUX v4.00 made it dynamic.  COM32R means relocatable.  I'd
consider either using a breakpoint then, if gdb allows, realign to the
new address, OR just use printf()/dprintf() calls as necessary.
dprintf() use would require a SYSLINUX core with such enabled and a
real serial port and probably only be applicable for BIOS.

Care to elaborate on what you're attempting to debug?

> How do I fix this problem? Is there a way to generate the correct mapping at compile time, so I can feed it to GDB when it starts?
>
> Thanks.

Hope that helps.

-- 
-Gene



More information about the Syslinux mailing list