public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Comparing binaries in Source Code space
@ 2000-03-31  6:52 P Costello
  2000-04-01  0:00 ` P Costello
  2000-04-01  2:39 ` Martin v. Loewis
  0 siblings, 2 replies; 3+ messages in thread
From: P Costello @ 2000-03-31  6:52 UTC (permalink / raw)
  To: help-gcc

I have two GNU executable objects that should be identical
but are not. They were (we think) made from the same source
and same tools and same command lines. In an attempt to
identify "where" they are different we have done a compare
of the binaries as in:

cmp -l new_command old_command

This yielded many bytes different. The sizes of new_command
anmd old_command are the same. The cmp output shows wide spread but
diffences scattered about. The differences are not due
to an extra byte throwing off the byte-by-byte cmp, but, rather
here and there bytes will be differnt.

A "strings" compare that compares the strings in each
binary yielded differences in true cha]racter strings. But
only because of a built in "date stamp" included in the compile.
So it is not that (since that should be the ONLY difference
as we have compared other compiles and found that to be the case).

What I need is:

1) Given two executables from a GNU compilation that
should be identical (time stamp difference taken into
account)

2) Given a cmp -l outout that shows the byte offset within
the executable "Elf" format file of each byte that is
different along with their values.

3) Given the symbol table exists in the binaries and
the source code is available.

I want to be able to identify what data structure, function,
or code segment where a given byte difference is located. That is:  What is
the closest symbol associated with the byte location
with an ELF format file.

GDB  does not seem to be enough. How can you relate the byte offset within a
binary to the actual code location?


Please send e-mail to  pec@counsellor.com

______________________________________________
FREE Personalized Email at Mail.com
Sign up at http://www.mail.com/?sr=signup

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Comparing binaries in Source Code space
  2000-03-31  6:52 Comparing binaries in Source Code space P Costello
@ 2000-04-01  0:00 ` P Costello
  2000-04-01  2:39 ` Martin v. Loewis
  1 sibling, 0 replies; 3+ messages in thread
From: P Costello @ 2000-04-01  0:00 UTC (permalink / raw)
  To: help-gcc

I have two GNU executable objects that should be identical
but are not. They were (we think) made from the same source
and same tools and same command lines. In an attempt to
identify "where" they are different we have done a compare
of the binaries as in:

cmp -l new_command old_command

This yielded many bytes different. The sizes of new_command
anmd old_command are the same. The cmp output shows wide spread but
diffences scattered about. The differences are not due
to an extra byte throwing off the byte-by-byte cmp, but, rather
here and there bytes will be differnt.

A "strings" compare that compares the strings in each
binary yielded differences in true cha]racter strings. But
only because of a built in "date stamp" included in the compile.
So it is not that (since that should be the ONLY difference
as we have compared other compiles and found that to be the case).

What I need is:

1) Given two executables from a GNU compilation that
should be identical (time stamp difference taken into
account)

2) Given a cmp -l outout that shows the byte offset within
the executable "Elf" format file of each byte that is
different along with their values.

3) Given the symbol table exists in the binaries and
the source code is available.

I want to be able to identify what data structure, function,
or code segment where a given byte difference is located. That is:  What is
the closest symbol associated with the byte location
with an ELF format file.

GDB  does not seem to be enough. How can you relate the byte offset within a
binary to the actual code location?


Please send e-mail to  pec@counsellor.com

______________________________________________
FREE Personalized Email at Mail.com
Sign up at http://www.mail.com/?sr=signup

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Comparing binaries in Source Code space
  2000-03-31  6:52 Comparing binaries in Source Code space P Costello
  2000-04-01  0:00 ` P Costello
@ 2000-04-01  2:39 ` Martin v. Loewis
  1 sibling, 0 replies; 3+ messages in thread
From: Martin v. Loewis @ 2000-04-01  2:39 UTC (permalink / raw)
  To: pec; +Cc: help-gcc

> GDB  does not seem to be enough. How can you relate the byte offset within a
> binary to the actual code location?

I don't know a simple procedure, but the following might work:

1. Use objdump -h to determine the file offsets of each section.
2. Check whether it really is in a code section. If not, you may need
   to reconsider your analysis so far.
3. Translate the file offset to a VMA offset.
4. Use objdump --disassemble to display all code sections in
   disassembly, and look for the VMA offset.

Hope this helps,
Martin

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2000-04-01  2:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-03-31  6:52 Comparing binaries in Source Code space P Costello
2000-04-01  0:00 ` P Costello
2000-04-01  2:39 ` Martin v. Loewis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).