Beispiel #1
0
Currently this tool only supports sysv output format (it accepts but ignores
any '-format' argument). It does not accept any other arguments aside from the
input file, which is expected to be a JS file. The wasm file is expected to be
in the same directory, and have the same basename with a '.wasm' extension.
"""

import argparse
import os
import subprocess
import sys

from tools import shared

LLVM_SIZE = os.path.expanduser(
    shared.build_llvm_tool_path(shared.exe_suffix('llvm-size')))


def error(text):
    print(text, file=sys.stderr, flush=True)
    return 1


def parse_args(argv):
    parser = argparse.ArgumentParser(description=__doc__)
    parser.add_argument('-format')
    parser.add_argument('file')
    args = parser.parse_args(argv)
    return args.file

Beispiel #2
0
# If the wasm has separate DWARF info, do the above with the side file
# If there is a source map, we can parse it to get file and line number.
# If there is an emscripten symbol map, we can parse that to get the symbol name
# If there is a name section or symbol table, llvm-nm can show the symbol name.

import argparse
from collections import namedtuple
import json
import os
import sys
from tools import shared
from tools import webassembly
from tools.shared import check_call

LLVM_SYMBOLIZER = os.path.expanduser(
    shared.build_llvm_tool_path(shared.exe_suffix('llvm-symbolizer')))


class Error(BaseException):
    pass


def get_codesec_offset(module):
    for sec in module.sections():
        if sec.type == webassembly.SecType.CODE:
            return sec.offset
    raise Error(f'No code section found in {module.filename}')


def has_debug_line_section(module):
    for sec in module.sections():
Beispiel #3
0
Currently this tool only supports sysv output format (it accepts but ignores
any '-format' argument). It does not accept any other arguments aside from the
input file, which is expected to be a JS file. The wasm file is expected to be
in the same directory, and have the same basename with a '.wasm' extension.
"""

from __future__ import print_function

import argparse
import os
import subprocess
import sys

from tools import shared

LLVM_SIZE = os.path.expanduser(shared.build_llvm_tool_path(shared.exe_suffix('llvm-size')))


def error(text):
  print(text, file=sys.stderr, flush=True)
  return 1


def parse_args(argv):
  parser = argparse.ArgumentParser(description=__doc__)
  parser.add_argument('-format')
  parser.add_argument('file')
  args = parser.parse_args(argv)
  return args.file