CodeLLDB:
CodeLLDB is a powerful and flexible debugger extension for Visual Studio Code. It provides advanced debugging features for C, C++, and Rust applications.
LLDB Commands
Start Debugging a Program:
lldb <program>
Run the Program:
run
Set a Breakpoint:
breakpoint set --name <function_name>
Sets a breakpoint at the specified function.
Set a Breakpoint at a Specific Line:
breakpoint set --file <filename> --line <line_number>
Sets a breakpoint at a specific line in a file.
Set Conditional Breakpoints:
breakpoint set --name <function_name> --condition "<condition>"
Sets a breakpoint that only triggers when the condition is true.
List Breakpoints:
breakpoint list
Displays all breakpoints.
Step Over a Line:
next
Executes the next line of code but steps over function calls.
Step Into a Function:
step
Steps into a function if the current line calls one.
Continue Execution:
continue
Inspect Variables:
frame variable <variable_name>
Displays the value of a variable in the current scope.
Watch a Variable:
watchpoint set variable <variable_name>
Sets a watchpoint to monitor changes to a variable.
Inspect Call Stack:
thread backtrace
Displays the call stack of the current thread.
Inspect Memory:
memory read <address> --size <size>
Reads memory from the specified address.
Examine Memory:
memory read <address> --size <size> --format <format>
Reads the memory at a specific address. You can specify the size (--size
) and format (--format
, e.g., x
for hexadecimal).
Dump Memory in Hexadecimal:
memory read <address> --size <size> --format x
Dumps memory in a hexadecimal format for easier inspection.
View Registers:
register read
Displays the values of all CPU registers.
Change Register Values:
register write <register_name> <value>
Modifies the value of a register.
List Disassembled Code:
disassemble --frame
Disassembles the current function’s code.
Disassemble a Specific Function:
disassemble --name <function_name>
Disassembles a specific function by name.
Evaluate Expressions:
expression <expression>
Evaluates an expression and print the result.
Comments
Post a Comment