📄 wdis.gml
字号:
.chap *refid=wdisasm The Object File Disassembler
.*
.if &e'&dohelp eq 0 .do begin
.section Introduction
.do end
.*
.np
.ix 'disassembler'
This chapter describes the &disname..
It takes as input an object file (a file with extension "&obj") and
produces, as output, the Intel assembly language equivalent.
The &company compilers do not produce an assembly language listing
directly from a source program.
Instead, the &disname can be used to generate an assembly language
listing from the object file generated by the compiler.
.np
The &disname command line syntax is the following.
.ix '&discmdup' 'command line format'
.ix 'command line format' '&discmdup'
.if '&target' eq 'QNX' .do begin
.mbigbox
&discmdup [options] filespec [options]
.embigbox
.np
The square brackets [ ] denote items which are optional.
.begnote
.mnote &discmd
is the name of the &disname..
.mnote filespec
is the filename specification of the object file to be
disassembled.
A default filename extension of ".o" is assumed when no extension is
specified.
A filename extension consists of that portion of a filename containing
the last "." and any characters which follow it.
.exam begin
File Specification Extension
/home/john.doe/foo (none)
/home/john.doe/foo. .
/home/john.doe/foo.bar .bar
/home/john.doe/foo.goo.bar .bar
.exam end
.mnote options
is a list of valid &disname options, each preceded by a dash
("&minus.").
Options may be specified in any order.
.endnote
.do end
.el .do begin
.mbigbox
&discmdup [options] [d:][path]filename[.ext] [options]
.embigbox
.np
The square brackets [ ] denote items which are optional.
.begnote
.mnote &discmdup
is the name of the &disname..
.mnote d:
is an optional drive specification such as "A:", "B:", etc.
If not specified, the default drive is assumed.
.mnote path
is an optional path specification such as "\PROGRAMS\OBJ\".
If not specified, the current directory is assumed.
.mnote filename
is the file name of the object file to disassemble.
.mnote ext
is the file extension of the object file to disassemble.
If omitted, a file extension of "&obj" is assumed.
If the period "." is specified but not the extension, the file is
assumed to have no file extension.
.mnote options
is a list of valid options, each preceded by a slash
("/") or a dash ("&minus.").
Options may be specified in any order.
.endnote
.do end
.np
The options supported by the &disname. are:
.begnote $break $compact
.note a
write assembly instructions only to the listing file
:CMT. .note au
:CMT. .ix 'UNIX'
:CMT. write assembly instructions only to the listing file using
:CMT. UNIX-style assembly syntax
.note e
include list of external names
.note fp
do not use instruction name pseudonyms
.note fr
do not use register name pseudonyms [Alpha only]
.note fi
use alternate indexing format [80(x)86 only]
.note fu
instructions/registers in upper case
.note i=<char>
redefine the initial character of internal labels (default: L)
.note l[=<list_file>]
create a listing file
.note m
leave C++ names mangled
.note p
include list of public names
.note s[=<source_file>]
using object file source line information, imbed original source
lines into the output file
:CMT. .note b
:CMT. generate alternate form of based or indexed addressing modes
:CMT. .note c=<code_name>
:CMT. name of additional segments that contain executable code
:CMT. .note r
:CMT. display register names in upper case
:CMT. .note u
:CMT. display instruction opcode mnemonics in upper case
.endnote
.np
.ix '&discmdup options'
The following sections describe the list of options.
:CMT. .*
:CMT. .section Identifying Code Segments Option - "c=<code_name>"
:CMT. .*
:CMT. .np
:CMT. .ix '&discmdup options' 'c'
:CMT. The "c" option permits you to specify one additional segment name
:CMT. or pattern for segments that contain executable code.
:CMT. Valid forms of the "c" option are:
:CMT. .millust begin
:CMT. c=<string>
:CMT. &setdelim.c=*<string>&setdelim.
:CMT. &setdelim.c=<string>*&setdelim.
:CMT. .millust end
:CMT. .pc
:CMT. .id <string>
:CMT. is any sequence of characters with letters treated in a case insensitive
:CMT. manner.
:CMT. The "*" character is a wildcard character.
:CMT. .if '&target' eq 'QNX' .do begin
:CMT. You must protect the "*" with quotation marks to prevent the shell
:CMT. from attempting to expand it.
:CMT. .do end
:CMT. .np
:CMT. By default, the following segments are assumed to contain executable code.
:CMT. .autopoint
:CMT. .point
:CMT. segments with class name "CODE"
:CMT. .point
:CMT. segments whose name ends in "TEXT" or "CODE" (this is equivalent to
:CMT. "c=*text" and "c=*code")
:CMT. .endpoint
:CMT. .np
:CMT. Consider the following example.
:CMT. .millust begin
:CMT. &prompt.&discmd myprog &setdelim.&sw.c=T@*&setdelim.
:CMT. .millust end
:CMT. .pc
:CMT. All segments whose name starts with the characters "T@" (in addition
:CMT. to those ending in "CODE" or "TEXT") are assumed to contain
:CMT. executable code.
:CMT. .remark
:CMT. It is not possible to instruct the &disname to interpret segments
:CMT. whose name ends in "CODE" or "TEXT" as data.
:CMT. .eremark
.*
.section Changing the Internal Label Character - "i=<char>"
.*
.np
.ix '&discmdup options' 'i'
The "i" option permits you to specify the first character to be used
for internal labels.
Internal labels take the form "Ln" where "n" is one or more digits.
The default character "L" can be changed using the "i" option.
The replacement character must be a letter (a-z, A-Z).
A lowercase letter is converted to uppercase.
.exam begin
&prompt.&discmd calendar &sw.i=x
.exam end
.*
:CMT. .section The Assembly Format Option - "a", "au"
.*
.section The Assembly Format Option - "a"
.*
.np
.ix '&discmdup options' 'a'
The "a" option controls the format of the output produced to the
listing file.
When specified, the &disname will produce a listing file that can be
used as input to an assembler.
:CMT. .ix 'UNIX'
:CMT. When "au" is specified, the assembly syntax is that employed by UNIX
:CMT. systems.
.exam begin
&prompt.&discmd calendar &sw.a &sw.l=calendar.asm
.exam end
.pc
In the above example, the &disname is instructed to disassemble the
contents of the file
.fi calendar&obj
and produce the output to the file
.fi calendar.asm
so that it can be assembled by an assembler.
.*
:CMT. .section The Alternate Addressing Form Option - "b"
.*
.section The External Symbols Option - "e"
.*
.np
.ix '&discmdup options' 'e'
The "e" option controls the amount of information produced in the
listing file.
When specified, a list of all externally defined symbols is produced
in the listing file.
.exam begin
&prompt.&discmd calendar &sw.e
.exam end
.pc
In the above example, the &disname is instructed to disassemble the
contents of the file
.fi calendar&obj
and produce the output, with a
list of all external symbols, on the screen.
A sample list of external symbols is shown below.
.if '&lang' eq 'C' or '&lang' eq 'C/C++' .do begin
.if '&arch' eq '16-bit' .do begin
.code begin
List of external symbols
Symbol
----------------
___iob 000002bc 000001c4 000001af 00000128 00000111
__STK 000002fc 000002c9 0000027f 000001e4 000000a9 00000004
Box_ 000000d2
Calendar_ 0000008e 00000066 0000003e
ClearScreen_ 00000012
fflush_ 000002bf 000001c7 000001b2 0000012b 00000114
int86_ 00000323 000002f1
Line_ 00000272 00000252 00000235 0000021c 00000205
localtime_ 00000023
memset_ 0000029d
PosCursor_ 000002af 000001a1 0000011c 00000100 00000097
printf_ 000002b6 000001be 000001a9 00000122 0000010b
strlen_ 000000e3
time_ 00000017
------------------------------------------------------------
.code end
.do end
.if '&arch' eq '32-bit' .do begin
.code begin
List of external symbols
Symbol
----------------
___iob 0000032f 00000210 000001f4 00000158 00000139
__CHK 00000381 00000343 000002eb 00000237 000000cb 00000006
Box_ 000000f2
Calendar_ 000000a7 00000079 00000049
ClearScreen_ 00000016
fflush_ 00000334 00000215 000001f9 0000015d 0000013e
int386_ 000003af 00000372
Line_ 000002db 000002b5 00000293 00000274 0000025a
localtime_ 00000028
memset_ 00000308
PosCursor_ 0000031e 000001e1 00000148 00000123 000000b6
printf_ 00000327 00000208 000001ec 00000150 00000131
strlen_ 00000108
time_ 0000001d
------------------------------------------------------------
.code end
.do end
.do end
.if '&lang' eq 'FORTRAN 77' .do begin
.if '&arch' eq '16-bit' .do begin
.code begin
List of external symbols
Symbol
----------------
CALENDAR 000000f8 000000aa 0000005c
CLEARSCREEN 0000000b
GETDAT 0000001f
POSCURSOR 00000117
------------------------------------------------------------
.code end
.do end
.if '&arch' eq '32-bit' .do begin
.code begin
List of external symbols
Symbol
----------------
CALENDAR 000000cf 0000008b 00000047
CLEARSCREEN 0000000a
GETDAT 00000018
POSCURSOR 000000e8
------------------------------------------------------------
.code end
.do end
.do end
.pc
Each externally defined symbol is followed by a list of location
counter values indicating where the symbol is referenced.
.np
The "e" option is ignored when the "a" option is specified.
.*
.section The No Instruction Name Pseudonyms Option - "fp"
.*
.np
.ix '&discmdup options' 'fp'
By default, AXP instruction name pseudonyms are emitted in place of
actual instruction names.
The &wasname accepts instruction name pseudonyms.
The "fp" option instructs the &disname to emit the actual instruction
names instead.
.*
.section The No Register Name Pseudonyms Option - "fr"
.*
.np
.ix '&discmdup options' 'fr'
By default, AXP register names are emitted in pseudonym form.
The &wasname accepts register pseudonyms.
The "fr" option instructs the &disname to display register names in
their non-pseudonym form.
.*
.section The Alternate Addressing Form Option - "fi"
.*
.np
.ix '&discmdup options' 'fi'
The "fi" option causes an alternate syntactical form of the based or
indexed addressing mode of the 80x86 to be used in an instruction.
For example, the following form is used by default for Intel
instructions.
.millust begin
mov ax,-2[bp]
.millust end
.pc
If the "fi" option is specified, the following form is used.
.millust begin
mov ax,[bp-2]
.millust end
.*
.section The Uppercase Instructions/Registers Option - "fu"
.*
.np
.ix '&discmdup options' 'fu'
The "fu" option instructs the &disname to display instruction and
register names in uppercase characters.
The default is to display them in lowercase characters.
.*
.section The Listing Option - "l[=<list_file>]"
.*
.np
.ix '&discmdup options' 'l (lowercase L)'
By default, the &disname produces its output to the terminal.
The "l" (lowercase L) option instructs the &disname to produce the
output to a listing file.
The default file name of the listing file is the same as the file
name of the object file.
The default file extension of the listing file is
.fi &lst..
.exam begin
&prompt.&discmd calendar &sw.l
.exam end
.pc
In the above example, the &disname is instructed to disassemble the
contents of the file
.fi calendar&obj
and produce the output to a listing file called
.fi calendar&lst..
.np
An alternate form of this option is "l=<list_file>".
With this form, you can specify the name of the listing file.
When specifying a listing file, a file extension of
.fi &lst
is assumed if none is specified.
.exam begin
&prompt.&discmd calendar &sw.l=calendar.lis
.exam end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -