Commit 7abe3e80 authored by jochen@chromium.org's avatar jochen@chromium.org

Use LLDB in gypv8sh to debug random crashes.

Nico tells me that lldb is better than gdb. So give it a try.

BUG=370551
R=marja@chromium.org

Review URL: https://codereview.chromium.org/386913002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@282607 0039d316-1c4b-4281-b951-d872f2087c98
parent 6abc8081
...@@ -50,12 +50,38 @@ def main (): ...@@ -50,12 +50,38 @@ def main ():
if p.returncode: if p.returncode:
# TODO(jochen): Remove once crbug.com/370551 is resolved. # TODO(jochen): Remove once crbug.com/370551 is resolved.
if sys.platform == 'darwin': if sys.platform == 'darwin':
cmd[:0] = ['gdb', '-batch', '-ex', 'run', '-ex', 'bt', '-ex', 'quit', sys.path.insert(0, '/Developer/Library/PrivateFrameworks/'
'-args'] 'LLDB.framework/Resources/Python')
p = subprocess.Popen( try:
cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, bufsize=0) import lldb
out, err = p.communicate() except:
raise Exception('Failed to run d8', out, err) raise Exception("Could not load lldb module")
debugger = lldb.SBDebugger.Create()
debugger.SetAsync(False)
target = debugger.CreateTargetWithFileAndArch(
cmd[0], lldb.LLDB_ARCH_DEFAULT)
if not target:
raise Exception("Failed to create d8 target")
process = target.LaunchSimple(cmd[1:], None, os.getcwd())
if not process:
raise Exception("Failed to start d8")
if process.GetState() == lldb.eStateStopped:
for thread in process:
print "Thread (id %d)" % thread.GetThreadID()
for frame in thread:
print frame
print ""
raise Exception(
"d8 crashed, please report this at http://crbug.com/370551")
else:
# For some reason d8 worked this time...
out = ''
while True:
s = process.GetSTDOUT(4096)
if s == '':
break
out += s
with open(cxxoutfile, 'wb') as f: with open(cxxoutfile, 'wb') as f:
f.write(out) f.write(out)
shutil.copyfile(inputfile, jsoutfile) shutil.copyfile(inputfile, jsoutfile)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment