Skip to content

Commit 4c2d358

Browse files
Update document for source debugging (#2051)
1 parent d975a1a commit 4c2d358

1 file changed

Lines changed: 19 additions & 8 deletions

File tree

doc/source_debugging.md

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,25 +40,36 @@ iwasm -g=127.0.0.1:1234 test.wasm
4040
# Use port = 0 to allow a random assigned debug port
4141
```
4242

43-
4. Build customized lldb (assume you have already cloned llvm)
43+
4. Build customized lldb
4444
``` bash
45-
cd ${WAMR_ROOT}/core/deps/llvm
46-
git apply ../../../build-scripts/lldb-wasm.patch
47-
mkdir build-lldb && cd build-lldb
48-
cmake -DCMAKE_BUILD_TYPE:STRING="Release" -DLLVM_ENABLE_PROJECTS="clang;lldb" -DLLVM_TARGETS_TO_BUILD:STRING="X86;WebAssembly" -DLLVM_ENABLE_LIBXML2:BOOL=ON ../llvm
49-
make -j $(nproc)
45+
git clone --branch release/13.x --depth=1 https://github.com/llvm/llvm-project
46+
cd llvm-project
47+
git apply ${WAMR_ROOT}/build-scripts/lldb-wasm.patch
48+
mkdir build-lldb
49+
cmake -S ./llvm -B build-lldb \
50+
-G Ninja \
51+
-DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS="clang;lldb" \
52+
-DLLVM_TARGETS_TO_BUILD:STRING="X86;WebAssembly" \
53+
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DLLVM_BUILD_BENCHMARKS:BOOL=OFF \
54+
-DLLVM_BUILD_DOCS:BOOL=OFF -DLLVM_BUILD_EXAMPLES:BOOL=OFF \
55+
-DLLVM_BUILD_LLVM_DYLIB:BOOL=OFF -DLLVM_BUILD_TESTS:BOOL=OFF \
56+
-DLLVM_ENABLE_BINDINGS:BOOL=OFF -DLLVM_INCLUDE_BENCHMARKS:BOOL=OFF \
57+
-DLLVM_INCLUDE_DOCS:BOOL=OFF -DLLVM_INCLUDE_EXAMPLES:BOOL=OFF \
58+
-DLLVM_INCLUDE_TESTS:BOOL=OFF -DLLVM_ENABLE_LIBXML2:BOOL=ON
59+
cmake --build build-lldb --target lldb --parallel $(nproc)
60+
# The lldb is generated under build-lldb/bin/lldb
5061
```
5162
> Note: If using `CommandLineTools` on MacOS, make sure only one SDK is present in `/Library/Developer/CommandLineTools/SDKs`.
5263
64+
> You can download pre-built `wamr-lldb` binaries from [here](https://github.com/bytecodealliance/wasm-micro-runtime/releases).
65+
5366
5. Launch customized lldb and connect to iwasm
5467
``` bash
5568
lldb
5669
(lldb) process connect -p wasm connect://127.0.0.1:1234
5770
```
5871
Then you can use lldb commands to debug your applications. Please refer to [lldb document](https://lldb.llvm.org/use/tutorial.html) for command usage.
5972

60-
> Known issue: `step over` on some function may be treated as `step in`, it will be fixed later.
61-
6273
## Debugging with AOT
6374

6475
> Note: AOT debugging is experimental and only a few debugging capabilities are supported.

0 commit comments

Comments
 (0)