lldb

Invoking function with string argument with lldb: how?

為{幸葍}努か 提交于 2019-12-06 02:42:35
I am unable to use lldb to invoke simple, non-templated functions that take string arguments. Is there any way to get lldb to understand the C++ datatype "string", which is a commonly used datatype in C++ programs? The sample source code here just creates a simple class with a few constructors, and then calls them (includes of "iostream" and "string" omitted): using namespace std; struct lldbtest{ int bar=5; lldbtest(){bar=6;} lldbtest(int foo){bar=foo;} lldbtest(string fum){bar=7;} }; int main(){ string name="fum"; lldbtest x,y(3); cout<<x.bar<<y.bar<<endl; return 0; } When compiled on Mac

Xcode 4 hangs on attaching to (App name) when debugger is set to LLDB

安稳与你 提交于 2019-12-06 00:29:22
问题 When I run a app in the simulator the Xcode hangs on Attaching to (App name), but this only happens when the debugger is set to LLDB. The app runs fine when the debugger is set to GDB (Product->Edit Scheme -> Run -> Debugger) How can I fix this to debug with LLDB without the Xcode hanging at Attaching to (App name)? 回答1: I've found this happens from time to time, but generally restarting either the simulator or the device, restarting XCode and cleaning your derived data directory does the

LLDB调试详解--逆向开发

二次信任 提交于 2019-12-05 22:14:56
前言 今天讲述在苹果日常开发中一个装逼神器LLDB,是Xcode内置的动态调试工具. 在iOS系统程序开发中,会经常需要代码调试的追踪, 最常用的也是LLDB(low level debugger) .LLDB能更好的辅助开发者通过各种手段如修改变量进行测试,甚至能协助开发同学来定位bug. LLDB是新一代高性能的调试器, 也是Mac OSX上Xcode的默认调试器, 支持在桌面和iOS设备模拟器上调试C,OC和C++以及Swift. 帮助 LLDB命令的格式如下: <命令名称> <命令动作> [-可选项 [可选项的值]] [参数1 [参数2...]] LLDB命令是由各部分空格分割, 如果参数是包含空格, 则需要双引号括起参数,如果参数本身中包含双引号或反斜杠, 就需要使用反斜杠来进行转义. LLDB命令是非常多的, 完全记录下来是不可能的, 而且还没有必要. 可以利用help命令查看相关LLDB命令的用法.如下: 三、LLDB常见命令 3.1 breakpoint指令 示例Demo1   func test1(str: String) { self.test2(str: str) } func test2(str: String) { self.test3(str: str) } func test3(str: String) { print(str) } override

Symbolic exception breakpoint on -[NSRangeException raise]

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-05 21:33:58
Adding a symbolic breakpoint in Xcode gives you an example template of -[NSException raise] . I want to do the same thing but specifically on -[NSRangeException raise] . The reason being that I want to breakpoint only on specific array bounds exceptions, for example: *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayI objectAtIndex:]: index 31 beyond bounds [0 .. 30]' Yes, I know that I can add a catch all exception breakpoint. However, I do not want to do that as I do not want to breakpoint on the many exceptions generated throughout using the app. I've

Add a symbolic breakpoint on a selector in Xcode

↘锁芯ラ 提交于 2019-12-05 19:39:05
问题 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

iOS app crashes with no error, just (lldb)

末鹿安然 提交于 2019-12-05 18:28:34
My application lately seems to randomly crash with no error or exceptions. The console just shows (lldb) in light blue. I have uncaught exception handling and still nothing. It happens at random times. I can do the same task over and over and sometimes it will happen and sometimes it won't. Also sometimes it will happen in random places within the application. So far what I have read is it is possibly just the lldb debugger crashing and not my app however I haven't noticed it before. Any ideas how to figure out what the cause of the crash is? It seems to have started when I added MBProgressHUD

gdb/lldb call a function and break in it

随声附和 提交于 2019-12-05 14:12:23
I have a global function in a long run program : int test() { int a = 12; int c = 10; printf("a=%d",a); a += c ; printf("a=%d", a); return a; } I debug the program and break, then issue the following command: (lldb) call test() a=12a=22(int) $0 = 22 (lldb) I want it to break in test() method every line after I hit call test() , not just return the result immediately. Anyone knows how to do it ? ------------------------------------ Answer Below ------------------------------------ @Jason Molenda 's answer is the right answer,use expr -i0 -- test() instead of call test() : (lldb) b test

使用LLDB远程调试iOS程序

点点圈 提交于 2019-12-05 10:39:45
This is an extended version of the guide I posted in 2014 . It covers iOS 7-9 for ARM32 and 64 bit processors. Please note that LLDB is quite buggy, so some things may not work for you, or work in a wrong way. Shit happens, sorry. 这篇文章是 2014年写的一篇 指导文章 的番外篇. 覆盖了从iOS7到iOS9的32位和64位程序. 请注意LLDB很棒, so some 所以有些事情可能不会以错误的方式为你工作,或工作。妈的情况,对不起。 概要: 准备沙盒 环境 准备debugserver 给debugserver签名 复制debugserver到iOS 设备 开始准备 问题和解决方法 debugserver不启动的解决 lldb显示SDK Path error 使用.lldbinit 使用USB进行联调 开始调试 进行中的进程 等待进程 使用LLDB运行程序 ASLR 在内存中计算ASLR漂移 移除ASLR Using a decrypted binary Preparing the sandbox Environment 你需要准备:

Use top of tree lldb with xcode

筅森魡賤 提交于 2019-12-05 10:10:12
问题 I built the top of tree of lldb in /usr/local/bin and I would like to tell xcode to use this binary instead of the default one. But I can't find how/where to set this. 回答1: Unfortunately this won't work. There have been a couple of API changes made to the svn repository lldb since lldb-179 was branched off (c. early December 2012) for Xcode 4.6.x. If you were to put the LLDB.framework built from current svn in /Applications/Xcode.app/Contents/SharedFrameworks/ it will cause Xcode to crash

Disable signals at LLDB initialization

风流意气都作罢 提交于 2019-12-05 04:35:51
My software uses the SIGUSR2 signal and I am using LLDB (under Xcode 4.6.2) as my debugger. I would like to disable LLDB from stoping at SIGUSR2 and have been doing so using the command: process handle --pass true --stop false --notify true SIGUSR2 I am looking for a way to have LLDB always execute this command at startup. I have looked into adding something along the lines of settings append target.process.extra-startup-command process in my .lldbinit, but while this changes the value of the target.process.extra-startup-command setting (as evidenced by the settings show command), I am