Questions tagged [kgdb]

KGDB is a source level debugger for the linux kernel. It is used along with gdb to debug linux kernels. It requires two machines that are connected via a serial connection.

Kernel developers can debug a kernel similar to application programs with use of KGDB. It makes it possible to place breakpoints in kernel code, step through the code and observe variables.

Two machines are required for using KGDB. One of these machines is a development machine and the other is a test machine. The machines are connected through a serial line, a null-modem cable which connects their serial ports. The kernel to be debugged runs on the test machine. gdb runs on the development machine. The serial line is used by gdb to communicate with the kernel being debugged.

KGDB is available for i386, x86_64, ppc and s390 architectures.

KGDB is a kernel patch. It has to be applied to a linux kernel to enable kernel debugging. KGDB adds the following components to a kernel.

  • gdb stub - The gdb stub is the heart of the debugger. It is the part that handles requests coming from gdb on the development machine. It has control of all processors in the target machine when the kernel running on it is inside the debugger.
  • modifications to fault handlers - Kernel gives control to debugger when an unexpected fault occurs. A kernel which does not contain gdb panics on unexpected faults. Modifications to fault handles allow kernel developers to analyze unexpected faults.
  • serial communication - This component uses a serial driver in the kernel and offers an interface to gdb stub in the kernel. It is responsible for sending and receiving data from a serial line. This component is also responsible for handling control break requests sent by gdb.

Project site

66 questions
0
votes
1 answer

KGDB, Remote connection Error

Im very New to KGDB, Im getting problem when im connecting the target from Host, Getting The following Error. (gdb) target remote /dev/ttyUSB0 Remote debugging using /dev/ttyUSB0 Ignoring packet error, continuing... warning: unrecognized item…
0
votes
1 answer

Embedded Linux kernel debug

I am working on a proprietary board at my workplace. Linux image (built from yocto) is copied into and getting booted from eMMC. Facing some issues in kernel startup. Are there any ways how to debug linux kernel at startup ?
0
votes
1 answer

why does kgdb not show function symbols when debugging vmlinux?

I have compiled my kernel with the following kernel option enabled. That should be enough. CONFIG_KGDB=y CONFIG_KGDB_SERIAL_CONSOLE=y CONFIG_DEBUG_INFO=y I want to implement a tcp socket server under kernel space. However when I debug my kernel,…
river
  • 694
  • 6
  • 22
0
votes
1 answer

gdb doesn't correctly places breakpoint at address

I'm debugging the linux kernel using kgdb module and gdb. when trying to set a breakpoint at some address, gdb sets it at another, wrong address. (gdb) b *0xffffffff81528690 Breakpoint 1 at 0x81528690 Anyone knows why?
TheAlgoMan
  • 51
  • 4
0
votes
0 answers

No debug symbols being created for user modules

I want to debug a user module using kgdb . The code : #include #include #include int r_day,rday1=10; static int hello_init(void) { printk(KERN_ALERT "Hello World"); return 0; } static void…
0
votes
1 answer

Android Bootloader Debugging

I am trying to debug aboot (aplication bootloader) on android and I have problems. I tried to patch the kernel to support KGDB serial debugging but the driver is loaded after aboot. Should I use an emulator? And if yes, how ?
0
votes
0 answers

Cannot see "Waiting for connection from remote gdb..."

I'm now configuring kgdb with a target pc and a host pc. These 2 PCs are connected via serial cable. The host PC has USB-to-Serial cable which is ttyUSB0. And the target PC has conventional serial port which is ttyS0. The target PC's BIOS has serial…
Cprogrammer
  • 153
  • 9
0
votes
1 answer

Toggling between remote KGDB and local DDB within a debugging session

I would like to know if there is indeed a way to toggle between gdb and ddb while debugging a remote kernel. I am already at the gdb (or rather kgdb) prompt. From here how do I switch to local ddb on the debugged machine? My kernel configuration…
AjB
  • 890
  • 13
  • 34
0
votes
1 answer

Freebsd kernel crash: run ddb commands before panic

I have a FreeBSD system running into crashes. I think it will be useful to run some ddb commands and collect data before writing the core file. I wanted to do this automatically for all the crashes. Has someone done this before ?
Vibhu
  • 61
  • 4
0
votes
1 answer

Using KGDB on Ubuntu 14.04.2 Kernel?

I tried to use KGDB on Ubuntu 14.04.2 - 3.16 kernel. Target is running with 3.16 kernel on Ubuntu 14.04.2. Host is running with 3.16 kernel on Ububtu 14.04.2. Target is waiting for remote gdb connection. Started my Host mechine and try to connect…
ayyappa ch
  • 95
  • 2
  • 9
0
votes
1 answer

Problems with version of kgdb patch

My kernel version is 2.6.35. I cannot find a kgdb 2.6.35 online. Anyone has idea about which version of kgdb can I use?
John
  • 67
  • 1
  • 1
  • 9
0
votes
0 answers

kgdb virtualbox target returning error code 22

I'm trying to debug a live Linux kernel running on virtualbox. I added the appropriate settings in the kernel (using the .config file, by enabling KGDB and adding the debug info in the kernel). My serial port is a named pipe (socket) which I then…
AjB
  • 890
  • 13
  • 34
0
votes
1 answer

Linux Kernel Remote Debugging using KGDB : GDB does not recognize functions?

I cross compiled the kernel sources for arm, with debug info and KGDB. When I run gdb in the host : $ arm-linux-gnueabihf-gdb vmlinux ... Reading symbols from vmlinux... done. (gdb) target remote /dev/ttyUSB0 Remote debugging unsing…
0
votes
1 answer

Is there kgdb for kernel 2.6.37?

I am having trouble using kgdb in kernel. I suspect that kgdb is available obly for specific linux version, and 2.6.37 is none of them ? Trying to search patch for 2.6.37 in web, does not give results. Is there anyone who knows or tires kgdb ? Is…
ransh
  • 1,589
  • 4
  • 30
  • 56
0
votes
0 answers

KGDB error code '22' using kgdboc

I'm currently trying to debug a board using a PowerPC 500v2 processor. When I try to connect to the board using gdb while the board is ready for me it gives me the status qTStatus: Target returns error code '22'. 0x00004100 in ?? () qTStatus:…