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 服务一直没装好 ...
随机推荐
- [POJ1007]DNA Sorting
[POJ1007]DNA Sorting 试题描述 One measure of ``unsortedness'' in a sequence is the number of pairs of en ...
- 从图片加载纹理-使用glut工具
转载 http://blog.csdn.net/dreamcs/article/details/7696069
- tomcat配置文件之Server.xml
Server.xml包含的元素有<Server>.<Service>.<Connector>.<Engine>.<Host>.<Con ...
- 用JAVA代码实现验证邮箱地址是否符合
public class Test{ public static void main(String[] args){ Test t = new Test(); String email = " ...
- django migration使用指南
转自: https://docs.djangoproject.com/en/1.8/topics/migrations/
- 基础知识《四》---Java多线程学习总结
本文转载自51cto 一.线程的基本概念简单的说:线程就是一个程序里不同的执行路径,在同一个时间点上cpu只会有一个线程在执行,Java里的多线程是通过java.lang.Thread类来实现的,每个 ...
- 【转】java反射详解
转自:http://www.cnblogs.com/rollenholt/archive/2011/09/02/2163758.html 本篇文章依旧采用小例子来说明,因为我始终觉的,案例驱动是最好的 ...
- 设置windows网络连接别名和linux网络连接别名
windows网络连接别名 C:\Windows\System32\drivers\etc目录下的hosts文件中添加 127.0.0.1 localhost 192.168.1.100 proxy. ...
- php对象引用和析构函数的关系
在php中构造函数和析构函数都属于魔术方法,比如构造函数在某一个类中,当这个类被实例化的时候就会自动调用,而析构函数是在这个类的对象被销毁的时候自动调用,默认情况下是在程序执行结束时自动调用. 如果我 ...
- hdu 1213 How Many Tables 解题报告
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1213 有关系(直接或间接均可)的人就坐在一张桌子,我们要统计的是最少需要的桌子数. 并查集的入门题,什 ...