【转帖】What are segfault rip/rsp numbers and how to use them
https://stackoverflow.com/questions/1456899/what-are-segfault-rip-rsp-numbers-and-how-to-use-them
When my linux application crashes, it produces a line in the logs something like:
segfault at 0000000 rip 00003f32a823 rsp 000123ade323 error 4
What are those rip and rsp addresses? How do I use them to pinpoint the problem? Do they correspond to something in the objdump or readelf outputs? Are they useful if my program gets its symbols stripped out (to a separate file, which can be used using gdb)?
2 Answers
Highest score (default)
Trending (recent votes count more)
Date modified (newest first)
Date created (oldest first)
Well the rip pointer tells you the instruction that caused the crash. You need to look it up in a map file.
In the map file you will have a list of functions and their starting address. When you load the application it is loaded to a base address. The rip pointer - the base address gives you the map file address. If you then search through the map file for a function that starts at an address slightly lower than your rip pointer and is followed, in the list, by a function with a higher address you have located the function that crashed.
From there you need to try and identify what went wrong in your code. Its not much fun but it, at least, gives you a starting point.
Edit: The "segfault at" bit is telling you, i'd wager, that you have dereferenced a NULL pointer. The rsp is the current stack pointer. Alas its probably not all that useful. With a memory dump you "may" be able to figure out more accurately where you'd got to in the function but it can be really hard to work out, exactly, where you are in an optimised build
I got the error, too. When I saw:
probe.out[28503]: segfault at 0000000000000180 rip 00000000004450c0 rsp 00007fff4d508178 error 4
probe.out is an app which using libavformat (ffmpeg). I disassembled it.
objdump -d probe.out
The rip is where the instruction will run:
00000000004450c0 <ff_rtp_queued_packet_time>:
4450c0: 48 8b 97 80 01 00 00 mov 0x180(%rdi),%rdx
44d25d: e8 5e 7e ff ff callq 4450c0 <ff_rtp_queued_packet_time>
finally, I found the app crashed in the function ff_rtp_queued_packet_time.
PS. sometimes the address doesn't exactly match, but it is almost there.
【转帖】What are segfault rip/rsp numbers and how to use them的更多相关文章
- 每天学点GDB14
在上一篇文章中讲到了ptrace,那么我们完全可以用ptrace来写一个非常简单的trace工具,用以trace程序的具体运行过程. 用它可以很清楚的回答,使用glibc编译后的hello world ...
- IA-32e模式下的异常处理
系统异常处理 CPU如果调用系统异常处理程序 需要的数据结构 IDT_Table: 中断向量表, 在中断向量表中的每一项都是一个中断描述符(中断门或者陷阱门), 一个中断描述符中的几位是段选择符 GD ...
- [Advance] How to debug a program (上)
Tool GDB Examining Memory (data or in machine instructions) You can use the command x (for “examine” ...
- Virtualization and Performance: Understanding VM Exits
翻译自:Virtualization and Performance: Understanding VM Exits 出于对特定指令 或 特定事件(eg. page fault)的响应而导致的VM ...
- xenomai内核解析之双核系统调用(一)
版权声明:本文为本文为博主原创文章,转载请注明出处.如有错误,欢迎指正.博客地址:https://www.cnblogs.com/wsg1100/ 目录 xenomai 内核系统调用 一.32位Lin ...
- C温故补缺(四):GDB
gdb gdb是由GNU软件社区提供的C Debug工具 Pre 在调试前,需要先编译.c程序,且要加上-g使输出文件变得可调式 gcc test.c -g -o test 用gdb test来调试程 ...
- [转帖]The Lambda Calculus for Absolute Dummies (like myself)
Monday, May 7, 2012 The Lambda Calculus for Absolute Dummies (like myself) If there is one highly ...
- 【pyhon】理想论坛单帖爬虫取得信息存入MySql数据库
代码: # 单帖爬虫,用于爬取理想论坛单个帖子得到发帖人,发帖时间和回帖时间并存入数据库,url例子见main函数 from bs4 import BeautifulSoup import reque ...
- 【Python】爬取理想论坛单帖爬虫
代码: # 单帖爬虫,用于爬取理想论坛帖子得到发帖人,发帖时间和回帖时间,url例子见main函数 from bs4 import BeautifulSoup import requests impo ...
- [转帖]软件的变革与 AOT
软件的变革与 AOT https://www.colabug.com/851475.html 文章写的很牛B .. 前言 AOT 即 Ahead of Time Compilation,即运行前编,与 ...
随机推荐
- vue常用函数
this.$router.back(); //回退上一页面
- 【API进阶之路】太秃然了,老板要我一周内检测并导入一万个小时的视频
摘要:假期结束后回来上班,走进电梯都有一种特别的感觉,电梯那个植发广告里的大哥看我的眼神好像和之前不太一样- 上回说到,老板奖励7天带薪假,我就回家玩耍了几天,顺便还帮兄弟发不脱当了一回"A ...
- 实例解析丨一文搞定GaussDB CM服务异常
摘要:本文主要为大家带来如何处理GaussDB CM服务异常问题. 本文分享自华为云社区<[实例状态]GaussDB CM服务异常>,作者:酷哥. 首先确认是否是虚拟机.网络故障,底层故障 ...
- 解析数仓lazyagg查询重写优化
摘要:本文对Lazy Agg查询重写优化和GaussDB(DWS)提供的Lazy Agg重写规则进行介绍. 本文分享自华为云社区<GaussDB(DWS) lazyagg查询重写优化解析[这次高 ...
- JVM内存模型,你看这一篇就够了
摘要:JVM是一种用于计算设备的规范,是一个虚构出来的计算机,通过在实际的计算机上仿真模拟各种计算机功能来实现的. 本文分享自华为云社区<[云驻共创]JVM内存模型的探知之旅>,作者:多米 ...
- 利用 Solon-web 框架写一个 Hello World
Solon 项目的开源地址: https://gitee.com/noear/solon 最近看了不少别人写的各种框架的 Hello world 示例,有些看起来,真的很复杂. 今天,我们用号称简单到 ...
- SpringBoot Scheduled 常见用法
外部统一管理可用 xxl-job ,将各定时任务集中管理,灵活改变执行频率,支持某一个定时器集群处理,避免多服务启动时,每个服务都执行(重复执行) 比如我的API服务里有一个定时任务,将API做成集群 ...
- Spark面试题(六)——Spark资源调优
Spark系列面试题 Spark面试题(一) Spark面试题(二) Spark面试题(三) Spark面试题(四) Spark面试题(五)--数据倾斜调优 Spark面试题(六)--Spark资源调 ...
- 【每天一个不会秃头的前端案例】CSS + JS 实现早安,晚安动画
从橘子学姐那边学来的 早安,晚安动画(CSS + js) 成果展示 先看成果. 通过点击太阳实现日夜的动画平滑交替 Movie 这里就不多说什么了,直接贴一下代码 HTML部分 <!DOCTYP ...
- springboot启动流程简单总结
Spring Boot程序有一个入口,就是main方法.main里面调用SpringApplication.run()启动整个Spring Boot程序,该方法所在类需要使用@SpringBootAp ...
