UMBC CMSC 313 -- Assembly Language Segment Previous | Next


The FPU and the Debugger

Using our last program with the debugger, we can do the following:
GNU gdb Red Hat Linux (5.3post-0.20021129.18rh)
Copyright 2003 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-gnu"...
(gdb) break *main
Breakpoint 1 at 0x8048330: file float.asm, line 22.
(gdb) run
Starting program: /home/burt/courses/umbc/CMSC313/spring04/lectures/Lect10/float/float
                                                                                                                         
Breakpoint 1, main () at float.asm:22
warning: Source file is more recent than executable.
                                                                                                                         
22              finit                           ;  Initialize the FPU and clear errors
(gdb) s
24              fld     dword [ fnr1 ]          ; st0 :  1.2000000476837158203125
(gdb) s
25
(gdb) print $st0
$1 = 1.2000000476837158203125
(gdb) print $st1
$2 = 0
(gdb) info all-registers
eax            0x1      1
ecx            0x42015554       1107383636
edx            0x40016bc8       1073834952
ebx            0x42130a14       1108544020
esp            0xbfffed0c       0xbfffed0c
ebp            0xbfffed28       0xbfffed28
esi            0x40015360       1073828704
edi            0x80483a8        134513576
eip            0x8048339        0x8048339
eflags         0x200346 2097990
cs             0x23     35
ss             0x2b     43
ds             0x2b     43
es             0x2b     43
fs             0x0      0
gs             0x33     51
st0            1.2000000476837158203125 (raw 0x3fff99999a0000000000)
st1            0        (raw 0x00000000000000000000)
st2            0        (raw 0x00000000000000000000)
st3            0        (raw 0x00000000000000000000)
st4            0        (raw 0x00000000000000000000)
st5            0        (raw 0x00000000000000000000)
st6            0        (raw 0x00000000000000000000)
st7            0        (raw 0x00000000000000000000)
fctrl          0x37f    895
fstat          0x3800   14336
ftag           0x3fff   16383
fiseg          0x23     35
fioff          0x8048333        134513459
foseg          0x2b     43
fooff          0x8049434        134517812
fop            0x0      0
xmm0           {v4_float = {0x0, 0x0, 0x0, 0x0}, v2_double = {0x0, 0x0}, v16_int8 = {0x0 },
  v8_int16 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, v4_int32 = {0x0, 0x0, 0x0, 0x0}, v2_int64 = {0x0, 0x0},
  uint128 = 0x00000000000000000000000000000000}
---Type  to continue, or q  to quit---q


Previous | Next

©2004, Gary L. Burt