matt
matt

Reputation: 1066

strace 'open' calls in a library of an executable

I have a program with no source code.

When I run it, I have a "Can't open file..." error in the logs.

I called strace to trace the open calls on the kernel, in that way:

strace -e trace=open,close,read,write,connect,accept your-command-here

However, it seems there is none of the open calls I am expecting (that shall happen before that the log says "Can't open file...")

The executable indeed delegated the open call to a tierce library. It seems that strace only trace the calls from the executable on the kernel, not those of the libraries depencies.

I tried to use ltrace to trace what happens in the subsequent libraries, but it doesnt display the same informations as strace, only the function calls (which are not human-readable).

Is there a way to run strace on the executable and the libraires in the same time ?

Upvotes: 4

Views: 7119

Answers (1)

Thomas Dickey
Thomas Dickey

Reputation: 54524

strace should be showing all of the open calls. However:

  • Perhaps your application calls a subprocess to do work. For that case, you can add a -f option.
  • On the other hand, it may be doing the work by opening a socket (or similar) connection to another process. For that case, you will not see any trace. Likewise, if you are using the syslog interface, then the actual work may be done outside your process, potentially in the kernel where you cannot trace with this tool.

Upvotes: 6

Related Questions