Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
10:07 AM
<DIR>
.
10:01 AM
<DIR>
..
10:07 AM
660 increment.o
10:06 AM
254 main.cpp
10:06 AM
328 sillyMath.cpp
10:04 AM
84 increment.cpp
10:05 AM
68 decrement.cpp
10:05 AM
107 sillyMath.h
10:03 AM
70 increment.h
10:04 AM
64 decrement.h
8 File(s)
1,635 bytes
2 Dir(s) 1,341,972,480 bytes free
Output 2;
increment.cpp: ASCII C program text, with CRLF line terminators
Output 3;
increment.o: MS Windows COFF Intel 80386 object file
Output 4;
00000000 b
00000000 d
00000000 r
00000000 r
00000000 t
00000000 T
.bss
.data
.eh_frame
.rdata$zzz
.text
__ZN8engi38914lab19incrementERi
Output 5;
engi3891::lab1::increment(int&)
Output 6;
00000000 b
00000000 d
00000000 r
00000000 r
00000000 t
00000000 T
.bss
.data
.eh_frame
.rdata$zzz
.text
engi3891::lab1::increment(int&)
Output 7;
00000000 b
00000000 d
00000000 r
00000000 r
00000000 t
00000000 T
.bss
.data
.eh_frame
.rdata$zzz
.text
engi3891::lab1::increment(int&)
Directory of H:\engi3891\lab1
09/24/2014
09/24/2014
09/24/2014
09/24/2014
09/24/2014
09/24/2014
09/24/2014
09/24/2014
09/24/2014
09/24/2014
09/24/2014
09/24/2014
10:17 AM
<DIR>
.
10:01 AM
<DIR>
..
10:07 AM
660 increment.o
10:14 AM
1,230 Outputs.txt
10:06 AM
254 main.cpp
10:17 AM
644 decrement.o
10:06 AM
328 sillyMath.cpp
10:04 AM
84 increment.cpp
10:05 AM
68 decrement.cpp
10:05 AM
107 sillyMath.h
10:03 AM
70 increment.h
10:04 AM
64 decrement.h
10 File(s)
3,509 bytes
2 Dir(s) 1,341,620,224 bytes free
Output 9;
decrement.cpp: ASCII C program text, with CRLF line terminators
Output 10;
decrement.o: MS Windows COFF Intel 80386 object file
Output 11;
H:\engi3891\lab1>file decrement.o
decrement.o: MS Windows COFF Intel 80386 object file
H:\engi3891\lab1>nm decrement.o
00000000 b .bss
00000000 d .data
00000000 r .eh_frame
00000000 r .rdata$zzz
00000000 t .text
00000000 T __Z9decrementRi
//H:\engi3891\lab1>c++filt __ZN8engi38914lab19decrementERi
//engi3891::lab1::decrement(int&)
H:\engi3891\lab1>nm decrement.o | c++filt
00000000 b .bss
00000000 d .data
00000000 r .eh_frame
00000000 r .rdata$zzz
00000000 t .text
00000000 T decrement(int&)
Question: What is the offset of decrement(int&) in the object file?
Question: What is different about nm
increment.o?
Question: Is there any disagreement between the declaration (in decrement.h) and
definition of decrement()?
3.4 Compile sillyMath.cpp
Output 12;
//H:\engi3891\lab1>c++filt __ZN8engi38914lab19sillyMathERi
//engi3891::lab1::sillyMath(int&)
H:\engi3891\lab1>nm sillyMath.o | c++filt
00000000 b .bss
00000000 d .data
00000000 r .eh_frame
00000000 r .rdata$zzz
00000000 t .text
00000000 T engi3891::lab1::add(int, unsigned int)
0000002b T engi3891::lab1::subtract(int, unsigned int)
U engi3891::lab1::decrement(int&)
U engi3891::lab1::increment(int&)
Question: What are the offsets of the definitions of the functions engi3891::lab
1::add(int, unsigned int)
and engi3891::lab1::subtract(int, unsigned int) within sillyMath.o?
Output 13;
sillyMath.o:
%ebp
%esp,%ebp
$0x28,%esp
$0x0,-0xc(%ebp)
1e <__ZN8engi38914lab13addEij+0x1e>
0x8(%ebp),%eax
%eax,(%esp)
1a <__ZN8engi38914lab13addEij+0x1a>
$0x1,-0xc(%ebp)
-0xc(%ebp),%eax
0xc(%ebp),%eax
f <__ZN8engi38914lab13addEij+0xf>
0x8(%ebp),%eax
0000002b <__ZN8engi38914lab18subtractEij>:
2b: 55
push %ebp
2c: 89 e5
mov
%esp,%ebp
2e: 83 ec 28
sub
$0x28,%esp
31: c7 45 f4 00 00 00 00
movl $0x0,-0xc(%ebp)
38: eb 0f
jmp
49 <__ZN8engi38914lab13addEij+0x49>
3a: 8d 45 08
lea
0x8(%ebp),%eax
3d: 89 04 24
mov
%eax,(%esp)
40: e8 00 00 00 00
call 45 <__ZN8engi38914lab13addEij+0x45>
45: 83 45 f4 01
addl $0x1,-0xc(%ebp)
49: 8b 45 f4
mov
-0xc(%ebp),%eax
4c: 3b 45 0c
cmp
0xc(%ebp),%eax
4f: 72 e9
jb
3a <__ZN8engi38914lab13addEij+0x3a>
51: 8b 45 08
mov
0x8(%ebp),%eax
54:
55:
56:
57:
c9
c3
90
90
leave
ret
nop
nop
09/24/2014
09/24/2014
09/24/2014
09/24/2014
09/24/2014
09/24/2014
09/24/2014
09/24/2014
09/24/2014
09/24/2014
09/24/2014
09/24/2014
09/24/2014
09/24/2014
09/24/2014
11:08 AM
<DIR>
.
10:01 AM
<DIR>
..
10:07 AM
660 increment.o
10:58 AM
5,908 Outputs.txt
11:03 AM
2,137 main.o
11:02 AM
289 main.cpp
11:18 AM
660 decrement.o
11:13 AM
344 sillyMath.cpp
10:04 AM
84 increment.cpp
11:14 AM
929 sillyMath.o
11:17 AM
84 decrement.cpp
10:05 AM
107 sillyMath.h
11:18 AM
94,088 example.exe
10:03 AM
70 increment.h
10:04 AM
64 decrement.h
13 File(s)
105,424 bytes
2 Dir(s) 1,302,024,192 bytes free
output 17;
example.exe: PE32 executable for MS Windows (console) Intel 80386 32-bit
output 18;
-7 + 10 = 3
-7 - 10 = -17
output 19;
00401858 T
00401883 T
004016b0 T
004016c8 T
output 20;
00401ef0 T
00401f80 T
004020d0 T
004019e0 T
004039b0 T
004020c0 T
00401e10 T
00401de0 T
004039c0 T
00401930 T
00401660 T
004015d0 T
00403870 T
00401e60 T
00402cb0 T
00402d70 T
00402020 T
00403858 T
00403850 T
004020c8 T
004019c0 T
00403860 T
004039b0 T
004039c0 T
004038d0 T
00403910 T
004038f8 T
____w64_mingwthr_add_key_dtor
____w64_mingwthr_remove_key_dtor
___chkstk_ms
___cpu_features_init
___CTOR_LIST__
___deregister_frame_info
___do_global_ctors
___do_global_dtors
___DTOR_LIST__
___dyn_tls_init@12
___gcc_deregister_frame
___gcc_register_frame
___getmainargs
___main
___mingw_glob
___mingw_globfree
___mingw_TLScallback
___p__environ
___p__fmode
___register_frame_info
___tlregdtor
__cexit
__CTOR_LIST__
__DTOR_LIST__
__errno
__findclose
__findfirst
00403908 T __findnext
004019d0 T __fpreset
00401720 T __fu0___ZSt4cout
00401794 T __fu1___ZSt4cout
004038f0 T __fullpath
004015c0 T __onexit
00401c00 T __pei386_runtime_relocator
00403848 T __setmode
00401858 T engi3891::lab1::add(int, unsigned int)
00401883 T engi3891::lab1::subtract(int, unsigned int)
004016b0 T engi3891::lab1::decrement(int&)
004016c8 T engi3891::lab1::increment(int&)
004018b0 T std::basic_ostream<char, std::char_traits<char> >::operator<<(int)
004018c0 T std::basic_ostream<char, std::char_traits<char> >::operator<<(unsigne
d int)
004018d0 T std::ios_base::Init::Init()
004018c8 T std::ios_base::Init::~Init()
004018b8 T std::basic_ostream<char, std::char_traits<char> >& std::operator<< <s
td::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char
const*)
00403888 T _abort
004015b0 T _atexit
00403898 T _calloc
00403540 T _closedir
00403970 T _DeleteCriticalSection@4
00402d90 T _dirname
00403950 T _EnterCriticalSection@4
00403928 T _ExitProcess@4
004019d0 T _fpreset
004038a0 T _free
00403878 T _fwrite
00403920 T _GetCommandLineA@0
00403960 T _GetLastError@0
00403930 T _GetModuleHandleA@4
00403938 T _GetProcAddress@8
00403978 T _InitializeCriticalSection@4
00403868 T _isspace
00403968 T _LeaveCriticalSection@4
004016e0 T _main
00401570 T _mainCRTStartup
004038a8 T _malloc
004038e8 T _mbstowcs
00403890 T _memcpy
00403190 T _opendir
004033e0 T _readdir
004038b8 T _realloc
00403590 T _rewinddir
004036f0 T _seekdir
004038d8 T _setlocale
00403918 T _SetUnhandledExceptionFilter@4
00403840 T _signal
004038c8 T _strcoll
00403980 T _strdup
00403988 T _stricoll
004038c0 T _strlen
00403900 T _strncpy
004036c0 T _telldir
00403958 T _TlsGetValue@4
004038b0 T _tolower
00403880 T _vfprintf
00403948
00403940
004038e0
00401590
T
T
T
T
_VirtualProtect@16
_VirtualQuery@12
_wcstombs
_WinMainCRTStartup