• Check it out - we have a chatbot! Go ask TuxBot a question in the Ask Tuxbot section!

How can gdb access variable names (__environ)

Electric_Pulse

New Member
Joined
Aug 22, 2021
Messages
6
Reaction score
0
Credits
67
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?
 


MattWinter

Active Member
Joined
Dec 5, 2022
Messages
117
Reaction score
153
Credits
858
I think the symbol information gets preserved when you build with the -g option
 
MALIBAL Linux Laptops

Linux Laptops Custom Built for You
MALIBAL is an innovative computer manufacturer that produces high-performance, custom laptops for Linux.

For more info, visit: https://www.malibal.com

Members online


Top