How can gdb access variable names (__environ)

Electric_Pulse

New Member
Joined
Aug 22, 2021
Messages
7
Reaction score
0
Credits
86
When a program is compiled all the variable names get turned into memory pointers right?
How come I can attach to any process (I have tried the root process and the user bash shell) and print the __environ variable - how does gdb know at what address this variable will be? Is this what "stripping" gets rid off?
 


I think the symbol information gets preserved when you build with the -g option
 

Members online


Top