lldb

How to import lldb in a python script

狂风中的少年 提交于 2019-12-08 06:38:28
问题 According to LLDB main page, LLDB can be imported in a python script like this: import lldb After installing LLDB from a release package (on Lubuntu 15.04: sudo apt-get install lldb), I get the following error: Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python2.7/dist-packages/lldb/__init__.py", line 52, in <module> _lldb = swig_import_helper() File "/usr/lib/python2.7/dist-packages/lldb/__init__.py", line 44, in swig_import_helper ImportError: No

C Buffer Overflow - Why is there a constant number of bytes that trips a segfault? (Mac OS 10.8 64-bit, clang)

混江龙づ霸主 提交于 2019-12-08 02:56:27
问题 I was experimenting with buffer overflow in C, and found an interesting quirk: For any given array size, there seems to be a set number of overflow bytes that can be written to memory before a SIGABRT crash. For example, in the code below the 10 byte array can be overflowed to 26 bytes before crashing at 27. Similarly, an array of 20 char s can be overflowed to 40 char s before it aborts on the 41st. Can anyone explain why this is? Also, is the SIGABRT the same as (or caused by) a

Symbolic exception breakpoint on -[NSRangeException raise]

巧了我就是萌 提交于 2019-12-07 18:14:34
问题 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

How to execute a block (identified by pointer) from lldb

可紊 提交于 2019-12-07 17:40:41
问题 I'm in the lldb debugger within the iOS simulator and I have the address for a block. I want to try to execute it. I tried the first thing that came to mind (see below) but it didn't work. Is there a way to do this? (lldb) po 0x2c7140 (int) $2 = 2912576 <__NSGlobalBlock__: 0x2c7140> (lldb) po 0x2c7140(NO, @"Test") error: called object type 'int' is not a function or function pointer I also tried call but apparently that is not a command in llvm? It was available in gdb. (lldb) call (void

In Xcode, how to debug with external libraries that you have the source for?

。_饼干妹妹 提交于 2019-12-07 17:20:08
问题 I have a large-ish C/C++/Objective-C project building for OS X in Xcode. The project links to pre-built Qt5 libraries. That all works very nicely, until something crashes and I get a stack trace with Qt functions in it. If I click on the stack frame for one of the Qt functions, Xcode/lldb displays assembly rather than source - I'm using Qt as an external library, so I don't have any of the Qt source in my project. How can I fix this? I've tried adding the Qt5 source to the project without

Swift Framework returns 'ambiguous use of' method extension in lldb

断了今生、忘了曾经 提交于 2019-12-07 15:46:49
问题 I've upgraded to Xcode 11 & swift 5, and hit an an issue with method extensions when they are made available through a framework. More specifically, in a project structured like this: -> Main Project -> Framework created from sources in 'Main Project' -> Subproject using the above Framework (Sources packaged in the framework are not visible to the sub-project) Everything compiles and runs fine, but when running debug sessions on the subproject, all extensions in 'Framework' return error:

gdb/lldb call a function and break in it

孤人 提交于 2019-12-07 12:01:09
问题 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

LLDB 常用命令

女生的网名这么多〃 提交于 2019-12-07 08:32:01
LLDB 小结 简介 LLDB 是新一代高性能调试器,其是一组可重用组件的集合,这些组件大多是 LLVM 工程中的类库,如 Clang 表达式解析器或 LLVM 反汇编程序等。LLDB 是 Xcode 中默认的调试器,并且支持调试 C/C++ 程序,详情参考 官方文档 。 LLDB 命令 LLDB 的命令格式不同于 GDB 的命令格式的随意,而是统一为如下格式: <命令名称> <命令动作> [-可选项 [可选项的值]] [参数1 [参数2···]] 需要注意的是,不管是命令名称、命令动作、可选项还是参数,它们都是由空格分隔的,所以如果,参数本身包含由空格符号,那么,使用双引号来包裹参数,如果,参数中包含有反斜杠或双引号,那么使用反斜杠对它们进行转义。 多个可选项在命令行中的顺序并不是固定的,但是如果可选项后的参数是以 - 开始的,那么需要使用 -- 标记可选项的结束,如下面的命令: (lldb) process launch -- stop -at -entry -- -program_arg_1 value -program_arg_2 value //可选项顺序可以不固定 (lldb) breakpoint set -l 34 -f UIView + Theme . m (lldb) breakpoint set -f UIView + Theme . m -l 35 开启调试

How do I add a UICollectionView to a UIView as a subview?

别等时光非礼了梦想. 提交于 2019-12-07 02:05:38
问题 Well I'm getting a (lldb) while compiling this code. I'm trying to add a UICollectionView into a UIView in the Storyboard. This isn't right, right? #import "MyViewController.h" #import "TLSpringFlowLayout.h" #import "TLViewController.h" @interface MyViewController () @end @implementation MyViewController @synthesize collectionViewController; - (void)viewDidLoad { [super viewDidLoad]; //I'm creating my UICollectionViewController by using TLViewController & the layout TLStringFlowLayout

warning: Swift error in module. Debug info from this module will be unavailable in the debugger

时光怂恿深爱的人放手 提交于 2019-12-06 20:17:05
问题 I have no debugging values in my console for my swift + obj-c app, and I get a really unhelpful message that explains why the debugger isn't working: "warning: Swift error in module XXX.". XXX is the name of my module, not a 3rd party that I include. My app has been around before swift. I used the bridging header to start using swift, and I recently use the xcode tool to migrate all the swift 2 files to swift 3. (but I still have obj-c legacy in there). I use cocoa pods, which may be