Get function name by address in Linux
Source file:
1: #define __USE_GNU //import!
2: #include <dlfcn.h>
3: #include <stdio.h>
4: void getFuncNameByAddr(void *this_fn, void *call_site) {
5: Dl_info DlInfo;
6: int nRet;
7: if ((nRet = dladdr(this_fn, &DlInfo)) != 0)
8: {
9: printf("ENTER:%s\t", DlInfo.dli_sname);
10: }
11: }
When you compile this code with GCC, please don’t forget the flag ‘-rdynamic’ or ‘-Wl, –-export-dynamic’, which is used to tell the Linker to add the symbols to the dynamic symbol table.
The below function interface is programming interface to dynamic linking loader, so when using them, please link with –ldl when compile.
dladdr, dlclose, dlerror, dlopen, dlsym, dlvsym
Get function name by address in Linux的更多相关文章
- Linux Force DHCP Client (dhclient) to Renew IP Address
http://www.cyberciti.biz/faq/howto-linux-renew-dhcp-client-ip-address/‘m using Ubuntu Linux. How to ...
- ARM32 Linux kernel virtual address space
http://thinkiii.blogspot.jp/2014/02/arm32-linux-kernel-virtual-address-space.html The 32-bit ARM C ...
- 浅谈Linux中的信号处理机制(二)
首先谢谢 @小尧弟 这位朋友对我昨天夜里写的一篇<浅谈Linux中的信号处理机制(一)>的指正,之前的题目我用的“浅析”一词,给人一种要剖析内核的感觉.本人自知功力不够,尚且不能对着Lin ...
- linux下cp覆盖原so文件时引起的段错误原因确定
原创作品,转载请注明出处http://www.cnblogs.com/leo0000/p/5694416.html 最近因为一个很有意思的段错误学习了一些新的东西. 当时现象是这样的,程序正在运行,系 ...
- Intel 80x86 Linux Kernel Interrupt(中断)、Interrupt Priority、Interrupt nesting、Prohibit Things Whthin CPU In The Interrupt Off State
目录 . 引言 . Linux 中断的概念 . 中断处理流程 . Linux 中断相关的源代码分析 . Linux 硬件中断 . Linux 软中断 . 中断优先级 . CPU在关中断状态下编程要注意 ...
- linux socket中的SO_REUSEADDR
Welcome to the wonderful world of portability... or rather the lack of it. Before we start analyzing ...
- 嵌入式Linux USB WIFI驱动的移植
硬件平台:飞思卡尔MX258开发板 操作系统:Linux2.6.31 WIFI: RT2860 USB WIFI模组 交叉编译环境:gcc version 4.1.2 调试步骤: 第一步:测试U ...
- Linux 网络编程: xinetd time
前言 终于把 xinetd 服务装好了,那就在来实现一下 TCP 协议从服务器和本机获取时间吧.那么多思想汇报还没写,我也是醉了. 安装 xinetd apt-get install xinetd 配 ...
- Linux 网络编程: daytime Service
前言 如果你这段时间过得很舒服,那就证明你荒废以一段时间.如果你这段时间过得很辛苦,那么恭喜,你又进步了.最近入党的事情忙得焦头烂额,博客也拖了好久没写,主要也是因为要装 xinetd 服务一直没装好 ...
随机推荐
- 修改Capfile,在正式环境不再使用migration修改数据库
原因是这样的,运维不开放正式环境数据库的alter权限,所以每次都要给他们把sql语句发过去, 由他们来操作. https://github.com/capistrano/rails Require ...
- Bellman-Ford算法
#include<stdio.h> #define max 0xffffff ][]; //图的邻接矩阵 ]; int n;//顶点个数 int m;//边个数 struct Edge { ...
- GraphicsMagick为图片添加水印
GraphicsMagick号称图像处理领域的瑞士军刀.提供了健壮及高效的图像处理工具包和库,支持超过88种主流图片格式包括:BMP,GIF,JPEG,JPEG-2000,PNG,PDF,PNM,TI ...
- Copy List with Random Pointer
A linked list is given such that each node contains an additional random pointer which could point t ...
- CAS单点登录之mysql数据库用户验证及常见问题
前面已经介绍了CAS服务器的搭建,详情见:搭建CAS单点登录服务器.然而前面只是简单地介绍了服务器的搭建,其验证方式是原始的配置文件的方式,这显然不能满足日常的需求.下面介绍下通过mysql数据库认证 ...
- Doodle Poll 投票文档
使用Doodle Poll网页文件可以让大家投票看什么时间大家都合适.
- QQ图片名字
ﻩ并亲了你一下ﻩ大兔子҉҉大兔子҉҉҉҉҉҉҉҉
- IDE整理
1.eclipse 下载地址:http://www.eclipse.org/downloads/ 2.myeclipse 下载地址:http://www.myeclipseide.com/mo ...
- javaScript中利用ActiveXObject来创建FileSystemObject操作文件
注:如果用javascript读本地文件,遇到安全问题. 需在浏览器中进行设置,如下: 工具—> Internet选项->安全->自定义级别->启用“没有标识为安全的A ...
- 案例(用封装的ajax函数检查用户名)
本程序主要功能是检查用户输入的用户名是否在检查的范围之内 CheckUserName.htm代码: <head> <title></title> <scrip ...