繁体   English   中英

LIBC_PROBE 宏如何在 Glibc 中实际工作?

[英]How does LIBC_PROBE macro actually work in Glibc?

我试图了解mallopt()在 glibc 中的工作原理,但无法理解函数mallopt()使用的LIBC_PROBE宏的使用。 LIBC_PROBE的定义是创建另一个宏LIBC_PROBE_1并且它再次创建另一个STAP_PROBE##n mallopt()情况下,它是STAP_PROBE3(a1, a2, a3) 在此之后,不知道STAP_PROBE3将如何工作?
源文件: https : //github.com/lattera/glibc/blob/master/malloc/malloc.c (行:5141)。

来自include/stap-probe.h

Without USE_STAP_PROBE, that does nothing but evaluates all
its arguments (to prevent bit rot, unlike e.g. assert).

Systemtap's header defines the macros STAP_PROBE (provider, name) and
STAP_PROBEn (provider, name, arg1, ..., argn).  For "provider" we paste
in MODULE_NAME (libc, libpthread, etc.) automagically.

The format of the arg parameters is discussed here:

https://sourceware.org/systemtap/wiki/UserSpaceProbeImplementation

The precise details of how register names are specified is
architecture specific and can be found in the gdb and SystemTap
source code.  */

所以:

  1. 别担心——这对于理解malloopt()工作原理并不重要。
  2. 如果您真的很在意,请阅读上面引用的 wiki 文章,并查看 SystemTap 源代码中如何定义宏(SystemTap 是完全独立于 GLIBC 的项目)。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM