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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """This script is used by chrome_tests.gypi's js2webui action to maintain the 6 """This script is used by chrome_tests.gypi's js2webui action to maintain the
7 argument lists and to generate inlinable tests. 7 argument lists and to generate inlinable tests.
8 """ 8 """
9 9
10 import json 10 import json
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 if opts.verbose or opts.impotent: 43 if opts.verbose or opts.impotent:
44 print cmd 44 print cmd
45 if not opts.impotent: 45 if not opts.impotent:
46 try: 46 try:
47 p = subprocess.Popen( 47 p = subprocess.Popen(
48 cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, bufsize=0) 48 cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, bufsize=0)
49 out, err = p.communicate() 49 out, err = p.communicate()
50 if p.returncode: 50 if p.returncode:
51 # TODO(jochen): Remove once crbug.com/370551 is resolved. 51 # TODO(jochen): Remove once crbug.com/370551 is resolved.
52 if sys.platform == 'darwin': 52 if sys.platform == 'darwin':
53 cmd[:0] = ['gdb', '-batch', '-ex', 'run', '-ex', 'bt', '-ex', 'quit', 53 sys.path.insert(0, '/Developer/Library/PrivateFrameworks/'
54 '-args'] 54 'LLDB.framework/Resources/Python')
55 p = subprocess.Popen( 55 try:
56 cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, bufsize=0) 56 import lldb
57 out, err = p.communicate() 57 except:
58 raise Exception('Failed to run d8', out, err) 58 raise Exception("Could not load lldb module")
59 debugger = lldb.SBDebugger.Create()
60 debugger.SetAsync(False)
61 target = debugger.CreateTargetWithFileAndArch(
62 cmd[0], lldb.LLDB_ARCH_DEFAULT)
63 if not target:
64 raise Exception("Failed to create d8 target")
65 process = target.LaunchSimple(cmd[1:], None, os.getcwd())
66 if not process:
67 raise Exception("Failed to start d8")
68 if process.GetState() == lldb.eStateStopped:
69 for thread in process:
70 print "Thread (id %d)" % thread.GetThreadID()
71 for frame in thread:
72 print frame
73 print ""
74 raise Exception(
75 "d8 crashed, please report this at http://crbug.com/370551")
76 else:
77 # For some reason d8 worked this time...
78 out = ''
79 while True:
80 s = process.GetSTDOUT(4096)
81 if s == '':
82 break
83 out += s
84
59 with open(cxxoutfile, 'wb') as f: 85 with open(cxxoutfile, 'wb') as f:
60 f.write(out) 86 f.write(out)
61 shutil.copyfile(inputfile, jsoutfile) 87 shutil.copyfile(inputfile, jsoutfile)
62 except Exception, ex: 88 except Exception, ex:
63 if os.path.exists(cxxoutfile): 89 if os.path.exists(cxxoutfile):
64 os.remove(cxxoutfile) 90 os.remove(cxxoutfile)
65 if os.path.exists(jsoutfile): 91 if os.path.exists(jsoutfile):
66 os.remove(jsoutfile) 92 os.remove(jsoutfile)
67 raise 93 raise
68 94
69 95
70 if __name__ == '__main__': 96 if __name__ == '__main__':
71 sys.exit(main()) 97 sys.exit(main())
OLDNEW
« 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