Mercurial > hg > graal-jvmci-8
comparison mxtool/mx.py @ 16167:1f4955abca9b
mx: add jol command for java object layout introspection
author | Andreas Woess <andreas.woess@jku.at> |
---|---|
date | Fri, 20 Jun 2014 13:43:47 +0200 |
parents | 64e172733061 |
children | 55f369530122 |
comparison
equal
deleted
inserted
replaced
16166:d69ede72299a | 16167:1f4955abca9b |
---|---|
4486 def _kwArg(kwargs): | 4486 def _kwArg(kwargs): |
4487 if len(kwargs) > 0: | 4487 if len(kwargs) > 0: |
4488 return kwargs.pop(0) | 4488 return kwargs.pop(0) |
4489 return None | 4489 return None |
4490 | 4490 |
4491 def findclass(args, logToConsole=True): | 4491 def findclass(args, logToConsole=True, matcher=lambda string, classname: string in classname): |
4492 """find all classes matching a given substring""" | 4492 """find all classes matching a given substring""" |
4493 matches = [] | 4493 matches = [] |
4494 for entry, filename in classpath_walk(includeBootClasspath=True): | 4494 for entry, filename in classpath_walk(includeBootClasspath=True): |
4495 if filename.endswith('.class'): | 4495 if filename.endswith('.class'): |
4496 if isinstance(entry, zipfile.ZipFile): | 4496 if isinstance(entry, zipfile.ZipFile): |
4497 classname = filename.replace('/', '.') | 4497 classname = filename.replace('/', '.') |
4498 else: | 4498 else: |
4499 classname = filename.replace(os.sep, '.') | 4499 classname = filename.replace(os.sep, '.') |
4500 classname = classname[:-len('.class')] | 4500 classname = classname[:-len('.class')] |
4501 for a in args: | 4501 for a in args: |
4502 if a in classname: | 4502 if matcher(a, classname): |
4503 matches.append(classname) | 4503 matches.append(classname) |
4504 if logToConsole: | 4504 if logToConsole: |
4505 log(classname) | 4505 log(classname) |
4506 return matches | 4506 return matches |
4507 | 4507 |