Fix gdb_spawn_with_cmdline_opts with non-empty GDBFLAGS
authorPedro Alves <palves@redhat.com>
Mon, 30 Mar 2015 17:00:28 +0000 (18:00 +0100)
committerPedro Alves <palves@redhat.com>
Wed, 1 Apr 2015 14:25:21 +0000 (15:25 +0100)
commit0bbeccb1eea844c2124eeb1e8d8d4a6cf7092d7a
tree877b5edabd719f503d709da6ea697bcd933b495a
parent1176ecec7082b4d6b4a3d965ef77726899c9eda2
Fix gdb_spawn_with_cmdline_opts with non-empty GDBFLAGS

Running attach.exp with a DejaGnu board that sets GDBFLAGS, like
e.g.,:

  set GDBFLAGS "-ex \"set displaced off\""

fails with (line breaks added for clarity):

 (gdb) PASS: gdb.base/attach.exp: starting with --pid
 Executing on build: kill -9 3537    (timeout = 300)
 spawn -ignore SIGHUP kill -9 3537
 spawn of build/gdb/gdb -nw -nx \
  -data-directory build/gdb/testsuite/../data-directory  \
  -ex "set displaced off"-iex "set height 0" -iex "set width 0" \
                     ^^^^^^^^
  --pid=4468 -ex "start"  failed
 ERROR: Spawning build/gdb/gdb failed.
 UNRESOLVED: gdb.base/attach.exp: cmdline attach run: run to prompt

gdb/testsuite/ChangeLog:
2015-04-01  Pedro Alves  <palves@redhat.com>

* lib/gdb.exp (gdb_spawn_with_cmdline_opts): Append space to
GDBFLAGS if not empty.
gdb/testsuite/ChangeLog
gdb/testsuite/lib/gdb.exp