=~=~=~=~=~=~=~=~=~=~=~= PuTTY log 2004.09.01 09:10:38 =~=~=~=~=~=~=~=~=~=~=~= login as: auyeunt auyeunt@linux3.arc.losrios.edu's password: Last login: Wed Sep 1 09:07:22 2004 from 165.196.101.54 UNIX - The breakfast of Champions... Welcome to Linux3 ]0;auyeunt@linux3: /home/auyeunt[auyeunt@linux3 auyeunt]$ ls -l   7to9 Desktop Mail public_html test.out test.txt 7to9.c mail mov_immreg.s test.o test.s ]0;auyeunt@linux3: /home/auyeunt[auyeunt@linux3 auyeunt]$ ls 7to9 Desktop Mail public_html test.out test.txt 7to9.c mail mov_immreg.s test.o test.s ]0;auyeunt@linux3: /home/auyeunt[auyeunt@linux3 auyeunt]$ cat mov_immreg.s .text # switch to program (code) space .global _start # release the definition of _start to the linker _start: # define a label for the beginning of this program movl $0xabcd1234, %eax movl %eax, %ebx # typical exit code follows movl $0x1, %ax # this tell the OS that we want to quit movl $0x0, %ebx # an exit code of 0 means normal termination int $0x80 # request OS service ]0;auyeunt@linux3: /home/auyeunt[auyeunt@linux3 auyeunt]$ as --gstabs -o mov_immreg.o mov_immreg.s mov_immreg.s: Assembler messages: mov_immreg.s:8: Warning: using `%r8w' instead of `%ax' due to `l' suffix ]0;auyeunt@linux3: /home/auyeunt[auyeunt@linux3 auyeunt]$ cat mov_immreg.s .text # switch to program (code) space .global _start # release the definition of _start to the linker _start: # define a label for the beginning of this program movl $0xabcd1234, %eax movl %eax, %ebx # typical exit code follows movl $0x1, %eax # this tell the OS that we want to quit movl $0x0, %ebx # an exit code of 0 means normal termination int $0x80 # request OS service ]0;auyeunt@linux3: /home/auyeunt[auyeunt@linux3 auyeunt]$ cat mov_immreg. mov_immreg.o mov_immreg.s [auyeunt@linux3 auyeunt]$ cat mov_immreg.s .text # switch to program (code) space .global _start # release the definition of _start to the linker _start: # define a label for the beginning of this program movl $0xabcd1234, %eax movl %eax, %ebx # typical exit code follows movl $0x1, %eax # this tell the OS that we want to quit movl $0x0, %ebx # an exit code of 0 means normal termination int $0x80 # request OS service ]0;auyeunt@linux3: /home/auyeunt[auyeunt@linux3 auyeunt]$ cat mov_immreg.s[24@as --gstabs -o mov_immreg.o mov_immreg.s ]0;auyeunt@linux3: /home/auyeunt[auyeunt@linux3 auyeunt]$ ls -l total 60 -rwxr-xr-x 1 auyeunt auyeunt 14349 Apr 13 18:26 7to9 -rw-r--r-- 1 auyeunt auyeunt 885 Apr 13 18:25 7to9.c drwxr-xr-x 2 auyeunt auyeunt 4096 Apr 12 19:55 Desktop drwx------ 2 auyeunt auyeunt 4096 Apr 29 13:22 mail drwx------ 2 auyeunt auyeunt 4096 Apr 29 13:17 Mail -rw-r--r-- 1 auyeunt auyeunt 820 Sep 1 09:24 mov_immreg.o -rw-r--r-- 1 auyeunt auyeunt 398 Sep 1 09:22 mov_immreg.s drwxr-xr-x 2 auyeunt auyeunt 4096 Apr 13 12:54 public_html -rw-r--r-- 1 auyeunt auyeunt 804 Aug 18 09:39 test.o -rwxr-xr-x 1 auyeunt auyeunt 948 Aug 18 09:42 test.out -rw-r--r-- 1 auyeunt auyeunt 93 Aug 20 09:42 test.s -rw-r--r-- 1 auyeunt auyeunt 21 Aug 20 09:36 test.txt ]0;auyeunt@linux3: /home/auyeunt[auyeunt@linux3 auyeunt]$ ld -o mov_immreg.out mov_immreg.o ]0;auyeunt@linux3: /home/auyeunt[auyeunt@linux3 auyeunt]$ ls -l total 64 -rwxr-xr-x 1 auyeunt auyeunt 14349 Apr 13 18:26 7to9 -rw-r--r-- 1 auyeunt auyeunt 885 Apr 13 18:25 7to9.c drwxr-xr-x 2 auyeunt auyeunt 4096 Apr 12 19:55 Desktop drwx------ 2 auyeunt auyeunt 4096 Apr 29 13:22 mail drwx------ 2 auyeunt auyeunt 4096 Apr 29 13:17 Mail -rw-r--r-- 1 auyeunt auyeunt 820 Sep 1 09:24 mov_immreg.o -rwxr-xr-x 1 auyeunt auyeunt 956 Sep 1 09:25 mov_immreg.out -rw-r--r-- 1 auyeunt auyeunt 398 Sep 1 09:22 mov_immreg.s drwxr-xr-x 2 auyeunt auyeunt 4096 Apr 13 12:54 public_html -rw-r--r-- 1 auyeunt auyeunt 804 Aug 18 09:39 test.o -rwxr-xr-x 1 auyeunt auyeunt 948 Aug 18 09:42 test.out -rw-r--r-- 1 auyeunt auyeunt 93 Aug 20 09:42 test.s -rw-r--r-- 1 auyeunt auyeunt 21 Aug 20 09:36 test.txt ]0;auyeunt@linux3: /home/auyeunt[auyeunt@linux3 auyeunt]$ ./ .kde Desktop mov_immreg.out .ssh Mail public_html 7to9 mail test.out [auyeunt@linux3 auyeunt]$ ./mov_immreg.out ]0;auyeunt@linux3: /home/auyeunt[auyeunt@linux3 auyeunt]$ gdb ./mov_immreg.ot ut GNU gdb Red Hat Linux (5.2-2) Copyright 2002 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i386-redhat-linux"... (gdb) help List of classes of commands: aliases -- Aliases of other commands breakpoints -- Making program stop at certain points data -- Examining data files -- Specifying and examining files internals -- Maintenance commands obscure -- Obscure features running -- Running the program stack -- Examining the stack status -- Status inquiries support -- Support facilities tracepoints -- Tracing of program execution without stopping the program user-defined -- User-defined commands Type "help" followed by a class name for a list of commands in that class. Type "help" followed by command name for full documentation. Command name abbreviations are allowed if unambiguous. (gdb) list 1 .text # switch to program (code) space 2 .global _start # release the definition of _start to the linker 3 _start: # define a label for the beginning of this program 4 movl $0xabcd1234, %eax 5 movl %eax, %ebx 6 7 # typical exit code follows 8 movl $0x1, %eax # this tell the OS that we want to quit 9 movl $0x0, %ebx # an exit code of 0 means normal termination 10 int $0x80 # request OS service (gdb) run Starting program: /home/auyeunt/mov_immreg.out Program exited normally. (gdb) break 5 Breakpoint 1 at 0x8048079: file mov_immreg.s, line 5. (gdb) run Starting program: /home/auyeunt/mov_immreg.out Breakpoint 1, _start () at mov_immreg.s:5 5 movl %eax, %ebx Current language: auto; currently asm (gdb) info reg eax 0xabcd1234 -1412623820 ecx 0x0 0 edx 0x0 0 ebx 0x0 0 esp 0xbffff1f0 0xbffff1f0 ebp 0x0 0x0 esi 0x0 0 edi 0x0 0 eip 0x8048079 0x8048079 eflags 0x246 582 cs 0x23 35 ss 0x2b 43 ds 0x2b 43 es 0x2b 43 fs 0x0 0 gs 0x0 0 fctrl 0x37f 895 fstat 0x0 0 ftag 0xffff 65535 fiseg 0x0 0 fioff 0x0 0 foseg 0x0 0 fooff 0x0 0 ---Type to continue, or q to quit--- fop 0x0 0 xmm0 {f = {0x0, 0x0, 0x0, 0x0}} {f = {0, 0, 0, 0}} xmm1 {f = {0x0, 0x0, 0x0, 0x0}} {f = {0, 0, 0, 0}} xmm2 {f = {0x0, 0x0, 0x0, 0x0}} {f = {0, 0, 0, 0}} xmm3 {f = {0x0, 0x0, 0x0, 0x0}} {f = {0, 0, 0, 0}} xmm4 {f = {0x0, 0x0, 0x0, 0x0}} {f = {0, 0, 0, 0}} xmm5 {f = {0x0, 0x0, 0x0, 0x0}} {f = {0, 0, 0, 0}} xmm6 {f = {0x0, 0x0, 0x0, 0x0}} {f = {0, 0, 0, 0}} xmm7 {f = {0x0, 0x0, 0x0, 0x0}} {f = {0, 0, 0, 0}} mxcsr 0x1f80 8064 orig_eax 0xffffffff -1 (gdb) info reg eax eax 0xabcd1234 -1412623820 (gdb) step 8 movl $0x1, %eax # this tell the OS that we want to quit (gdb) list 3 _start: # define a label for the beginning of this program 4 movl $0xabcd1234, %eax 5 movl %eax, %ebx 6 7 # typical exit code follows 8 movl $0x1, %eax # this tell the OS that we want to quit 9 movl $0x0, %ebx # an exit code of 0 means normal termination 10 int $0x80 # request OS service (gdb) info reg eax eax 0xabcd1234 -1412623820 (gdb) i r ebx ebx 0xabcd1234 -1412623820 (gdb) s 9 movl $0x0, %ebx # an exit code of 0 means normal termination (gdb) i r eax eax 0x1 1 (gdb) s 10 int $0x80 # request OS service (gdb) i r ebx ebx 0x0 0 (gdb) s Program exited normally. (gdb) quit ]0;auyeunt@linux3: /home/auyeunt[auyeunt@linux3 auyeunt]$ gdb mov_immreg. GNU gdb Red Hat Linux (5.2-2) Copyright 2002 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i386-redhat-linux"...mov_immreg.: No such file or directory. (gdb) quit ]0;auyeunt@linux3: /home/auyeunt[auyeunt@linux3 auyeunt]$ gdb mov_immreg.out GNU gdb Red Hat Linux (5.2-2) Copyright 2002 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i386-redhat-linux"... (gdb) help info reg List of integer registers and their contents, for selected stack frame. Register name as argument means describe only that register. (gdb) i r     b 5 Breakpoint 1 at 0x8048079: file mov_immreg.s, line 5. (gdb) run Starting program: /home/auyeunt/mov_immreg.out Breakpoint 1, _start () at mov_immreg.s:5 5 movl %eax, %ebx Current language: auto; currently asm (gdb) i r eax ebx eax 0xabcd1234 -1412623820 ebx 0x0 0 (gdb) The program is running. Exit anyway? (y or n) y ]0;auyeunt@linux3: /home/auyeunt[auyeunt@linux3 auyeunt]$ gdb mov_immreg.out./mov_immreg.out./mov_immreg.out ls -ld -o mov_immreg.out mov_immreg.o [auyeunt@linux3 auyeunt]$ ls -las --gstabs -o mov_immreg.o mov_immreg.s[1@i[1@m[1@m[1@d[1@i[1@r[1@d[1@i[1@r ]0;auyeunt@linux3: /home/auyeunt[auyeunt@linux3 auyeunt]$ as --gstabs -o mov_immdir.o mov_immdir.s [auyeunt@linux3 auyeunt]$ gdb mov_immreg.out./mov_immreg.out./mov_immreg.out ls -ld -o mov_immreg.out mov_immreg.o[1@d[1@i[1@r[1@d[1@i[1@r ]0;auyeunt@linux3: /home/auyeunt[auyeunt@linux3 auyeunt]$ ld -o mov_immdir.out mov_immdir.o [auyeunt@linux3 auyeunt]$ as --gstabs -o mov_immdir.o mov_immdir.s ]0;auyeunt@linux3: /home/auyeunt[auyeunt@linux3 auyeunt]$ as --gstabs -o mov_immdir.o mov_immdir.s [auyeunt@linux3 auyeunt]$ ld -o mov_immdir.out mov_immdir.o ]0;auyeunt@linux3: /home/auyeunt[auyeunt@linux3 auyeunt]$ gdb mov_immdir.out GNU gdb Red Hat Linux (5.2-2) Copyright 2002 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i386-redhat-linux"... (gdb) list 1 .lcomm var1 4 # allocate 4 bytes, assign the address of the first byte 2 # to the symbolic name var1 3 .text # switch to program (code) space 4 .global _start # release the definition of _start to the linker 5 _start: # define a label for the beginning of this program 6 nop 7 movl $0xabcd1234, var1 # copy from immediate to direct memory 8 9 # typical exit code follows 10 movl $0x1, %eax # this tell the OS that we want to quit (gdb) b 7 Breakpoint 1 at 0x8048075: file mov_immdir.s, line 7. (gdb) run Starting program: /home/auyeunt/mov_immdir.out Breakpoint 1, _start () at mov_immdir.s:7 7 movl $0xabcd1234, var1 # copy from immediate to direct memory Current language: auto; currently asm (gdb) help x Examine memory: x/FMT ADDRESS. ADDRESS is an expression for the memory address to examine. FMT is a repeat count followed by a format letter and a size letter. Format letters are o(octal), x(hex), d(decimal), u(unsigned decimal), t(binary), f(float), a(address), i(instruction), c(char) and s(string). Size letters are b(byte), h(halfword), w(word), g(giant, 8 bytes). The specified number of objects of the specified size are printed according to the format. Defaults for format and size letters are those previously used. Default count is 1. Default address is following last thing printed with this command or "print". (gdb) x/xw var1 0x0: Cannot access memory at address 0x0 (gdb) x/xw var1[1@& 0x804908c : 0x00000000 (gdb) s 10 movl $0x1, %eax # this tell the OS that we want to quit (gdb) sx/xw &var1 0x804908c : 0xabcd1234 (gdb) 0x8049090: 0x00000000 (gdb) print var1 $1 = -1412623820 (gdb) help print Print value of expression EXP. Variables accessible are those of the lexical environment of the selected stack frame, plus all those whose scope is global or an entire file. $NUM gets previous value number NUM. $ and $$ are the last two values. $$NUM refers to NUM'th value back from the last one. Names starting with $ refer to registers (with the values they would have if the program were to return to the stack frame now selected, restoring all registers saved by frames farther in) or else to debugger "convenience" variables (any such name not a known register). Use assignment expressions to give values to convenience variables. {TYPE}ADREXP refers to a datum of data type TYPE, located at address ADREXP. @ is a binary operator for treating consecutive data objects anywhere in memory as an array. FOO@NUM gives an array whose first element is FOO, whose second element is stored in the space following where FOO is stored, etc. FOO must be an expression whose value resides in memory. EXP may be preceded with /FMT, where FMT is a format letter but no count or size letter (see "x" command). (gdb) [ print/xx w var1 Size letters are meaningless in "print" command. (gdb) print/xw var1 $2 = 0xabcd1234 (gdb) The program is running. Exit anyway? (y or n) y ]0;auyeunt@linux3: /home/auyeunt[auyeunt@linux3 auyeunt]$