提交 c287c2ac 编写于 作者: G Gloria

Update docs against 17557

Signed-off-by: wusongqing<wusongqing@huawei.com>
上级 0fd2f81c
...@@ -8,3 +8,4 @@ ...@@ -8,3 +8,4 @@
- [Common Event Manager](cem-tool.md) - [Common Event Manager](cem-tool.md)
- [Advanced Notification Manager](anm-tool.md) - [Advanced Notification Manager](anm-tool.md)
- [restool](restool.md) - [restool](restool.md)
- [LLDB Usage Guide](lldb-tool.md)
# LLDB Usage Guide
## Overview
Low Lever Debugger (LLDB) is a next-generation high-performance debugger.
LLDB is developed based on the [llvm15.0.4](https://github.com/llvm/llvm-project/releases/tag/llvmorg-15.0.4) and supports debugging on the home screen and OpenHarmony devices or simulators.
## How to Obtain
Obtain the OpenHarmony SDK from http://ci.openharmony.cn/dailys/dailybuilds.
LLDB is in the following path of the SDK:
```
\ohos-sdk\[system]\native\llvm
```
The value of **system** can be **windows**, **linux**, or **darwin**.
For example, for Windows, **lldb.exe** is stored in the following path after the SDK is decompressed:
```
\ohos-sdk\windows\native\llvm\bin
```
## Supported Platform and Architecture
### Local Debugging
#### Example: Local Debugging on the Linux Platform
1. Obtain the name of the executable file with debugging information generated by the clang compiler of the same version as LLDB.
2. Run the following command in the terminal window to specify the name of the file to debug:
```
./lldb filename
```
3. Set a breakpoint at the **main** function in the code and run the following command on the LLDB interface:
```
(lldb) b main
```
4. Run the following command on the LLDB interface. The program will stop at the breakpoint:
```
(lldb) run
```
5. Perform subsequent debugging operations.
### Remote Debugging
> **Note: During remote debugging, the LLDB server and LLDB must be used together.**
- Debugging the OHOS device on the Windows platform (Arm architecture)
- Debugging the OHOS device on the Windows platform (AArch64 architecture)
- Debugging the simulator on the Windows platform
- Debugging the OHOS device on the macOS (M1) platform (Arm architecture)
- Debugging the OHOS device on the macOS (M1) platform (AArch64 architecture)
- Debugging the simulator on the macOS (M1) platform
- Debugging the OHOS device on the macOS (x86) platform (Arm architecture)
- Debugging the OHOS device on the macOS (x86) platform (AArch64 architecture)
- Debugging the simulator on the macOS (x86) platform
- Debugging the OHOS device on the Linux platform (Arm architecture)
- Debugging the OHOS device on the Linux platform (AArch64 architecture)
#### Example: Remote Debugging the OHOS Device on the Linux Platform (Arm Architecture)
1. Run the executable file with debugging information on the device.
```
./filename
```
2. Push the LLDB server to the device and run the LLDB server.
Command line window 1:
```
hdc file send lldb-server /data/local/tmp
hdc shell ./data/local/tmp/lldb-server p --server --listen "*:8080"
```
> **Note: /data/local/tmp is a directory on the device, and 8080 is a listening port. Both of them can be customized.**
3. Start LLDB in another window, select the remote OHOS device, and connect to it.
Command line window 2:
```
./lldb
(lldb) platform select remote-ohos
(lldb) platform connect connect://localhost:8080
```
4. Set breakpoints and perform debugging operations.
Command line window 2:
```
(lldb) breakpoint set --file <filename> --line <linenum>
(lldb) process attach --name process-name
```
## Functions Provided by LLDB
- Loading a program to LLDB
- Setting a breakpoint
- Setting an observation point
- Starting or attaching to a program
- Executing a control program
- Checking the thread status
- Checking the stack frame status
## References
For details about other functions and commands, see [LLDB Usage Guide](https://gitee.com/openharmony/third_party_llvm-project/blob/master/lldb/README_zh.md)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册