Re:Strace – My Favourite Secret Weapon (2011)
by orivej on Sunday February 11, 2018 @03:17PM
(#16354546)
Re. My Library Is Not Loading!, a pretty useful trick to find what files are missing is to extend your path env var with an empty directory and then grep strace output for its occurrences, e.g.
I had a need to track what files are used by what processes spawned by a program (to infer dependencies between the processes), and it seemed (and probably was) simpler to use ptrace directly rather than to parse strace output, so I wrote https://github.com/orivej/fptrace/ . Soon it turned out useful to dump its data into shell scripts that reflect the tree of spawned processes and let you rerun an arbitrary subtree. I mostly use it to debug build systems, for example to trace configure and examine what env var affected a certain check in a strange way, or to trace make and rerun the C compiler with -dD -E to inspect an unexpected interference between includes.
[ Parent
| on HN ]
Re:Strace – My Favourite Secret Weapon (2011)
by glandium on Sunday February 11, 2018 @04:34PM
(#16354959)
If your only concern is libraries, you can ask the dynamic loader to print out what it loads:
LD_DEBUG=libs command
You can check out all the valid options with:
LD_DEBUG=help cat
or check out `man ld.so`.
On mac, there is something similar. Lookup all the DYLD_PRINT_* variables in `man dyld`.
Re:Strace – My Favourite Secret Weapon (2011)
by ereyes01 on Sunday February 11, 2018 @03:37PM
(#16354651)
This is a cool trick. On Linux, the ldd command also tells you what libraries a program wants to link to. You can also play around with LD_LIBRARY_PATH to manipulate what ldd tells you.
Re:Strace – My Favourite Secret Weapon (2011)
by hugelgupf on Sunday February 11, 2018 @03:41PM
(#16354680)
Binaries can also use dlopen to open libraries that aren't listed by ldd.