Commit 0221575903ad68debea57679b5b46575bf57afb1

Authored by Paolo 'Blaisorblade' Giarrusso
Committed by Linus Torvalds
1 parent 640aa46e25

[PATCH] uml: workaround GDB problems on debugging

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 <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

Showing 3 changed files with 15 additions and 4 deletions Side-by-side Diff

arch/um/Kconfig.debug
... ... @@ -2,6 +2,17 @@
2 2  
3 3 source "lib/Kconfig.debug"
4 4  
  5 +config CMDLINE_ON_HOST
  6 + bool "Show command line arguments on the host in TT mode"
  7 + depends on MODE_TT
  8 + default !DEBUG_INFO
  9 + help
  10 + This controls whether arguments in guest processes should be shown on
  11 + the host's ps output.
  12 + Enabling this option hinders debugging on some recent GDB versions
  13 + (because GDB gets "confused" when we do an execvp()). So probably you
  14 + should disable it.
  15 +
5 16 config PT_PROXY
6 17 bool "Enable ptrace proxy"
7 18 depends on XTERM_CHAN && DEBUG_INFO && MODE_TT
arch/um/kernel/main.c
... ... @@ -97,7 +97,7 @@
97 97 exit(1);
98 98 }
99 99  
100   -#ifdef UML_CONFIG_MODE_TT
  100 +#ifdef UML_CONFIG_CMDLINE_ON_HOST
101 101 /* Allocate memory for thread command lines */
102 102 if(argc < 2 || strlen(argv[1]) < THREAD_NAME_LEN - 1){
103 103  
arch/um/kernel/um_arch.c
... ... @@ -126,7 +126,7 @@
126 126 unsigned long end_vm;
127 127 int ncpus = 1;
128 128  
129   -#ifdef CONFIG_MODE_TT
  129 +#ifdef CONFIG_CMDLINE_ON_HOST
130 130 /* Pointer set in linux_main, the array itself is private to each thread,
131 131 * and changed at address space creation time so this poses no concurrency
132 132 * problems.
... ... @@ -141,7 +141,7 @@
141 141  
142 142 void set_cmdline(char *cmd)
143 143 {
144   -#ifdef CONFIG_MODE_TT
  144 +#ifdef CONFIG_CMDLINE_ON_HOST
145 145 char *umid, *ptr;
146 146  
147 147 if(CHOOSE_MODE(honeypot, 0)) return;
... ... @@ -385,7 +385,7 @@
385 385  
386 386 setup_machinename(system_utsname.machine);
387 387  
388   -#ifdef CONFIG_MODE_TT
  388 +#ifdef CONFIG_CMDLINE_ON_HOST
389 389 argv1_begin = argv[1];
390 390 argv1_end = &argv[1][strlen(argv[1])];
391 391 #endif