gpt4 book ai didi

c - glibc中哪个函数调用了main函数

转载 作者:IT王子 更新时间:2023-10-29 00:19:12 24 4
gpt4 key购买 nike

我想了解 Linux 如何启动程序。我在某处读到 glibc 中的某些函数调用了 main 函数。使用 callgrind 进行分析并查看 Kcachegrind 中的调用图,我看到 below main 调用了 main。但是我不明白这一点,函数不能这样命名。所以我的问题是 glibc 中的哪个函数实际启动了 main 函数。

最佳答案

在 valgrind 自己的帮助下,您将找到对选项--show-below-main 的解释:

By default, stack traces for errors do not show any functions that appear beneath main because most of the time it's uninteresting C library stuff and/or gobbledygook. Alternatively, if main is not present in the stack trace, stack traces will not show any functions below main-like functions such as glibc's __libc_start_main. Furthermore, if main-like functions are present in the trace, they are normalised as (below main), in order to make the output more deterministic.

因此,在 main 下 不是调用 main 本身的函数,而是 __libc_start_main

关于c - glibc中哪个函数调用了main函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10642852/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com