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
8
votes
2 answers

How to make strace print addresses of string arguments instead of just their values?

I'm trying to use strace to understand how a binary program uses memory. However, the default output of strace, in an attempt to be more user friendly, prints any char * buffers as the respective strings. read(3, "Tell me, Muse, of that man of…
m000
  • 5,932
  • 3
  • 31
  • 28
8
votes
1 answer

Using strace fixes hung memory issue

I have a multithreaded process running on RHEL6.x (64bit). I find that the process hangs and some threads (of the same process) crash most of the time when I try to bring up the process. Some threads wait for shared memory between the threads to get…
umayneverknow
  • 190
  • 1
  • 3
  • 13
8
votes
1 answer

Strace Multithreaded Program

When running strace on a multithreaded program I get results like this: [pid 14778] futex(0x7fd8082f266c, FUTEX_WAKE_OP_PRIVATE, 1, 1, 0x7fd8082f2668, {FUTEX_OP_SET, 0, FUTEX_OP_CMP_GT, 1} [pid 14780] <... futex resumed> ) =…
benmmurphy
  • 2,503
  • 1
  • 20
  • 30
7
votes
2 answers

Using (DR)STRACE to compare Windows program execution

I'm posing a question here directly in relation to this issue on github for node-serialport. In a nutshell something that used to work fine in v4.x of the library no longer works in v6.x of the library. I think it must have something to do with how…
vicatcu
  • 5,407
  • 7
  • 41
  • 65
7
votes
3 answers

How to see system call that executed in current time by process?

Linux utility "strace" show the list of syscall that started after run of strace. How I can see syscall that run in current moment by process? before start of strace.
Dmity P.
  • 115
  • 1
  • 1
  • 7
7
votes
2 answers

strace a python function

Is it possible to strace a python function for opened files, and differentiate if they were opened by python or a subprocess? read_python, read_external = [], [] @strace_read(read_python, read_external) function test(): file = open("foo.txt",…
user19087
  • 1,899
  • 1
  • 16
  • 21
7
votes
1 answer

How to parse strace in shell into plain text?

I've trace log generated by strace command like on running PHP by: sudo strace -e sendto -fp $(pgrep -n php) -o strace.log And the output looks like: 11208 sendto(4, "set 29170397297_-cache-schema 85 0…
kenorb
  • 155,785
  • 88
  • 678
  • 743
7
votes
2 answers

Adding custom struct types to strace

I'm trying to reverse-engineer a user-mode shared object that interacts with a kernel driver via ioctl syscalls. I have a header file with definitions for the kernel driver's ioctl interface (i.e. #defines for ioctl command numbers, and struct…
Kyle Gagnet
  • 2,294
  • 2
  • 20
  • 27
7
votes
2 answers

How to track down PHP script running a given process?

I have a website with a custom script running on a VPS hosting service. All scripts go out through index.php using mod_rewrite and .htaccess for friendly URLs Something in my script is generating high CPU Usage, as show: When I go and strace a…
6
votes
2 answers

GDB strace shows it tries to ptrace at an invalid address

I encountered such error when executing ni command during gdb debugging: Warning: Cannot insert breakpoint 0. Error accessing memory address 0x3ac706a: Input/output error. 0xf6fa4771 in siglongjmp () from /lib/libc.so.6 To investigate what…
Ma Yaming
  • 173
  • 1
  • 7
6
votes
3 answers

iphone: strace, dtruss, dtrace or equivalent?

Does anyone know if there is something like strace, dtruss, or dtrace for iPhone? tester-iPhone:/tmp root$ apt-cache search dtruss tester-iPhone:/tmp root$ apt-cache search dtrace tester-iPhone:/tmp root$ apt-cache search trace tester-iPhone:/tmp…
osmund sadler
  • 1,021
  • 2
  • 15
  • 27
6
votes
6 answers

How to call an equivalent command to strace on mac -- ideally from python?

Self contained reproducible example I need to strace the output of any command through python. But I only need to translate the following amd linux command to mac m1/arm commands (so python is likely irrelevant): strace -e trace=execve -v -s…
Charlie Parker
  • 5,884
  • 57
  • 198
  • 323
6
votes
4 answers

Line Number Info in ltrace and strace tools

Is it possible that I can view the line number and file name (for my program running with ltrace/strace) along with the library call/system call information. Eg: code section :: ptr = malloc(sizeof(int)*5); (file:code.c, line:21) ltrace or any…
Sandeep Singh
  • 4,941
  • 8
  • 36
  • 56
6
votes
1 answer

Gammu has different behaviour when running under strace

I am attempting to debug Gammu, a "library and command line utility for mobile phones", which is "timing out" when communicating normally with the modem. gammu identify -> No response in specified timeout. Probably phone not connected. Looking at…
coiax
  • 462
  • 4
  • 19
6
votes
0 answers

Build android ltrace

Need help building ($ANDROID)/external/ltrace as part of AOSP Android 6.0. How do you build a version of Android with the external programs, specifically ltrace (source code is under $(ANDROID)/external)? I followed these steps…
AlfredP
  • 99
  • 6