【转帖】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,即运行前编,与 ...
随机推荐
- 前端面试常考题:JS垃圾回收机制
摘要:众所周知,应用程序在运行过程中需要占用一定的内存空间,且在运行过后就必须将不再用到的内存释放掉,否则就会出现下图中内存的占用持续升高的情况,一方面会影响程序的运行速度,另一方面严重的话则会导致整 ...
- GaussDB CN服务异常实例分析
摘要:先通过OPS确认节点状态是否已经恢复,或登录后台执行cm_ctl query -Cv确认集群是否已经Normal. 本文分享自华为云社区<[实例状态]GaussDB CN服务异常>, ...
- vue2升级vue3: TSX Vue 3 Composition API Refs
在vue2时代,$refs 直接操作子组件 this.$refs.gridlayout.$children[index]; 虽然不推荐这么做,但是确实非常好用.但是vue2快速迁移到vue3,之前的这 ...
- AtCoder Beginner Contest 335 总结
ABC335总结 A.202<s>3</s> 翻译 给你一个由小写英文字母和数字组成的字符串 \(S\). \(S\) 保证以 2023 结尾. 将 \(S\) 的最后一个字符 ...
- Flask中本地代理的使用
本地代理 当请求到来时应用上下文和程序上下文被推入本地栈中,全局变量current_app,request,g,session都可以使用了.以current_app为例,current_app代表的是 ...
- AtCoder Beginner Contest 197(Sponsored by Panasonic) Person Editorial
A - Rotate 先输出第二和第三个字符,然后再输出第一个字符即可 B - Visibility 以 \((x,y)\) 作为起点向4个方向探索不是 # 的点,注意一下会在\((x,y)\)重复计 ...
- Flask的简单学习
简介 Flask是一个非常小的PythonWeb框架,被称为微型框架:只提供了一个稳健的核心,其他功能全部是通过扩展实现的:意思就是我们可以根据项目的需要量身定制,也意味着我们需要学习各种扩展库的使用 ...
- 【有奖体验】叮!你有一张 3D 卡通头像请查收
立即体验基于函数计算部署[图生图]一键部署3D卡通风格模型: https://developer.aliyun.com/topic/aigc_fc 人工智能生成内容(Artificial Intell ...
- win32com操作word 第十五 Find接口的使用
最近一直在忙于项目,以至于win32com的视频一直拖更.要不,书面形式更新吧.这次介绍的是Find接口. 假如,要在一篇2万字的文章中找到某些关键词,并返回Range对象,通常可以通过遍历段落 + ...
- 若依封装的request.js
import axios from 'axios' import { Notification, MessageBox, Message } from 'element-ui' import stor ...
