From a7b919f025242c611256dc41d6a7e2e9f7d05a5b Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Thu, 24 Aug 2017 21:35:53 +1000 Subject: [PATCH] Tools: do not attach gdb to gdbserver unless --gdb is given --- Tools/autotest/pysim/util.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/Tools/autotest/pysim/util.py b/Tools/autotest/pysim/util.py index 58f7dde7be..013a87eb82 100644 --- a/Tools/autotest/pysim/util.py +++ b/Tools/autotest/pysim/util.py @@ -194,17 +194,19 @@ def start_SITL(binary, valgrind=False, gdb=False, wipe=False, cmd = [] if valgrind and os.path.exists('/usr/bin/valgrind'): cmd.extend(['valgrind', '-q', '--log-file=%s' % valgrind_log_filepath(binary=binary, model=model)]) - if gdb: + if gdbserver: + cmd.extend(['gdbserver', 'localhost:3333']) + if gdb: + # attach gdb to the gdbserver: + f = open("/tmp/x.gdb", "w") + f.write("target extended-remote localhost:3333\nc\n") + f.close() + run_cmd('screen -d -m -S ardupilot-gdb bash -c "gdb -x /tmp/x.gdb"') + elif gdb: f = open("/tmp/x.gdb", "w") f.write("r\n") f.close() cmd.extend(['xterm', '-e', 'gdb', '-x', '/tmp/x.gdb', '--args']) - if gdbserver: - f = open("/tmp/x.gdb", "w") - f.write("target extended-remote localhost:3333\nc\n") - f.close() - cmd.extend(['gdbserver', 'localhost:3333']) - run_cmd('screen -d -m -S ardupilot-gdb bash -c "gdb -x /tmp/x.gdb"') cmd.append(binary) if wipe: