Tools: autotest: add option to disable breakpoints at sim startup

This commit is contained in:
Peter Barker 2019-07-12 10:58:46 +10:00 committed by Peter Barker
parent 5987131958
commit 87e43d6e44
3 changed files with 13 additions and 0 deletions

View File

@ -380,6 +380,7 @@ def run_step(step):
"gdb": opts.gdb, "gdb": opts.gdb,
"gdbserver": opts.gdbserver, "gdbserver": opts.gdbserver,
"breakpoints": opts.breakpoint, "breakpoints": opts.breakpoint,
"disable_breakpoints": opts.disable_breakpoints,
"frame": opts.frame, "frame": opts.frame,
"_show_test_timings": opts.show_test_timings, "_show_test_timings": opts.show_test_timings,
} }
@ -727,6 +728,10 @@ if __name__ == "__main__":
action="append", action="append",
default=[], default=[],
help="add a breakpoint at given location in debugger") help="add a breakpoint at given location in debugger")
group_sim.add_option("--disable-breakpoints",
default=False,
action='store_true',
help="disable all breakpoints before starting")
parser.add_option_group(group_sim) parser.add_option_group(group_sim)
opts, args = parser.parse_args() opts, args = parser.parse_args()

View File

@ -169,6 +169,7 @@ class AutoTest(ABC):
params=None, params=None,
gdbserver=False, gdbserver=False,
breakpoints=[], breakpoints=[],
disable_breakpoints=False,
viewerip=None, viewerip=None,
use_map=False, use_map=False,
_show_test_timings=False): _show_test_timings=False):
@ -180,6 +181,7 @@ class AutoTest(ABC):
self.params = params self.params = params
self.gdbserver = gdbserver self.gdbserver = gdbserver
self.breakpoints = breakpoints self.breakpoints = breakpoints
self.disable_breakpoints = disable_breakpoints
self.speedup = speedup self.speedup = speedup
self.mavproxy = None self.mavproxy = None
@ -2007,6 +2009,7 @@ class AutoTest(ABC):
self.progress("Starting simulator") self.progress("Starting simulator")
self.sitl = util.start_SITL(self.binary, self.sitl = util.start_SITL(self.binary,
breakpoints=self.breakpoints, breakpoints=self.breakpoints,
disable_breakpoints=self.disable_breakpoints,
defaults_file=self.defaults_filepath(), defaults_file=self.defaults_filepath(),
gdb=self.gdb, gdb=self.gdb,
gdbserver=self.gdbserver, gdbserver=self.gdbserver,

View File

@ -227,6 +227,7 @@ def start_SITL(binary,
unhide_parameters=False, unhide_parameters=False,
gdbserver=False, gdbserver=False,
breakpoints=[], breakpoints=[],
disable_breakpoints=False,
vicon=False): vicon=False):
"""Launch a SITL instance.""" """Launch a SITL instance."""
cmd = [] cmd = []
@ -253,6 +254,8 @@ def start_SITL(binary,
f.write("target extended-remote localhost:3333\nc\n") f.write("target extended-remote localhost:3333\nc\n")
for breakpoint in breakpoints: for breakpoint in breakpoints:
f.write("b %s\n" % (breakpoint,)) f.write("b %s\n" % (breakpoint,))
if disable_breakpoints:
f.write("disable\n")
f.close() f.close()
run_cmd('screen -d -m -S ardupilot-gdbserver ' run_cmd('screen -d -m -S ardupilot-gdbserver '
'bash -c "gdb -x /tmp/x.gdb"') 'bash -c "gdb -x /tmp/x.gdb"')
@ -260,6 +263,8 @@ def start_SITL(binary,
f = open("/tmp/x.gdb", "w") f = open("/tmp/x.gdb", "w")
for breakpoint in breakpoints: for breakpoint in breakpoints:
f.write("b %s\n" % (breakpoint,)) f.write("b %s\n" % (breakpoint,))
if disable_breakpoints:
f.write("disable\n")
f.write("r\n") f.write("r\n")
f.close() f.close()
if os.environ.get('DISPLAY'): if os.environ.get('DISPLAY'):