Find the answer to your Linux question:
Results 1 to 7 of 7
Hi all, I have a binary file which display a lot of message when I run that binary. This binary file is statically linked with many files which are unknown ...
  1. #1
    Just Joined!
    Join Date
    Feb 2005
    Posts
    28

    how to get details of a binary file

    Hi all,
    I have a binary file which display a lot of message when I run that binary. This binary file is statically linked with many files which are unknown to me. Is there any way to know from which file (obj or static lib) does these printf come from?

    There is a way to get to know about the source of a symbol, but I am interested about the source of a string.

    Thanks...

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,977
    One word - gdb. However, if the executable and libraries were stripped of symbolic information, you will have to deal with raw program addresses. Have fun!
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  3. #3
    Linux User Manko10's Avatar
    Join Date
    Sep 2010
    Posts
    250
    If theses message are not generated entirely dynamically, you might also run grep over the source files to find the corresponding code lines.

  4. #4
    Just Joined!
    Join Date
    Feb 2005
    Posts
    28
    Problem is I don't have the full source, so if I can figure out which file contains those print statements I can ask for the specific module source. At least I know the source that I already have don't contain those print statements.

    The binary is run in a target platform for which I dont have gdb facility.

    Is there any way to know this using 'nm' or 'ar' or something like that?

  5. #5
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,977
    There is the strings command that will extract strings/messages from any file including shared libraries, executables, etc. If it is coming from a shared library, that might help. Another is hexedit which allows you to look inside the file itself, though you need to be careful not to write to the file, or you may be SOL... A safer tool for that actually would be hexdump which will show you the internals of a binary file, but won't allow you to modify it.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  6. #6
    Just Joined!
    Join Date
    Feb 2005
    Posts
    28
    The 'strings' command gives me all the strings/printable characters present in a binary file. Althogh it doesn't give me exactly what I wanted but still it is helpful for debugging purpose.

    Thanx for your time.

  7. #7
    Just Joined!
    Join Date
    Dec 2010
    Posts
    10
    try ldd to see the dynamically linked libraris , and nm for list of symbols

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...