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的更多相关文章

  1. 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 ...

  2. ARM32 Linux kernel virtual address space

    http://thinkiii.blogspot.jp/2014/02/arm32-linux-kernel-virtual-address-space.html   The 32-bit ARM C ...

  3. 浅谈Linux中的信号处理机制(二)

    首先谢谢 @小尧弟 这位朋友对我昨天夜里写的一篇<浅谈Linux中的信号处理机制(一)>的指正,之前的题目我用的“浅析”一词,给人一种要剖析内核的感觉.本人自知功力不够,尚且不能对着Lin ...

  4. linux下cp覆盖原so文件时引起的段错误原因确定

    原创作品,转载请注明出处http://www.cnblogs.com/leo0000/p/5694416.html 最近因为一个很有意思的段错误学习了一些新的东西. 当时现象是这样的,程序正在运行,系 ...

  5. Intel 80x86 Linux Kernel Interrupt(中断)、Interrupt Priority、Interrupt nesting、Prohibit Things Whthin CPU In The Interrupt Off State

    目录 . 引言 . Linux 中断的概念 . 中断处理流程 . Linux 中断相关的源代码分析 . Linux 硬件中断 . Linux 软中断 . 中断优先级 . CPU在关中断状态下编程要注意 ...

  6. linux socket中的SO_REUSEADDR

    Welcome to the wonderful world of portability... or rather the lack of it. Before we start analyzing ...

  7. 嵌入式Linux USB WIFI驱动的移植

    硬件平台:飞思卡尔MX258开发板 操作系统:Linux2.6.31 WIFI:    RT2860 USB WIFI模组 交叉编译环境:gcc version 4.1.2 调试步骤: 第一步:测试U ...

  8. Linux 网络编程: xinetd time

    前言 终于把 xinetd 服务装好了,那就在来实现一下 TCP 协议从服务器和本机获取时间吧.那么多思想汇报还没写,我也是醉了. 安装 xinetd apt-get install xinetd 配 ...

  9. Linux 网络编程: daytime Service

    前言 如果你这段时间过得很舒服,那就证明你荒废以一段时间.如果你这段时间过得很辛苦,那么恭喜,你又进步了.最近入党的事情忙得焦头烂额,博客也拖了好久没写,主要也是因为要装 xinetd 服务一直没装好 ...

随机推荐

  1. [POJ1050]To the Max

    [POJ1050]To the Max 试题描述 Given a two-dimensional array of positive and negative integers, a sub-rect ...

  2. VS2008+Qt+助手 智能提示不显示、Qt关键字不高亮的解决办法【已解决】

    笔者使用的开发环境是VS2008+Qt4.8.5+VAssistX,有时候会出现代码关键字不能高亮显示,并且助手的智能提示不显示.问题如下 解决的办法是在助手的选项中设置其搜索路径,助手的设置通过VS ...

  3. Rotate bitmap by real angle

    tl;dr; Use GDI+ SetWorldTransform With WinAPI's SetWorldTransform you can transform the space of dev ...

  4. HTML 笔记,持续更新

    一.文本格式化标签 <b> 定义粗体文本. <big> 定义大号字. <em> 定义着重文字. <i> 定义斜体字. <small> 定义小 ...

  5. nested exception is org.xml.sax.SAXParseException; lineNumber: 8; columnNumber: 56; cvc-complex-type.2.4.c通配符的匹配很全面, 但无法找到元素 'dubbo:application' 的声明

    严重: Exception sending context initialized event to listener instance of class org.springframework.we ...

  6. Maven运行时异常java.lang.UnsupportedClassVersionError的解决方案

    我用的Maven版本为最新版:3.3.9,但是我执行一个简单的clean命令会报如下错误: Exception in thread "main" java.lang.Unsuppo ...

  7. HDU 5805 NanoApe Loves Sequence (思维题) BestCoder Round #86 1002

    题目:传送门. 题意:题目说的是求期望,其实翻译过来意思就是:一个长度为 n 的数列(n>=3),按顺序删除其中每一个数,每次删除都是建立在最原始数列的基础上进行的,算出每次操作后得到的新数列的 ...

  8. HDU 5317 RGCDQ (数论素筛)

    RGCDQ Time Limit: 3000MS   Memory Limit: 65536KB   64bit IO Format: %I64d & %I64u Submit Status ...

  9. Hudson可扩展持续集成引擎

    参考文章:http://blog.csdn.net/dazhi_100/article/details/11629133 极限编程中一项建议实践便是持续集成,持续集成是指在开发阶段,对项目进行持续性自 ...

  10. Android之Fragment(一)

    Fragment的产生与介绍 Android运行在各种各样的设备中,有小屏幕的手机,超大屏的平板甚至电视.针对屏幕尺寸的差距,很多情况下,都是先针对手机开发一套App,然后拷贝一份,修改布局以适应平板 ...