comparison mx/commands.py @ 5194:a6eceb5efb0e

added --ecl option to mx for saving VM execution(s) as Eclipse launch configurations
author Doug Simon <doug.simon@oracle.com>
date Thu, 05 Apr 2012 22:35:28 +0200
parents 6fbf12b8e572
children e91f0761c56d
comparison
equal deleted inserted replaced
5193:02da376dd213 5194:a6eceb5efb0e
47 This can be set via the global '--fastdebug' and '--debug' options. """ 47 This can be set via the global '--fastdebug' and '--debug' options. """
48 _vmbuild = 'product' 48 _vmbuild = 'product'
49 49
50 _jacoco = 'off' 50 _jacoco = 'off'
51 51
52 _make_eclipse_launch = False
53
52 _jacocoExcludes = ['com.oracle.graal.hotspot.snippets.ArrayCopySnippets', 54 _jacocoExcludes = ['com.oracle.graal.hotspot.snippets.ArrayCopySnippets',
53 'com.oracle.graal.snippets.DoubleSnippets', 55 'com.oracle.graal.snippets.DoubleSnippets',
54 'com.oracle.graal.snippets.FloatSnippets', 56 'com.oracle.graal.snippets.FloatSnippets',
55 'com.oracle.graal.snippets.MathSnippetsX86', 57 'com.oracle.graal.snippets.MathSnippetsX86',
56 'com.oracle.graal.snippets.NodeClassSnippets', 58 'com.oracle.graal.snippets.NodeClassSnippets',
224 226
225 if len(failed) != 0: 227 if len(failed) != 0:
226 mx.abort('DaCapo failures: ' + str(failed)) 228 mx.abort('DaCapo failures: ' + str(failed))
227 229
228 def intro(args): 230 def intro(args):
229 """"run a simple program and visualize its compilation in the Graal Visualizer""" 231 """run a simple program and visualize its compilation in the Graal Visualizer"""
230 # Start the visualizer in a separate thread 232 # Start the visualizer in a separate thread
231 t = Thread(target=gv, args=([[]])) 233 t = Thread(target=gv, args=([[]]))
232 t.start() 234 t.start()
233 235
234 # Give visualizer time to start 236 # Give visualizer time to start
510 mx.log('Appending "' + prefix + ' KNOWN" to ' + jvmCfg) 512 mx.log('Appending "' + prefix + ' KNOWN" to ' + jvmCfg)
511 lines.append(vmKnown) 513 lines.append(vmKnown)
512 with open(jvmCfg, 'w') as f: 514 with open(jvmCfg, 'w') as f:
513 for line in lines: 515 for line in lines:
514 f.write(line) 516 f.write(line)
515 517
516 def vm(args, vm=None, nonZeroIsFatal=True, out=None, err=None, cwd=None, timeout=None, vmbuild=None): 518 def vm(args, vm=None, nonZeroIsFatal=True, out=None, err=None, cwd=None, timeout=None, vmbuild=None):
517 """run the VM selected by the '--vm' option""" 519 """run the VM selected by the '--vm' option"""
518 520
519 if vm is None: 521 if vm is None:
520 vm = _vm 522 vm = _vm
521 523
522 build = vmbuild if vmbuild is not None else _vmbuild if _vmSourcesAvailable else 'product' 524 build = vmbuild if vmbuild is not None else _vmbuild if _vmSourcesAvailable else 'product'
523 mx.expand_project_in_args(args) 525 mx.expand_project_in_args(args)
526 if _make_eclipse_launch:
527 mx.make_eclipse_launch(args, 'graal-' + build, name=None, deps=mx.project('com.oracle.graal.hotspot').all_deps([], True))
524 if len([a for a in args if 'PrintAssembly' in a]) != 0: 528 if len([a for a in args if 'PrintAssembly' in a]) != 0:
525 hsdis([]) 529 hsdis([])
526 if mx.java().debug_port is not None: 530 if mx.java().debug_port is not None:
527 args = ['-Xdebug', '-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=' + str(mx.java().debug_port)] + args 531 args = ['-Xdebug', '-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=' + str(mx.java().debug_port)] + args
528 if _jacoco == 'on' or _jacoco == 'append': 532 if _jacoco == 'on' or _jacoco == 'append':
941 if (_vmSourcesAvailable): 945 if (_vmSourcesAvailable):
942 mx.add_argument('--vm', action='store', dest='vm', default='graal', choices=['graal', 'server', 'client'], help='the VM to build/run (default: graal)') 946 mx.add_argument('--vm', action='store', dest='vm', default='graal', choices=['graal', 'server', 'client'], help='the VM to build/run (default: graal)')
943 mx.add_argument('--product', action='store_const', dest='vmbuild', const='product', help='select the product build of the VM') 947 mx.add_argument('--product', action='store_const', dest='vmbuild', const='product', help='select the product build of the VM')
944 mx.add_argument('--debug', action='store_const', dest='vmbuild', const='debug', help='select the debug build of the VM') 948 mx.add_argument('--debug', action='store_const', dest='vmbuild', const='debug', help='select the debug build of the VM')
945 mx.add_argument('--fastdebug', action='store_const', dest='vmbuild', const='fastdebug', help='select the fast debug build of the VM') 949 mx.add_argument('--fastdebug', action='store_const', dest='vmbuild', const='fastdebug', help='select the fast debug build of the VM')
950 mx.add_argument('--ecl', action='store_true', dest='make_eclipse_launch', help='create launch configuration for running VM execution(s) in Eclipse')
946 951
947 commands.update({ 952 commands.update({
948 'export': [export, '[-options] [zipfile]'], 953 'export': [export, '[-options] [zipfile]'],
949 'build': [build, '[-options] [product|debug|fastdebug]...'] 954 'build': [build, '[-options] [product|debug|fastdebug]...']
950 }) 955 })
965 global _vm 970 global _vm
966 _vm = opts.vm 971 _vm = opts.vm
967 if hasattr(opts, 'vmbuild') and opts.vmbuild is not None: 972 if hasattr(opts, 'vmbuild') and opts.vmbuild is not None:
968 global _vmbuild 973 global _vmbuild
969 _vmbuild = opts.vmbuild 974 _vmbuild = opts.vmbuild
975 global _make_eclipse_launch
976 _make_eclipse_launch = getattr(opts, 'make_eclipse_launch', False)
970 global _jacoco 977 global _jacoco
971 _jacoco = opts.jacoco 978 _jacoco = opts.jacoco