lldb

How to send a message to an object in lldb console?

对着背影说爱祢 提交于 2019-12-04 15:44:33
问题 Say that I have the pointer to an object ' 0x20c28010 '. How can I send this object a message in the debugger console (lldb)? As in: [0x20c28010 doSomething]; 回答1: If the message doesn't return anything, or returns a pointer, an integer or a floating-point type that you don't care about, you can do this: p (void)[0x20c28010 doSomething] If you care about the return type, or the return type is a struct , you need to cast to the correct return type. Examples: p (int)[0x20c28010 length] p (float

Unable to use po command in console (debug area)

Deadly 提交于 2019-12-04 14:42:08
Suddenly I have started to get this message randomly ( but pretty much often) expression produced error: warning: /var/folders/53/0z4yfqt16tvbcn0z7f2385n80000gn/T/expr3-d271e2..swift:3:9: warning: initialization of variable '$__lldb_error_result' was never used; consider replacing with assignment to '_' or removing it var $__lldb_error_result = __lldb_tmp_error ~~~~^~~~~~~~~~~~~~~~~~~~ _ when I try to type something like this in console: po myObject So, the console prints only message above, rather than it gives me something useful... How to fix this, and what caused it? lldb has changed in

Symbolic breakpoint for when dispatch_async is called with a specific queue

有些话、适合烂在心里 提交于 2019-12-04 12:25:55
I'm debugging an issue in my project involving grand central dispatch. In debugging this, it would be really helpful to have a way of being notified when work is dispatched to a specific queue. Is there some way of setting a symbolic breakpoint on dispatch_async with a condition that could check whether the dispatch queue argument is the same as some other queue that I have access to? Dave Lee Here's how to set a conditional breakpoint. (I haven't done conditions on queues, I'm making the assumption here that pointer equality will Just Work™.) First get the address of the queue you want, let's

Dump memory in lldb

强颜欢笑 提交于 2019-12-04 11:41:13
问题 As stated on this site. When I want to dump memory in gdb. The start point is 0x1000 and end 0x2000 . For lldb start is 0x1000 and end 0x1200 . Is there a reason for this or is just a mistake ? Main question is: How do I dump a memory area from 0x1000 to 0x2000 in lldb? 回答1: The following works fine for me: (lldb) memory read --outfile /tmp/mem.txt 0x6080000fe680 0x6080000fe680+1000 Dumps 1000 bytes of memory, from the given start address, in hex format, to /tmp/mem.txt. Use --binary for

Xcode lldb error: can't print out Swift variable - get “$__lldb_injected_self.$__lldb_wrapped_expr_x” instead

為{幸葍}努か 提交于 2019-12-04 09:20:13
问题 Sometimes, when trying to print out a variable in the debugger, the following error message is displayed: error: warning: <EXPR>:12:9: warning: initialization of variable '$__lldb_error_result' was never used; consider replacing with assignment to '_' or removing it var $__lldb_error_result = __lldb_tmp_error ~~~~^~~~~~~~~~~~~~~~~~~~ _ error: <EXPR>:18:5: error: use of unresolved identifier '$__lldb_injected_self' $__lldb_injected_self.$__lldb_wrapped_expr_120( ^~~~~~~~~~~~~~~~~~~~~ This is a

How to print more than 256 array elements in Xcode lldb?

做~自己de王妃 提交于 2019-12-04 08:22:59
When I use p or print it will only print the first 256 elements. How can I print all of them? You can tell lldb to force all the array elements to be printed for a particular expression evaluation thusly: (lldb) expr -A -- array_variable You can also raise the maximum number of elements (lldb calls them "children") that get printed by default by running: (lldb) set set target.max-children-count 1024 or whatever value you want. You can also put this in your ~/.lldbinit if you want to up this limit for all your lldb sessions. 来源: https://stackoverflow.com/questions/42647198/how-to-print-more

lldb is not starting an application

◇◆丶佛笑我妖孽 提交于 2019-12-04 07:34:53
this is my first experience in commandline mode of lldb. unsuccessful. installed minimal kit with clang, lld, lldb v5 (ubuntu 16.04) sample application built with clang. trying to start: lldb applcation >run error: process launch failed: unable to locate lldb-server-5.0.0 so now the questions: why lldb tries to run a server? this is not a remote debugging. why lldb refers to 5.0.0 (and where to change this setting)? actually there was added symbolic links automiticaly with xxx-5.0 suffix to all llvm utilities, but not with xxx-5.0.0. would be reasonable if this refers to lldb-server itself,

Error in breakpoint condition

人盡茶涼 提交于 2019-12-04 04:04:53
I've set a breakpoint with the condition... [event.name isEqualToString:@"Some Name"] This works fine. However, when I try to add another breakpoint with the condition... [part.name isEqualToString:@"Some Value With A Pound Sign £"] I get the error... Internal error [IRForTarget]: An Objective-C constant string's string initializer is not an array Stopped due to an error evaluating condition of breakpoint Do I need to escape the pound sign or something? There's a bug with the expression parser and an NSString literal containing non-ASCII characters. (lldb) po @"u" $9 = 0x00007fff7debe5e0 u

LLDB 'thread return' command emits error in a Swift function

≯℡__Kan透↙ 提交于 2019-12-04 03:38:17
I am reading the Dancing in the Debugger — A Waltz with LLDB article. And I am trying the thread return command with Swift 2.2 as well as Swift 3.0. My code is pretty simple: class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() let resust = test() print(resust) } func test() -> Bool { return true } } and I added a breakpoint at the beginning of the test() function with a thread return false action. However, after command+R, my program stops at the breakpoint as expect, but with the following error: "error: Error returning from frame 0 of thread 1: We only

Add a symbolic breakpoint on a selector in Xcode

女生的网名这么多〃 提交于 2019-12-04 02:54:27
There's a bug in my app which shows up with the following (partial) stacktrace: 2011-11-25 01:55:59.760 Events2[6650:403] -[Event boolValue]: unrecognized selector sent to instance 0x7fb903928670 To debug this I decided to add a symbolic breakpoint on -[Event boolValue] reasoning that when that selector is sent, the debugger would halt. However, nothing happens. After setting the breakpoint the app just soldiers on and generates the same exception without halting. I have defined the breakpoint as follows: I'm using the LLDB debugger with Xcode 4.2 Setting a breakpoint on a selector causes lldb