博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Object c 汇编debug(转)
阅读量:5021 次
发布时间:2019-06-12

本文共 1928 字,大约阅读时间需要 6 分钟。

文章来源
有时间看看object c 的汇编,先转一个,有时间了再学习。

One of the reasons I have not been posting as regularly is because of a big project I am currently working on. I have delved into the world of Objective-C, and have been enjoying it a ton. One of the pleasant surprises I found was the XCode utilizes GCC and GDB to do its compilation and debugging. Although they provide a nice GUI to interact with the debugger (create breakpoints, etc), it still will give you the normal ASM dump on errors. I imagine many developers out there just glaze over when they see this, but I got very excited! After doing some research and reading, I found some very useful  articles to help me with my debugging.

If you are brand new to ASM I would recommend you go over to SecurityTube and check out their. For those who know some ASM, you should be able to understand mostly.

Useful Commands

Identify Selector

When a message fails it is important to know which exactly selector threw the error. That selector can be found referenced within $ecx. The following is the command to display the value of $ecx, as well as a GDB command to display every call and selector made:

Single Command:
x/s $ecx


Script:
break
commands
x/s $ecx
c
end

The script works by creating designating a command to print out the value of $ecx as a string, then continue the process. See the above Phrack article for more details.

Identify Class Name

When an object is going to execute a method the method pointer is loaded into $ecx (as seen above) and the pointer to the id/object is loaded into $eax.The class name can be found within a struct that exists within each object. It exists as a pointer (4-bytes) 8-bytes into the struct. We can access it in two ways:

printf:
printf "%s\n", *(long*)($eax+8)


call getName method:
call (char *)class_getName($eax)

That is just the basics, but I hope you will find it helpful.

转载于:https://www.cnblogs.com/likwo/archive/2012/01/04/2312491.html

你可能感兴趣的文章
Android读取url图片保存及文件读取
查看>>
完整ASP.Net Excel导入
查看>>
判断CPU大小端示例代码
查看>>
ARTS打卡第13周
查看>>
循环队列的运用---求K阶斐波那契序列
查看>>
pta 编程题14 Huffman Codes
查看>>
初始化bootstrap treeview树节点
查看>>
python selenium向<sapn>标签中写入内容
查看>>
JS常用坐标
查看>>
使用”结构化的思考方式“来编码和使用”流程化的思考方式“来编码,孰优孰劣?...
查看>>
C#调用斑马打印机打印条码标签(支持COM、LPT、USB、TCP连接方式和ZPL、EPL、CPCL指令)【转】...
查看>>
关于git的认证方式
查看>>
字符串按照字典序排列
查看>>
IOS 开发调用打电话,发短信
查看>>
CI 框架中的日志处理 以及 404异常处理
查看>>
keepalived介绍
查看>>
css3 标签 background-size
查看>>
python itertools
查看>>
Linux内核调试技术——jprobe使用与实现
查看>>
样式、格式布局
查看>>