This is the mail archive of the mailing list for the glibc project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Find out the system calls statically?

On Sat, Aug 16, 2008 at 1:23 PM, River Wang <> wrote:
> I want to find all the system calls that will be called by a program.
> Is there any tools to get it? I think normally a program just calls a
> function call and the glibc actually calls the system call. How can I
> find all the system calls in glibc? I know there are some dynamic
> tools like strace, but I need to use static analysis tools because
> they are more complete.

As far as I know there are no static trace tools.

You can never know which syscalls will be made statically, since the
user program may call *any* syscall using the syscall function.

The best you could do is this:
1. Build pattern matchers against syscall stubs from sysdeps.h
2. Run analyzer to look for syscall instruction patterns *and* syscall
function call
3. Decode instructions to determine the syscall made *or* make a note
that syscall was called and therefore any syscall could have been

This is going to be target dependent, and not 100% reliable.

> Another question, how can I debug glibc? I want to trace into some
> function calls like fopen to see how it use actual system calls. My
> distro is CentOS5, but I cannot find the package for debug info of
> glibc.

You need a glibc build with debugging information included. Your
distribution must provide this.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]