home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Windoware
/
WINDOWARE_1_6.iso
/
source
/
dmpprg12
/
dumpprog.doc
next >
Wrap
Text File
|
1991-08-15
|
5KB
|
129 lines
DUMPPROG version 1.2 - Dump .EXE file in mixed disassembly and source code.
Copyright (c) D.J. Murdoch, 1991
Portions of disassembler copyright (c) L. David Baldwin, 1986
Syntax: DUMPPROG [option] progname
reads map from progname.MAP and dumps executable progname.EXE.
/Exxx Use source extension xxx if unspecified in MAP file.
/O Dump old-style stub of Windows or OS/2 executable
/Snnnn Dump segment nnnn (hex value or name) completely.
Examples:
DUMPPROG myprog.exe
will use myprog.map for information, and make no assumptions about
extension. Output will go to the screen.
DUMPPROG myprog /Epas >myprog.lst
will dump myprog.exe using myprog.map for information, and assume
that any source file with no extension should have .pas added,
putting the results into the file myprog.lst.
DUMPPROG myprog /S0000
will dump the very first segment of myprog.exe, whether or not
there's any line number information.
DUMPPROG myprog /Smyprog
will dump the segment named "myprog" from the program myprog.exe.
Description:
This is a rough program designed to let you see disassembled output
mixed with source code, as some compilers will optionally output. It
requires a detailed .MAP file from the compiler which includes source
files and line number information. If you don't have one, it will try
to construct a segment map; you must then explicitly ask for a
particular segment (using the /S option) to see the disassembled
output.
I wrote it and tested it on the .EXE files and .MAP files produced by
Turbo Pascal 6.0; it should work (but probably has bugs) on other
programs. To get a detailed map from Turbo Pascal, use the $D+
(debugging info) and /GD options on the command line, or set these
options in the IDE.
You can control which parts of a program are dumped by editing the
.MAP file, or using the /S option. With no /S, those parts of
the file for which there's line number information will be dumped.
If the /Snnnn option is used, the segment specified will be completely
dumped, whether or not line number information is available.
Limitations:
This version of DUMPPROG completely ignores all of the public symbol
names in the .MAP file. It displays hex addresses where a smarter
disassembler would put names.
DUMPPROG can't tell code from data with standard .EXE files. In Turbo
Pascal executables, constant data is kept at the beginning of code
segments. DUMPPROG will often try to disassemble this, producing
lengthy streams of nonsense.
It doesn't know whether a source line is complete or not. The map
file says where the source starts; it doesn't say where it ends.
DUMPPROG only inserts a single line of source for each reference in
the MAP file.
It also doesn't know where code ends, but does a bit better here.
Generally it assumes code stretches to the next line given in the MAP
file. This can lead to very long stretches of assembler with no
source, and probably with incorrect segment/offset addresses, if
there's a gap in the .MAP. For the last line in the .MAP file, it
displays up to the the start of the next segment, or the end of the
executable, whichever comes first.
On Windows or OS/2 executables, DUMPPROG doesn't do anything to
interpret loader fixups. This means most far calls won't have useful
addresses.
Source code must be in the current directory, or on a path specified
with the filename in the .MAP file. If DUMPPROG can't find the
source, it will print a warning and go ahead, leaving blanks where the
source code should go.
The disassembler in DUMPPROG is an adaptation of a module from L.
David Baldwin's excellent UNINLINE program (used with permission).
It's taken from a 1986 version of the program; the original code could
only disassemble 8086 opcodes. I've horribly mutilated the module to
fit DUMPPROG and add 80286 and 80386 opcodes, but there are some
missing, and I may even have introduced bugs into the 8086
disassembly.
History
1.0 - First version
1.1 - Added code for Windows/3 executables as well as standard DOS
.EXE files; it may also handle OS/2 executables, but I don't
have any to try it on.
1.2 - Added some 286 and 386 opcodes to disassembler
License
DUMPPROG is not a public domain program. It contains code whose
copyright belongs to L. David Baldwin and D.J. Murdoch, as well as
library code from Borland International and TurboPower Software.
You are free to use DUMPPROG without charge. You may distribute it
unmodified, together with this documentation file, provided that you
charge no more than distribution costs, and on no account more than
$10 per copy.
Warranty
There is no warranty of any kind with this program. It is
experimental software, and likely contains bugs. Use at your own
risk.
Note: Version 1.2 is the first public release of DUMPPROG. Expect
bugs. If you find any, please send bug reports to me (Duncan Murdoch)
at one of the following addresses:
DJ Murdoch at Fidonet node 1:221/177.40
dmurdoch@watstat.waterloo.edu on Internet
71631,122 on Compuserve
79 John St. W
Waterloo, Ontario, Canada
N2L 1B7