4 ms·
If using LLVM, you may want to debug with lldb instead. Also with gdb you can use the tui mode. To read the environment variables used by a program you can use
by partycoder 8y ago
If using LLVM, you may want to debug with lldb instead. Also with gdb you can use the tui mode.
To read the environment variables used by a program you can use
cat /proc/{pid}/environ
update: Some of this overlaps with reverse engineering. I posted this comment yesterday about useful reverse engineering resources on Linux https://news.ycombinator.com/item?id=17342197 https://news.ycombinator.com/item?id=17342197
- glandium 8y agoNote that `/proc/$pid/environ` has null bytes between the entries, so it's not very readable if you just `cat` it. So you want to filter its content, e.g.: tr "\0" "\n" < /proc/$pid/environ
- samuell 8y agoI found cgdb much easier to use and more robust when resizing the terminal than gdb+tui. Liked it so much I made a video demonstrating it's usage: https://youtu.be/OKLR6rrsBmI https://youtu.be/OKLR6rrsBmI
- laumars 8y ago> To read the environment variables used by a program This is only the environmental variables used when the program launches. If said program changes any environmental variables during the course of it's execution then /proc/$pid/environ wouldn't be updated to reflect that. I expect you're already aware of this but it's worth me mentioning just in case anyone reading this thread wasn't aware.