summaryrefslogtreecommitdiff
path: root/gdb/fork-child.c
diff options
context:
space:
mode:
authornobody <>2003-05-09 16:41:43 +0000
committernobody <>2003-05-09 16:41:43 +0000
commitb41719d9f61907f1c810753438454c6f5656347b (patch)
treea9a2a8e140602339a92e5990e1238c48b6d14f34 /gdb/fork-child.c
parent291862d73dc6b445dae7638c7490d74473dea27c (diff)
downloadbinutils-gdb-b41719d9f61907f1c810753438454c6f5656347b.tar.gz
This commit was manufactured by cvs2svn to create branch 'jimb-jimb-ppc64-linux-20030509-branchpoint
ppc64-linux-20030509-branch'. Sprout from kettenis_i386newframe-20030419-branch 2003-04-19 14:43:51 UTC nobody 'This commit was manufactured by cvs2svn to create branch' Cherrypick from kettenis_i386newframe-20030419-branch 2003-05-04 03:57:40 UTC nobody 'This commit was manufactured by cvs2svn to create branch': bfd/elf32-m68hc1x.h gdb/infcall.h gdb/mi/mi-cmd-symbol.c gdb/testsuite/gdb.mi/mi1-symbol.exp Cherrypick from master 2003-05-09 16:41:42 UTC Martin Schwidefsky <schwidefsky@de.ibm.com> ' * elf32-s390.c (allocate_dynrelocs, elf_s390_relocate_section):': ChangeLog MAINTAINERS Makefile.in Makefile.tpl bfd/ChangeLog bfd/Makefile.am bfd/Makefile.in bfd/acinclude.m4 bfd/aclocal.m4 bfd/archures.c bfd/bfd-in.h bfd/bfd-in2.h bfd/coff-h8300.c bfd/coffcode.h bfd/configure bfd/configure.in bfd/cpu-arm.c bfd/cpu-h8300.c bfd/cpu-sh.c bfd/elf-bfd.h bfd/elf-m10200.c bfd/elf-m10300.c bfd/elf.c bfd/elf32-arm.h bfd/elf32-h8300.c bfd/elf32-hppa.c bfd/elf32-i386.c bfd/elf32-ip2k.c bfd/elf32-iq2000.c bfd/elf32-m32r.c bfd/elf32-m68hc11.c bfd/elf32-m68hc12.c bfd/elf32-m68hc1x.c bfd/elf32-m68k.c bfd/elf32-mips.c bfd/elf32-ppc.c bfd/elf32-s390.c bfd/elf32-sh.c bfd/elf32-sh64-com.c bfd/elf32-sh64.c bfd/elf32-v850.c bfd/elf32-xstormy16.c bfd/elf32-xtensa.c bfd/elf64-alpha.c bfd/elf64-hppa.c bfd/elf64-mips.c bfd/elf64-mmix.c bfd/elf64-ppc.c bfd/elf64-s390.c bfd/elf64-sh64.c bfd/elf64-sparc.c bfd/elf64-x86-64.c bfd/elfcode.h bfd/elflink.c bfd/elflink.h bfd/elfxx-ia64.c bfd/elfxx-mips.c bfd/reloc.c bfd/section.c bfd/version.h bfd/xtensa-isa.c bfd/xtensa-modules.c config-ml.in cpu/ChangeLog gdb/ChangeLog gdb/Makefile.in gdb/ada-lang.c gdb/ada-valprint.c gdb/alpha-nat.c gdb/alpha-tdep.c gdb/alpha-tdep.h gdb/alphabsd-nat.c gdb/alphafbsd-tdep.c gdb/alphanbsd-tdep.c gdb/arch-utils.c gdb/arch-utils.h gdb/arm-linux-tdep.c gdb/arm-tdep.c gdb/avr-tdep.c gdb/blockframe.c gdb/breakpoint.c gdb/breakpoint.h gdb/c-lang.c gdb/charset.c gdb/charset.h gdb/cli/cli-cmds.c gdb/cli/cli-cmds.h gdb/config/djgpp/fnchange.lst gdb/config/i386/nto.mt gdb/config/i386/tm-nto.h gdb/config/ia64/tm-ia64.h gdb/config/m68k/tm-vx68.h gdb/config/mips/tm-mips.h gdb/config/pa/nm-hppah.h gdb/config/pa/tm-hppa.h gdb/config/pa/tm-hppa64.h gdb/config/s390/tm-s390.h gdb/config/sparc/tm-sp64.h gdb/config/sparc/tm-sparc.h gdb/config/tm-nto.h gdb/config/vax/nm-vax.h gdb/configure.tgt gdb/corefile.c gdb/cp-support.c gdb/cris-tdep.c gdb/d10v-tdep.c gdb/defs.h gdb/disasm.c gdb/disasm.h gdb/doc/ChangeLog gdb/doc/gdb.texinfo gdb/doc/gdbint.texinfo gdb/dummy-frame.c gdb/dummy-frame.h gdb/dve3900-rom.c gdb/dwarf2cfi.c gdb/dwarf2loc.c gdb/dwarf2read.c gdb/eval.c gdb/findvar.c gdb/fork-child.c gdb/frame.c gdb/frame.h gdb/frv-tdep.c gdb/gcore.c gdb/gdbarch.c gdb/gdbarch.h gdb/gdbarch.sh gdb/gdbcmd.h gdb/gdbserver/ChangeLog gdb/gdbserver/low-nbsd.c gdb/gdbthread.h gdb/h8300-tdep.c gdb/hppa-tdep.c gdb/hppab-nat.c gdb/hppah-nat.c gdb/hpux-thread.c gdb/i386-linux-nat.c gdb/i386-nto-tdep.c gdb/i386-tdep.c gdb/i387-tdep.c gdb/ia64-tdep.c gdb/infcall.c gdb/infcmd.c gdb/inferior.h gdb/infptrace.c gdb/infrun.c gdb/irix4-nat.c gdb/linespec.c gdb/lynx-nat.c gdb/m68hc11-tdep.c gdb/m68k-tdep.c gdb/m68klinux-nat.c gdb/maint.c gdb/mcore-tdep.c gdb/mi/ChangeLog gdb/mi/mi-cmds.c gdb/mi/mi-cmds.h gdb/mi/mi-main.c gdb/mips-linux-tdep.c gdb/mips-nat.c gdb/mips-tdep.c gdb/mipsv4-nat.c gdb/mn10300-tdep.c gdb/monitor.c gdb/nlm/i386.c gdb/nlm/i386.h gdb/ns32k-tdep.c gdb/ns32knbsd-nat.c gdb/nto-tdep.c gdb/nto-tdep.h gdb/objc-lang.c gdb/objfiles.c gdb/ppc-linux-nat.c gdb/printcmd.c gdb/procfs.c gdb/regcache.c gdb/regcache.h gdb/remote-array.c gdb/remote-e7000.c gdb/remote-mips.c gdb/remote-rdp.c gdb/remote-sim.c gdb/remote.c gdb/rom68k-rom.c gdb/rs6000-nat.c gdb/rs6000-tdep.c gdb/s390-tdep.c gdb/scm-lang.c gdb/sentinel-frame.c gdb/sh-tdep.c gdb/sol-thread.c gdb/sparc-tdep.c gdb/stack.c gdb/std-regs.c gdb/symmisc.c gdb/symtab.c gdb/symtab.h gdb/target.c gdb/target.h gdb/testsuite/ChangeLog gdb/testsuite/Makefile.in gdb/testsuite/configure gdb/testsuite/configure.in gdb/testsuite/gdb.asm/asm-source.exp gdb/testsuite/gdb.asm/s390x.inc gdb/testsuite/gdb.base/charset.exp gdb/testsuite/gdb.base/maint.exp gdb/testsuite/gdb.base/signals.exp gdb/testsuite/gdb.base/watchpoint.exp gdb/testsuite/gdb.c++/maint.exp gdb/testsuite/gdb.mi/ChangeLog gdb/testsuite/gdb.objc/Makefile.in gdb/testsuite/gdb.objc/basicclass.exp gdb/testsuite/gdb.objc/basicclass.m gdb/testsuite/gdb.threads/schedlock.exp gdb/testsuite/lib/gdb.exp gdb/thread-db.c gdb/thread.c gdb/tracepoint.c gdb/tui/ChangeLog gdb/tui/tuiDisassem.c gdb/tui/tuiRegs.c gdb/v850-tdep.c gdb/valarith.c gdb/valops.c gdb/value.h gdb/vax-tdep.c gdb/version.in gdb/x86-64-tdep.c gdb/xstormy16-tdep.c include/ChangeLog include/bfdlink.h include/coff/ChangeLog include/coff/h8300.h include/elf/ChangeLog include/elf/common.h include/elf/h8.h include/gdb/ChangeLog include/gdb/sim-d10v.h include/hashtab.h include/xtensa-isa-internal.h libiberty/ChangeLog libiberty/aclocal.m4 libiberty/config.in libiberty/configure libiberty/configure.in libiberty/cp-demangle.c libiberty/hashtab.c libiberty/splay-tree.c libiberty/vsnprintf.c opcodes/ChangeLog opcodes/fr30-desc.c opcodes/fr30-desc.h opcodes/fr30-opc.c opcodes/fr30-opc.h opcodes/frv-desc.c opcodes/frv-desc.h opcodes/frv-opc.c opcodes/frv-opc.h opcodes/i386-dis.c opcodes/ip2k-desc.c opcodes/ip2k-desc.h opcodes/ip2k-opc.c opcodes/ip2k-opc.h opcodes/m32r-desc.c opcodes/m32r-desc.h opcodes/m32r-opc.c opcodes/m32r-opc.h opcodes/m32r-opinst.c opcodes/openrisc-desc.c opcodes/openrisc-desc.h opcodes/openrisc-opc.c opcodes/openrisc-opc.h opcodes/xstormy16-desc.c opcodes/xstormy16-desc.h opcodes/xstormy16-opc.c opcodes/xstormy16-opc.h opcodes/z8k-dis.c sim/d10v/ChangeLog sim/d10v/interp.c sim/igen/ChangeLog sim/igen/compare_igen_models sim/mips/ChangeLog sim/mips/cp1.c sim/mips/cp1.h sim/mips/mdmx.c sim/mips/mdmx.igen sim/mips/mips3d.igen sim/mips/sb1.igen src-release
Diffstat (limited to 'gdb/fork-child.c')
-rw-r--r--gdb/fork-child.c30
1 files changed, 25 insertions, 5 deletions
diff --git a/gdb/fork-child.c b/gdb/fork-child.c
index 1dc28e822d4..e1d32b06452 100644
--- a/gdb/fork-child.c
+++ b/gdb/fork-child.c
@@ -88,6 +88,29 @@ breakup_args (char *scratch, char **argv)
}
+/* When executing a command under the given shell, return non-zero
+ if the '!' character should be escaped when embedded in a quoted
+ command-line argument. */
+
+static int
+escape_bang_in_quoted_argument (const char *shell_file)
+{
+ const int shell_file_len = strlen (shell_file);
+
+ /* Bang should be escaped only in C Shells. For now, simply check
+ that the shell name ends with 'csh', which covers at least csh
+ and tcsh. This should be good enough for now. */
+
+ if (shell_file_len < 3)
+ return 0;
+
+ if (shell_file[shell_file_len - 3] == 'c'
+ && shell_file[shell_file_len - 2] == 's'
+ && shell_file[shell_file_len - 1] == 'h')
+ return 1;
+
+ return 0;
+}
/* Start an inferior Unix child process and sets inferior_ptid to its pid.
EXEC_FILE is the file to run.
@@ -171,6 +194,7 @@ fork_inferior (char *exec_file_arg, char *allargs, char **env,
char *p;
int need_to_quote;
+ const int escape_bang = escape_bang_in_quoted_argument (shell_file);
strcat (shell_command, "exec ");
@@ -215,7 +239,7 @@ fork_inferior (char *exec_file_arg, char *allargs, char **env,
{
if (*p == '\'')
strcat (shell_command, "'\\''");
- else if (*p == '!')
+ else if (*p == '!' && escape_bang)
strcat (shell_command, "\\!");
else
strncat (shell_command, p, 1);
@@ -404,9 +428,6 @@ startup_inferior (int ntraps)
inferior_ignoring_leading_exec_events =
target_reported_exec_events_per_exec_call () - 1;
-#ifdef STARTUP_INFERIOR
- STARTUP_INFERIOR (pending_execs);
-#else
while (1)
{
/* Make wait_for_inferior be quiet */
@@ -444,6 +465,5 @@ startup_inferior (int ntraps)
resume (0, TARGET_SIGNAL_0); /* Just make it go on */
}
}
-#endif /* STARTUP_INFERIOR */
stop_soon = NO_STOP_QUIETLY;
}