LLDB Introduction

4,436 views
4,202 views

Published on

LLDB is a next generation, high perfornace debugger

Published in: Technology
1 Comment
4 Likes
Statistics
Notes
No Downloads
Views
Total views
4,436
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
44
Comments
1
Likes
4
Embeds 0
No embeds

No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • LLDB Introduction

    1. 1. LLDB Introduction Jaemok Jeong 2012. 8.
    2. 2. OverviewLLDB is a next generation, high performancedebuggerAvailable under the standard LLVM license,an open source ‘BSD-Style’ licenseDefault debugger in Xcode on MAC OS X
    3. 3. FeaturesSupports modern multi-threaded programUpto date language support for C, C++,Objective CExtensible : Python scriptable and use aplug-in architecture
    4. 4. General(lldb) help <command> <subcommand>(lldb) <noun> <verb> [-options [option-value]][argument [argument...]]
    5. 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 selectedframe)
    6. 6. Hooks(lldb) target stop-hook addEnter your stop hook command(s). Type ‘DONE’ to end.> print i> DONEStop hook #1 added(lldb) n(int) $32 = 1
    7. 7. Breakpoint(lldb) b main (Set a break point at all function namedmain)(lldb) b test.c:12 (Set a breakpoint in file test.c at line12)(lldb) b -[NSString stringWithFormat:](lldb) br s -S count / br set -SvtDataCenterFetchComplete:userData:(lldb) br delete [n]
    8. 8. Watchpoint(lldb) watch set var -w write global_var (setwrite watchpoint)(lldb) watch set exp -w write -- my_ptr (setwrite watchpoint in pointer)(lldb) watch set var -w read global_var (set readwatchpoint)(lldb) watch modify -c ‘(global==5)’ (setcondition on watchpoint)
    9. 9. Examining Variables(lldb) frame variable (show arguments for thecurrent frame)(lldb) frame v -a (--no-args) (show the localvariables 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. 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. 11. Executable & Shared Library(lldb) image list (list the main executable andall dependent shared libraries)(lldb) image dump sections (dump all sectionsfrom the main executable and any sharedlibraries)
    12. 12. LLDB Python(lldb) script help(lldb)(lldb) script help(lldb.SBFrame)(lldb) script (Python interpreter)Define New Command with PythonDefine New Breakpoint action with Python
    13. 13. TipsAlias (lldb) command alias bfl breakpoint set -f %1 -l %2 (lldb) bfl foo.c 12Init file Reads the file ~/.lldbinit at startup
    14. 14. Examplesbr set -S invalidateCachebr set -SvtDataCenterFetchComplete:userData:watch set var -w read selectedDate
    15. 15. LinksHomepage http://lldb.llvm.org/Source code svn co http://llvm.org/svn/llvm-project/ lldb/trunk lldb

    ×