On Wednesday 27 July 2005 21:22, Allan Graves wrote: > Hi guys, from the lists, this looks like it should work. Its not > though, and so my question. :)
> I'm working on debugging a module, and it panics and takes down uml. > I'm running uml in a gdb session, but since UML exits after the panic > code, i don't have a backtrace, context, or really anything to help me > debug. I've tried putting a breakpoint on panic to catch it, but for > some reason, it didn't stop it. Any thoughts on how i can get gdb to > catch and keep the context of the panic and not just let UML exit? Well, a first thing might be to compile in only SKAS mode, and play with static / dynamic. GDB has always appreciated more a standard binary than a TT one. If it's a segfault put a breakpoint on handle_segv, otherwise you can always try adding something as dump_stack() at the beginning of panic(); there's currently one done by notifier_call_chain(&panic_notifier_list, 0, buf); in particular by panic_exit, but it doesn't always work. And I think that the two attached patches might improve this (I can't use GDB on UML without them). -- Inform me of my mistakes, so I can keep imitating Homer Simpson's "Doh!". Paolo Giarrusso, aka Blaisorblade (Skype ID "PaoloGiarrusso", ICQ 215621894) http://www.user-mode-linux.org/~blaisorblade
Signed-off-by: Paolo 'Blaisorblade' Giarrusso <[EMAIL PROTECTED]> --- linux-2.6.git-paolo/arch/um/kernel/uml.lds.S | 25 +++++++++++++++++++++++++ 1 files changed, 25 insertions(+) diff -puN arch/um/kernel/uml.lds.S~uml-add-dwarf-sections-to-static-link-script arch/um/kernel/uml.lds.S --- linux-2.6.git/arch/um/kernel/uml.lds.S~uml-add-dwarf-sections-to-static-link-script 2005-07-18 18:53:15.000000000 +0200 +++ linux-2.6.git-paolo/arch/um/kernel/uml.lds.S 2005-07-18 18:53:15.000000000 +0200 @@ -103,4 +103,29 @@ SECTIONS .stab.index 0 : { *(.stab.index) } .stab.indexstr 0 : { *(.stab.indexstr) } .comment 0 : { *(.comment) } + /* DWARF debug sections. + Symbols in the DWARF debugging sections are relative to the beginning + of the section so we begin them at 0. */ + /* DWARF 1 */ + .debug 0 : { *(.debug) } + .line 0 : { *(.line) } + /* GNU DWARF 1 extensions */ + .debug_srcinfo 0 : { *(.debug_srcinfo) } + .debug_sfnames 0 : { *(.debug_sfnames) } + /* DWARF 1.1 and DWARF 2 */ + .debug_aranges 0 : { *(.debug_aranges) } + .debug_pubnames 0 : { *(.debug_pubnames) } + /* DWARF 2 */ + .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_line 0 : { *(.debug_line) } + .debug_frame 0 : { *(.debug_frame) } + .debug_str 0 : { *(.debug_str) } + .debug_loc 0 : { *(.debug_loc) } + .debug_macinfo 0 : { *(.debug_macinfo) } + /* SGI/MIPS DWARF 2 extensions */ + .debug_weaknames 0 : { *(.debug_weaknames) } + .debug_funcnames 0 : { *(.debug_funcnames) } + .debug_typenames 0 : { *(.debug_typenames) } + .debug_varnames 0 : { *(.debug_varnames) } } _
Signed-off-by: Paolo 'Blaisorblade' Giarrusso <[EMAIL PROTECTED]> --- linux-2.6.git-paolo/arch/um/Kconfig | 10 ++++++++++ linux-2.6.git-paolo/arch/um/kernel/main.c | 2 +- linux-2.6.git-paolo/arch/um/kernel/um_arch.c | 6 +++--- 3 files changed, 14 insertions(+), 4 deletions(-) diff -puN arch/um/kernel/main.c~uml-fix-host-debug-on-TT-binaries arch/um/kernel/main.c --- linux-2.6.git/arch/um/kernel/main.c~uml-fix-host-debug-on-TT-binaries 2005-07-18 18:53:19.000000000 +0200 +++ linux-2.6.git-paolo/arch/um/kernel/main.c 2005-07-18 18:53:19.000000000 +0200 @@ -97,7 +97,7 @@ int main(int argc, char **argv, char **e exit(1); } -#ifdef UML_CONFIG_MODE_TT +#ifdef UML_CONFIG_CMDLINE_ON_HOST /* Allocate memory for thread command lines */ if(argc < 2 || strlen(argv[1]) < THREAD_NAME_LEN - 1){ diff -puN arch/um/kernel/um_arch.c~uml-fix-host-debug-on-TT-binaries arch/um/kernel/um_arch.c --- linux-2.6.git/arch/um/kernel/um_arch.c~uml-fix-host-debug-on-TT-binaries 2005-07-18 18:53:19.000000000 +0200 +++ linux-2.6.git-paolo/arch/um/kernel/um_arch.c 2005-07-18 18:53:19.000000000 +0200 @@ -123,7 +123,7 @@ unsigned long start_vm; unsigned long end_vm; int ncpus = 1; -#ifdef CONFIG_MODE_TT +#ifdef CONFIG_CMDLINE_ON_HOST /* Pointer set in linux_main, the array itself is private to each thread, * and changed at address space creation time so this poses no concurrency * problems. @@ -138,7 +138,7 @@ long physmem_size = 32 * 1024 * 1024; void set_cmdline(char *cmd) { -#ifdef CONFIG_MODE_TT +#ifdef CONFIG_CMDLINE_ON_HOST char *umid, *ptr; if(CHOOSE_MODE(honeypot, 0)) return; @@ -366,7 +366,7 @@ int linux_main(int argc, char **argv) setup_machinename(system_utsname.machine); -#ifdef CONFIG_MODE_TT +#ifdef CONFIG_CMDLINE_ON_HOST argv1_begin = argv[1]; argv1_end = &argv[1][strlen(argv[1])]; #endif diff -puN arch/um/Kconfig~uml-fix-host-debug-on-TT-binaries arch/um/Kconfig --- linux-2.6.git/arch/um/Kconfig~uml-fix-host-debug-on-TT-binaries 2005-07-18 18:53:19.000000000 +0200 +++ linux-2.6.git-paolo/arch/um/Kconfig 2005-07-18 18:53:19.000000000 +0200 @@ -51,6 +51,16 @@ config MODE_TT use only skas mode (and the host has the skas patch applied to it), then it is OK to say N here. +config CMDLINE_ON_HOST + bool + depends on MODE_TT && !DEBUG_INFO + default y + help + This controls whether arguments in guest processes should be shown at all. + I'm disabling this when TT mode is enabled because it creates problems + with host debugging, on recent GDB versions (starting from the execvp + point). + config STATIC_LINK bool "Force a static link" default n _