We have a situation where a binary from our build system is failing in one specific flow but the same from dev works fine. We are sure that build system picks up the right libs and code, however we see a difference of 6000 bytes in both. (build - 6000 bytes = size of dev binary)
Hence we would like to know:
a. How we can compare two Unix Binaries when they differ only in terms of build boxes (ex dev and build)
b. Given a binary (not compiled with debug options) what are the information we can gather from it.
O/S & Version - Red Hat Enterprise Linux Server release 5.4
Architecture - Linux xxxxx 2.6.18-164.el5 #1 SMP Tue Aug 18 15:51:48 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux
I would compare the build flags (debug builds often can "null" statically allocated memory whilst optimized builds do not)
I would do an "ldd" on the binary and find which libraries it is using.
Then for each of the libraries you can either use "rpm" to find the version installed, or use "sum" or "md5sum" to check they are the same on both hosts.
After all that I would "strace" the program running on both and compare the two outputs - this usually gives you an indication of where to start looking for failures.
I hope this helps...
Location: Saint Paul, MN USA / BSD, CentOS, Debian, OS X, Solaris
Posts: 2,288
Thanks Given: 430
Thanked 480 Times in 395 Posts
Hi.
The utility nm can extract linkage symbols from object files and executables (in most situations, e.g. where the executable has not been stripped).
You could use the lists from each version of the executable (or constituent object files) to compare for differences, although this would be at a large granularity.
We have a situation where a binary from our build system is failing in one specific flow but the same from dev works fine. We are sure that build system picks up the right libs and code, however we see a difference of 6000 bytes in both. (build - 6000 bytes = size of dev binary)
Hence we would like to know:
a. How we can compare two Unix Binaries when they differ only in terms of build boxes (ex dev and build)
b. Given a binary (not compiled with debug options) what are the information we can gather from it.
Thanks in advance.
A diff of 6000 bytes, itself tells that either the code or the lib used is not exactly same at both the build locations. You mentioned that you are confirmed that these things are same, how did you arrived at the conclusion?
---------- Post updated at 08:33 PM ---------- Previous update was at 08:27 PM ----------
Quote:
Originally Posted by citaylor
I would compare the build flags (debug builds often can "null" statically allocated memory whilst optimized builds do not)
I would do an "ldd" on the binary and find which libraries it is using.
Then for each of the libraries you can either use "rpm" to find the version installed, or use "sum" or "md5sum" to check they are the same on both hosts.
After all that I would "strace" the program running on both and compare the two outputs - this usually gives you an indication of where to start looking for failures.
I hope this helps...
Great suggestion!!! I'd have done similarly, eventhough a bit cumbursome, but bound to get results. Also the version control of the source should tell what's different in the recent time, should help narrow down the suspected libraries.
---------- Post updated at 08:48 PM ---------- Previous update was at 08:33 PM ----------
Lastly, I'd also have made sure, as a first step, that the build system itself does not have different versions. Apart need to make sure that the code does not have too much of flag based compilations like:
If yes, then I'd also suggest to have a look at the environment variables in addition to the makefile flag definition.
Good Luck.
Last edited by Praveen_218; 08-21-2010 at 12:19 PM..
Reason: Fixed a typo error.
I think what I'm trying to do is pretty straightforward but I just can't find a way to do it.
I'm trying to run a double pattern match in a three column file. If the first two columns match, I need to output the third.
So in the file
AAA BBB 1
BBC CCC 5
CCC DDD 7
DDD EEE 12
If the... (4 Replies)
Hi Folks,
Please advise for FTP client softwares like winscp we use mostly to transfer the files to other unix box machines but any ftp software which in logs will also generate and show the unix commands parallely for ex if I create a directory graphically through ftp software then it will list... (1 Reply)
Hi Friends,
I need to generate a graph in on the basis of data available in csv file in unix.
Please let me know how to generate the graph.
Thanks
Mayank (4 Replies)
Hi All,
I have extracted some report from database for few activities done.
Now I have a requirement to add some random time(In range of 10-35) in front of each activity.
Can be generated random numbers in any bash/sh shell within a given number range, let's say in between 10-30.
... (10 Replies)
Hi All,
I am newbie to this forum. I am also new to shell script world.
I don't understand the below shell script.
File Name: sendFile.sh
#!/bin/bash
#
# This script invokes the Connect:Direct UNIX CLI
# and submits a process inline to copy a file to a remote
# node.
# $1 is... (3 Replies)
Hi,
I have an application's log file:
/var/log/logfile which is feeded from time to time due to an application. This file contains data, what I want is:
-Whenever some new data is copied to /var/log/logfileI want to generate an email to root BUT only with the new added data in the body.... (6 Replies)
Hi,
i am trying to create a makefile for my C++ program. when i say "make" it should generate the binary file. and when i say make clean, it should delete all the bins and libs.
can u please help me out. (5 Replies)
Hi,
Is there a way to edit BINARY files in Unix.
Or even are there any commands (shellscript/perl) through which I can replace all the occurences of a string inside a BINARY file with another string ?? (1 Reply)
not much familiar with binary and hex calculation in script programming....
explaination:
binary format control the parameter turned on or off in the program stored in hex mode, the question is:
how to change 39e to 19e using the binary calculation(although i don't know the command for... (2 Replies)
I need to know how to enter a unix path in a cgi script for a guest book:
example:
My URL is http://www.kitachi.info
I have an html file in the main folder on my site, the file is called :
gbook.html
what would the correct unix path for this file be ???
the part of the script... (1 Reply)