📄 wdis.gml
字号:
.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.lis.
.*
.section The Public Symbols Option - "p"
.*
.np
.ix '&discmdup options' 'p'
The "p" option controls the amount of information produced in the
listing file.
When specified, a list of all public symbols is produced in the
listing file.
.exam begin
&prompt.&discmd calendar &sw.p
.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 exported symbols, to the
screen.
A sample list of public 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 public symbols
SYMBOL SECTION OFFSET
--------------------------------------------------------
main_ _TEXT 0000024A
void near Box( int, int, int, int )
_TEXT 0000007D
void near Calendar( int, int, int, int, int, char near * )
_TEXT 00000118
void near ClearScreen() _TEXT 00000000
void near Line( int, int, int, char, char, char )
_TEXT 0000002E
void near PosCursor( int, int )
_TEXT 00000015
.code end
.do end
.if '&arch' eq '32-bit' .do begin
.np
The following is a list of public symbols in 80x86 code.
.code begin
List of public symbols
SYMBOL SECTION OFFSET
--------------------------------------------------------
main_ _TEXT 000002C0
void near Box( int, int, int, int )
_TEXT 00000093
void near Calendar( int, int, int, int, int, char near * )
_TEXT 0000014A
void near ClearScreen() _TEXT 00000000
void near Line( int, int, int, char, char, char )
_TEXT 00000036
void near PosCursor( int, int )
_TEXT 0000001A
.code end
.np
The following is a list of public symbols in Alpha AXP code.
.code begin
List of public symbols
SYMBOL SECTION OFFSET
--------------------------------------------------------
main .text 000004F0
void near Box( int, int, int, int )
.text 00000148
void near Calendar( int, int, int, int, int, char near * )
.text 00000260
void near ClearScreen() .text 00000000
void near Line( int, int, int, char, char, char )
.text 00000060
void near PosCursor( int, int )
.text 00000028
.code end
.do end
.do end
.if '&lang' eq 'FORTRAN 77' .do begin
.if '&arch' eq '16-bit' .do begin
.code begin
List of public symbols
SYMBOL GROUP SEGMENT ADDRESS
---------------------------------------------------------
BOX BOX_TEXT 00000000
CALENDAR CALENDAR_TEXT 00000000
CLEARSCREEN CLEARSCREEN_TEXT 00000000
FMAIN FMAIN_TEXT 00000000
LINE LINE_TEXT 00000000
POSCURSOR POSCURSOR_TEXT 00000000
------------------------------------------------------------
.code end
.do end
.if '&arch' eq '32-bit' .do begin
.code begin
List of public symbols
SYMBOL GROUP SEGMENT ADDRESS
---------------------------------------------------------
BOX BOX_TEXT 00000000
CALENDAR CALENDAR_TEXT 00000000
CLEARSCREEN CLEARSCREEN_TEXT 00000000
FMAIN FMAIN_TEXT 00000000
LINE LINE_TEXT 00000000
POSCURSOR POSCURSOR_TEXT 00000000
------------------------------------------------------------
.code end
.do end
.do end
.np
The "p" option is ignored when the "a" option is specified.
.*
.section Retain C++ Mangled Names - "m"
.*
.np
.ix '&discmdup options' 'm'
The "m" option instructs the &disname to retain C++ mangled names
rather than displaying their demangled form.
The default is to interpret mangled C++ names and display them in
a somewhat more intelligible form.
.*
.section The Source Option - "s[=<source_file>]"
.*
.np
.ix '&discmdup options' 's'
The "s" option causes the source lines corresponding to the assembly
language instructions to be produced in the listing file.
The object file must contain line numbering information.
That is, the "d1" or "d2" option must have been specified when the
source file was compiled.
If no line numbering information is present in the object file, the "s"
option is ignored.
.np
The following defines the order in which the source file name is
determined when the "s" option is specified.
.autopoint
.point
If present,
the source file name specified on the command line.
.point
The name from the module header record.
.point
The object file name.
.endpoint
.np
In the following example, we have compiled the source file
.fi mysrc.&langsuff
with "d1" debugging information.
We then disassemble it as follows:
.exam begin
&prompt.&discmd mysrc &sw.s &sw.l
.exam end
.pc
In the above example, the &disname is instructed to disassemble the
contents of the file
.fi mysrc&obj
and produce the output to the listing file
.fi mysrc&lst..
The source lines are extracted from the file
.fi mysrc.&langsuff..
.np
An alternate form of this option is "s=<source_file>".
With this form, you can specify the name of the source file.
:cmt. When specifying a source file, a file extension of ".&langsuffup" is
:cmt. assumed if none is specified.
.exam begin
&prompt.&discmd mysrc &sw.s=myprog.&langsuff &sw.l
.exam end
.pc
The above example produces the same result as in the previous example
except the source lines are extracted from the file
.fi myprog.&langsuff..
.*
.section An Example
.*
.np
.ix '&discmdup example'
.ix 'disassembly example'
Consider the following program contained in the file
.fi hello.&langsuff..
.if '&lang' eq 'C' or '&lang' eq 'C/C++' .do begin
.mbox begin
#include <stdio.h>
void main()
{
printf( "Hello world\n" );
}
.mbox end
.do end
.if '&lang' eq 'FORTRAN 77' .do begin
.mbox begin
program main
print *, 'Hello world'
end
.mbox end
.do end
.np
Compile it with the "d1" option.
An object file called
.fi hello&obj
will be produced.
The "d1" option causes line numbering information to be generated in
the object file.
We can use the &disname to disassemble the contents of the object file
by issuing the following command.
.millust begin
&prompt.&discmd hello &sw.l &sw.e &sw.p &sw.s &sw.fu
.millust end
.pc
The output will be written to a listing file called
.fi hello&lst
(the "l" option was specified").
It will contain a list of external symbols
(the "e" option was specified),
a list of public symbols (the "p" option was specified) and
the source lines corresponding to the assembly language instructions
(the "s" option was specified).
The source input file is called
.fi hello.&langsuff..
The register names will be displayed in upper case (the "fu" option was
specified).
The output, shown below, is the result of using the
.if '&lang' eq 'C' or '&lang' eq 'C/C++' .do begin
&cmppname
.do end
.if '&lang' eq 'FORTRAN 77' .do begin
&cmpname
.do end
compiler.
.if '&lang' eq 'C' or '&lang' eq 'C/C++' .do begin
.if '&arch' eq '16-bit' .do begin
.code begin
Module: HELLO.C
GROUP: 'DGROUP' CONST,CONST2,_DATA,_BSS
Segment: _TEXT WORD USE16 00000013 bytes
#include <stdio.h>
void main()
0000 main_:
0000 B8 04 00 MOV AX,0x00000004
0003 E8 00 00 CALL __STK
{
printf( "Hello world\n" );
0006 B8 00 00 MOV AX,offset L$1
0009 50 PUSH AX
000A E8 00 00 CALL printf_
000D 83 C4 02 ADD SP,0x00000002
}
0010 31 C0 XOR AX,AX
0012 C3 RET
Routine Size: 19 bytes, Routine Base: _TEXT + 0000
No disassembly errors
.code break
List of external references
SYMBOL
-------
__STK 0004
printf_ 000B
Segment: CONST WORD USE16 0000000D bytes
0000 L$1:
0000 48 65 6C 6C 6F 20 77 6F 72 6C 64 0A 00 Hello world..
BSS Size: 0 bytes
.code break
List of public symbols
SYMBOL SECTION OFFSET
--------------------------------------------------------
main_ _TEXT 00000000
.code end
.do end
.if '&arch' eq '32-bit' .do begin
.np
The following is a disassembly of 80x86 code.
.code begin
Module: HELLO.C
GROUP: 'DGROUP' CONST,CONST2,_DATA,_BSS
Segment: _TEXT DWORD USE32 0000001A bytes
#include <stdio.h>
void main()
0000 main_:
0000 68 08 00 00 00 PUSH 0x00000008
0005 E8 00 00 00 00 CALL __CHK
{
printf( "Hello world\n" );
000A 68 00 00 00 00 PUSH offset L$1
000F E8 00 00 00 00 CALL printf_
0014 83 C4 04 ADD ESP,0x00000004
}
0017 31 C0 XOR EAX,EAX
0019 C3 RET
Routine Size: 26 bytes, Routine Base: _TEXT + 0000
No disassembly errors
.code break
List of external references
SYMBOL
-------
__CHK 0006
printf_ 0010
Segment: CONST DWORD USE32 0000000D bytes
0000 L$1:
0000 48 65 6C 6C 6F 20 77 6F 72 6C 64 0A 00 Hello world..
BSS Size: 0 bytes
.code break
List of public symbols
SYMBOL SECTION OFFSET
--------------------------------------------------------
main_ _TEXT 00000000
.code end
.np
The following is a disassembly of Alpha AXP code.
.code begin
.new_section .text, "crx4"
#include <stdio.h>
void main()
0000 main:
0000 23DEFFF0 LDA SP,-0x10(SP)
0004 B75E0000 STQ RA,(SP)
{
printf( "Hello world\n" );
0008 261F0000 LDAH A0,h^L$0(R31)
000C 22100000 LDA A0,l^L$0(A0)
0010 43F00010 SEXTL A0,A0
0014 D3400000 BSR RA,j^printf
}
0018 201F0000 MOV 0x00000000,V0
001C A75E0000 LDQ RA,(SP)
0020 23DE0010 LDA SP,0x10(SP)
0024 6BFA8001 RET (RA)
Routine Size: 40 bytes, Routine Base: .text + 0000
No disassembly errors
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -