(args)
| 259 | |
| 260 | |
| 261 | def main(args): |
| 262 | with webassembly.Module(args.wasm_file) as module: |
| 263 | base = 16 if args.address.lower().startswith('0x') else 10 |
| 264 | address = int(args.address, base) |
| 265 | |
| 266 | if args.addrtype == 'code': |
| 267 | address += get_codesec_offset(module) |
| 268 | |
| 269 | def print_loc(loc): |
| 270 | if isinstance(loc, list): |
| 271 | for l in loc: |
| 272 | l.print() |
| 273 | else: |
| 274 | loc.print() |
| 275 | |
| 276 | if ((has_debug_line_section(module) and not args.source) or |
| 277 | 'dwarf' in args.source): |
| 278 | print_loc(symbolize_address_symbolizer(module, address)) |
| 279 | elif ((get_sourceMappingURL_section(module) and not args.source) or |
| 280 | 'sourcemap' in args.source): |
| 281 | print_loc(symbolize_address_sourcemap(module, address, args.file)) |
| 282 | elif ((has_name_section(module) and not args.source) or |
| 283 | 'names' in args.source): |
| 284 | print_loc(symbolize_address_symbolizer(module, address)) |
| 285 | elif ((has_linking_section(module) and not args.source) or |
| 286 | 'symtab' in args.source): |
| 287 | print_loc(symbolize_address_symbolizer(module, address)) |
| 288 | elif (args.source == 'symbolmap'): |
| 289 | print_loc(symbolize_address_symbolmap(module, address, args.file)) |
| 290 | else: |
| 291 | raise Error('No .debug_line or sourceMappingURL section found in ' |
| 292 | f'{module.filename}.' |
| 293 | " I don't know how to symbolize this file yet") |
| 294 | |
| 295 | |
| 296 | def get_args(): |
no test coverage detected