Jump to: navigation, search

Procedure to gdb traces for UML processes

Gbd traces are usually required in the uml-users and uml-devel mailling maillists, and this brief howto describes a procedure to get them.

(Recipe adapted from

The procedure is inspired in

  1. Compile a kernel with CONFIG_DEBUG_INFO and CONFIG_FRAME_POINTER enabled. Kernels provided by VNUML project use to match this requirement.
  2. Run a vm with the following command line:
  3.  ./linux ubd0=/tmp/root_fs_debug con=null con0=pts uml_dir=/tmp umid=run
  4. Get the pts associated with the vm (i.e., /dev/pts/X) using 'uml_mconsole config con0'
  5. Access to the vm with 'screen /dev/pts/X'. Then issue the command that is causing the problem (e.g., 'iptables -L') in order to get the desired behaviour (e.g., the vm hangs and the top command run in the host shows a CPU usage around 100% for the linux process).
  6. Attach gdb to the linux process using:
  7.  gdb ./linux `cat /tmp/run/pid`
  8. Get the backtrace (bt). Something like that:
  9.  (gdb) bt
     #0  0xb7f9d7f2 in ?? () from /lib/
     #1  0xb7f19ab0 in tcsetattr () from /lib/i686/cmov/
     #2  0x080610d5 in generic_console_write (fd=7,
          buf=0x828fc13 "ip_tables: (C) 2000-2006 Netfilter Core Team\n", n=45)
          at arch/um/drivers/chan_user.c:37
     #3  0x0806096e in console_write_chan (chans=0x82756f0,
          buf=0x828fc13 "ip_tables: (C) 2000-2006 Netfilter Core Team\n", len=45)
          at arch/um/drivers/chan_kern.c:352
     #4  0x08060232 in uml_console_write (console=0x8275ca0,
          string=0x828fc13 "ip_tables: (C) 2000-2006 Netfilter Core Team\n", len=45)
          at arch/um/drivers/stdio_console.c:132
     #5  0x0807595b in __call_console_drivers (start=3059, end=3104)
          at kernel/printk.c:331
     #6  0x080759cf in _call_console_drivers (start=3059, end=3104, msg_log_level=4)
          at kernel/printk.c:361
     #7  0x08075aa3 in call_console_drivers (start=3056, end=3104)
          at kernel/printk.c:404
     #8  0x08075f85 in release_console_sem () at kernel/printk.c:827
     #9  0x08075dcc in vprintk (
          fmt=0xa83f2c8 "ip_tables: (C) 2000-2006 Netfilter Core Team\n",
          args=0x951bf10 "\200\t\204\n$?Q\tm?\b\b?\r\005\b") at kernel/printk.c:613
     #10 0x08075bdf in printk (
          fmt=0xa83f2c8 "ip_tables: (C) 2000-2006 Netfilter Core Team\n")
          at kernel/printk.c:507
     #11 0x0a811062 in ?? ()
     #12 0x0a83f2c8 in ?? ()
     #13 0x0a840980 in ?? ()
     #14 0x0951bf24 in ?? ()
     #15 0x0808f16d in sys_init_module (umod=0x8050dc0, len=0,
          uargs=0x951bf70 "\214?Q\t\234?\006\bT?\205\t[\023") at kernel/module.c:2015
     #16 0x0808f16d in sys_init_module (umod=0x40166000, len=156732,
          uargs=0x8050dc0 "9&\b??\002i??????E?") at kernel/module.c:2015
     #17 0x0805f882 in handle_syscall (r=0x985c254)
          at arch/um/kernel/skas/syscall.c:38
     #18 0x0806e09c in handle_trap (pid=4955, regs=0x985c254, local_using_sysemu=2)
          at arch/um/os-Linux/skas/process.c:173
     #19 0x0806e48f in userspace (regs=0x985c254)
          at arch/um/os-Linux/skas/process.c:330
     #20 0x0805f5a5 in fork_handler () at arch/um/kernel/skas/process.c:96
     #21 0x00000000 in ?? ()