[patch 2/3] uml: workaround GDB problems on debugging

blaisorblade_at_yahoo.it
Date: 07/30/05

  • Next message: blaisorblade_at_yahoo.it: "[patch 1/1] sys_get_thread_area does not clear the returned argument"
    To: akpm@osdl.org
    Date:	Sat, 30 Jul 2005 21:05:36 +0200
    
    

    From: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>

    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>

    ---
     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-07-30 16:50:53.000000000 +0200
    +++ linux-2.6.git-paolo/arch/um/Kconfig.debug	2005-07-30 16:58:52.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-07-30 16:50:53.000000000 +0200
    +++ linux-2.6.git-paolo/arch/um/kernel/main.c	2005-07-30 16:50: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-07-30 16:50:53.000000000 +0200
    +++ linux-2.6.git-paolo/arch/um/kernel/um_arch.c	2005-07-30 16:50: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
    _
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at  http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at  http://www.tux.org/lkml/
    

  • Next message: blaisorblade_at_yahoo.it: "[patch 1/1] sys_get_thread_area does not clear the returned argument"

    Relevant Pages

    • [PATCH 8/17] 4level support for m32r
      ... * Allocate and free page tables. ... #ifdef CONFIG_SMP ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • [PATCH 4/8] cciss: direct lookup for command completions
      ... This patch changes the way we complete commands. ... This method uses a tag associated with each command ... +#ifdef CONFIG_CISS_SCSI_TAPE ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: despair
      ... %SYSTEM-F-DEVMOUNT, device is already mounted ... It's a command procedure and should be written ... I'm talking about "someone left the wrong tape in" or "someone else is ... You allocate a resource, you ...
      (comp.os.vms)
    • [PATCH 3/4] myri10ge - Driver core
      ... +#ifdef CONFIG_MTRR ... +/* Allocate 2x as much space as required and use whichever portion ...
      (Linux-Kernel)
    • Re: despair
      ... Say this runs on the SYSTEM account. ... The allocate will fail, but other commands may succeed due to the fact that this account has all mighty privileges. ... Of course, the command would then write the backup to whatever tape was physically in the drive, and it could be someone else's tape. ...
      (comp.os.vms)