3 ms·
Debug your programs like they're closed source
- carey 12y agoShould I stop feeling guilty now about debugging Java programs on Windows using Process Monitor?
- greenyoda 12y agoOn Windows, there's also Process Explorer[1], which can show you all your processes' threads, file handles, etc. (plus all the stuff you can see in Task Manager like memory and CPU usage). And it can search for which process has a particular file open. Very useful. [1] https://en.wikipedia.org/wiki/Process_Explorer https://en.wikipedia.org/wiki/Process_Explorer
- greenyoda 12y ago"Your program communicates with something on a network, but some of the information it’s sending is wrong? It’s probably sending it with write, sendto, or send." If you want to debug network traffic, a higher-level tool like Wireshark[1] (which knows about the packet formats for all sorts of different wire protocols and has sophisticated tools for filtering out just the packets you're interested in seeing) would be much easier to use than looking at system call traces. Still, this is a great article, and I definitely agree that learning about your operating system's debugging facilities is useful, but in many cases you can save yourself a lot of time by using a tool that's optimized for a particular task. [1] https://en.wikipedia.org/wiki/Wireshark https://en.wikipedia.org/wiki/Wireshark
- Retric 12y agoThe nice thing about learning to use the UNIX approach is you can use that output as you would any other stream. So, grep it and save that it to a file or any of those other 1001 fun unix things.
- anaphor 12y agoHere is a good way I've found to debug network based code: Step 1: write shell scripts to capture certain kinds of network traffic with tcpdump and output a pcap file (e.g. have a certain function to capture HTTP traffic of a certain kind) Step 2: open with wireshark and split screen with source code I'm sure wireshark has a nice way of doing step 1 but I prefer the workflow of typing "foocap example.org" and then looking at the results in wireshark.
- Pacabel 12y agoWhile I suppose this may be a "new way" of debugging for the author of this article, it's hardly a new technique. strace, trace, truss and similar tools have been around for decades now. They're the kind of tools that many developers and sysadmins use without a second thought.
- helper 12y agoIf you find strace useful, you should check out sysdig[1]. Sysdig is like strace but uses kernel trace points instead of ptrace so it has a lower probe effect on the running process. [1]: http://www.sysdig.org/ http://www.sysdig.org/
- cordite 12y agostrace with Haskell is really messy because of the run time scheduler for green threads. I would guess that it is similar for other run times that involve similar concurrency management techniques.