News for hackers. Stuff that matters.
Re:Some ways to get better at debugging by benreesman on Wednesday August 31, 2022 @06:43PM (#32669293)
`strace` has a bunch of features that I'd like to learn thoroughly someday, but I get weekly if not daily value from a few basic invocations:

`run_my_build.whatever` -> hangs, damn.

`strace run_my_build.whatever` -> awesome i can see all the system calls so i know what `.so`s it's pulling in, and what config files it's trying to read, and if it's hanging on a network socket or whatever. This is usually where `strace` just immediately solves my problem.

If you've got like a background daemon that's misbehaving you can do `strace -p <PID>` and it will attach and start printing out the syscalls, this can also be really useful.

`strace` (on all my systems at least) logs to `STDERR` by default, so sometimes you want some combination of like `2>/tmp/log.strace.blah` or to interleave the `STDOOUT` of the process so it's just the usual shell stuff `strace whatever 2>&1 | rg -C ...`.

My use of the tool is very basic, but that's part of what makes it such a great tool, a few simple invocations will just save your bacon. This is especially true on a new team/company or whatever where you run the thing from the Wiki and it doesn't build or start or...

Re:Some ways to get better at debugging by mbwgh on Thursday September 01, 2022 @07:06AM (#32674711)
If you use `htop`, you can press `s` while hovering over the process. In addition to providing the `strace -p` functionality, you also get some rudimentary helper functionality like searching, filtering, or manually scrolling vs. tailing the output.
Re:Some ways to get better at debugging by omginternets on Thursday September 01, 2022 @12:09PM (#32678517)
That's super cool. Thanks for the tip!
Re:Some ways to get better at debugging by omginternets on Wednesday August 31, 2022 @07:15PM (#32669574)
Nice. I definitely need to use this more. Thanks :)