|
ascii-chat 0.6.0
Real-time terminal-based video chat with ASCII art conversion
|
LLDB process controller. More...
#include <src/tooling/query/lldb_controller.h>
Public Member Functions | |
| LLDBController () | |
| ~LLDBController () | |
| LLDBController (const LLDBController &)=delete | |
| LLDBController & | operator= (const LLDBController &)=delete |
| LLDBController (LLDBController &&)=delete | |
| LLDBController & | operator= (LLDBController &&)=delete |
| bool | initialize () |
| Initialize LLDB. Must be called before any other methods. | |
| void | shutdown () |
| Shutdown LLDB and release resources. | |
| bool | attach (pid_t pid) |
| Attach to a process by PID. | |
| bool | attachByName (const std::string &process_name, bool wait_for=false) |
| Attach to a process by name. | |
| void | detach () |
| Detach from the current process. | |
| bool | isAttached () const |
| Check if attached to a process. | |
| pid_t | targetPid () const |
| Get the PID of the attached process. | |
| std::string | targetName () const |
| Get the name of the attached process. | |
| bool | stop () |
| Stop the target process. | |
| bool | resume () |
| Resume the target process. | |
| bool | stepInto () |
| Single step the current thread (step into) | |
| bool | stepOver () |
| Step over the current line. | |
| bool | stepOut () |
| Step out of the current function. | |
| ProcessState | state () const |
| Get the current process state. | |
| const std::string & | lastError () const |
| Get the last error message. | |
| std::vector< ThreadInfo > | getThreads () const |
| Get list of all threads. | |
| std::optional< ThreadInfo > | getSelectedThread () const |
| Get the currently selected thread. | |
| bool | selectThread (uint64_t thread_id) |
| Select a thread by ID. | |
| std::vector< FrameInfo > | getFrames (uint32_t max_frames=0) const |
| Get stack frames for the selected thread. | |
| std::optional< FrameInfo > | getFrame (uint32_t frame_index) const |
| Get a specific frame by index. | |
| std::optional< VariableInfo > | readVariable (const std::string &name, uint32_t frame_index=0, uint32_t expand_depth=0) const |
| Read a variable from the current frame. | |
| std::vector< VariableInfo > | listVariables (uint32_t frame_index=0, bool include_args=true, bool include_locals=true, bool include_statics=false) const |
| List all variables in scope at a frame. | |
| int32_t | setBreakpoint (const std::string &file, uint32_t line, const std::string &condition="") |
| Set a breakpoint at file:line. | |
| bool | removeBreakpoint (int32_t breakpoint_id) |
| Remove a breakpoint. | |
| std::vector< BreakpointInfo > | getBreakpoints () const |
| Get all breakpoints. | |
| std::optional< BreakpointInfo > | getBreakpoint (int32_t breakpoint_id) const |
| Get information about a specific breakpoint. | |
| bool | waitForBreakpoint (uint32_t timeout_ms=0) |
| Wait for any breakpoint to be hit. | |
| std::optional< VariableInfo > | evaluateExpression (const std::string &expression, uint32_t frame_index=0) const |
| Evaluate an expression in the current context. | |
LLDB process controller.
Wraps LLDB's SB API to provide process attachment, breakpoint management, and variable inspection for the query tool.
Definition at line 106 of file lldb_controller.h.
|
default |
| ascii_query::LLDBController::~LLDBController | ( | ) |
Definition at line 36 of file lldb_controller.cpp.
References shutdown().
|
delete |
|
delete |
| bool ascii_query::LLDBController::attach | ( | pid_t | pid | ) |
Attach to a process by PID.
| pid | Process ID to attach to |
On success, the target process is stopped.
Definition at line 103 of file lldb_controller.cpp.
Referenced by main().
| bool ascii_query::LLDBController::attachByName | ( | const std::string & | process_name, |
| bool | wait_for = false |
||
| ) |
Attach to a process by name.
| process_name | Name of process to attach to |
| wait_for | If true, wait for process to start |
Definition at line 133 of file lldb_controller.cpp.
Referenced by main().
| void ascii_query::LLDBController::detach | ( | ) |
Detach from the current process.
The target process continues running after detach.
Definition at line 165 of file lldb_controller.cpp.
References isAttached().
Referenced by main(), and shutdown().
| std::optional< VariableInfo > ascii_query::LLDBController::evaluateExpression | ( | const std::string & | expression, |
| uint32_t | frame_index = 0 |
||
| ) | const |
Evaluate an expression in the current context.
| expression | Expression to evaluate |
| frame_index | Which frame context (0 = current) |
Definition at line 611 of file lldb_controller.cpp.
| std::optional< BreakpointInfo > ascii_query::LLDBController::getBreakpoint | ( | int32_t | breakpoint_id | ) | const |
Get information about a specific breakpoint.
| breakpoint_id | Breakpoint ID |
Definition at line 558 of file lldb_controller.cpp.
| std::vector< BreakpointInfo > ascii_query::LLDBController::getBreakpoints | ( | ) | const |
Get all breakpoints.
Definition at line 538 of file lldb_controller.cpp.
Get a specific frame by index.
| frame_index | Frame index (0 = innermost) |
Definition at line 431 of file lldb_controller.cpp.
Get stack frames for the selected thread.
| max_frames | Maximum number of frames to return (0 = all) |
Definition at line 407 of file lldb_controller.cpp.
| std::optional< ThreadInfo > ascii_query::LLDBController::getSelectedThread | ( | ) | const |
Get the currently selected thread.
Definition at line 375 of file lldb_controller.cpp.
| std::vector< ThreadInfo > ascii_query::LLDBController::getThreads | ( | ) | const |
Get list of all threads.
Definition at line 348 of file lldb_controller.cpp.
| bool ascii_query::LLDBController::initialize | ( | ) |
Initialize LLDB. Must be called before any other methods.
Definition at line 42 of file lldb_controller.cpp.
Referenced by main().
| bool ascii_query::LLDBController::isAttached | ( | ) | const |
Check if attached to a process.
Definition at line 178 of file lldb_controller.cpp.
References state().
Referenced by detach(), main(), resume(), shutdown(), and stop().
| const std::string & ascii_query::LLDBController::lastError | ( | ) | const |
Get the last error message.
Definition at line 342 of file lldb_controller.cpp.
Referenced by main().
| std::vector< VariableInfo > ascii_query::LLDBController::listVariables | ( | uint32_t | frame_index = 0, |
| bool | include_args = true, |
||
| bool | include_locals = true, |
||
| bool | include_statics = false |
||
| ) | const |
List all variables in scope at a frame.
| frame_index | Which frame (0 = current) |
| include_args | Include function arguments |
| include_locals | Include local variables |
| include_statics | Include static variables |
Definition at line 474 of file lldb_controller.cpp.
|
delete |
|
delete |
| std::optional< VariableInfo > ascii_query::LLDBController::readVariable | ( | const std::string & | name, |
| uint32_t | frame_index = 0, |
||
| uint32_t | expand_depth = 0 |
||
| ) | const |
Read a variable from the current frame.
| name | Variable name (supports dot notation for members) |
| frame_index | Which frame to read from (0 = current) |
| expand_depth | How deep to expand struct members (0 = don't expand) |
Definition at line 443 of file lldb_controller.cpp.
| bool ascii_query::LLDBController::removeBreakpoint | ( | int32_t | breakpoint_id | ) |
Remove a breakpoint.
| breakpoint_id | Breakpoint ID to remove |
Definition at line 523 of file lldb_controller.cpp.
| bool ascii_query::LLDBController::resume | ( | ) |
Resume the target process.
Definition at line 250 of file lldb_controller.cpp.
References isAttached().
Referenced by main(), and waitForBreakpoint().
Select a thread by ID.
| thread_id | Thread ID to select |
Definition at line 383 of file lldb_controller.cpp.
References thread_id.
| int32_t ascii_query::LLDBController::setBreakpoint | ( | const std::string & | file, |
| uint32_t | line, | ||
| const std::string & | condition = "" |
||
| ) |
Set a breakpoint at file:line.
| file | Source file path |
| line | Line number |
| condition | Optional condition expression |
Definition at line 503 of file lldb_controller.cpp.
| void ascii_query::LLDBController::shutdown | ( | ) |
Shutdown LLDB and release resources.
Definition at line 73 of file lldb_controller.cpp.
References detach(), and isAttached().
Referenced by main(), and ~LLDBController().
| ProcessState ascii_query::LLDBController::state | ( | ) | const |
Get the current process state.
Definition at line 316 of file lldb_controller.cpp.
References ascii_query::Crashed, ascii_query::Detached, ascii_query::Exited, ascii_query::Invalid, ascii_query::Running, and ascii_query::Stopped.
Referenced by isAttached(), main(), and waitForBreakpoint().
| bool ascii_query::LLDBController::stepInto | ( | ) |
Single step the current thread (step into)
Definition at line 280 of file lldb_controller.cpp.
| bool ascii_query::LLDBController::stepOut | ( | ) |
Step out of the current function.
Definition at line 304 of file lldb_controller.cpp.
| bool ascii_query::LLDBController::stepOver | ( | ) |
Step over the current line.
Definition at line 292 of file lldb_controller.cpp.
| bool ascii_query::LLDBController::stop | ( | ) |
Stop the target process.
Definition at line 212 of file lldb_controller.cpp.
References isAttached().
| std::string ascii_query::LLDBController::targetName | ( | ) | const |
Get the name of the attached process.
Definition at line 194 of file lldb_controller.cpp.
Referenced by main().
| pid_t ascii_query::LLDBController::targetPid | ( | ) | const |
Get the PID of the attached process.
Definition at line 187 of file lldb_controller.cpp.
Referenced by main().
Wait for any breakpoint to be hit.
| timeout_ms | Timeout in milliseconds (0 = no timeout) |
Definition at line 571 of file lldb_controller.cpp.
References resume(), state(), and ascii_query::Stopped.