On Friday 26 August 2005 15:07, Clifford Ton wrote:
> I continued to receive "Program received signal SIGTRAP, Trace/breakpoint
> trap". How can I fix it?
Disable TT mode in the guest kernel config and things should work again. If 
that doesn't work, I'll post some patches I'm using for that which work very 
well (I'm attaching them too but they're against 2.6.13-rc, so you might get 
some fuzz against 2.6.12).

Also, please, next time don't post an HTML message (you can see why in the 
following quoting:).
> My host system is 2.6.12-skas3-v9-pre7, fedora 4.

> Host/Guest Kernel
>
> http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.12.5.tar.bz2
>
> Uml Patch
>
> http://www.user-mode-linux.org/~blaisorblade/patches/skas3-2.6/skas-2.6.12-
>v 9-pre7/skas-2.6.12-v9-pre7.patch.bz2
>
>
>
>
>
> Guest config file is in the following after the gdb message.
>
>
>
> [EMAIL PROTECTED] linux-2.6.12.5]# gdb linux
>
> GNU gdb Red Hat Linux (6.3.0.0-1.21rh)
>
> Copyright 2004 Free Software Foundation, Inc.
>
> GDB is free software, covered by the GNU General Public License, and you
> are
>
> welcome to change it and/or distribute copies of it under certain
> conditions.
>
> Type "show copying" to see the conditions.
>
> There is absolutely no warranty for GDB.  Type "show warranty" for details.
>
> This GDB was configured as "i386-redhat-linux-gnu"...Using host
> libthread_db library "/lib/libthread_db.so.1".
-- 
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
From: Paolo 'Blaisorblade' Giarrusso <[EMAIL PROTECTED]>

Inside the linker script, insert the code for DWARF debug info sections. This
may help GDB'ing a Uml binary. Actually, it seems that ld is able to guess
what I added correctly, but normal linker scripts include this section so it
should be correct anyway adding it.

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-30 13:41:40.000000000 +0200
+++ linux-2.6.git-paolo/arch/um/kernel/uml.lds.S	2005-07-30 13:41:40.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) }
 }
_
From: Paolo 'Blaisorblade' Giarrusso <[EMAIL PROTECTED]>

Apparently, GDB gets confused when we do an execvp() on ourselves.

Since it's simply done to allocate further space for command line arguments
(which we'll use to allow gathering the startup command line for guest
processes through the host), allow the user to disable that to get a
debuggable UML binary.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <[EMAIL PROTECTED]>
---

 linux-2.6.git-paolo/arch/um/Kconfig.debug    |   11 +++++++++++
 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, 15 insertions(+), 4 deletions(-)

diff -puN arch/um/Kconfig.debug~uml-fix-host-debug-on-TT-binaries arch/um/Kconfig.debug
--- linux-2.6.git/arch/um/Kconfig.debug~uml-fix-host-debug-on-TT-binaries	2005-08-08 23:25:53.000000000 +0200
+++ linux-2.6.git-paolo/arch/um/Kconfig.debug	2005-08-08 23:25:53.000000000 +0200
@@ -2,6 +2,17 @@ menu "Kernel hacking"
 
 source "lib/Kconfig.debug"
 
+config CMDLINE_ON_HOST
+	bool "Show command line arguments on the host in TT mode"
+	depends on MODE_TT
+	default !DEBUG_INFO
+	help
+	This controls whether arguments in guest processes should be shown on
+	the host's ps output.
+	Enabling this option hinders debugging on some recent GDB versions
+	(because GDB gets "confused" when we do an execvp()). So probably you
+	should disable it.
+
 config PT_PROXY
 	bool "Enable ptrace proxy"
 	depends on XTERM_CHAN && DEBUG_INFO && MODE_TT
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-08-08 23:25:53.000000000 +0200
+++ linux-2.6.git-paolo/arch/um/kernel/main.c	2005-08-08 23:25:53.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-08-08 23:25:53.000000000 +0200
+++ linux-2.6.git-paolo/arch/um/kernel/um_arch.c	2005-08-08 23:25:53.000000000 +0200
@@ -126,7 +126,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.
@@ -141,7 +141,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;
@@ -385,7 +385,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
_

Reply via email to