6

In UNIX environment(linux/solaris/AIX) my application crashing. Please help to me get environment variable from the core dump

1 Answers1

9

Running strings -a core should produce an obvious-looking block of strings like HOME=..., HOSTNAME=..., etc.

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.

Finally, current environment block is pointed at by __environ or similar variable.

Employed Russian
  • 182,696
  • 29
  • 267
  • 329