aboutsummaryrefslogtreecommitdiff
path: root/binary_search_tool
diff options
context:
space:
mode:
authorCassidy Burden <cburden@google.com>2016-08-02 14:52:22 -0700
committerchrome-bot <chrome-bot@chromium.org>2016-08-05 17:35:28 -0700
commita8f9ceefac8a7088f3bb1154c8add6d24d5e62da (patch)
tree77cc6131311a89e56f2aa4ab676607a8dbdc6c56 /binary_search_tool
parentf1fe83c3276136a7b7dcd7e499e67b4a16e4a5f1 (diff)
downloadtoolchain-utils-a8f9ceefac8a7088f3bb1154c8add6d24d5e62da.tar.gz
binary search tool: Add option to always run compiler
Similar to sysroot_wrapper, add option that will always call compiler during triage stage. This option is safer, but much slower. TEST=Test with NDK app with missing side effects Change-Id: I242d7267c52e50989bcc5968f132956ba1cd3105 Reviewed-on: https://chrome-internal-review.googlesource.com/273457 Commit-Ready: Cassidy Burden <cburden@google.com> Tested-by: Cassidy Burden <cburden@google.com> Reviewed-by: Caroline Tice <cmtice@google.com>
Diffstat (limited to 'binary_search_tool')
-rw-r--r--binary_search_tool/bisect_driver.py19
-rwxr-xr-xbinary_search_tool/compiler_wrapper.py3
2 files changed, 20 insertions, 2 deletions
diff --git a/binary_search_tool/bisect_driver.py b/binary_search_tool/bisect_driver.py
index 0e3d3998..c151f7b9 100644
--- a/binary_search_tool/bisect_driver.py
+++ b/binary_search_tool/bisect_driver.py
@@ -8,6 +8,9 @@ This module contains a set of utilities to allow bisection between
two sets (good and bad) of object files. Mostly used to find compiler
bugs.
+Reference page:
+https://sites.google.com/a/google.com/chromeos-toolchain-team-home2/home/team-tools-and-scripts/bisecting-chromeos-compiler-problems/bisection-compiler-wrapper
+
Design doc:
https://docs.google.com/document/d/1yDgaUIa2O5w6dc3sSTe1ry-1ehKajTGJGQCbyn0fcEM
"""
@@ -27,6 +30,7 @@ BAD_CACHE = 'bad'
LIST_FILE = os.path.join(GOOD_CACHE, '_LIST')
CONTINUE_ON_MISSING = os.environ.get('BISECT_CONTINUE_ON_MISSING', None) == '1'
+WRAPPER_SAFE_MODE = os.environ.get('BISECT_WRAPPER_SAFE_MODE', None) == '1'
class Error(Exception):
@@ -241,8 +245,8 @@ def restore_file(bisect_dir, cache, abs_file_path):
os.remove(abs_file_path)
os.link(cached_path, abs_file_path)
else:
- raise Error(('%s is missing from %s cache! Unsure how to proceed. Make will'
- 'now crash.' % (cache, cached_path)))
+ raise Error(('%s is missing from %s cache! Unsure how to proceed. Make '
+ 'will now crash.' % (cache, cached_path)))
def bisect_populate(execargs, bisect_dir, population_name):
@@ -299,6 +303,17 @@ def bisect_triage(execargs, bisect_dir):
cache = which_cache(full_obj_path)
+ # If using safe WRAPPER_SAFE_MODE option call compiler and overwrite the
+ # result from the good/bad cache. This option is safe and covers all compiler
+ # side effects, but is very slow!
+ if WRAPPER_SAFE_MODE:
+ retval = exec_and_return(execargs)
+ if retval:
+ return retval
+ os.remove(full_obj_path)
+ restore_file(bisect_dir, cache, full_obj_path)
+ return
+
# Generate compiler side effects. Trick Make into thinking compiler was
# actually executed.
for side_effect in get_side_effects(execargs):
diff --git a/binary_search_tool/compiler_wrapper.py b/binary_search_tool/compiler_wrapper.py
index 54d5d7ea..35a28e6a 100755
--- a/binary_search_tool/compiler_wrapper.py
+++ b/binary_search_tool/compiler_wrapper.py
@@ -8,6 +8,9 @@ Installation instructions:
<compiler_name>. compiler_wrapper.py can live anywhere as long as it is
executable.
+Reference page:
+https://sites.google.com/a/google.com/chromeos-toolchain-team-home2/home/team-tools-and-scripts/bisecting-chromeos-compiler-problems/bisection-compiler-wrapper
+
Design doc:
https://docs.google.com/document/d/1yDgaUIa2O5w6dc3sSTe1ry-1ehKajTGJGQCbyn0fcEM
"""