GithubHelp home page GithubHelp logo

lldb's Introduction

lldb

Most used lldb commands

Starting lldb

lldb a.out

# with args
lldb -- a.out arg1 arg2

(lldb) file a.out

Help

(lldb) help

# help on specific sub commands
(lldb) help breakpoint
(lldb) help watchpoint
(lldb) help source

Running

(lldb) run
# or short style
(lldb) r

Setting breakpoint

# set breakpoint on file main.cpp at line 30
(lldb) breakpoint set -f main.cpp -l 30

# or short style
(lldb) br s -f main.cpp -l 30
# or enen shorter style
(lldb) b main.cpp : 30

# Breakpoints with Symbols
# On a function
(lldb) b square(int)
# On a class method
(lldb) b Demo::demo()
# Inside a namespace
(lldb) b LLDBDemo::add(int)

# List breakpoints
(lldb) br list

# delete breakpoint with number 1, can use `br list` to show all breakpoints first then delete based on number
(lldb) br delete 1

# delete all breakpoints
(lldb) br del

Steping around

# stepping over
(lldb) next
(lldb) n

# stepping into
(lldb) step
(lldb) s

# continue
(lldb) continue
(lldb) c

Print variable contents

# print the content of a
(lldb) print a

# frame variables (local variables)
(lldb) frame variable
(lldb) fr v

Call stack (backtrace)

(lldb) bt

# select frame 2
(lldb) fr select 2

# select top frame 0 (the top of current stack)
(lldb) fr select 0

# switch frame 3, shortcut version
(lldb) f 3

# go back to the current frame
(lldb) fr select

Watch points

Note: program must be running to set watch points

# when variable `a` gets changed, the pragram will stop at where it changed
(lldb) watchpoint set variable a

# you can also monitor read, write or read_write on variable `a`
(lldb) watchpoint set variable -w read | write | read_write

# watch member variable (short version) `obj.m_count`
# w -> watchpoint, s -> set, v -> variable
(lldb) w s v -w read obj.m_count

# delete watchpoint 1
(lldb) watchpoint delete 1

Kill process and exit

# kill current debugging process
(lldb) kill
# quit lldb
(lldb) quit

lldb's People

Contributors

bgyu avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.