This question deals with why you can't read the GDTR and LDTR in user-mode GDB. But I don't see why it shouldn't be possible when debugging a Linux kernel (with KGDB compiled in), using GDB on another machine with serial cable.
The kernel being debugged should be able to tell the debugger the values of the GDTR and LDTR, but it doesn't seem there is any GDB command to make it do so. Is there a good reason for this? Is it just something which nobody has implemented?
As you say, nobody implemented it.
gdb
in particular doesn't consider those valid registers, so the kernel debug interface doesn't even try to send them.
Unless you are willing to change gdb
, you must use a workaround to get that information. One such possibility I can think of is the ThreadExtraInfo
command which should be able to send arbitrary string message that gets printed in gdb
. So you could add that information in kernel/debug/gdbstub.c
.