Thursday, April 15, 2010

LDD3 notes: Debugging

My notes while reading Linux Device Drivers 3rd edition.

printk_ratelimit() tells if we're not flooding the log

Kernel configuration

  • CONFIG_DEBUG_SLAB -> canary killed
  • CONFIG_DEBUG_SPINLOCK_SLEEP -> potential sleeps with spinlocks detected

seq_file - kernel in-memory file buffer, similar to open_memstream or ostringstream.

  • a cleaner interface for implementing a /proc file
  • iterator/visitor: start, show, next, stop
  • api for the visitor: seq_printf into a seq_file
  • fops implemented for reading

debugging a live kernel through a 'dynamic' core dump

  • gdb vmlinux /proc/kcore, core-file /proc/kcore
  • cannot modify data, breakpoint, watchpoint or single-step
  • add-symbol-file for modules, using /sys/module/*/sections/.* like with a jtag emulator
  • print *(address)

kdb -debugging from SGI

  • ia32 only
  • built-in to kernel, pause/break key as 'ctrl-c' takes you into debugger
  • has breakpoints and can modify data
  • sees module symbols automatically

kgdb -mm -variant

  • serial port, ethernet kgdboe
  • x86, ppc.
  • no ARM

kgdb variant

  • serial port only
  • x86, ppc.
  • no ARM

Linux trace toolkit


  • vs kprobes?

No comments:

Post a Comment