Skip to main content
Back

Meta Rebuilds LLDB to Debug CPUs and GPUs in One Session

Meta's new lldb-server plugin treats CPUs and GPUs as separate debugger processes in one session, with most of the framework now upstream in LLVM.

  • Meta built a vendor-neutral accelerator plugin architecture in lldb-server for debugging CPU plus GPU applications.
  • CPU and GPU appear as two independent LLDB targets inside one session, coordinated over the GDB remote protocol.
  • Supports live debugging and postmortem core-dump analysis, with zero overhead for CPU-only programs.
  • Most of the common framework is already upstream in LLVM, remaining pieces coming soon.
  • A mock accelerator plugin lets the LLVM test suite validate the flow without real GPU hardware.
  • Replaces vendor-specific tools like ROCgdb and CUDA-GDB with one shared LLDB client across devices.

AI applications often span a host CPU and accelerator kernels with different instruction sets, registers, execution models, and memory spaces. Meta engineers have described the LLDB design for inspecting both sides through one debugging session, using a vendor-neutral accelerator interface in lldb-server.

The design keeps the LLDB client generic. Hardware vendors provide server-side plugins that translate their device-debugging APIs into concepts LLDB already understands, including processes, threads, registers, modules, memory, breakpoints, and stop reasons. Developers can use the same client and IDE integration across supported accelerators, although each device family still requires a compatible backend.

Why GPUs fracture the debugger model

Conventional debuggers assume that a process has one architecture and a coherent view of its threads, registers, modules, and memory. GPU workloads violate those assumptions. A host process may execute x86-64 or Arm instructions while its kernels use a separate instruction set. CPU threads have individual register contexts, while GPU hardware commonly executes groups of lanes together.

Memory also needs explicit scoping. The address 0x1000 can identify one location in host memory and another in device memory. Treating both as part of a single address space could make reads, breakpoints, and symbol resolution ambiguous.

Vendor-specific debuggers such as AMD ROCgdb and NVIDIA CUDA-GDB solve these problems for their respective platforms. Their separate implementations also duplicate work across user interfaces, remote protocols, symbol handling, IDE integrations, and other shared debugger features.

Two targets, one coordinated session

Meta’s design represents the CPU and accelerator as independent LLDB targets within the same session. Each target retains its own architecture, modules, threads, registers, and address spaces. A typical session might expose target #0 as x86_64 and target #1 as amdgcn, with target select switching between them.

Component Responsibility
LLDB client Presents targets, breakpoints, stack frames, registers, and source-level controls.
lldb-server Controls the native process and coordinates accelerator runtime events.
Accelerator plugin Translates a vendor’s debugging API into LLDB’s process and target abstractions.
GDB Remote Protocol Carries commands for discovery, memory access, register inspection, breakpoints, and execution control.

Placing the plugin interface in lldb-server gives it access to the host process that launches and manages accelerator work. The server can observe runtime events, initialize the vendor API at the correct point, and expose a separate connection for the device target.

From host launch to kernel frame

  1. LLDB connects to lldb-server and discovers the installed accelerator plugins.
  2. A plugin requests internal host breakpoints for runtime events relevant to device debugging.
  3. When the host reaches one of those breakpoints, lldb-server notifies the plugin.
  4. The plugin initializes the vendor debugging API and creates an accelerator endpoint.
  5. LLDB creates a second target and connects it to that endpoint.
  6. Pending kernel breakpoints resolve when device modules load, and GPU backtraces appear under the accelerator target.

This arrangement preserves the differences between host and device execution while coordinating them through one client. Developers can inspect the CPU call path that launches a kernel, switch to the accelerator target, and examine the corresponding kernel frames and device state.

Upstream code, hardware-specific coverage

Meta reports that most of the common framework has entered upstream LLVM. The contributed work includes the lldb-server plugin interface, remote-protocol packets for discovery and initialization, runtime-event coordination, accelerator connection creation, CPU-to-GPU process associations, multiple address spaces, and hardware-independent tests.

A mock accelerator plugin exercises the workflow without physical GPU hardware. LLVM’s test suite can use it to verify plugin discovery, host-breakpoint coordination, connection setup, and basic device state in ordinary continuous-integration environments.

  • Live debugging: Plugins can attach device debugging to a running host process when its accelerator runtime becomes active.
  • Postmortem analysis: The framework supports GPU core dumps through a shared base class for core-file plugins.
  • CPU-only behavior: Programs that do not activate a supported accelerator runtime continue through LLDB’s existing native path.
  • Vendor boundaries: Hardware-specific register layouts, execution controls, memory access, and runtime integration remain inside each backend.

Actual device coverage depends on vendors shipping and maintaining those backends. At the time of Meta’s write-up, additional framework pieces were still expected upstream, so the architecture should not be read as universal GPU support in every LLDB installation or release.

What changes for debugger builders

Debugger and IDE teams gain a shared client model for heterogeneous programs. Improvements to LLDB’s interface, symbol handling, remote transport, and editor integrations can serve multiple accelerators, while vendors focus on translating their hardware APIs into the plugin contract.

The design also gives custom accelerator teams a defined integration point. Vendors building devices such as Meta’s MTIA chips can implement a server-side plugin while retaining LLDB’s existing client and protocol infrastructure.

For developers tracing failures from frameworks such as PyTorch into CUDA, HIP, or custom kernels, the practical gain is a coordinated view of host and device state. Separate targets preserve architectural accuracy, while a shared LLDB session reduces the need for independent debugger clients, command sets, and IDE adapters.