SlideShare ist ein Scribd-Unternehmen logo
1 von 15
LLDB Introduction

     Jaemok Jeong
        2012. 8.
Overview

LLDB is a next generation, high performance
debugger

Available under the standard LLVM license,
an open source ‘BSD-Style’ license



Default debugger in Xcode on MAC OS X
Features

Supports modern multi-threaded program

Upto date language support for C, C++,
Objective C



Extensible : Python scriptable and use a
plug-in architecture
General


(lldb) help <command> <subcommand>



(lldb) <noun> <verb> [-options [option-value]]
[argument [argument...]]
Execution
(lldb) r / run (run)

(lldb) s / step (source level single step in)

(lldb) n / next (source level single step over)

(lldb) si / ni (instruction level single step in)

(lldb) finish (step out of currently selected
frame)
Hooks
(lldb) target stop-hook add
Enter your stop hook command(s). Type ‘DONE’ to end.
> print i
> DONE
Stop hook #1 added
(lldb) n
(int) $32 = 1
Breakpoint
(lldb) b main (Set a break point at all function named
main)

(lldb) b test.c:12 (Set a breakpoint in file test.c at line
12)

(lldb) b -[NSString stringWithFormat:]

(lldb) br s -S count / br set -S
vtDataCenterFetchComplete:userData:

(lldb) br delete [n]
Watchpoint
(lldb) watch set var -w write global_var (set
write watchpoint)

(lldb) watch set exp -w write -- my_ptr (set
write watchpoint in pointer)

(lldb) watch set var -w read global_var (set read
watchpoint)

(lldb) watch modify -c ‘(global==5)’ (set
condition on watchpoint)
Examining Variables
(lldb) frame variable (show arguments for the
current frame)

(lldb) frame v -a (--no-args) (show the local
variables for the current frame)

(lldb) frame v isChanged (p isChanged)

(lldb) target v (show the global/static variables)

(lldb) print a_var / po a_var
Examining Thread state
 (lldb) thread backtrace (show the stack
 backtrace)

 (lldb) bt

 (lldb) up (select the stack frame that called
 the current stack frame)

 (lldb) down (select the stack frame that is
 called by the current stack frame)
Executable & Shared
      Library

(lldb) image list (list the main executable and
all dependent shared libraries)

(lldb) image dump sections (dump all sections
from the main executable and any shared
libraries)
LLDB Python

(lldb) script help(lldb)

(lldb) script help(lldb.SBFrame)

(lldb) script (Python interpreter)

Define New Command with Python

Define New Breakpoint action with Python
Tips

Alias

  (lldb) command alias bfl breakpoint set -f
  %1 -l %2

  (lldb) bfl foo.c 12

Init file

  Reads the file ~/.lldbinit at startup
Examples


br set -S invalidateCache

br set -S
vtDataCenterFetchComplete:userData:

watch set var -w read selectedDate
Links

Homepage

  http://lldb.llvm.org/

Source code

  svn co http://llvm.org/svn/llvm-project/
  lldb/trunk lldb

Weitere ähnliche Inhalte

Was ist angesagt?

Kotlin advanced - language reference for android developers
Kotlin advanced - language reference for android developersKotlin advanced - language reference for android developers
Kotlin advanced - language reference for android developers
Bartosz Kosarzycki
 
NDC 2011, C++ 프로그래머를 위한 C#
NDC 2011, C++ 프로그래머를 위한 C#NDC 2011, C++ 프로그래머를 위한 C#
NDC 2011, C++ 프로그래머를 위한 C#
tcaesvk
 
[Td 2015] what is new in visual c++ 2015 and future directions(ulzii luvsanba...
[Td 2015] what is new in visual c++ 2015 and future directions(ulzii luvsanba...[Td 2015] what is new in visual c++ 2015 and future directions(ulzii luvsanba...
[Td 2015] what is new in visual c++ 2015 and future directions(ulzii luvsanba...
Sang Don Kim
 

Was ist angesagt? (20)

Triton and Symbolic execution on GDB@DEF CON China
Triton and Symbolic execution on GDB@DEF CON ChinaTriton and Symbolic execution on GDB@DEF CON China
Triton and Symbolic execution on GDB@DEF CON China
 
Developing android apps with java 8
Developing android apps with java 8Developing android apps with java 8
Developing android apps with java 8
 
Kotlin Developer Starter in Android projects
Kotlin Developer Starter in Android projectsKotlin Developer Starter in Android projects
Kotlin Developer Starter in Android projects
 
Kotlin advanced - language reference for android developers
Kotlin advanced - language reference for android developersKotlin advanced - language reference for android developers
Kotlin advanced - language reference for android developers
 
The craft of meta programming on JVM
The craft of meta programming on JVMThe craft of meta programming on JVM
The craft of meta programming on JVM
 
Kotlin in action
Kotlin in actionKotlin in action
Kotlin in action
 
How do you create a programming language for the JVM?
How do you create a programming language for the JVM?How do you create a programming language for the JVM?
How do you create a programming language for the JVM?
 
Scalaz By Example (An IO Taster) -- PDXScala Meetup Jan 2014
Scalaz By Example (An IO Taster) -- PDXScala Meetup Jan 2014Scalaz By Example (An IO Taster) -- PDXScala Meetup Jan 2014
Scalaz By Example (An IO Taster) -- PDXScala Meetup Jan 2014
 
Joel Falcou, Boost.SIMD
Joel Falcou, Boost.SIMDJoel Falcou, Boost.SIMD
Joel Falcou, Boost.SIMD
 
[TECHCON 2019: MOBILE - iOS]3.쉽고 재미있는 iOS 디버깅 - LLDB Command
[TECHCON 2019: MOBILE - iOS]3.쉽고 재미있는 iOS 디버깅 - LLDB Command[TECHCON 2019: MOBILE - iOS]3.쉽고 재미있는 iOS 디버깅 - LLDB Command
[TECHCON 2019: MOBILE - iOS]3.쉽고 재미있는 iOS 디버깅 - LLDB Command
 
Session1
Session1Session1
Session1
 
Verilogspk1
Verilogspk1Verilogspk1
Verilogspk1
 
Verilog overview
Verilog overviewVerilog overview
Verilog overview
 
NDC 2011, C++ 프로그래머를 위한 C#
NDC 2011, C++ 프로그래머를 위한 C#NDC 2011, C++ 프로그래머를 위한 C#
NDC 2011, C++ 프로그래머를 위한 C#
 
Return of c++
Return of c++Return of c++
Return of c++
 
Lisp Macros in 20 Minutes (Featuring Clojure)
Lisp Macros in 20 Minutes (Featuring Clojure)Lisp Macros in 20 Minutes (Featuring Clojure)
Lisp Macros in 20 Minutes (Featuring Clojure)
 
Eval4j @ JVMLS 2014
Eval4j @ JVMLS 2014Eval4j @ JVMLS 2014
Eval4j @ JVMLS 2014
 
RESTful API using scalaz (3)
RESTful API using scalaz (3)RESTful API using scalaz (3)
RESTful API using scalaz (3)
 
Java byte code in practice
Java byte code in practiceJava byte code in practice
Java byte code in practice
 
[Td 2015] what is new in visual c++ 2015 and future directions(ulzii luvsanba...
[Td 2015] what is new in visual c++ 2015 and future directions(ulzii luvsanba...[Td 2015] what is new in visual c++ 2015 and future directions(ulzii luvsanba...
[Td 2015] what is new in visual c++ 2015 and future directions(ulzii luvsanba...
 

Ähnlich wie LLDB Introduction

Building Efficient and Highly Run-Time Adaptable Virtual Machines
Building Efficient and Highly Run-Time Adaptable Virtual MachinesBuilding Efficient and Highly Run-Time Adaptable Virtual Machines
Building Efficient and Highly Run-Time Adaptable Virtual Machines
Guido Chari
 
Introduction to the Java bytecode - So@t - 20130924
Introduction to the Java bytecode - So@t - 20130924Introduction to the Java bytecode - So@t - 20130924
Introduction to the Java bytecode - So@t - 20130924
yohanbeschi
 
Debugger Principle Overview & GDB Tricks
Debugger Principle Overview & GDB TricksDebugger Principle Overview & GDB Tricks
Debugger Principle Overview & GDB Tricks
dutor
 
Clojure and Modularity
Clojure and ModularityClojure and Modularity
Clojure and Modularity
elliando dias
 

Ähnlich wie LLDB Introduction (20)

BUD17-310: Introducing LLDB for linux on Arm and AArch64
BUD17-310: Introducing LLDB for linux on Arm and AArch64 BUD17-310: Introducing LLDB for linux on Arm and AArch64
BUD17-310: Introducing LLDB for linux on Arm and AArch64
 
2013.02.02 지앤선 테크니컬 세미나 - Xcode를 활용한 디버깅 팁(OSXDEV)
2013.02.02 지앤선 테크니컬 세미나 - Xcode를 활용한 디버깅 팁(OSXDEV)2013.02.02 지앤선 테크니컬 세미나 - Xcode를 활용한 디버깅 팁(OSXDEV)
2013.02.02 지앤선 테크니컬 세미나 - Xcode를 활용한 디버깅 팁(OSXDEV)
 
Building Efficient and Highly Run-Time Adaptable Virtual Machines
Building Efficient and Highly Run-Time Adaptable Virtual MachinesBuilding Efficient and Highly Run-Time Adaptable Virtual Machines
Building Efficient and Highly Run-Time Adaptable Virtual Machines
 
Usage of GDB
Usage of GDBUsage of GDB
Usage of GDB
 
Clojure And Swing
Clojure And SwingClojure And Swing
Clojure And Swing
 
Lobos Introduction
Lobos IntroductionLobos Introduction
Lobos Introduction
 
PIL - A Platform Independent Language
PIL - A Platform Independent LanguagePIL - A Platform Independent Language
PIL - A Platform Independent Language
 
Game development with_lib_gdx
Game development with_lib_gdxGame development with_lib_gdx
Game development with_lib_gdx
 
Apache Spark & Streaming
Apache Spark & StreamingApache Spark & Streaming
Apache Spark & Streaming
 
Go 1.10 Release Party - PDX Go
Go 1.10 Release Party - PDX GoGo 1.10 Release Party - PDX Go
Go 1.10 Release Party - PDX Go
 
How to implement a simple dalvik virtual machine
How to implement a simple dalvik virtual machineHow to implement a simple dalvik virtual machine
How to implement a simple dalvik virtual machine
 
Iron Languages - NYC CodeCamp 2/19/2011
Iron Languages - NYC CodeCamp 2/19/2011Iron Languages - NYC CodeCamp 2/19/2011
Iron Languages - NYC CodeCamp 2/19/2011
 
Rsltollvm
RsltollvmRsltollvm
Rsltollvm
 
Native Java with GraalVM
Native Java with GraalVMNative Java with GraalVM
Native Java with GraalVM
 
Tuning and Debugging in Apache Spark
Tuning and Debugging in Apache SparkTuning and Debugging in Apache Spark
Tuning and Debugging in Apache Spark
 
Introduction to the Java bytecode - So@t - 20130924
Introduction to the Java bytecode - So@t - 20130924Introduction to the Java bytecode - So@t - 20130924
Introduction to the Java bytecode - So@t - 20130924
 
Big Data Day LA 2016/ Hadoop/ Spark/ Kafka track - Iterative Spark Developmen...
Big Data Day LA 2016/ Hadoop/ Spark/ Kafka track - Iterative Spark Developmen...Big Data Day LA 2016/ Hadoop/ Spark/ Kafka track - Iterative Spark Developmen...
Big Data Day LA 2016/ Hadoop/ Spark/ Kafka track - Iterative Spark Developmen...
 
Swug July 2010 - windows debugging by sainath
Swug July 2010 - windows debugging by sainathSwug July 2010 - windows debugging by sainath
Swug July 2010 - windows debugging by sainath
 
Debugger Principle Overview & GDB Tricks
Debugger Principle Overview & GDB TricksDebugger Principle Overview & GDB Tricks
Debugger Principle Overview & GDB Tricks
 
Clojure and Modularity
Clojure and ModularityClojure and Modularity
Clojure and Modularity
 

Kürzlich hochgeladen

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Kürzlich hochgeladen (20)

Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 

LLDB Introduction

  • 1. LLDB Introduction Jaemok Jeong 2012. 8.
  • 2. Overview LLDB is a next generation, high performance debugger Available under the standard LLVM license, an open source ‘BSD-Style’ license Default debugger in Xcode on MAC OS X
  • 3. Features Supports modern multi-threaded program Upto date language support for C, C++, Objective C Extensible : Python scriptable and use a plug-in architecture
  • 4. General (lldb) help <command> <subcommand> (lldb) <noun> <verb> [-options [option-value]] [argument [argument...]]
  • 5. Execution (lldb) r / run (run) (lldb) s / step (source level single step in) (lldb) n / next (source level single step over) (lldb) si / ni (instruction level single step in) (lldb) finish (step out of currently selected frame)
  • 6. Hooks (lldb) target stop-hook add Enter your stop hook command(s). Type ‘DONE’ to end. > print i > DONE Stop hook #1 added (lldb) n (int) $32 = 1
  • 7. Breakpoint (lldb) b main (Set a break point at all function named main) (lldb) b test.c:12 (Set a breakpoint in file test.c at line 12) (lldb) b -[NSString stringWithFormat:] (lldb) br s -S count / br set -S vtDataCenterFetchComplete:userData: (lldb) br delete [n]
  • 8. Watchpoint (lldb) watch set var -w write global_var (set write watchpoint) (lldb) watch set exp -w write -- my_ptr (set write watchpoint in pointer) (lldb) watch set var -w read global_var (set read watchpoint) (lldb) watch modify -c ‘(global==5)’ (set condition on watchpoint)
  • 9. Examining Variables (lldb) frame variable (show arguments for the current frame) (lldb) frame v -a (--no-args) (show the local variables for the current frame) (lldb) frame v isChanged (p isChanged) (lldb) target v (show the global/static variables) (lldb) print a_var / po a_var
  • 10. Examining Thread state (lldb) thread backtrace (show the stack backtrace) (lldb) bt (lldb) up (select the stack frame that called the current stack frame) (lldb) down (select the stack frame that is called by the current stack frame)
  • 11. Executable & Shared Library (lldb) image list (list the main executable and all dependent shared libraries) (lldb) image dump sections (dump all sections from the main executable and any shared libraries)
  • 12. LLDB Python (lldb) script help(lldb) (lldb) script help(lldb.SBFrame) (lldb) script (Python interpreter) Define New Command with Python Define New Breakpoint action with Python
  • 13. Tips Alias (lldb) command alias bfl breakpoint set -f %1 -l %2 (lldb) bfl foo.c 12 Init file Reads the file ~/.lldbinit at startup
  • 14. Examples br set -S invalidateCache br set -S vtDataCenterFetchComplete:userData: watch set var -w read selectedDate
  • 15. Links Homepage http://lldb.llvm.org/ Source code svn co http://llvm.org/svn/llvm-project/ lldb/trunk lldb

Hinweis der Redaktion

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n