Eric Pouech : dbghelp: module target: Better error handling when init fails and creates a dummy thread.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Mar 5 06:23:39 CST 2007


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

Author: Eric Pouech <eric.pouech at wanadoo.fr>
Date:   Sun Mar  4 17:02:31 2007 +0100

dbghelp: module target: Better error handling when init fails and creates a dummy thread.

---

 programs/winedbg/tgt_module.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/programs/winedbg/tgt_module.c b/programs/winedbg/tgt_module.c
index 0f72510..043d051 100644
--- a/programs/winedbg/tgt_module.c
+++ b/programs/winedbg/tgt_module.c
@@ -51,11 +51,17 @@ enum dbg_start tgt_module_load(const char* name, BOOL keep)
 {
     DWORD opts = SymGetOptions();
     HANDLE hDummy = (HANDLE)0x87654321;
+    enum dbg_start ret = start_ok;
 
     SymSetOptions((opts & ~(SYMOPT_UNDNAME|SYMOPT_DEFERRED_LOADS)) |
                   SYMOPT_LOAD_LINES | SYMOPT_AUTO_PUBLICS | 0x40000000);
-    SymInitialize(hDummy, NULL, FALSE);
-    SymLoadModule(hDummy, NULL, name, NULL, 0, 0);
+    if (!SymInitialize(hDummy, NULL, FALSE))
+        return start_error_init;
+    if (!SymLoadModule(hDummy, NULL, name, NULL, 0, 0))
+    {
+        ret = start_error_init;
+        keep = FALSE;
+    }
 
     if (keep)
     {
@@ -64,6 +70,8 @@ enum dbg_start tgt_module_load(const char* name, BOOL keep)
         SymSetOptions(SymGetOptions() | 0x40000000);
         dbg_curr_process = dbg_add_process(&be_process_module_io, 1, hDummy);
         dbg_curr_pid = 1;
+        dbg_curr_thread = dbg_add_thread(dbg_curr_process, 2, NULL, NULL);
+
         /* FIXME: missing thread creation, fetching frames, restoring dbghelp's options... */
     }
     else
@@ -72,7 +80,7 @@ enum dbg_start tgt_module_load(const char* name, BOOL keep)
         SymSetOptions(opts);
     }
 
-    return start_ok;
+    return ret;
 }
 
 static BOOL tgt_process_module_close_process(struct dbg_process* pcs, BOOL kill)




More information about the wine-cvs mailing list