Hello everyone,
Suppose we have the source codes, how to get all invoked system API (like printf, open, etc.) other than program self-defined API? Are there any existing tools?
Either on Windows or on Linux platform is ok.
thanks in advance,
George
This is a discussion on how to get all invoked system API of a program within the C Programming forums, part of the General Programming Boards category; Hello everyone, Suppose we have the source codes, how to get all invoked system API (like printf, open, etc.) other ...
Hello everyone,
Suppose we have the source codes, how to get all invoked system API (like printf, open, etc.) other than program self-defined API? Are there any existing tools?
Either on Windows or on Linux platform is ok.
thanks in advance,
George
Try the nm command in linux:
Code:itsme@itsme:~/C$ cat nmexample.c #include <stdio.h> #include <string.h> void foo(void) { } int main(void) { char buf[BUFSIZ]; strcpy(buf, "Hello, world!"); puts(buf); printf("%s\n", buf); foo(); return 0; }Code:itsme@itsme:~/C$ nm -D nmexample 080484f8 R _IO_stdin_used w _Jv_RegisterClasses w __gmon_start__ U __libc_start_main U printf U puts U strcpy itsme@itsme:~/C$
If you understand what you're doing, you're not learning anything.
Thank you itsme86!
Your reply makes senses. I have tried to use nm to analyze an executable file on Linux platform, using the -D option and it works good. I have also looked at the man page of -D option of Linux man page. It is explained as dynamic symbol analysis rather than normal symbols. What does it mean -- dynamic symbols? normal symbols?Originally Posted by itsme86
regards,
George
It means it lists symbols that aren't resolved in the executable. Symbols that are linked at runtime from a library file.
If you understand what you're doing, you're not learning anything.