查看设备日志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. Windows下安装Oracle12C(一)

    1,在官网上下载oracle的压缩文件,两个都要下载. 并两个同时选中解压在一个文件夹里面. 2,解压之后,如下图,点击setup.exe稍等一会儿 ,3,开始安装: 不选点击下一步,或者直接点击下一 ...

  2. php 变量定义方法

    1.定义常量define("CONSTANT", "Hello world."); 常量只能包含标量数据(boolean,integer,float 和 str ...

  3. android studio怎么导入appcompat-v7

    方法1: 在项目的build.gradle文件里,用传统的自动依赖处理方式:compile ‘com.Android.support:appcompat-v7:+’,然后rebuild就可以了. 方法 ...

  4. js 历史

    原文http://javascript.ruanyifeng.com/introduction/history.html JavaScript的诞生 JavaScript 因为互联网而生,紧随着浏览器 ...

  5. 安卓开发笔记——GridView组件

    1.什么是GridView? GridView(网格视图)是按照行列的方式来显示内容的,一般用于显示图片,图片等内容,比如实现九宫格图,用GridView是首选,也是最简单的. 2.正文 GridVi ...

  6. Lynx

    http://www.unlinux.com/doc/soft/20051105/7402.html http://www.today-wx.com/linux/274.html 把 HTML 转成文 ...

  7. 【spark】jieba + wordcount

    import sys reload(sys) sys.setdefaultencoding('utf-8') from os import path import jieba from pyspark ...

  8. Python下字符画(ascii art)生成

    之前在b站上看到有人用C写了个脚本把妹抖龙op转换成字符画的形式输出了,感觉比较好玩在下就用python也写了一遍(主要是因为python比较简单好用).这里就这里就不介绍字符画了,因为能搜到这个的肯 ...

  9. Nginx服务器之负载均衡策略

    http://www.cnblogs.com/1214804270hacker/p/9325150.html

  10. python 导入模块的坑。为什么整个项目能运行,单独运行某个文件模块就报错?多层目录不同文件夹怎么导入?

    一些文章介绍了python不同目录怎么导入问题,但py文件运行起点却从来没有文章说过!这是相当重要的!! 这个连接是网上99%的所讲的导入 https://www.cnblogs.com/luoye0 ...