Permalink
Please sign in to comment.
Showing
with
704 additions
and 1 deletion.
- +1 −0 llnode.gyp
- +43 −0 scripts/otool2segments.py
- +43 −0 scripts/readelf2segments.py
- +20 −1 src/llnode.cc
- +366 −0 src/llscan.cc
- +129 −0 src/llscan.h
- +96 −0 src/llv8.cc
- +6 −0 src/llv8.h
| @@ -0,0 +1,43 @@ | ||
| +#!/usr/bin/env python | ||
| +''' | ||
| +Created on 7 Apr 2016 | ||
| + | ||
| +@author: hhellyer | ||
| +''' | ||
| +import sys,os,subprocess | ||
| + | ||
| +OTOOL_COMMAND = "otool -l {0}" | ||
| + | ||
| +# Grab the details of the memory ranges in the process from otool. | ||
| +def main(): | ||
| + if( len(sys.argv) < 2 ): | ||
| + print("Usage " + sys.argv[0] + " <core_file>") | ||
| + sys.exit(1) | ||
| + core_file = sys.argv[1] | ||
| + | ||
| + otool_proc = subprocess.Popen( | ||
| + OTOOL_COMMAND.format(core_file), shell=True, bufsize=1, | ||
| + stdin=subprocess.PIPE, stdout=subprocess.PIPE, close_fds=True) | ||
| + (otool_stdin, otool_stdout) = (otool_proc.stdin, otool_proc.stdout) | ||
| + | ||
| + reading_segment = False | ||
| + vaddress = "" | ||
| + | ||
| + for line in otool_stdout: | ||
| + line = line.strip() | ||
| + if not line.startswith("vmaddr") and not reading_segment: | ||
| + continue | ||
| + elif line.startswith("vmaddr"): | ||
| + # Might need to filer out segments that have a file offset of 0 | ||
| + # (ie segments that aren't in the core!) | ||
| + reading_segment = True | ||
| + (name, vaddress) = line.split() | ||
| + elif line.startswith("vmsize") and reading_segment: | ||
| + reading_segment = False | ||
| + memsize = line.split()[1] | ||
| + # Simple format "address size", both in hex | ||
| + print("{0} {1}".format(vaddress, memsize)) | ||
| + vaddress = "" | ||
| + | ||
| +if __name__ == '__main__': | ||
| + main() |
| @@ -0,0 +1,43 @@ | ||
| +#!/usr/bin/env python | ||
| +''' | ||
| +Created on 7 Apr 2016 | ||
| + | ||
| +@author: hhellyer | ||
| +''' | ||
| +import sys,os,subprocess | ||
| + | ||
| +READELF_COMMAND = "readelf --segments {0}" | ||
| + | ||
| +# Grab the details of the memory ranges in the process from readelf. | ||
| +def main(): | ||
| + if( len(sys.argv) < 2 ): | ||
| + print("Usage " + sys.argv[0] + " <core_file>") | ||
| + sys.exit(1) | ||
| + core_file = sys.argv[1] | ||
| + | ||
| + readelf_proc = subprocess.Popen( | ||
| + READELF_COMMAND.format(core_file), shell=True, bufsize=1, | ||
| + stdin=subprocess.PIPE, stdout=subprocess.PIPE, close_fds=True) | ||
| + (readelf_stdin, readelf_stdout) = (readelf_proc.stdin, readelf_proc.stdout) | ||
| + | ||
| + reading_segment = False | ||
| + vaddress = "" | ||
| + | ||
| + for line in readelf_stdout: | ||
| + line = line.strip() | ||
| + if not line.startswith("LOAD") and not reading_segment: | ||
| + continue | ||
| + elif line.startswith("LOAD"): | ||
| + # Might need to filer out segments that have a file offset of 0 | ||
| + # (ie segments that aren't in the core!) | ||
| + reading_segment = True | ||
| + (type, offset, vaddress, paddr) = line.split() | ||
| + elif reading_segment: | ||
| + reading_segment = False | ||
| + memsize = line.split()[1] | ||
| + # Simple format "address size", both in hex | ||
| + print("{0} {1}".format(vaddress, memsize)) | ||
| + vaddress = "" | ||
| + | ||
| +if __name__ == '__main__': | ||
| + main() |
Oops, something went wrong.
0 comments on commit
c517e0c