Questions tagged [strace]

strace is a Linux/UNIX tool for logging and analysing the system calls made by a user-side process.

strace is a diagnostic, debugging and instructional userspace utility for Linux. It is used to monitor interactions between processes and the Linux kernel, which include system calls, signal deliveries, and changes of process state. The operation of strace is made possible by the kernel feature known as .

Use this tag to ask programming questions related to the strace command and the strace() system call.

Source: Wikipedia

485 questions
6
votes
2 answers

Slow service response Times : Java SecureRandom & /dev/random

I am trying to debug a few slow responses served by an app deployed on Tomcat. Right now I am focussing on SecureRandom and /dev/random (some of the other probable causes have been investigated and ruled out). The pattern is as follows: The first…
TJ-
  • 14,085
  • 12
  • 59
  • 90
6
votes
1 answer

strace: Any sense in `dup2(A, B); close(B)`?

I'm trying to understand a strace of an Java application server running in a oracle JVM. I often see these lines: [pid 10465] 23:04:59.658453 dup2(215, 274) = 274 [pid 10465] 23:04:59.658616 close(274) = 0 In this case 215 is a UNIX socket: java …
try-catch-finally
  • 7,436
  • 6
  • 46
  • 67
6
votes
3 answers

View/intercept all emacs lisp function calls

I would like to see a log of all the emacs lisp function calls made during an emacs session. I want to know exactly what the interpreter is doing. How can "intercept" the interpreter's REPL, if that makes any sense? With strace I can attach to the…
ealfonso
  • 6,622
  • 5
  • 39
  • 67
6
votes
3 answers

'strace' fixes hung process

I have a singlethreaded Unix process that communicates over TCP with other processes. The problem is the following. When I start up the process it hangs (no busy loop) until I kill it. The funny thing is, as soon as I attach with strace to it, it…
user1770305
  • 101
  • 1
  • 5
6
votes
0 answers

strace hang on system call read

I exectued command: strace -ttt /bin/cat to get system calls on Ubuntu 11.04. However strace got hang on command "read" and could not finish. I have to press ctrl+c to stop it. The output is something like: ... 1365073129.724883 close(3) …
user1515940
  • 161
  • 1
  • 5
6
votes
1 answer

What are the differences between LD_PRELOAD and strace?

Both methods are used to gather system calls also parameters and return values of them. When we prefer LD_PRELOAD and why? Maybe we can say that we can only gather syscalls via strace but we can gather library calls with LD_PRELOAD trick. However,…
Ricardo Cristian Ramirez
  • 1,194
  • 3
  • 20
  • 42
5
votes
4 answers

How to log the DeviceIoControl calls of a program on windows

I need to capture the DeviceIoControl() system calls of an application. On linux, strace can be used to analyze all ioctl calls. Is there any similar functionality on windows? MSDN website recommends a program called "Process Monitor" to analyze the…
tantuni
  • 671
  • 1
  • 8
  • 19
5
votes
1 answer

What kind of info are there in the first 832 bytes of .so file?

I saw many similar stuff like this: open("/lib64/libpthread.so.0", O_RDONLY) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\260W \0242\0\0\0"..., 832) = 832 What's there in the beginning 832 bytes?
new_perl
  • 7,345
  • 11
  • 42
  • 72
5
votes
2 answers

Visualising strace output

Is there a simple tool, or maybe a method to turn strace output into something that can be visualised or otherwise easier to sift through? I am having to figure out where an application is going wrong, but stracing it produces massive amounts of…
tMC
  • 18,105
  • 14
  • 62
  • 98
5
votes
3 answers

Why are many system calls (getpid) captured only once using strace?

I invoked getpid() in a program for many times (to test the efficiency of system calls), however when I use strace to get the trace, only one getpid() call is captured. The code is simple: #include #include #include…
Infinite
  • 3,198
  • 4
  • 27
  • 36
5
votes
3 answers

Identifying file causing hang from strace

I have a GTK program running on Ubuntu 10.04 that hangs in interruptible state, and I'd like to understand the output of strace. In particular, I have this line: read(5, 0x2ba9ac4, 4096) = -1 EAGAIN (Resource temporarily unavailable) I suspect 5 is…
Greg
  • 6,038
  • 4
  • 22
  • 37
5
votes
0 answers

Is strace changing the behavior of a command?

I am trying to debug a problem on a linux server. When I run sudo ls / the command takes several seconds to run. non-sudo ls / runs as expected. I suspect it has something to do with auditing going on via auditd but I'm not certain. Anyway, I then…
marc esher
  • 4,871
  • 3
  • 36
  • 51
5
votes
1 answer

Why isn't strace logging all my system calls?

I am trying to debug a serial connection on a BeagleBone running Debian 8.7. To do this I have written a test program in go. I wasn't getting the results I was expecting, so I fired up strace on the test program. Sure enough, the write system calls…
jonseymour
  • 1,006
  • 1
  • 12
  • 22
5
votes
0 answers

System call read() returns bigger number than count

I read data from /proc//environ and got bizarre results. How this could be possible? open("/proc/24696/environ", O_RDONLY) = 10 read(10, "24694\nPPid:\t2606\nTracerPid:\t0\nUi"..., 4096) = 1470144576 open("/proc/25387/environ", O_RDONLY) =…
lstipakov
  • 3,138
  • 5
  • 31
  • 46
5
votes
2 answers

strace on Linux not logging all calls to open()

I am using strace to capture calls to open(), close() and read() on Linux. The target process is the jetty web server. As far as I can tell, strace is not logging all calls to open(). Maybe the others too, I have not tried to correlate the file…