如何从核心转储中获取环境变量 [英] How to get environment variable from a core dump
本文介绍了如何从核心转储中获取环境变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在UNIX环境(linux/solaris/AIX)中,我的应用程序崩溃了.请帮助我从核心转储中获取环境变量
In UNIX environment(linux/solaris/AIX) my application crashing. Please help to me get environment variable from the core dump
推荐答案
运行strings -a core
应该会产生一个看起来很明显的字符串块,例如HOME=...
,HOSTNAME=...
等.
Running strings -a core
should produce an obvious-looking block of strings like HOME=...
, HOSTNAME=...
, etc.
您还可以通过查看main
的第三个参数来检查初始环境,该参数是envp[]
-以NULL
终止的指向环境字符串的指针数组.
You can also examine initial environment by looking at the 3rd argument to main
, which is a envp[]
-- a NULL
-terminated array of pointers to the environment strings.
最后,当前环境块由__environ
或类似变量指向.
Finally, current environment block is pointed at by __environ
or similar variable.
这篇关于如何从核心转储中获取环境变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文