Strace
|
Size: 865
Comment: Using strace
|
Size: 2015
Comment:
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 1: | Line 1: |
| [[Include(Debugging/Header)]] ||<tablestyle="float:right; font-size: 0.9em; width:30%; background:#F1F1ED; background-image: url('https://librarian.launchpad.net/1812570/bugsquad.png'); background-repeat: no-repeat; background-position: 98% 0.5ex; margin: 0 0 1em 1em; padding: 0.5em;">'''Contents'''[[BR]][[TableOfContents]]|| |
|
| Line 11: | Line 13: |
| strace -Ff -tt <program> <arguments> 2>&1 | tee strace.log | strace -Ff -tt <program> <arguments> 2>&1 | tee strace-<program>.log |
| Line 14: | Line 16: |
| 1. Attach the complete output from strace, contained in strace.log, in your bug report. | 1. Attach the complete output from strace, contained in strace-<program>.log, in your bug report. = Already running programs = You may want to run strace on an already running program. This could be because strace logs too many things before you can reproduce a crash. Or, it could be because you are trying to find out what a program is doing in an infinite loop. 1. Make sure strace is installed. {{{ apt-get install strace }}} 1. Find the process ID of <program>: {{{ pidof <program> }}} 1. Start strace with the process ID: {{{ strace -Ff -tt -p <PID> 2>&1 | tee strace-<program>.log }}} 1. Perform any actions necessary to reproduce the bug. 1. You may have to hit Control-C to get strace to detach from a running program. 1. Attach the complete output from strace, contained in strace-<program>.log, in your bug report. ---- CategoryDebugging CategoryBugSquad |
ContentsBRTableOfContents |
Sometimes, a program starts behaving errantly. It gives incorrect output on its input, it doesn't print anything at all, or even hangs. Under a Linux-based system, every userspace process has to interact with its environment through the kernel. And it does this by invoking system calls.
Strace is a utility that intercepts and logs these system calls. In this way, you can watch how a program interacts with the system, which is useful for tracking down behavioural issues.
Generation
Make sure strace is installed.
apt-get install strace
Start the program under control of strace:
strace -Ff -tt <program> <arguments> 2>&1 | tee strace-<program>.log
- The program will start. Perform any actions necessary to reproduce the crash
Attach the complete output from strace, contained in strace-<program>.log, in your bug report.
Already running programs
You may want to run strace on an already running program. This could be because strace logs too many things before you can reproduce a crash. Or, it could be because you are trying to find out what a program is doing in an infinite loop.
Make sure strace is installed.
apt-get install strace
Find the process ID of <program>:
pidof <program>
Start strace with the process ID:
strace -Ff -tt -p <PID> 2>&1 | tee strace-<program>.log
- Perform any actions necessary to reproduce the bug.
- You may have to hit Control-C to get strace to detach from a running program.
Attach the complete output from strace, contained in strace-<program>.log, in your bug report.
Strace (last edited 2008-08-06 17:00:03 by localhost)