调试MobileSubstrate扩展的最佳方式是什么,即放置断点等?有没有在Xcode中做到这一点? GNU调试器?如何调试MobileSubstrate调整?
3
A
回答
2
#define Debugger() { kill(getpid(), SIGINT) ; }
然后,只需调用Debugger(),无论您想要放置断点。
,如果你想跟踪的堆栈你也可以引发一个异常:
[NSException raise:@"Exception Message" format:formatString];
6
我用的系统日志和尾巴。你需要Cydia的syslogd
和Erica Utilities
。然后在整个调整的地方NSLog(@"breakpoint 1 - %@", someObject);
并运行调整。
tail -f /var/log/syslog
+0
错字:'埃里卡公用事业'。 ,P – Matoe
1
Mobilesubstrate将您的dylib注入到目标进程中。使用GDB或LLDB调试目标进程也在调试您的扩展代码。 我将向您展示如何使用GDB调试Mobilesubstrate扩展。 下面是简单的MobileSubstrate有/标志扩展:
%hook SBApplicationController
-(void)uninstallApplication:(id)application {
int i = 5;
i = i +7;
NSLog(@"Hey, we're hooking uninstallApplication: and number: %d", i);
%orig; // Call the original implementation of this method
return;
}
%end
我编译和安装代码,然后在GDB连接到它:
yaron-shanis-iPhone:~ root# ps aux | grep -i springboard
mobile 396 1.6 4.3 423920 21988 ?? Ss 2:19AM 0:05.23 /System/Library/CoreServices/SpringBoard.app/SpringBoard
root 488 0.0 0.1 273024 364 s000 S+ 2:22AM 0:00.01 grep -i springboard
yaron-shanis-iPhone:~ root# gdb -p 488
你可以找到你的MobileSubstrate有扩展使用以下命令:
(gdb) info sharedlibrary
此命令打印已加载模块的列表,找到您的扩展名:
test-debug-substrate.dylib - 0x172c000 dyld Y Y /Library/MobileSubstrate/DynamicLibraries/test-debug-substrate.dylib at 0x172c000 (offset 0x172c000)
您还可以找到标志uninstallApplication挂钩的地址:哪些输出该
(gdb) info functions uninstallApplication
:
0x0172cef0 _logos_method$_ungrouped$SBApplicationController$uninstallApplication$(SBApplicationController*, objc_selector*, objc_object*)
可以调试与断点和其他GDB的功能,您uninstallApplication钩子函数:
(gdb) b *0x0172cef0+36
其中偏移量36是程序集opcod e在uninstallApplication钩子函数中将7添加到i变量中。只要您愿意,您可以继续从这里调试您的Mobilesubstrate扩展。
相关问题
- 1. 如何创建基本的MobileSubstrate调整
- 2. Mobilesubstrate:创建一个调整钩入另一个调整或dylib
- 3. 在MobileSubstrate调整中显示UIView?
- 4. Mobilesubstrate MobileSafari调整徽标编译问题
- 5. 重新调整和调试
- 6. 如何调整
- 7. 调整后调整/调试当前FPS吗?
- 8. 如何调试Rscript调用
- 9. 如何调试grpc调用?
- 10. 如何调试JS调用
- 11. 如何调试SOAP调用?
- 12. 如何调试
- 13. 如何调整iFrame
- 14. 如何调整infowindow?
- 15. 如何从调整
- 16. 如何调整GGPLOT2
- 17. 如何调整CSS
- 18. 如何调整AlertView
- 19. 如何调整imageButton?
- 20. 如何调整offset()?
- 21. 如何调整“spark.rpc.askTimeout”?
- 22. 如何调整imageview?
- 23. 如何调整divs?
- 24. 如何调整mapred.reduce.parallel.copies?
- 25. 如何调试自定义调试器?
- 26. 如何通过调试进行调试?
- 27. 当我创建MobileSubstrate有重复的接口声明的错误调整
- 28. 我将如何返回? (MobileSubstrate)
- 29. 试图调整的iframe
- 30. 如何调试TreeNodeCollection
当您放置断点时,您会做什么? – Tyilo