4 lldb-repro is a utility to transparently capture and replay debugger sessions
5 through the command line driver. Its used to test the reproducers by running
8 During the first run, with 'capture' as its first argument, it captures a
9 reproducer for every lldb invocation and saves it to a well-know location
10 derived from the arguments and current working directory.
12 During the second run, with 'replay' as its first argument, the test suite is
13 run again but this time every invocation of lldb replays the previously
24 print("usage: {} capture|replay [args]".fmt(sys.argv[0]))
32 # Compute a hash based on the input arguments and the current working
34 args = ' '.join(sys.argv[3:])
36 input_hash = str(hash((cwd, args)))
38 # Use the hash to "uniquely" identify a reproducer path.
39 reproducer_path = os.path.join(tempfile.gettempdir(), input_hash)
41 # Create a new lldb invocation with capture or replay enabled.
42 lldb = os.path.join(os.path.dirname(sys.argv[0]), 'lldb')
43 new_args = [sys.argv[1]]
44 if sys.argv[2] == "replay":
45 new_args.extend(['--replay', reproducer_path])
46 elif sys.argv[2] == "capture":
48 '--capture', '--capture-path', reproducer_path,
49 '--reproducer-auto-generate'
51 new_args.extend(sys.argv[1:])
56 return subprocess.call(new_args)
59 if __name__ == '__main__':