lldb

lldb objc_msgSend tracing on OS X

家住魔仙堡 提交于 2019-11-29 12:46:12
I'm tracing a OS X application, I hope can find a way like this way on iOS: lldb Xcode: error: 'printf' is not a valid command Is there a way to do like this? I tried expr -- (void)printf("[%s, %s]\n",(char *) object_getClassName(*(long*)($esp+4)), (char *) *(long *)($esp+8) ) I think OS X is used 64bit registers. So this command cann't work(Indeed, it doesn't work). How should I write this command? Or there is a simple way to do the same? Just tracing the class and method called The command you quote above is only correct for iOS Simulator apps which run as i386 processes on the Mac. $esp+4

po Swift String “unresolved identifier”

Deadly 提交于 2019-11-29 11:24:26
问题 I am having trouble debugging Swift Strings func stringTest() { let test1:String = "test1"; let test2:NSString = "test2"; // <-- Breakpoint here println(test1); println(test2); } If I set a breakpoint after these lines and try and print test1 I get the following error: po test1 error: <REPL>:1:1: error: use of unresolved identifier 'test1' test1 ^ But I am able to print test2 successfully: po test2 test2 回答1: This is most likely a bug in the debug information output. You can check this by

Attaching sources to a binary dylib in Xcode

假如想象 提交于 2019-11-29 06:03:25
问题 I've a framework with a dylib in my iOS app which was compiled on another machine. I checked out the sources on my machine and tried instructing lldb to map the source code path using: settings set target.source-map /source/code/path/in/dylib/prefix /source/code/path/on/my/machine/prefix To no avail, still seeing assembly. Note #1: the dylib was compiled from C++ code in the same version of Xcode. Note #2: I'm used nm -pa /path/to/dylib to determine whether file paths are embedded into the

How to get NDK debugging to work in Android Studio?

与世无争的帅哥 提交于 2019-11-29 05:47:57
Android Studio doesn't stop at breakpoints in C++ code, this is what i've done so far : In AndroidManifest.xml : android:debuggable="true" In build.gradle (this may be the problem): sourceSets.main { jniLibs.srcDir 'src/main/libs' jni.srcDirs = [] } task ndkBuild(type: Exec) { commandLine android.ndkDirectory.getAbsolutePath() + '\\' + 'ndk-build.cmd', '-C', file('src/main/jni').absolutePath, 'NDK_DEBUG=1' } tasks.withType(JavaCompile) { compileTask -> compileTask.dependsOn ndkBuild } Configured the application as a native application on Android Studio Put breakpoints in C++ code Debug the app

Xcode LLDB watchpoints

守給你的承諾、 提交于 2019-11-29 05:42:09
问题 Is there any way to watch a variable in Xcode using LLDB ? Or is this only possible with GDB ? I'm trying to use the command watchpoint set variable but I get the message: invalid command 'watchpoint set' 回答1: Watchpoints are supported for iOS and Mac OS X debugging as of Xcode 4.5. To set a breakpoint on a variable named foo , do (lldb) watchpoint set variable foo you can always use the shortest unambiguous name for commands in the lldb console so (lldb) w s v foo would also work here. In

How can I do remote debugging in Xcode 4?

柔情痞子 提交于 2019-11-29 04:54:24
问题 Is there a way to do remote debugging in Xcode 4? The previous answers to this question were for Xcode 3 and Apple removed the specific debugging in Xcode guide that (I assume) covered remote debugging. For kicks I've been doing this with lldb , but if there's a way with gdb that'd be great. So far, I've been able to start a debug server on the remote machine like so /usr/bin/ssh -l ${REMOTE_USER} -f ${REMOTE_HOST} "/Developer/usr/bin/debugserver localhost:12345" And I can then manually log

Why doesn't lldb forward my environment variable anymore?

夙愿已清 提交于 2019-11-29 03:23:53
I'm working on a patch for FFmpeg and need to debug my code. I'm loading an external library, and in order to test different library versions, I have them in different folders. To select which one I want to use, I've been using DYLD_LIBRARY_PATH=/path/to/lib/dir ./ffmpeg and that works okay. But when I try it within lldb , it crashes saying dyld: Library not loaded and Reason: image not found . This used to work pre-Xcode 7.1, but I just recently upgraded and it stopped working. Here's my MVCE: #include <stdio.h> #include <stdlib.h> int main() { char* str = getenv("DYLD_LIBRARY_PATH"); if (str

Random (lldb) crashes in iOS Simulator on Mac OS X 10.8.4

帅比萌擦擦* 提交于 2019-11-29 03:23:37
I've been struggling with an weird issue for some time now. When running my app with the iOS Simulator initially closed it launches correctly. But if I then run it again without closing the simulator it crashes and just prints (lldb) in the error log. If I then run it again (without closing the simulator) it launches correctly. And if I do the same again it crashes. So it seems to be every second time. It works when using a iOS device and I have a college with the exact same project who doesn't experience this problem in the iOS Simulator. What I've tried is cleaning, reset contents and

How to attach to child process in LLDB

别说谁变了你拦得住时间么 提交于 2019-11-29 02:18:56
问题 My process starts child processes and I want to debug these as well, using LLDB on OS X. I can't find any option in the debugger to auto-attach. How to do it? 回答1: Google is really silent on this issue, but I found a workaround. Run your main process and stop it before it spins off any children. Then put a breakpoint on the function fork : b fork and let the program continue. When it is about to launch a child process, the breakpoint will be hit. At this moment, run another instance of LLDB

Setting breakpoint at NSKVODeallocateBreak

走远了吗. 提交于 2019-11-29 02:01:39
I am playing around with the map kit and I created an annotation. I am trying to find my bug due to this error: An instance 0x1b7ac0 of class AddressAnnotation was deallocated while key value observers were still registered with it. Observation info was leaked, and may even become mistakenly attached to some other object. Set a breakpoint on NSKVODeallocateBreak to stop here in the debugger. Here's the current observation info: I'm not sure where that NSKVODeallocateBreak to set a breakpoint at is. I thought I could use Instruments to debug it, but when I try, it crashes without giving me any