GDB to LLDB Command Map for Switching Debuggers
A GDB-to-LLDB command map by task: running, breakpoints, stepping, variables, memory, registers, threads and settings, with the cases where the two differ.

Moving from GDB to LLDB, or the other way, is mostly a matter of vocabulary. Both debuggers read the same DWARF, stop programs with the same breakpoint instruction and show the same stacks, so the concepts carry across completely. What changes is the spelling of commands and the shape of the output. This is a map from one to the other, grouped by task. Each entry gives the GDB form, the LLDB form, and, since a map without exceptions misleads, the place where the two stop being equivalent. LLDB has built-in GDB-style aliases for the commonest commands (b, c, n, s, bt, p, r, fin, i r), so many of these work unchanged. The LLDB forms are for LLDB 21, and the GDB forms for GDB 16.3. The project's own table lives in the LLDB documentation as the "GDB to LLDB command map", which is worth keeping open for the rest.
Starting and running
| Task | GDB | LLDB |
|---|---|---|
| Load a program | gdb ./prog | lldb ./prog |
| Load with arguments | gdb --args ./prog a b | lldb -- ./prog a b |
| Run | run or r | process launch or run or r |
| Run with arguments | run a b | run a b |
| Run and stop at main | start | process launch --stop-at-entry, or breakpoint set -n main then run |
| Attach to a pid | gdb -p 123, attach 123 | lldb -p 123, process attach --pid 123 |
| Attach by name | gdb -p $(pidof prog) | process attach --name prog |
| Detach | detach | process detach |
| Kill | kill | process kill |
| Quit | quit | quit |
Where they differ. GDB's start sets a temporary breakpoint on main; LLDB has no one-word equivalent, and --stop-at-entry stops at the program's very first instruction, before main and before the dynamic loader has run, which is not the same thing. On macOS, process attach --name can also wait for a process with --waitfor, which GDB does not do natively.
Breakpoints
| Task | GDB | LLDB |
|---|---|---|
| On a function | break main | breakpoint set --name main or b main |
| On file and line | break file.c:12 | breakpoint set --file file.c --line 12 or b file.c:12 |
| On an address | break *0x4005d0 | breakpoint set --address 0x4005d0 |
| By regex | rbreak ^parse_ | breakpoint set --func-regex '^parse_' |
| Temporary | tbreak main | breakpoint set --name main --one-shot true |
| Conditional | break f if x > 3 | breakpoint set --name f --condition 'x > 3' |
| List | info breakpoints | breakpoint list |
| Disable, enable | disable 2, enable 2 | breakpoint disable 2, breakpoint enable 2 |
| Delete | delete 2 | breakpoint delete 2 |
| Ignore first N hits | ignore 2 5 | breakpoint modify --ignore-count 5 2 |
| Commands on hit | commands 2 ... end | breakpoint command add 2 ... DONE |
Where they differ. A GDB commands list ends with end and LLDB's with DONE, which catches people in scripts. GDB's commands can start with silent; in LLDB use --auto-continue and a one-line command with -o. GDB's rbreak sets breakpoints for each match immediately and lists them, while LLDB's regex breakpoint is one breakpoint with many locations. GDB's dprintf has no LLDB twin; use a breakpoint command that prints and auto-continues.
Stepping and execution
| Task | GDB | LLDB |
|---|---|---|
| Continue | continue or c | process continue or c |
| Step over a line | next or n | thread step-over or next or n |
| Step into | step or s | thread step-in or step or s |
| Step out | finish | thread step-out or finish |
| One instruction | stepi or si | thread step-inst or si |
| One instruction, over calls | nexti or ni | thread step-inst-over or ni |
| Run to a line | until 20 or advance 20 | thread until --address ADDR, or a one-shot breakpoint |
| Jump to a line | jump 20 | thread jump --line 20 |
| Return now | return | thread return |
Where they differ. LLDB's finish prints Return value: (int) $1 = 108, which GDB prints as Value returned is $1 = 108; scripts that parse them need both patterns. GDB's until LINE has no direct LLDB command; set a one-shot breakpoint on the line and continue. By default LLDB's step does not enter functions that have no debug information, controlled by settings set target.step-avoid-regexp, and GDB does the same unless set step-mode on.
Looking at variables and expressions
| Task | GDB | LLDB |
|---|---|---|
| Print an expression | print x * 2 | expression x * 2 or p x * 2 |
| Print a variable, no code | print x | frame variable x or v x |
| Hex format | print/x x | p/x x |
| All locals | info locals | frame variable |
| Arguments | info args | frame variable --arguments |
| Type of an expression | whatis x, ptype x | image lookup --type T, or expression -T -- x |
| Show a struct's definition | ptype struct s | type lookup s |
| Display each stop | display x | target stop-hook add --one-liner "frame variable x" |
| Set a variable | set var x = 5 | expression x = 5 |
| Call a function | call f(2) | expression f(2) |
Where they differ. LLDB has two ways to print, frame variable (direct memory read) and expression (compiles code), where GDB has only print. p in LLDB is expression. LLDB's ptype equivalent is type lookup, and whatis does not exist as such. GDB's display is a per-expression list that prints at every stop; LLDB's target stop-hook is more general, running any command list at each stop.
The call stack
| Task | GDB | LLDB |
|---|---|---|
| Backtrace | backtrace or bt | thread backtrace or bt |
| Backtrace with locals | bt full | bt plus frame variable per frame |
| Backtrace of all threads | thread apply all bt | thread backtrace all or bt all |
| Select a frame | frame 2 | frame select 2 or f 2 |
| Up, down | up, down | up, down |
| Frame details | info frame | frame info |
Where they differ. GDB's bt full has no single-command LLDB twin, and the usual replacement is a short Python loop or a series of frame select and frame variable. LLDB marks the selected frame with * in a backtrace, and shows its frame number as frame #N.
Memory and registers
| Task | GDB | LLDB |
|---|---|---|
| Examine memory | x/4xw &v | memory read --size 4 --format x --count 4 &v or x/4xw &v |
| Examine a string | x/s p | memory read --format s p or x/s p |
| Disassemble a function | disassemble f | disassemble --name f or di -n f |
| Disassemble at pc | x/5i $pc | disassemble --pc --count 5 |
| All registers | info registers | register read |
| One register | info registers rip, p $rip | register read rip, p $rip |
| Write a register | set $rax = 1 | register write rax 1 |
Where they differ. Recent LLDB accepts GDB's x/NFU syntax as a built-in alias, so x/4xw &v works, but its output has a different layout: LLDB prints the address, a colon and the values, with a 0x on each. Disassembly syntax is AT&T on both by default for x86; GDB switches with set disassembly-flavor intel, LLDB with settings set target.x86-disassembly-flavor intel.
Watchpoints and signals
| Task | GDB | LLDB |
|---|---|---|
| Watch a variable | watch x | watchpoint set variable x or w s v x |
| Watch an address | watch -l *(int*)0x... | watchpoint set expression -- 0x... |
| Read or access watch | rwatch x, awatch x | watchpoint set variable -w read x, -w read_write x |
| List | info watchpoints | watchpoint list |
| Delete | delete 3 | watchpoint delete 3 |
| Handle a signal | handle SIGPIPE nostop noprint pass | process handle SIGPIPE --notify false --stop false --pass true |
Where they differ. An LLDB watchpoint has a size and type chosen with -s and -w, and defaults to a write watch. GDB's scoped watch on a local is deleted when the frame returns; LLDB behaves similarly but the wording of the message differs. The post on LLDB watchpoints covers the sizes and the four-register limit that both share.
Threads, shared libraries and settings
| Task | GDB | LLDB |
|---|---|---|
| List threads | info threads | thread list |
| Switch thread | thread 2 | thread select 2 |
| Shared libraries | info sharedlibrary | image list |
| Find a symbol | info address f, info symbol 0x... | image lookup --name f, image lookup --address 0x... |
| Show source | list f | source list --name f or l f |
| Limit printed elements | set print elements 200 | settings set target.max-children-count 200 |
| Show a setting | show print pretty | settings show NAME |
| Search commands | apropos word | apropos word |
| Help on a command | help break | help breakpoint set |
Where they differ. GDB's settings are flat and named by what they affect, while LLDB's live in a tree (target., target.process., frame-format), which settings list shows. LLDB's image command is the family that GDB spreads over info sharedlibrary, info address and info symbol.
Making LLDB feel like GDB
Put your habits into ~/.lldbinit, which LLDB reads at startup.
command alias bpl breakpoint list
command alias lo frame variable
settings set stop-line-count-before 5
settings set stop-line-count-after 5
settings set target.x86-disassembly-flavor intelcommand alias creates a new command out of an existing one with fixed arguments. With -x on the command line, lldb -x ./prog skips the init file for a clean session. LLDB's own set of GDB-compatible short forms covers b, br, c, n, s, bt, p, po, r, fr v, up, down and i r (as register read's alias), so for daily stepping most of your GDB muscle memory works as typed.
When the map stops helping
The map covers commands, not output. Scripts that scrape GDB's text will not work on LLDB's, and the reverse; use the structured interfaces, GDB's MI or LLDB's Python API, for automation. And three things have no counterpart: GDB's reverse execution and rr, LLDB's Swift and Objective-C expression support, and GDB's define language, which LLDB replaces with Python commands.


