components/gdb/patches/gdb.fork-child.c.patch
branchs11-update
changeset 4192 f6232e8b6127
parent 4186 3361a0caff28
child 4198 4c973b9013d7
equal deleted inserted replaced
4186:3361a0caff28 4192:f6232e8b6127
     1 --- gdb-7.6/gdb/fork-child.c	2012-12-31 22:32:42.000000000 -0800
       
     2 +++ gdb-7.6/gdb/fork-child.c	2013-07-10 23:30:02.327235300 -0700
       
     3 @@ -35,13 +35,19 @@
       
     4  
       
     5  #include <signal.h>
       
     6  
       
     7 +#include <fcntl.h>
       
     8 +#include <sys/types.h>
       
     9 +#include <sys/stat.h>
       
    10 +
       
    11  /* This just gets used as a default if we can't find SHELL.  */
       
    12 -#define SHELL_FILE "/bin/sh"
       
    13 +#define SHELL_FILE "/bin/bash"
       
    14  
       
    15  extern char **environ;
       
    16  
       
    17  static char *exec_wrapper;
       
    18  
       
    19 +static int isaexec_shell;
       
    20 +
       
    21  /* Break up SCRATCH into an argument vector suitable for passing to
       
    22     execvp and store it in ARGV.  E.g., on "run a b c d" this routine
       
    23     would get as input the string "a b c d", and as output it would
       
    24 @@ -142,6 +148,7 @@
       
    25    struct inferior *inf;
       
    26    int i;
       
    27    int save_errno;
       
    28 +  isaexec_shell = 0;
       
    29  
       
    30    /* If no exec file handed to us, get it from the exec-file command
       
    31       -- with a good, common error message if none is specified.  */
       
    32 @@ -155,12 +162,20 @@
       
    33    shell_file = shell_file_arg;
       
    34    if (STARTUP_WITH_SHELL)
       
    35      {
       
    36 +      struct stat buf1, buf2;
       
    37        /* Figure out what shell to start up the user program under.  */
       
    38        if (shell_file == NULL)
       
    39  	shell_file = getenv ("SHELL");
       
    40        if (shell_file == NULL)
       
    41  	shell_file = default_shell_file;
       
    42        shell = 1;
       
    43 +
       
    44 +      if (stat ("/usr/lib/isaexec", &buf1) == 0 &&
       
    45 +          stat (shell_file, &buf2) == 0 &&
       
    46 +          buf1.st_ino == buf2.st_ino &&
       
    47 +          buf1.st_dev == buf2.st_dev &&
       
    48 +          buf1.st_nlink == buf2.st_nlink)
       
    49 +        isaexec_shell = 1;
       
    50      }
       
    51  
       
    52    if (!shell)
       
    53 @@ -416,6 +431,8 @@
       
    54    int terminal_initted = 0;
       
    55    ptid_t resume_ptid;
       
    56  
       
    57 +  pending_execs += isaexec_shell;
       
    58 +
       
    59    if (target_supports_multi_process ())
       
    60      resume_ptid = pid_to_ptid (ptid_get_pid (inferior_ptid));
       
    61    else