[lldb/Reproducer] Add version check
authorJonas Devlieghere <jonas@devlieghere.com>
Tue, 3 Dec 2019 15:53:23 +0000 (07:53 -0800)
committerJonas Devlieghere <jonas@devlieghere.com>
Tue, 3 Dec 2019 15:54:42 +0000 (07:54 -0800)
commit62827737acd878af6cd8930758b0d6f297173f40
tree126b0cb5ef3db51cf8702002cce68aabda05242d
parentf2e7de81c625413a7f682c757ab64e7b63b48800
[lldb/Reproducer] Add version check

To ensure a reproducer works correctly, the version of LLDB used for
capture and replay must match. Right now the reproducer already contains
the LLDB version. However, this is purely informative. LLDB will happily
replay a reproducer generated with a different version of LLDB, which
can cause subtle differences.

This patch adds a version check which compares the current LLDB version
with the one in the reproducer. If the version doesn't match, LLDB will
refuse to replay. It also adds an escape hatch to make it possible to
still replay the reproducer without having to mess with the recorded
version. This might prove useful when you know two versions of LLDB
match, even though the version string doesn't. This behavior is
triggered by passing a new flag -reproducer-skip-version-check to the
lldb driver.

Differential revision: https://reviews.llvm.org/D70934
lldb/include/lldb/API/SBReproducer.h
lldb/source/API/SBReproducer.cpp
lldb/test/Shell/Reproducer/TestVersionCheck.test [new file with mode: 0644]
lldb/tools/driver/Driver.cpp
lldb/tools/driver/Options.td