lldb

探秘Runtime

帅比萌擦擦* 提交于 2019-12-06 17:57:37
该文章属于<简书 — 刘小壮>原创,转载请注明: <简书 — 刘小壮> https://www.jianshu.com/p/5b7e7c8075ef NSObject 之前的定义 在 OC1.0 中, Runtime 很多定义都写在 NSObject.h 文件中,如果之前研究过 Runtime 的同学可以应该见过下面的定义,定义了一些基础的信息。 // 声明Class和id typedef struct objc_class *Class; typedef struct objc_object *id; // 声明常用变量 typedef struct objc_method *Method; typedef struct objc_ivar *Ivar; typedef struct objc_category *Category; typedef struct objc_property *objc_property_t; // objc_object和objc_class struct objc_object { Class _Nonnull isa OBJC_ISA_AVAILABILITY; }; struct objc_class { Class isa OBJC_ISA_AVAILABILITY; #if !__OBJC2__ Class super_class

lldb: Couldn't materialize: couldn't get the value of variable

半腔热情 提交于 2019-12-06 16:36:53
问题 I have compiled a cpp file with this command line: g++ -g test.cpp It throws an exception at line 28. I want to investigate the cause by inspecting the variables in lldb. I set a break point at line 28 and run the a.out in lldb. (lldb) n Process 84233 stopped * thread #1: tid = 0xa44b86, 0x00000001000017fb a.out`say(s=<unavailable>) + 987 at so.cpp:28, queue = 'com.apple.main-thread', stop reason = step over frame #0: 0x00000001000017fb a.out`say(s=<unavailable>) + 987 at so.cpp:28 25 } 26

Qt Creator fails to start debugging on Mac

孤人 提交于 2019-12-06 14:40:18
Recently (I suspect some system/homebrew update) the Qt's debugger stopped working. It hangs forever on Setting up inferior... The internal log: dStart parameters: 'QGIS' mode: 1 dABI: x86-darwin-generic-mach_o-64bit dLanguages: c++ dExecutable: ./QGIS dDirectory: ./build/output/bin/QGIS.app/Contents/MacOS dDebugger: /Library/Developer/CommandLineTools/usr/bin/lldb dProject: ./QGIS dAdditional Search Directories: dSysroot: dDebug Source Location: dDebugger settings: dAdditionalArguments: (default: ) dAdjustBreakpointLocations: true (default: true) dAllPluginBreakpoints: true (default: true)

lldb python handle breakpoint hit

此生再无相见时 提交于 2019-12-06 12:14:41
问题 I was looking through this huge LLDB python reference manual, and can't find still how to handle breakpoint hit with my code. I mean, I want to run my foo() when some breakpoint was hit. Please help me with some code snippets! Or point me the needed class in Python reference manual. Thanx! 回答1: On the page: http://lldb.llvm.org/python-reference.html there is a section titled: RUNNING A PYTHON SCRIPT WHEN A BREAKPOINT GETS HIT which has some useful info. What you are doing is "adding a command

Extending LLDB from NDK (Android Studio 3.1.3)

我们两清 提交于 2019-12-06 10:22:39
I've found a nice plugin for lldb that allows watching memory regions as images: https://github.com/carlodalmutto/ImageWatchLLDB As I can see, this plugin was developed for Xcode and not for Android. However, it is written in Python and therefore should be cross-platform. I've found a directory c:\Users\username\.lldb\ on my hard drive. Its size is about 1 Gb. I've created following files: c:\Users\username\.lldbinit , c:\Users\username\lldbinit , c:\Users\username\.lldb\lldbinit , c:\Users\username\.lldb\.lldbinit , c:\Users\username\.lldb\init All of them have the similar content: script

Unable to use po command in console (debug area)

落花浮王杯 提交于 2019-12-06 08:51:57
问题 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,

How do you debug an app for an older version of Mac OS X?

匆匆过客 提交于 2019-12-06 06:08:25
问题 I am developing an app using Xcode 4.6 on an OS X 10.8 machine. The app deployment target is set to 10.6, which is what we need to support. But when I archive the app (compile, link and embed resources+frameworks) and deploy (aka copy) it to the 10.6 test machine, it crashes with a generic Segmentation fault. It works fine on 10.7. I can't compile the project in Xcode on the older Mac because the app is built using the newer compiler (it uses ARC, implicit property synthesis, the new

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

旧时模样 提交于 2019-12-06 03:35:07
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 adding it to my executable target, but Xcode/lldb still doesn't 'see' the source or figure out that the

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

巧了我就是萌 提交于 2019-12-06 03:25:08
问题 When I use p or print it will only print the first 256 elements. How can I print all of them? 回答1: 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

Tell LLDB to ignore files

柔情痞子 提交于 2019-12-06 02:55:21
Is there a way to tell LLDB to ignore a file, i.e. step over code in that file when debugging? (This could be used as a workaround for 1 , 2 , 3 ) There is a setting to avoid stepping into functions whose name match a regular expression, (lldb) set list target.process.thread.step-avoid-regexp step-avoid-regexp -- A regular expression defining functions step-in won't stop in. e.g. put this in your ~/.lldbinit file settings set target.process.thread.step-avoid-regexp ^[^ ]+ std::|^std:: but in Xcode 4.5.x that's the best that can be done. I mentioned in #2 of your links that inlined stepping