Kernel debugging in skas mode
host% gdb linux
(host gdb) r ubd0=/home/jdike/roots/cow.debian,/home/jdike/roots/debian_22 con=port:9000 ssl=pty con0=fd:0,fd:1 umid=debian mem=128MAlso, have gdb ignore SIGSEGV and SUGUSR1 since these are used internally by UML, and your debugging session would otherwise be continually interrupted by them
(host gdb) handle SIGSEGV pass nostop noprint
(host gdb) handle SIGUSR1 pass nostop noprint
If you've enabled both CONFIG_MODE_TT and CONFIG_MODE_SKAS, UML will
exec itself, and gdb will see a SIGTRAP.
If you set any breakpoints before running UML, then all you need to do is get UML to hit one of them, and you will be bounced back to the gdb prompt for debugging. When you continue UML, you will be back to whatever UML prompt you had.
If you need to interrupt UML, you can't ^C it because the terminal is
in raw mode, and the ^C will just hit whatever UML is running. What
you need to do is send the UML kernel thread a SIGINT from another
shell. It is normally the first process after the gdb
host% kill -INT 7133
Debian GNU/Linux 2.2 usermode ttys/0 usermode login: Program received signal SIGINT, Interrupt. 0xa019a6c1 in __libc_nanosleep () (gdb) bt #0 0xa019a6c1 in __libc_nanosleep () #1 0xa00ed092 in idle_sleep (secs=10) at time.c:114 #2 0xa00e5765 in cpu_idle () at process_kern.c:210 #3 0xa000c50e in rest_init () at init/main.c:341 #4 0xa000356d in start_kernel () at init/main.c:435 #5 0xa00f38f7 in start_kernel_proc (unused=0x0) at process_kern.c:153 #6 0xa00e52a2 in run_kernel_thread (fn=0xa00f38d0 <start_kernel_proc>, arg=0x0, jmp_ptr=0xa020c554) at process.c:239 #7 0xa00f36de in new_thread_handler (sig=10) at process_kern.c:67 #8 <signal handler called> #9 0xa01891d1 in __kill () #10 0xa0188f85 in siglongjmp () at ../sysdeps/generic/longjmp.c:39 #11 0xa00f32e3 in start_idle_thread (stack=0xa020e000, switch_buf_ptr=0xa020c57c, fork_buf_ptr=0xa020c580) at process.c:275 #12 0xa00f3947 in start_uml_skas () at process_kern.c:169 #13 0xa00ee779 in linux_main (argc=8, argv=0xbffff814) at um_arch.c:376 #14 0xa000c3d2 in main (argc=8, argv=0xbffff814, envp=0xbffff838) at arch/um/main.c:143 #15 0xa0188d52 in __libc_start_main (main=0xa000c1dc <main>, argc=8, ubp_av=0xbffff814, init=0xa01c6520 <_init>, fini=0xa01c6cb0 <_fini>, rtld_fini=0, stack_end=0xbffff80c) at ../sysdeps/generic/libc-start.c:129 (gdb) c Continuing. Debian GNU/Linux 2.2 usermode ttys/0 usermode login: