3 ms·
I pretty much read the code for every dependency I use. It helps me understand how it works and what the docs are fibbing about. If I can't read the code becau
by vhost- 12y ago
I pretty much read the code for every dependency I use. It helps me understand how it works and what the docs are fibbing about.
If I can't read the code because it's proprietary, I always strace it to see what it's doing.
For me, it makes it easier to reason about the behavior of my program.
Currently my favorite code to read includes: key/value databases written in C and other "lower level" languages, and the golang standard library packages.
- sillysaurus3 12y agoWould you mind going into detail about how you use strace in that context? Or about how you learned to do that? That's a very handy skill which I need to learn.
- seanp2k2 12y agoThis should whet your appetite and give you a bit of direction on what to dig deeper into: http://althing.cs.dartmouth.edu/local/reverse-talk.pdf http://althing.cs.dartmouth.edu/local/reverse-talk.pdf
- vhost- 12y agoStart with htop. You can get that package from apt in a debian-based distro: `sudo apt-get install htop strace`. When you launch htop, you will see a list of all your running procs. If you select a proc with the arrow keys, you can hit "s" to start a strace and then hit f4 to follow the strace as it dishes output. This won't work for all procs, you will need root to strace certain procs. This is a good place to start as it's visual and easy to follow. Later you can start traces from the shell with proc IDs and even get system call info from GDB.