Added possibility to load .stabs/.stabstr sections from PE dlls.
Unfortunately my samples use currently typedefs which wine-dbg does
not understand, so no actual parsing.

diff --git a/debugger/hash.c b/debugger/hash.c
index c0e1391..f4c18ed 100644
--- a/debugger/hash.c
+++ b/debugger/hash.c
@@ -865,10 +865,7 @@
           DEBUG_AddSymbol( buffer, &addr, NULL, SYM_WIN32 | SYM_FUNC );
       }
     }
-
-    dir = &PE_HEADER(hModule)->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_DEBUG];
-    if (dir->Size)
-        DEBUG_RegisterDebugInfo(hModule, name, dir->VirtualAddress, dir->Size);
+    DEBUG_RegisterDebugInfo(hModule, name);
 #undef RVA
 }
 
diff --git a/debugger/msc.c b/debugger/msc.c
index 35a73d8..9d6b138 100644
--- a/debugger/msc.c
+++ b/debugger/msc.c
@@ -915,17 +915,21 @@
  * We don't fully process it here for performance reasons.
  */
 int
-DEBUG_RegisterDebugInfo( HMODULE32 hModule, const char *module_name,
-                         u_long v_addr, u_long size)
+DEBUG_RegisterDebugInfo( HMODULE32 hModule, const char *module_name)
 {
   int			  has_codeview = FALSE;
   int			  rtn = FALSE;
   int			  orig_size;
   PIMAGE_DEBUG_DIRECTORY dbgptr;
+  u_long v_addr, size;
+  PIMAGE_NT_HEADERS	  nth  = PE_HEADER(hModule);
 
-  orig_size = size;
-  dbgptr = (PIMAGE_DEBUG_DIRECTORY) (hModule + v_addr);
-  for(; size >= sizeof(*dbgptr); size -= sizeof(*dbgptr), dbgptr++ )
+  size = nth->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_DEBUG].Size;
+  if (size) {
+    v_addr = nth->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_DEBUG].VirtualAddress;
+    dbgptr = (PIMAGE_DEBUG_DIRECTORY) (hModule + v_addr);
+    orig_size = size;
+    for(; size >= sizeof(*dbgptr); size -= sizeof(*dbgptr), dbgptr++ )
     {
       switch(dbgptr->Type)
 	{
@@ -936,9 +940,9 @@
 	}
     }
 
-  size = orig_size;
-  dbgptr = (PIMAGE_DEBUG_DIRECTORY) (hModule + v_addr);
-  for(; size >= sizeof(*dbgptr); size -= sizeof(*dbgptr), dbgptr++ )
+    size = orig_size;
+    dbgptr = (PIMAGE_DEBUG_DIRECTORY) (hModule + v_addr);
+    for(; size >= sizeof(*dbgptr); size -= sizeof(*dbgptr), dbgptr++ )
     {
       switch(dbgptr->Type)
 	{
@@ -1029,11 +1033,35 @@
 	default:
 	}
     }
-
-  DEBUG_next_index++;
-
+    DEBUG_next_index++;
+  }
+  /* look for .stabs/.stabstr sections */
+  {
+    PIMAGE_SECTION_HEADER      pe_seg = PE_SECTIONS(hModule);
+    int i,stabsize=0,stabstrsize=0;
+    unsigned int stabs=0,stabstr=0;
+    
+    for (i=0;i<nth->FileHeader.NumberOfSections;i++) {
+      if (!strcasecmp(pe_seg[i].Name,".stab")) {
+	stabs = pe_seg[i].VirtualAddress;
+	stabsize = pe_seg[i].SizeOfRawData;
+      }
+      if (!strncasecmp(pe_seg[i].Name,".stabstr",8)) {
+	stabstr = pe_seg[i].VirtualAddress;
+	stabstrsize = pe_seg[i].SizeOfRawData;
+      }
+    }
+    if (stabstrsize && stabsize) {
+#ifdef _WE_SUPPORT_THE_STAB_TYPES_USED_BY_MINGW_TOO
+      /* Won't work currently, since MINGW32 uses some special typedefs
+       * which we do not handle yet. Support for them is a bit difficult.
+       */
+      DEBUG_ParseStabs(hModule,0,stabs,stabsize,stabstr,stabstrsize);
+#endif
+      fprintf(stderr,"(stabs not loaded)");
+    }
+  }
   return (rtn);
-
 }
 
 /*
diff --git a/debugger/stabs.c b/debugger/stabs.c
index 67565ca..b26be21 100644
--- a/debugger/stabs.c
+++ b/debugger/stabs.c
@@ -620,7 +620,6 @@
   return stab_types[DEBUG_ReadTypeEnum(&c)];
 }
 
-static 
 int
 DEBUG_ParseStabs(char * addr, unsigned int load_offset,
 		 unsigned int staboff, int stablen, 
diff --git a/include/debugger.h b/include/debugger.h
index 74bf0bb..c490e9d 100644
--- a/include/debugger.h
+++ b/include/debugger.h
@@ -271,10 +271,10 @@
 
   /* debugger/stabs.c */
 extern int DEBUG_ReadExecutableDbgInfo(void);
+extern int DEBUG_ParseStabs(char * addr, unsigned int load_offset, unsigned int staboff, int stablen, unsigned int strtaboff, int strtablen);
 
   /* debugger/msc.c */
-extern int DEBUG_RegisterDebugInfo( HMODULE32, const char *,
-                                    unsigned long, unsigned long);
+extern int DEBUG_RegisterDebugInfo( HMODULE32, const char *);
 extern int DEBUG_ProcessDeferredDebug(void);
 extern int DEBUG_RegisterELFDebugInfo(int load_addr, u_long size, char * name);
 extern void DEBUG_InfoShare(void);