Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(155)

Unified Diff: tools/gypv8sh.py

Issue 386913002: Use LLDB in gypv8sh to debug random crashes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gypv8sh.py
diff --git a/tools/gypv8sh.py b/tools/gypv8sh.py
index ad6fa4a36328c24e7e7dc5df1b165fb773c395d4..8e8fd59fb1a27a3080636da580bbf84fb845607a 100755
--- a/tools/gypv8sh.py
+++ b/tools/gypv8sh.py
@@ -50,12 +50,38 @@ def main ():
if p.returncode:
# TODO(jochen): Remove once crbug.com/370551 is resolved.
if sys.platform == 'darwin':
- cmd[:0] = ['gdb', '-batch', '-ex', 'run', '-ex', 'bt', '-ex', 'quit',
- '-args']
- p = subprocess.Popen(
- cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, bufsize=0)
- out, err = p.communicate()
- raise Exception('Failed to run d8', out, err)
+ sys.path.insert(0, '/Developer/Library/PrivateFrameworks/'
+ 'LLDB.framework/Resources/Python')
+ try:
+ import lldb
+ except:
+ 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:
f.write(out)
shutil.copyfile(inputfile, jsoutfile)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698