惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Google DeepMind News
Google DeepMind News
D
Darknet – Hacking Tools, Hacker News & Cyber Security
博客园 - 【当耐特】
博客园_首页
博客园 - Franky
有赞技术团队
有赞技术团队
T
The Blog of Author Tim Ferriss
Recorded Future
Recorded Future
H
Hackread – Cybersecurity News, Data Breaches, AI and More
F
Fortinet All Blogs
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
酷 壳 – CoolShell
酷 壳 – CoolShell
量子位
T
Tailwind CSS Blog
博客园 - 三生石上(FineUI控件)
M
MIT News - Artificial intelligence
D
Docker
H
Help Net Security
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
GbyAI
GbyAI
S
SegmentFault 最新的问题
腾讯CDC
Latest news
Latest news
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
I
InfoQ
美团技术团队
C
Cybersecurity and Infrastructure Security Agency CISA
宝玉的分享
宝玉的分享
Hugging Face - Blog
Hugging Face - Blog
V
Visual Studio Blog
C
Cisco Blogs
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
S
Schneier on Security
Spread Privacy
Spread Privacy
Recent Announcements
Recent Announcements
T
Threat Research - Cisco Blogs
F
Full Disclosure
T
Threatpost
T
Tenable Blog
AWS News Blog
AWS News Blog
Cloudbric
Cloudbric
The Last Watchdog
The Last Watchdog
B
Blog RSS Feed
W
WeLiveSecurity
I
Intezer
月光博客
月光博客
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
L
Lohrmann on Cybersecurity
Hacker News - Newest:
Hacker News - Newest: "LLM"

博客园 - 小洋房

防止中文程序在英文系统上乱码 [Delphi] 快速获取文件大小 SQL Server2005中四种排名函数的使用 Delphi字符串函数大全 DateUtils-Function 用Delphi创建服务程序 - 小洋房 - 博客园 由图像的灰度化看基本图像处理 [转摘]Indy10,采用线程,发送电子邮件 如何过XP的防火墙而不被拦截 安装MSDE 2000 自动安装SQL Server数据库 现有 Delphi 项目迁移到 Tiburon 中的注意事项 Delphi中的字符串(转) Playing With System Using Delphi Format函数详解 更改Delphi系统的默认字体 delphi指针 关于基础类数据结构的设计想法 判断SQL SERVER 服务是否断开
Delphi之通过崩溃地址找出源代码的出错行
小洋房 · 2008-04-07 · via 博客园 - 小洋房

一 什么是MAP文件

      什么是 MAP 文件?简单地讲, MAP 文件是程序的全局符号、源文件和代码行号信息的唯一的文本表示方法,它可以在任何地方、任何时候使用,不需要有额外的程序进行支持。而且,这是唯一能找出程序崩溃的地方的救星。

      如果要查找代码行号,需要使用下面的公式做一些十六进制的减法运算:

      崩溃行偏移 = 崩溃地址(Crash Address) - 基地址(ImageBase Address) - 0x1000

      为什么要这样做呢?我们得到的崩溃地址都是由 偏移地址+ 基地址得来的,所以在计算行号的时候要把基地址减去,一般情况下,基地址的值是 0x00400000 。另外,由于一般的 PE 文件的代码段都是从 0x1000 偏移开始的,所以也必须减去 0x1000 。

二 Delphi 下生成MAP文件的方法 

        1.   project   ->   options   ->   Linker   ->   Map   file   选择detailed.  

三 例子

      代码

     运行时会抱错

这里可以发现出错地址是:$00401A51

根据:      崩溃行偏移 = 崩溃地址(Crash Address) - 基地址(ImageBase Address) - 0x1000

                                     =$00401A51 - $00400000 -$1000

                                    =$00000A51

那么,通过在MAP文件里查找小于或等于$00000A51的最大值就是,我们要得到的崩溃行偏移.

这样得到出错行在, Unit1单元的36行.  正好是这行:   p^   :=   'A';   //   36行.  这里会报错