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.
This commit is contained in:
parent
d9036a5d35
commit
88217ec276
@ -17,9 +17,22 @@ if len(sys.argv) != 3:
|
|||||||
sys.exit(2);
|
sys.exit(2);
|
||||||
|
|
||||||
outfile = file(sys.argv[1], 'w');
|
outfile = file(sys.argv[1], 'w');
|
||||||
pipe = subprocess.Popen([ 'objdump', '-z', '-D', sys.argv[2] ],
|
try:
|
||||||
|
pipe = subprocess.Popen([ 'objdump', '-z', '-D', sys.argv[2] ],
|
||||||
bufsize=-1, stdout=subprocess.PIPE).stdout;
|
bufsize=-1, stdout=subprocess.PIPE).stdout;
|
||||||
pattern = re.compile('(00000000|0000000000000000) <(.*)>:');
|
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}) <(.*)>:');
|
||||||
v8dbg = re.compile('^v8dbg.*$')
|
v8dbg = re.compile('^v8dbg.*$')
|
||||||
numpattern = re.compile('^[0-9a-fA-F]{2} $');
|
numpattern = re.compile('^[0-9a-fA-F]{2} $');
|
||||||
octets = 4
|
octets = 4
|
||||||
@ -50,10 +63,12 @@ def out_reset():
|
|||||||
def out_define():
|
def out_define():
|
||||||
global curr_sym, curr_val, curr_octet, outfile, octets
|
global curr_sym, curr_val, curr_octet, outfile, octets
|
||||||
if curr_sym != None:
|
if curr_sym != None:
|
||||||
|
wrapped_val = curr_val & 0xffffffff;
|
||||||
if curr_val & 0x80000000 != 0:
|
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:
|
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();
|
out_reset();
|
||||||
|
|
||||||
for line in pipe:
|
for line in pipe:
|
||||||
@ -82,8 +97,6 @@ for line in pipe:
|
|||||||
if match == None:
|
if match == None:
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
octets = len(match.group(1)) / 2;
|
|
||||||
|
|
||||||
# Print previous symbol
|
# Print previous symbol
|
||||||
out_define();
|
out_define();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user