I am trying to test that Visual Studio generates a predictable/repeatable executable from the same code.
To do this, I'm creating a small program (one .cpp file) and building a .exe (A), making some changes and making another .exe (B), then un-doing the changes and making another .exe (C).
My theory is that the information for A and C will be the same and confirm that MSVS generates predictable/repeatable .exe's from the same code.
Several problems:
(i've saved the results of the commands in .txt's)
I've used dumpbin /rawdata to get rid of time/date stamp data and save the raw contents of each section of the file (not entirely sure what "raw" means), but that leaves 2 lines of difference when comparing with windiff.
Running dumpbin /headers shows differences in the .rdata section (Raw Data #2) under Debug Directories; the differences are in the time (which is expected) and in the Format: X, {Y}, "difference here", Z column.
I've searched forums and msdn for hours and cannot find a solution using dumpbin. Similar forum posts have ended with shrugged shoulders.
Can anyone give me a hand? I will do my best to add more specificity as requested.
Thank you, ZayJay
Viewed References:
http://support.microsoft.com/kb/177429
http://support.microsoft.com/kb/164151
http://msdn.microsoft.com/en-us/windows/hardware/gg463119.aspx
http://www.ms-news.net/f3614/how-can-i-compare-2-executables-1980031.html
+ others...
Also, running a comparison between my .cpp and a new .cpp with a main that only returns 0 yielded differences in the same areas. I expected there to be differences in the .text (Raw Data #1) section of the dumpbin /headers results... Anything to read or straight up answers would be great! thanks!
To compare two files or groups of files at a local site, you can use the Fc.exe and the Comp.exe file compare commands. Both commands are run from a command prompt. You can use Fc.exe to compare two ASCII or binary files on a line-by-line basis.
On most UNIXes, including Linux and OS X, you can use the cmp command-line tool. By default it stops at the first differing byte, gives the distance into the file and shows the different values. With the right command switch it will show all differences between the two files.
Once WinMerge is open, press the Control+O hotkey combo to open a new comparison. To select a folder, click “Browse…” on the far right just under the “1st File or Folder” bar. Use the browse feature to select a folder that you want to compare. Click Browse to select which folder you want to compare.
An executable file is a file that is used to perform various functions or operations on a computer. Unlike a data file, an executable file cannot be read because it's compiled. On an IBM compatible computer, common executable files are . BAT, .
There are a few fields in the portable executable format which will change every compilation (PE format is used for .exe and .dll). Writing a parsing app that memory maps such an exe and walks its internal datastructures isn't too hard (it is, in fact, what dumpbin does). You'll basically need to ensure that you exclude any GUIDs, date stamps, and anything else that might reasonably change.
The references section of http://en.wikipedia.org/wiki/Portable_Executable (the PE format docs from Microsoft) explain the format. I've written a similar app (mine was to extract version information of the resources section) and found the documentation to be pretty good.
That said, this seems like a bit of a waste of time. Modern compilers are fantastic at what they do. And they generally don't have randomness thrown into them, so you should expect the .rdata, .data and .text sections to be generally the same. In general, when you start questioning your compiler (especially a big one like Visual Studio or gcc), chances are you should take a deep breath and go back and look at your own code. Bugs are few and far between. And the few that there are usually have MSDN/StackOverflow articles written about them already.
(In other words: what exactly are you trying to accomplish?)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With