From the course: Debugging in Go
Unlock this course with a free trial
Join today to access over 25,500 courses taught by industry experts.
Using strace - Go Tutorial
From the course: Debugging in Go
Using strace
- [Instructor] In this video, we're going to learn about a system utility called strace. Strace is a Linux system utility. So if you happen to be running on macOS, you can use dtruss instead. Strace will trace all of the system calls made by your program and output information about them, including the syscall arguments and return values. This can be really useful for tracking down issues in your program that stem from interactions with the kernel vs syscalls. Additionally, if you're in a situation where you have a program that is hanging and unresponsive and might be hanging on a blocking syscall, using strace can help you find out what's going on. Let's take a look at how we can use strace to trace a program. Here we have a program that doesn't do anything particularly useful, but it is a good example of using a bunch of different syscalls. On line 11, we have timed out now, which we'll use syscalls to get the current time. Then we have OS to open, close, and io ReadAll, which we'll…