Eric Pouech : winedbg: Implement float fetching for x86-64 debugger.

Alexandre Julliard julliard at winehq.org
Thu Feb 4 11:11:00 CST 2010


Module: wine
Branch: master
Commit: 7d3a9c6ffd5d57e869741c2a14d2e7c762904bc7
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=7d3a9c6ffd5d57e869741c2a14d2e7c762904bc7

Author: Eric Pouech <eric.pouech at orange.fr>
Date:   Wed Feb  3 21:47:40 2010 +0100

winedbg: Implement float fetching for x86-64 debugger.

---

 programs/winedbg/be_i386.c   |    2 +-
 programs/winedbg/be_x86_64.c |   20 +++++++++++++++++---
 2 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/programs/winedbg/be_i386.c b/programs/winedbg/be_i386.c
index e805a80..6ab5970 100644
--- a/programs/winedbg/be_i386.c
+++ b/programs/winedbg/be_i386.c
@@ -726,7 +726,7 @@ static int be_i386_fetch_integer(const struct dbg_lvalue* lvalue, unsigned size,
 static int be_i386_fetch_float(const struct dbg_lvalue* lvalue, unsigned size, 
                                long double* ret)
 {
-    char        tmp[12];
+    char        tmp[sizeof(long double)];
 
     /* FIXME: this assumes that debuggee and debugger use the same 
      * representation for reals
diff --git a/programs/winedbg/be_x86_64.c b/programs/winedbg/be_x86_64.c
index 3a111af..42cdcab 100644
--- a/programs/winedbg/be_x86_64.c
+++ b/programs/winedbg/be_x86_64.c
@@ -364,11 +364,25 @@ static int be_x86_64_fetch_integer(const struct dbg_lvalue* lvalue, unsigned siz
     return TRUE;
 }
 
-static int be_x86_64_fetch_float(const struct dbg_lvalue* lvalue, unsigned size, 
+static int be_x86_64_fetch_float(const struct dbg_lvalue* lvalue, unsigned size,
                                 long double* ret)
 {
-    dbg_printf("not done fetch_float\n");
-    return FALSE;
+    char        tmp[sizeof(long double)];
+
+    /* FIXME: this assumes that debuggee and debugger use the same
+     * representation for reals
+     */
+    if (!memory_read_value(lvalue, size, tmp)) return FALSE;
+
+    /* float & double types have to be promoted to a long double */
+    switch (size)
+    {
+    case sizeof(float):         *ret = *(float*)tmp;            break;
+    case sizeof(double):        *ret = *(double*)tmp;           break;
+    case sizeof(long double):   *ret = *(long double*)tmp;      break;
+    default:                    return FALSE;
+    }
+    return TRUE;
 }
 
 struct backend_cpu be_x86_64 =




More information about the wine-cvs mailing list