查看设备日志tail -f /var/log/syslog
或者

Mobilesubstrate injects your dylib into the target process. Debugging the target process using GDB or LLDB is also debugging your extension code. I will show you how to debug Mobilesubstrate extension using GDB. Here is simple Mobilesubstrate/Logos extension:

%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

I compile and install the code, and then attaching gdb to it:

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

You can find your Mobilesubstrate extension with the command:

(gdb) info sharedlibrary 

This command print a list of loaded modules, find your extension:

test-debug-substrate.dylib            - 0x172c000         dyld Y Y /Library/MobileSubstrate/DynamicLibraries/test-debug-substrate.dylib at 0x172c000 (offset 0x172c000)

You can also find the address of Logos uninstallApplication hook:

(gdb) info functions uninstallApplication

Which outputs this:

0x0172cef0  _logos_method$_ungrouped$SBApplicationController$uninstallApplication$(SBApplicationController*, objc_selector*, objc_object*)

You can debug your uninstallApplication hook function with breakpoints and other gdb features:

(gdb) b *0x0172cef0+36

Where the offset 36 is the assembly opcode that adding of 7 to the i variable in uninstallApplication hook function. You can continue to debug your Mobilesubstrate extension from here as you wish.

使用gdb调试theos tweak插件的更多相关文章

  1. win10下搭建jz2440v3(arm s3c2440)开发及gdb调试环境【转】

    本文转载自:https://blog.csdn.net/newjay03/article/details/72835758 本来打算完全在Ubuntu下开发的,但是水平有限,没有在Ubuntu下找到合 ...

  2. 8. VIM 系列 - 利用 VIM 8.1 版本编译项目和GDB调试

    目录 term 模式 termdebug 模式 VIM版本安装请参考: 0. VIM 系列 - 源码升级最新版本vim term 模式 输入:term 打开此模式,效果如下 这个模式有编辑文本窗口和s ...

  3. Linux基础(03)gdb调试

    1. 安装GDB增强工具 (gef) * GDB的版本大于7.7 * wget -q -O- https://github.com/hugsy/gef/raw/master/scripts/gef.s ...

  4. GDB调试基础使用方法

    尽管目前使用的VS code可以使用插件一键构建和运行程序,但GDB作为调试利器,还是值得花时间去学习的. 概述 GDB(GNU Debugger) 是一个由GNU开源组织发布的.UNIX/LINUX ...

  5. GDB调试:Linux开发人员必备技能

    开篇词:Linux C/C++ 开发人员要熟练掌握 GDB 调试 大家好,我是范蠡,目前在某知名互联网旅游公司基础框架业务部技术专家组任开发经理一职. 本系列课程的主题是 Linux 后台开发的 C/ ...

  6. GDB调试命令小结

    1.启动调试 前置条件:编译生成执行码时带上 -g,如果使用Makefile,通过给CFLAGS指定-g选项,否则调试时没有符号信息.gdb program //最常用的用gdb启动程序,开始调试的方 ...

  7. GDB调试汇编堆栈过程分析

    GDB调试汇编堆栈过程分析 分析过程 这是我的C源文件:click here 使用gcc - g example.c -o example -m32指令在64位的机器上产生32位汇编,然后使用gdb ...

  8. gdb调试器的使用

    想要使用gdb调试程序的话,首先需要gcc -g main.c -o test 然后运行gdb test对程序进行调试 l (小写的l,是list的首字母),用以列出程序 回车    是运行上一个命令 ...

  9. 20145212——GDB调试汇编堆栈过程分析

    GDB调试汇编堆栈过程分析 测试代码 #include <stdio.h> short val = 1; int vv = 2; int g(int xxx) { return xxx + ...

随机推荐

  1. RHEL 7 中 systemctl 的用法(替代service 和 chkconfig)

    1.systemctl是RHEL 7 的服务管理工具中主要的工具,它融合之前service和chkconfig的功能于一体.可以使用它永久性或只在当前会话中启用/禁用服务. systemctl可以列出 ...

  2. Mysql:This version of MySQL doesn’t yet support ‘LIMIT & IN/ALL/ANY/SOME 错误解决

    From: http://blog.chinaunix.net/uid-22414998-id-2945656.html This version of MySQL doesn’t yet suppo ...

  3. DShow + OpenGL播放视屏

    #include <DShow.h> #pragma include_alias( "dxtrans.h", "qedit.h" ) #define ...

  4. Ubuntu下从外网上北邮人BT

    首先你需要有北邮的VPN账号和密码,只要是北邮的学生都有 账号和密码不懂的请查看 VPN账号密码说明 接下来登录 https://sslvpn.bupt.edu.cn,输入账号和密码 已经登录好了 但 ...

  5. 机器学习——使用Apriori算法进行关联分析

    从大规模的数据集中寻找隐含关系被称作为关联分析(association analysis)或者关联规则学习(association rule learning). Apriori算法 优点:易编码实现 ...

  6. jsTree 插件Ajax数据

    完整代码 <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta ...

  7. [转] 关于QT的系统总结

    出处:http://www.cnblogs.com/wangqiguo/p/4625611.html 阅读目录 编译环境与开发流程 QT项目的构成及原理 QT中的布局 QT中的通用控件 QVarian ...

  8. 输入控件tagsinput

    ​摘要: ​tagsinput是一款基于jQuery的插件.具有组织输入内容.校验.backspace删除等功能.当你在输入框输入结束按下enter键,tagsinput会将你输入的内容用标签封装,每 ...

  9. 阿里云被挖矿使用,导致cpu长期处于100%,ddgs进程,xWx3T进程,关于redis密码

    1.使用top命令,查看到一个叫xWx3T的进程cpu占用99.8%,由于我的阿里云是单核的,所以最高只能100%. 把它用kill命令杀死后,过一会儿又启动了,又占用100%. 使用ps -ef可以 ...

  10. win10进入到安全模式的三种方法

    这里介绍三种方法: 如果能够进入到系统 点击开始--设置--更新和安全--恢复,右侧点击高级启动中的立即重启 能够进入到登陆界面 进入到登录屏幕后,在按住 Shift 键的同时依次选择“电源” > ...