mirror of
				https://github.com/bytecodealliance/wasm-micro-runtime.git
				synced 2025-10-26 19:01:17 +00:00 
			
		
		
		
	 0e4c4799b1
			
		
	
	
		0e4c4799b1
		
			
		
	
	
	
	
		
			
			Update the `addr2line` script so that:
- line info is printed in a more convenient format, e.g.
```
0: c
        at wasm-micro-runtime/test-tools/addr2line/trap.c:5:1
1: b
        at wasm-micro-runtime/test-tools/addr2line/trap.c:11:12
2: a
        at wasm-micro-runtime/test-tools/addr2line/trap.c:17:12
```
similar to how Rust prints stack traces when there's a panic. In an IDE, the user
can conveniently click on the printed path and be redirected to the file line.
- a new `--no-addr` argument can be provided to the script 
It can be used in fast interpreter mode (that is not supported by the script otherwise)
or with older wamr versions (where the stack trace only had the function index info
and not the function address). In that case, `wasm-objdump` is used to get the function
name from the index and `llvm-dwarfdump` to obtain the location info (where the line
refers to the start of the function).
		
	
			
		
			
				
	
	
		
			23 lines
		
	
	
		
			615 B
		
	
	
	
		
			Bash
		
	
	
	
	
	
			
		
		
	
	
			23 lines
		
	
	
		
			615 B
		
	
	
	
		
			Bash
		
	
	
	
	
	
| #!/bin/bash
 | |
| set -euox pipefail
 | |
| 
 | |
| # Symbolicate .wasm
 | |
| python3 ../../../test-tools/addr2line/addr2line.py \
 | |
|     --wasi-sdk /opt/wasi-sdk \
 | |
|     --wabt /opt/wabt \
 | |
|     --wasm-file wasm-apps/trap.wasm \
 | |
|     call_stack.txt
 | |
| 
 | |
| # Symbolicate .wasm with `--no-addr`
 | |
| python3 ../../../test-tools/addr2line/addr2line.py \
 | |
|     --wasi-sdk /opt/wasi-sdk \
 | |
|     --wabt /opt/wabt \
 | |
|     --wasm-file wasm-apps/trap.wasm \
 | |
|     call_stack.txt --no-addr
 | |
| 
 | |
| # Symbolicate .aot
 | |
| python3 ../../../test-tools/addr2line/addr2line.py \
 | |
|     --wasi-sdk /opt/wasi-sdk \
 | |
|     --wabt /opt/wabt \
 | |
|     --wasm-file wasm-apps/trap.wasm \
 | |
|     call_stack_aot.txt |