← 返回命令列表

Linux command

lldb 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Debug executable

lldb [program]

Debug with arguments

lldb -- [program] [arg1] [arg2]

Attach to process

lldb -p [pid]

Attach by name

lldb -n [process_name]

Run commands on start

lldb -o "[breakpoint set -n main]" [program]

Load core dump

lldb -c [core] [program]

说明

lldb is the LLVM debugger. It debugs C, C++, Objective-C, and Swift programs. The tool provides breakpoints, watchpoints, stepping, and memory inspection. It's the default debugger on macOS and is part of the Xcode developer tools.

参数

-p _PID_
Attach to process by PID.
-n _NAME_
Attach to process by name.
-c _CORE_
Load core dump file.
-o _CMD_
Execute command on start.
-s _FILE_
Source commands from file after loading.
-O _CMD_
Execute command before loading the file.
-f _FILE_
Specify executable to debug.
-a _ARCH_
Specify architecture to use when launching the program.
-w
Wait for a process to launch with the name given by -n.
-x
Don't automatically parse .lldbinit files.
-h, --help
Display help information.
-v, --version
Display version information.

FAQ

What is the lldb command used for?

lldb is the LLVM debugger. It debugs C, C++, Objective-C, and Swift programs. The tool provides breakpoints, watchpoints, stepping, and memory inspection. It's the default debugger on macOS and is part of the Xcode developer tools.

How do I run a basic lldb example?

Run `lldb [program]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -p _PID_ do in lldb?

Attach to process by PID.