diff options
author | Fedor Indutny <fedor.indutny@gmail.com> | 2013-01-20 18:31:30 +0400 |
---|---|---|
committer | Fedor Indutny <fedor.indutny@gmail.com> | 2013-01-21 12:46:27 +0400 |
commit | 3d67f895521cf905922d20af9b03e5c73c363868 (patch) | |
tree | 819c4517ba0e5b84248d19db03d2e694c0d3799d /tools | |
parent | 2dd373894f76f768a72c9c08096c2598c0b8485b (diff) |
dtrace: fix generation of v8 constants on freebsd
Every constant is certainly 4 bytes now, but freebsd's objdump utility
prints out odd byte sequences (5-bytes, 6-bytes and even 9-bytes long)
for v8's data section. We can safely ignore all upper bytes, because all
constants that we're using are just `int`s. Since on all supported
platforms `int` is 32bit long (and anyway v8's constants are 32bit too),
we ignore all higher bits if they were read.
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/genv8constants.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/tools/genv8constants.py b/tools/genv8constants.py index a79ba06fdc1..45b4ae31712 100755 --- a/tools/genv8constants.py +++ b/tools/genv8constants.py @@ -32,7 +32,7 @@ except OSError, e: sys.exit() -pattern = re.compile('(00000000|0000000000000000) <(.*)>:'); +pattern = re.compile('([0-9a-fA-F]{8}|[0-9a-fA-F]{16}) <(.*)>:'); v8dbg = re.compile('^v8dbg.*$') numpattern = re.compile('^[0-9a-fA-F]{2} $'); octets = 4 @@ -63,10 +63,12 @@ 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: - outfile.write("#define %s -0x%x\n" % (curr_sym.upper(), 0x100000000 - curr_val)); + wrapped_val = 0x100000000 - wrapped_val; + outfile.write("#define %s -0x%x\n" % (curr_sym.upper(), wrapped_val)); else: - outfile.write("#define %s 0x%x\n" % (curr_sym.upper(), curr_val)); + outfile.write("#define %s 0x%x\n" % (curr_sym.upper(), wrapped_val)); out_reset(); for line in pipe: @@ -95,8 +97,6 @@ for line in pipe: if match == None: continue; - octets = len(match.group(1)) / 2; - # Print previous symbol out_define(); |