diff options
Diffstat (limited to 'tools/genv8constants.py')
-rwxr-xr-x | tools/genv8constants.py | 27 |
1 files changed, 7 insertions, 20 deletions
diff --git a/tools/genv8constants.py b/tools/genv8constants.py index 45b4ae3171..5c034b6fa4 100755 --- a/tools/genv8constants.py +++ b/tools/genv8constants.py @@ -17,22 +17,9 @@ if len(sys.argv) != 3: sys.exit(2); outfile = file(sys.argv[1], 'w'); -try: - pipe = subprocess.Popen([ 'objdump', '-z', '-D', sys.argv[2] ], - bufsize=-1, stdout=subprocess.PIPE).stdout; -except OSError, e: - if e.errno == errno.ENOENT: - print ''' - Node.js compile error: could not find objdump - - Check that GNU binutils are installed and included in PATH - ''' - else: - print 'problem running objdump: ', e.strerror - - sys.exit() - -pattern = re.compile('([0-9a-fA-F]{8}|[0-9a-fA-F]{16}) <(.*)>:'); +pipe = subprocess.Popen([ 'objdump', '-z', '-D', sys.argv[2] ], + bufsize=-1, stdout=subprocess.PIPE).stdout; +pattern = re.compile('(00000000|0000000000000000) <(.*)>:'); v8dbg = re.compile('^v8dbg.*$') numpattern = re.compile('^[0-9a-fA-F]{2} $'); octets = 4 @@ -63,12 +50,10 @@ def out_reset(): def out_define(): global curr_sym, curr_val, curr_octet, outfile, octets if curr_sym != None: - wrapped_val = curr_val & 0xffffffff; if curr_val & 0x80000000 != 0: - wrapped_val = 0x100000000 - wrapped_val; - outfile.write("#define %s -0x%x\n" % (curr_sym.upper(), wrapped_val)); + outfile.write("#define %s -0x%x\n" % (curr_sym.upper(), 0x100000000 - curr_val)); else: - outfile.write("#define %s 0x%x\n" % (curr_sym.upper(), wrapped_val)); + outfile.write("#define %s 0x%x\n" % (curr_sym.upper(), curr_val)); out_reset(); for line in pipe: @@ -97,6 +82,8 @@ for line in pipe: if match == None: continue; + octets = len(match.group(1)) / 2; + # Print previous symbol out_define(); |