lldb

Redirect lldb output to file

China☆狼群 提交于 2019-12-20 10:12:15
问题 I'm using lldb inside Xcode, and one of my variables contains a huge chunk of JSON data. Using po myVar isn't much helpful to analyse this data, as it will output in the tiny Xcode debug console. Is there a way to redirect lldb output to a file ? I saw here that such a feature seems to be available on gdb as : (gdb) set logging on (gdb) set logging file /tmp/mem.txt (gdb) x/512bx 0xbffff3c0 (gdb) set logging off and is "translated" in lldb as : (lldb) memory read --outfile /tmp/mem.txt -

lldb: Breakpoint on exceptions (equivalent of gdb's catch throw)

孤街浪徒 提交于 2019-12-20 09:56:55
问题 I am trying to use lldb for c++ debugging and I want to halt if an exception is thrown, like gdb's catch throw , and I cannot find an equivalent in the lldb documentation. 回答1: In Xcode, you can set an Exception breakpoint (View > Navigators > Show Breakpoint Navigator, hit the + button in the bottom of the breakpoint list window to add a new breakpoint). If you're using command line lldb, put a breakpoint on __cxa_throw for C++ exception throws, objc_exception_throw for Objective-C exception

Xcode: how to exit lldb swift repl

梦想的初衷 提交于 2019-12-20 09:53:32
问题 I made a typo debugging my project and appeared in lldb swift REPL now I don't know how to exit it and simultaneously do not exit from my program which I debug. So I typed expr -r -- myVariable instead of expr -R -- myVariable. and below is what I see. (if you want to try personally I use Xcode 6.1, C++ code project, and myVariable has to exist) (lldb) expr -r -- record.mFileRecord.mVolumeName (std::string) $19 = "" 1> help expr /var/folders/zv/r3033x4n0f72bprvyk8612480000gn/T/lldb/30856

lldb breakpoint on all methods in class objective c

我是研究僧i 提交于 2019-12-20 09:38:37
问题 How can I automate setting a breakpoint on all methods in an Objective C class using lldb? This is useful for learning the behavior of a complicated legacy class. I am using Xcode (includes lldb) for iOS development, and it is cumbersome to manually go through the (large) file in Xcode and click the gutter next to each method to set breakpoints. 回答1: One option is to use regex breakpoints. breakpoint set -r '\[ClassName .*\]$' You can play around with the regexp to suit your needs. The

Dynamically accessing local variables in Objective-C runtime

可紊 提交于 2019-12-20 03:14:13
问题 When attached to the debugger via Xcode, LLDB provides a useful view of local variables (the bottom left of the screenshot): I found an LLDB command frame variable (and gdb's info locals ) that provides a list of the local variables (as seen in the right side of the screenshot above). My hope is that this functionality is possible to perform on the device at runtime. For example, I can access the stack trace using backtrace_symbols() , the current selector via _cmd , and a few others. Has

Android Studio 2.2.2 LLDB 2.2 update issue

我们两清 提交于 2019-12-19 17:46:20
问题 Today I updated my android studio to version V-2.2.2. When I am trying to debug my android application with native code(app-native) I am always getting error message C++ debugger package is missing or incompatible, do you want to fix it. After updating to lldb 2.2 also I am getting same issue when I try to debug my native c++ code. I am using gradle plug in 'com.android.tools.build:gradle-experimental:0.8.2' for building native ndk code. I have even updated ndk-bundle to latest version 13.0

Writing a Python script to print out an array of recs in lldb

只谈情不闲聊 提交于 2019-12-19 10:56:15
问题 I need help with the SBValue class used in the lldb Python module which is used for creating scripts for lldb debugging sessions. I am in the process of porting my kext test and debug system from gdb to lldb so I can start using the latest version of Xcode and Mac OS 10.9.1 . Part of this process is rewriting my gdb debug scripts in python so they can be used with lldb. I have the two mac setup working, can drop into lldb and poke around in the kernel of the victim Mac. I can also my Python

“return” from method while stepping?

女生的网名这么多〃 提交于 2019-12-19 05:16:54
问题 I would like to exit out the current method that I'm stepping through. -(void)helloWorld { NSLog(@"Hello"); // I would like to return here, so that "World" isn't printed. NSLog(@"World"); } I have tried the following, but without luck. (lldb) expr return <no result> Is this possible with lldb? 回答1: When you are debugging using Xcode and when your program is paused at a breakpoint, you can drag the little green arrow to any other line in the function. E.g. in the following code: if I want to

Why sometimes 'self' isn't available while debugging with lldb?

我只是一个虾纸丫 提交于 2019-12-18 19:14:07
问题 A lot of time (when it's not every time) I got the following error when I try to print objects on lldb. Is there some build/debug configuration to change or is this an error inside lldb? (lldb) po userLevel error: warning: Stopped in an Objective-C method, but 'self' isn't available; pretending we are in a generic context error: use of undeclared identifier 'userLevel' error: 1 errors parsing expression I build with llvm and do not strip debug symbols. Edit: Here is the backtrace: (lldb) bt *

How to match precompiled static library's debugging symbols to source code with Xcode 5?

给你一囗甜甜゛ 提交于 2019-12-18 16:58:40
问题 I have to compile FFmpeg for iOS using an external build script, but when I am debugging I see assembler if I delve too deep into libavformat library functions: 0x109a73: cmpl $0, 1192(%ebp) 0x109a7a: jns 0x109a86 ; mov_write_header + 198 at movenc.c:3539 0x109a7c: movl $1, 1192(%ebp) 0x109a86: movl 16(%ebp), %eax 0x109a89: cmpl $0, 84(%eax) 0x109a8d: movl %edx, %ecx 0x109a8f: jne 0x109ad9 ; mov_write_header + 281 at movenc.c:3548 0x109a91: testb $2, 48(%ecx) 0x109a95: jne 0x109ac1 ; mov