mirror of https://github.com/svaarala/duktape.git
Sami Vaarala
9 years ago
1 changed files with 26 additions and 0 deletions
@ -0,0 +1,26 @@ |
|||
#!/usr/bin/python |
|||
# |
|||
# Resolve a line number in the combined source into an uncombined file/line |
|||
# using a dist/src/metadata.json file. |
|||
# |
|||
# Usage: $ python resolve_combined_lineno.py dist/src/metadata.json 12345 |
|||
# |
|||
|
|||
import os |
|||
import sys |
|||
import json |
|||
|
|||
def main(): |
|||
with open(sys.argv[1], 'rb') as f: |
|||
metadata = json.loads(f.read()) |
|||
lineno = int(sys.argv[2]) |
|||
|
|||
for e in reversed(metadata['line_map']): |
|||
if lineno >= e['combined_line']: |
|||
orig_lineno = e['original_line'] + (lineno - e['combined_line']) |
|||
print('%s:%d -> %s:%d' % ('duktape.c', lineno, |
|||
e['original_file'], orig_lineno)) |
|||
break |
|||
|
|||
if __name__ == '__main__': |
|||
main() |
Loading…
Reference in new issue