diff --git a/tools/dev/gm.py b/tools/dev/gm.py index 61242fd36b..e7a4a239e0 100755 --- a/tools/dev/gm.py +++ b/tools/dev/gm.py @@ -206,6 +206,16 @@ def GetPath(arch, mode): subdir = "%s.%s" % (arch, mode) return os.path.join(OUTDIR, subdir) +def PrepareMksnapshotCmdline(orig_cmdline, path): + result = "gdb --args %s/mksnapshot " % path + for w in orig_cmdline.split(" "): + if w.startswith("gen/") or w.startswith("snapshot_blob"): + result += ("%(path)s%(sep)s%(arg)s " % + {"path": path, "sep": os.sep, "arg": w}) + else: + result += "%s " % w + return result + class Config(object): def __init__(self, arch, mode, targets, tests=[]): self.arch = arch @@ -266,32 +276,16 @@ class Config(object): return_code, output = _CallWithOutput("autoninja -C %s %s" % (path, targets)) - if return_code != 0 and "FAILED: snapshot_blob.bin" in output: + if return_code != 0 and "FAILED:" in output and "snapshot_blob" in output: csa_trap = re.compile("Specify option( --csa-trap-on-node=[^ ]*)") match = csa_trap.search(output) extra_opt = match.group(1) if match else "" + cmdline = re.compile("python ../../tools/run.py ./mksnapshot (.*)") + match = cmdline.search(output) + cmdline = PrepareMksnapshotCmdline(match.group(1), path) + extra_opt _Notify("V8 build requires your attention", "Detected mksnapshot failure, re-running in GDB...") - _Call("gdb -args %(path)s/mksnapshot " - "--startup_src %(path)s/gen/snapshot.cc " - "--random-seed 314159265 " - "--startup-blob %(path)s/snapshot_blob.bin" - "%(extra)s"% {"path": path, "extra": extra_opt}) - if (return_code != 0 and - "FAILED: gen/embedded.cc snapshot_blob.bin" in output): - csa_trap = re.compile("Specify option( --csa-trap-on-node=[^ ]*)") - match = csa_trap.search(output) - extra_opt = match.group(1) if match else "" - _Notify("V8 build requires your attention", - "Detected mksnapshot failure, re-running in GDB...") - _Call("gdb -args %(path)s/mksnapshot " - "--turbo-instruction-scheduling " - "--embedded_src %(path)s/gen/embedded.cc " - "--embedded_variant Default " - "--startup_src %(path)s/gen/snapshot.cc " - "--random-seed 314159265 " - "--startup-blob %(path)s/snapshot_blob.bin" - "%(extra)s"% {"path": path, "extra": extra_opt}) + _Call(cmdline) return return_code def RunTests(self):