Index: documentation/debugger.sgml
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/documentation/debugger.sgml,v
retrieving revision 1.26
diff -u -r1.26 debugger.sgml
--- documentation/debugger.sgml        22 Sep 2003 19:33:43 -0000        1.26
+++ documentation/debugger.sgml        13 Dec 2003 07:56:31 -0000
@@ -1147,66 +1147,6 @@
         </sect3>
 
         <sect3>
-          <title>Output handling</title>
-
-          <variablelist>
-            <varlistentry>
-              <term><varname>ConChannelMask</varname></term>
-              <listitem>
-                <para>
-                  Mask of active debugger output channels on console
-                </para>
-              </listitem>
-            </varlistentry>
-            <varlistentry>
-              <term><varname>StdChannelMask</varname></term>
-              <listitem>
-                <para>
-                  Mask of active debugger output channels on <filename>stderr</filename>
-                </para>
-              </listitem>
-            </varlistentry>
-          </variablelist>
-
-          <para>
-            Those last 2 variables are jointly used in two generic ways:
-          </para>
-
-          <orderedlist>
-            <listitem>
-              <para>
-                default
-              </para>
-              <programlisting>
-ConChannelMask = DBG_CHN_MESG (1)
-StdChannelMask = 0
-              </programlisting>
-              <para>
-                In this case, all input/output goes into the
-                debugger's console (either the standard unix console
-                if winedbg is started from the command line, or a
-                specific windowed-console if the debugger is started
-                upon an exception in a running program. All debug
-                messages <function>TRACE</function>,
-                <function>WARN</function>... still goes to tty where
-                wine is run from).
-              </para>
-            </listitem>
-            <listitem>
-              <para>
-                To have all input/output go into the tty where Wine
-                was started from (to be used in a X11-free
-                environment)
-              </para>
-              <screen>
-ConChannelMask = 0
-StdChannelMask = DBG_CHN_MESG (1)
-              </screen>
-            </listitem>
-          </orderedlist>
-        </sect3>
-
-        <sect3>
           <title>Context information</title>
 
           <variablelist>
Index: programs/winedbg/break.c
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/programs/winedbg/break.c,v
retrieving revision 1.2
diff -u -r1.2 break.c
--- programs/winedbg/break.c        16 Sep 2002 19:26:48 -0000        1.2
+++ programs/winedbg/break.c        13 Dec 2003 09:36:46 -0000
@@ -22,6 +22,9 @@
 
 #include "config.h"
 #include "debugger.h"
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(winedbg);
 
 #ifdef __i386__
 #define DR7_CONTROL_SHIFT        16
@@ -197,7 +200,7 @@
             if (!DEBUG_WRITE_MEM( (void*)DEBUG_ToLinear(&breakpoints[i].addr),
                                   &ch, sizeof(ch) ))
             {
-               DEBUG_Printf(DBG_CHN_MESG, "Invalid address for breakpoint %d, disabling it\n", i);
+               DEBUG_Printf("Invalid address for breakpoint %d, disabling it\n", i);
                breakpoints[i].enabled = FALSE;
             }
 #endif
@@ -304,7 +307,7 @@
       }
    }
 
-   DEBUG_Printf( DBG_CHN_MESG, "Too many breakpoints. Please delete some.\n" );
+   DEBUG_Printf("Too many breakpoints. Please delete some.\n");
    return -1;
 }
 
@@ -350,7 +353,7 @@
     if (!DEBUG_READ_MEM((void*)DEBUG_ToLinear( &value->addr ), &ch, sizeof(ch)))
     {
         if (verbose)
-            DEBUG_Printf( DBG_CHN_MESG, "Invalid address, can't set breakpoint\n");
+            DEBUG_Printf("Invalid address, can't set breakpoint\n");
         return FALSE;
     }
 
@@ -360,10 +363,10 @@
     breakpoints[num].u.b.opcode = ch;
     breakpoints[num].u.b.func = func;
 
-    DEBUG_Printf( DBG_CHN_MESG, "Breakpoint %d at ", num );
+    DEBUG_Printf("Breakpoint %d at ", num);
     DEBUG_PrintAddress( &breakpoints[num].addr, breakpoints[num].is32 ? MODE_32 : MODE_16,
                         TRUE );
-    DEBUG_Printf( DBG_CHN_MESG, "\n" );
+    DEBUG_Printf("\n");
 
     return FALSE;
 }
@@ -395,11 +398,11 @@
     {
         if (!DBG_IVAR(CanDeferOnBPByAddr))
         {
-            DEBUG_Printf( DBG_CHN_MESG, "Invalid address, can't set breakpoint\n"
-                          "You can turn on deferring breakpoints by address by setting $CanDeferOnBPByAddr to 1\n");
+            DEBUG_Printf("Invalid address, can't set breakpoint\n"
+                         "You can turn on deferring breakpoints by address by setting $CanDeferOnBPByAddr to 1\n");
             return FALSE;
         }
-        DEBUG_Printf(DBG_CHN_MESG, "Unable to add breakpoint, will check again any time a new DLL is loaded\n");
+        DEBUG_Printf("Unable to add breakpoint, will check again any time a new DLL is loaded\n");
         DEBUG_CurrProcess->delayed_bp = DBG_realloc(DEBUG_CurrProcess->delayed_bp,
                                                     sizeof(DBG_DELAYED_BP) * ++DEBUG_CurrProcess->num_delayed_bp);
 
@@ -432,7 +435,7 @@
         return;
     }
 
-    DEBUG_Printf(DBG_CHN_MESG, "Unable to add breakpoint, will check again when a new DLL is loaded\n");
+    DEBUG_Printf("Unable to add breakpoint, will check again when a new DLL is loaded\n");
     for (i = 0; i < DEBUG_CurrProcess->num_delayed_bp; i++)
     {
         if (DEBUG_CurrProcess->delayed_bp[i].is_symbol &&
@@ -466,7 +469,7 @@
         DEBUG_FindNearestSymbol(&value.addr, TRUE, &nh, 0, NULL);
         if (nh == NULL)
         {
-            DEBUG_Printf(DBG_CHN_MESG, "Unable to add breakpoint\n");
+            DEBUG_Printf("Unable to add breakpoint\n");
             return;
         }
         DEBUG_GetLineNumberAddr(nh, lineno, &value.addr, TRUE);
@@ -497,15 +500,15 @@
         }
         else
             value = dbp[i].u.value;
-        DEBUG_Printf(DBG_CHN_MESG, "trying to add delayed %s-bp\n", dbp[i].is_symbol ? "S" : "A");
+        WINE_TRACE("trying to add delayed %s-bp\n", dbp[i].is_symbol ? "S" : "A");
         if (!dbp[i].is_symbol)
-            DEBUG_Printf(DBG_CHN_MESG, "\t%04x %04lx:%08lx\n",
-                         dbp[i].u.value.cookie,
-                         dbp[i].u.value.addr.seg,
-                         dbp[i].u.value.addr.off);
+            WINE_TRACE("\t%04x %04lx:%08lx\n",
+                       dbp[i].u.value.cookie,
+                       dbp[i].u.value.addr.seg,
+                       dbp[i].u.value.addr.off);
         else
-            DEBUG_Printf(DBG_CHN_MESG, "\t'%s' @ %d\n",
-                         dbp[i].u.symbol.name, dbp[i].u.symbol.lineno);
+            WINE_TRACE("\t'%s' @ %d\n",
+                       dbp[i].u.symbol.name, dbp[i].u.symbol.lineno);
 
         if (DEBUG_AddBreakpoint(&value, NULL, FALSE))
             memmove(&dbp[i], &dbp[i+1], (--DEBUG_CurrProcess->num_delayed_bp - i) * sizeof(*dbp));
@@ -554,7 +557,7 @@
    for (reg = 0; reg < 4 && (mask & (1 << reg)); reg++);
    if (reg == 4)
    {
-      DEBUG_Printf(DBG_CHN_MESG, "All i386 hardware watchpoints have been set. Delete some\n");
+      DEBUG_Printf("All i386 hardware watchpoints have been set. Delete some\n");
       return;
    }
 #endif
@@ -568,7 +571,7 @@
 
    if (!DEBUG_GetWatchedValue( num, &breakpoints[num].u.w.oldval))
    {
-      DEBUG_Printf(DBG_CHN_MESG, "Bad address. Watchpoint not set\n");
+      DEBUG_Printf("Bad address. Watchpoint not set\n");
       breakpoints[num].refcount = 0;
    }
    else
@@ -576,9 +579,9 @@
       breakpoints[num].u.w.rw = (is_write) ? TRUE : FALSE;
       breakpoints[reg].u.w.reg = reg;
 
-      DEBUG_Printf( DBG_CHN_MESG, "Watchpoint %d at ", num );
+      DEBUG_Printf("Watchpoint %d at ", num);
       DEBUG_PrintAddress( &breakpoints[num].addr, breakpoints[num].is32 ? MODE_32 : MODE_16, TRUE );
-      DEBUG_Printf( DBG_CHN_MESG, "\n" );
+      DEBUG_Printf("\n");
    }
 }
 
@@ -597,7 +600,7 @@
       DEBUG_AddWatchpoint( &value, 1 );
       break;
    case gsv_unknown:
-      DEBUG_Printf(DBG_CHN_MESG, "Unable to add watchpoint\n");
+      DEBUG_Printf("Unable to add watchpoint\n");
       break;
    case gsv_aborted: /* user aborted symbol lookup */
        break;
@@ -613,14 +616,14 @@
 {
     if ((num <= 0) || (num >= next_bp) || breakpoints[num].refcount == 0)
     {
-        DEBUG_Printf( DBG_CHN_MESG, "Invalid breakpoint number %d\n", num );
+        DEBUG_Printf("Invalid breakpoint number %d\n", num);
         return;
     }
 
     if (--breakpoints[num].refcount > 0)
        return;
 
-    if( breakpoints[num].condition != NULL )
+    if (breakpoints[num].condition != NULL)
     {
        DEBUG_FreeExpr(breakpoints[num].condition);
        breakpoints[num].condition = NULL;
@@ -640,7 +643,7 @@
 {
     if ((num <= 0) || (num >= next_bp) || breakpoints[num].refcount == 0)
     {
-        DEBUG_Printf( DBG_CHN_MESG, "Invalid breakpoint number %d\n", num );
+        DEBUG_Printf("Invalid breakpoint number %d\n", num);
         return;
     }
     breakpoints[num].enabled = (enable) ? TRUE : FALSE;
@@ -728,40 +731,40 @@
 {
     int i;
 
-    DEBUG_Printf( DBG_CHN_MESG, "Breakpoints:\n" );
+    DEBUG_Printf("Breakpoints:\n");
     for (i = 1; i < next_bp; i++)
     {
         if (breakpoints[i].refcount && breakpoints[i].type == DBG_BREAK)
         {
-            DEBUG_Printf( DBG_CHN_MESG, "%d: %c ", i, breakpoints[i].enabled ? 'y' : 'n');
+            DEBUG_Printf("%d: %c ", i, breakpoints[i].enabled ? 'y' : 'n');
             DEBUG_PrintAddress( &breakpoints[i].addr,
                                 breakpoints[i].is32 ? MODE_32 : MODE_16, TRUE);
-            DEBUG_Printf( DBG_CHN_MESG, " (%u)\n", breakpoints[i].refcount );
+            DEBUG_Printf(" (%u)\n", breakpoints[i].refcount );
             if( breakpoints[i].condition != NULL )
             {
-                DEBUG_Printf(DBG_CHN_MESG, "\t\tstop when  ");
+                DEBUG_Printf("\t\tstop when  ");
                  DEBUG_DisplayExpr(breakpoints[i].condition);
-                DEBUG_Printf(DBG_CHN_MESG, "\n");
+                DEBUG_Printf("\n");
             }
         }
     }
-    DEBUG_Printf( DBG_CHN_MESG, "Watchpoints:\n" );
+    DEBUG_Printf("Watchpoints:\n");
     for (i = 1; i < next_bp; i++)
     {
         if (breakpoints[i].refcount && breakpoints[i].type == DBG_WATCH)
         {
-            DEBUG_Printf( DBG_CHN_MESG, "%d: %c ", i, breakpoints[i].enabled ? 'y' : 'n');
+            DEBUG_Printf("%d: %c ", i, breakpoints[i].enabled ? 'y' : 'n');
             DEBUG_PrintAddress( &breakpoints[i].addr,
                                 breakpoints[i].is32 ? MODE_32 : MODE_16, TRUE);
-            DEBUG_Printf( DBG_CHN_MESG, " on %d byte%s (%c)\n",
+            DEBUG_Printf(" on %d byte%s (%c)\n",
                      breakpoints[i].u.w.len + 1,
                      breakpoints[i].u.w.len > 0 ? "s" : "",
                      breakpoints[i].u.w.rw ? 'W' : 'R');
             if( breakpoints[i].condition != NULL )
             {
-                DEBUG_Printf(DBG_CHN_MESG, "\t\tstop when  ");
+                DEBUG_Printf("\t\tstop when  ");
                  DEBUG_DisplayExpr(breakpoints[i].condition);
-                DEBUG_Printf(DBG_CHN_MESG, "\n");
+                DEBUG_Printf("\n");
             }
         }
     }
@@ -784,9 +787,9 @@
             /*
              * Something wrong - unable to evaluate this expression.
              */
-            DEBUG_Printf(DBG_CHN_MESG, "Unable to evaluate expression ");
+            DEBUG_Printf("Unable to evaluate expression ");
             DEBUG_DisplayExpr(breakpoints[bpnum].condition);
-            DEBUG_Printf(DBG_CHN_MESG, "\nTurning off condition\n");
+            DEBUG_Printf("\nTurning off condition\n");
             DEBUG_AddBPCondition(bpnum, NULL);
         }
         else if( !DEBUG_GetExprValue( &value, NULL) )
@@ -834,10 +837,10 @@
     {
         if (!DEBUG_ShallBreak(bpnum)) return TRUE;
 
-        DEBUG_Printf( DBG_CHN_MESG, "Stopped on breakpoint %d at ", bpnum );
+        DEBUG_Printf("Stopped on breakpoint %d at ", bpnum);
         syminfo = DEBUG_PrintAddress( &breakpoints[bpnum].addr,
                                       breakpoints[bpnum].is32 ? MODE_32 : MODE_16, TRUE );
-        DEBUG_Printf( DBG_CHN_MESG, "\n" );
+        DEBUG_Printf("\n");
 
         if( syminfo.list.sourcefile != NULL )
             DEBUG_List(&syminfo.list, NULL, 0);
@@ -858,10 +861,10 @@
        if (!DEBUG_ShallBreak(wpnum)) return TRUE;
 
        addr_mode = DEBUG_GetSelectorType( addr->seg );
-       DEBUG_Printf(DBG_CHN_MESG, "Stopped on watchpoint %d at ", wpnum);
+       DEBUG_Printf("Stopped on watchpoint %d at ", wpnum);
        syminfo = DEBUG_PrintAddress( addr, addr_mode, TRUE );
 
-       DEBUG_Printf(DBG_CHN_MESG, " values: old=%lu new=%lu\n",
+       DEBUG_Printf(" values: old=%lu new=%lu\n",
                     oldval, breakpoints[wpnum].u.w.oldval);
        if (syminfo.list.sourcefile != NULL)
           DEBUG_List(&syminfo.list, NULL, 0);
@@ -980,7 +983,7 @@
       {
         if( mode == EXEC_CONT && count > 1 )
           {
-            DEBUG_Printf(DBG_CHN_MESG, "Not stopped at any breakpoint; argument ignored.\n");
+            DEBUG_Printf("Not stopped at any breakpoint; argument ignored.\n");
           }
       }
 
@@ -1011,19 +1014,15 @@
         if( ((mode == EXEC_STEP_OVER) || (mode == EXEC_STEPI_OVER))
             && status == FUNC_IS_TRAMPOLINE )
           {
-#if 0
-            DEBUG_Printf(DBG_CHN_MESG, "Not stepping into trampoline at %x (no lines)\n",
-                    addr2.off);
-#endif
+            WINE_TRACE("Not stepping into trampoline at %lx (no lines)\n",
+                       addr2.off);
             mode = EXEC_STEP_OVER_TRAMPOLINE;
           }
 
         if( mode == EXEC_STEP_INSTR && status == FUNC_HAS_NO_LINES )
           {
-#if 0
-            DEBUG_Printf(DBG_CHN_MESG, "Not stepping into function at %x (no lines)\n",
-                    addr2.off);
-#endif
+            WINE_TRACE("Not stepping into function at %lx (no lines)\n",
+                       addr2.off);
             mode = EXEC_STEP_OVER;
           }
       }
@@ -1033,8 +1032,8 @@
       {
         if( DEBUG_CheckLinenoStatus(&addr) == FUNC_HAS_NO_LINES )
           {
-            DEBUG_Printf(DBG_CHN_MESG, "Single stepping until exit from function, \n");
-            DEBUG_Printf(DBG_CHN_MESG, "which has no line number information.\n");
+            DEBUG_Printf("Single stepping until exit from function, \n"
+                         "which has no line number information.\n");
 
             ret_mode = mode = EXEC_FINISH;
           }
@@ -1109,7 +1108,7 @@
 {
     if ((num <= 0) || (num >= next_bp) || !breakpoints[num].refcount)
     {
-        DEBUG_Printf( DBG_CHN_MESG, "Invalid breakpoint number %d\n", num );
+        DEBUG_Printf("Invalid breakpoint number %d\n", num);
         return FALSE;
     }
 
Index: programs/winedbg/db_disasm.c
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/programs/winedbg/db_disasm.c,v
retrieving revision 1.2
diff -u -r1.2 db_disasm.c
--- programs/winedbg/db_disasm.c        9 Oct 2003 04:39:01 -0000        1.2
+++ programs/winedbg/db_disasm.c        13 Dec 2003 07:13:07 -0000
@@ -1070,7 +1070,7 @@
     char                       buffer[4];
 
     if (size != 1 && size != 2 && size != 4) {
-        DEBUG_Printf(DBG_CHN_MESG, "Illegal size specified\n");
+        DEBUG_Printf("Illegal size specified\n");
     } else {
        DEBUG_READ_MEM((void*)DEBUG_ToLinear( addr ), buffer, size);
 
@@ -1194,21 +1194,21 @@
 void db_print_address(const char *seg, int size, struct i_addr *addrp, int byref)
 {
         if (addrp->is_reg) {
-            DEBUG_Printf(DBG_CHN_MESG,"%s", db_reg[size][addrp->disp]);
+            DEBUG_Printf("%s", db_reg[size][addrp->disp]);
             return;
         }
 
         if (seg) {
-            DEBUG_Printf(DBG_CHN_MESG,"%s:", seg);
+            DEBUG_Printf("%s:", seg);
         }
 
         if (addrp->base != 0 || addrp->index != 0) {
-            DEBUG_Printf(DBG_CHN_MESG,"0x%x(", addrp->disp);
+            DEBUG_Printf("0x%x(", addrp->disp);
             if (addrp->base)
-                DEBUG_Printf(DBG_CHN_MESG,"%s", addrp->base);
+                DEBUG_Printf("%s", addrp->base);
             if (addrp->index)
-                DEBUG_Printf(DBG_CHN_MESG,",%s,%d", addrp->index, 1<<addrp->ss);
-            DEBUG_Printf(DBG_CHN_MESG,")");
+                DEBUG_Printf(",%s,%d", addrp->index, 1<<addrp->ss);
+            DEBUG_Printf(")");
         }
         else {
 
@@ -1218,11 +1218,11 @@
                void*        a1;
                void*        a2;
 
-               DEBUG_Printf(DBG_CHN_MESG,"0x%x -> ", addrp->disp);
+               DEBUG_Printf("0x%x -> ", addrp->disp);
                if (!DEBUG_READ_MEM((void*)addrp->disp, &a1, sizeof(a1))) {
-                   DEBUG_Printf(DBG_CHN_MESG, "(invalid source)");
+                   DEBUG_Printf("(invalid source)");
                } else if (!DEBUG_READ_MEM(a1, &a2, sizeof(a2))) {
-                  DEBUG_Printf(DBG_CHN_MESG, "(invalid destination)");
+                  DEBUG_Printf("(invalid destination)");
                } else {
                   db_task_printsym((unsigned long)a1, 0);
                }
@@ -1254,34 +1254,22 @@
         fp = &db_Esc_inst[inst - 0xd8][f_reg(regmodrm)];
         mod = f_mod(regmodrm);
         if (mod != 3) {
+            const char* p;
             /*
              * Normal address modes.
              */
             db_read_address( addr, short_addr, regmodrm, &address);
-            DEBUG_Printf(DBG_CHN_MESG,fp->f_name);
+            DEBUG_Printf(fp->f_name);
             switch(fp->f_size) {
-                case SNGL:
-                    DEBUG_Printf(DBG_CHN_MESG,"s");
-                    break;
-                case DBLR:
-                    DEBUG_Printf(DBG_CHN_MESG,"l");
-                    break;
-                case EXTR:
-                    DEBUG_Printf(DBG_CHN_MESG,"t");
-                    break;
-                case WORD:
-                    DEBUG_Printf(DBG_CHN_MESG,"s");
-                    break;
-                case LONG:
-                    DEBUG_Printf(DBG_CHN_MESG,"l");
-                    break;
-                case QUAD:
-                    DEBUG_Printf(DBG_CHN_MESG,"q");
-                    break;
-                default:
-                    break;
+                case SNGL: p = "s"; break;
+                case DBLR: p = "l"; break;
+                case EXTR: p = "t"; break;
+                case WORD: p = "s"; break;
+                case LONG: p = "l"; break;
+                case QUAD: p = "q"; break;
+                default:   p = "";  break;
             }
-            DEBUG_Printf(DBG_CHN_MESG,"\t");
+            DEBUG_Printf("%s\t", p);
             db_print_address(seg, BYTE, &address, 0);
         }
         else {
@@ -1291,25 +1279,24 @@
             switch (fp->f_rrmode) {
                 case op2(ST,STI):
                     name = (fp->f_rrname) ? fp->f_rrname : fp->f_name;
-                    DEBUG_Printf(DBG_CHN_MESG,"%s\t%%st,%%st(%d)",name,f_rm(regmodrm));
+                    DEBUG_Printf("%s\t%%st,%%st(%d)",name,f_rm(regmodrm));
                     break;
                 case op2(STI,ST):
                     name = (fp->f_rrname) ? fp->f_rrname : fp->f_name;
-                    DEBUG_Printf(DBG_CHN_MESG,"%s\t%%st(%d),%%st",name, f_rm(regmodrm));
+                    DEBUG_Printf("%s\t%%st(%d),%%st",name, f_rm(regmodrm));
                     break;
                 case op1(STI):
                     name = (fp->f_rrname) ? fp->f_rrname : fp->f_name;
-                    DEBUG_Printf(DBG_CHN_MESG,"%s\t%%st(%d)",name, f_rm(regmodrm));
+                    DEBUG_Printf("%s\t%%st(%d)",name, f_rm(regmodrm));
                     break;
                 case op1(X):
-                    DEBUG_Printf(DBG_CHN_MESG,"%s", ((char **)fp->f_rrname)[f_rm(regmodrm)]);
+                    DEBUG_Printf("%s", ((char **)fp->f_rrname)[f_rm(regmodrm)]);
                     break;
                 case op1(XA):
-                    DEBUG_Printf(DBG_CHN_MESG,"%s\t%%ax",
-                                 ((char **)fp->f_rrname)[f_rm(regmodrm)]);
+                    DEBUG_Printf("%s\t%%ax", ((char **)fp->f_rrname)[f_rm(regmodrm)]);
                     break;
                 default:
-                    DEBUG_Printf(DBG_CHN_MESG,"<bad instruction>");
+                    DEBUG_Printf("<bad instruction>");
                     break;
             }
         }
@@ -1349,7 +1336,7 @@
         case MODE_VM86:
         case MODE_16: db_disasm_16 = 1; break;
         case MODE_32: db_disasm_16 = 0; break;
-        default: DEBUG_Printf(DBG_CHN_MESG, "Bad selector %lx\n", addr->seg); return;
+        default: DEBUG_Printf("Bad selector %lx\n", addr->seg); return;
         }
 
         get_value_inc( inst, addr, 1, FALSE );
@@ -1399,15 +1386,15 @@
                     break;
                 case 0xf0:
                     if( db_display )
-                        DEBUG_Printf(DBG_CHN_MESG,"lock ");
+                        DEBUG_Printf("lock ");
                     break;
                 case 0xf2:
                     if( db_display )
-                        DEBUG_Printf(DBG_CHN_MESG,"repne ");
+                        DEBUG_Printf("repne ");
                     break;
                 case 0xf3:
                     if( db_display )
-                        DEBUG_Printf(DBG_CHN_MESG,"repe ");        /* XXX repe VS rep */
+                        DEBUG_Printf("repe ");        /* XXX repe VS rep */
                     break;
                 default:
                     prefix = FALSE;
@@ -1475,28 +1462,28 @@
           if( db_display )
             {
               if (size == WORD)
-                DEBUG_Printf(DBG_CHN_MESG,i_name);
+                DEBUG_Printf(i_name);
               else
-                DEBUG_Printf(DBG_CHN_MESG,ip->i_extra);
+                DEBUG_Printf(ip->i_extra);
             }
         }
         else {
           if( db_display )
             {
-              DEBUG_Printf(DBG_CHN_MESG,i_name);
+              DEBUG_Printf(i_name);
             }
             if (i_size != NONE) {
                 if (i_size == BYTE) {
                   if( db_display )
                     {
-                      DEBUG_Printf(DBG_CHN_MESG,"b");
+                      DEBUG_Printf("b");
                     }
                     size = BYTE;
                 }
                 else if (i_size == WORD) {
                   if( db_display )
                     {
-                      DEBUG_Printf(DBG_CHN_MESG,"w");
+                      DEBUG_Printf("w");
                     }
                     size = WORD;
                 }
@@ -1504,28 +1491,28 @@
                   {
                   if( db_display )
                     {
-                      DEBUG_Printf(DBG_CHN_MESG,"w");
+                      DEBUG_Printf("w");
                     }
                   }
                 else
                   {
                   if( db_display )
                     {
-                      DEBUG_Printf(DBG_CHN_MESG,"l");
+                      DEBUG_Printf("l");
                     }
                   }
             }
         }
         if( db_display )
           {
-            DEBUG_Printf(DBG_CHN_MESG,"\t");
+            DEBUG_Printf("\t");
           }
         for (first = TRUE;
              i_mode != 0;
              i_mode >>= 8, first = FALSE)
         {
             if (!first && db_display)
-                DEBUG_Printf(DBG_CHN_MESG,",");
+                DEBUG_Printf(",");
 
             switch (i_mode & 0xFF) {
 
@@ -1539,7 +1526,7 @@
                 case Eind:
                   if( db_display )
                     {
-                      DEBUG_Printf(DBG_CHN_MESG,"*");
+                      DEBUG_Printf("*");
                       db_print_address(seg, size, &address, 1);
                     }
                     break;
@@ -1561,31 +1548,31 @@
                 case R:
                   if( db_display )
                     {
-                      DEBUG_Printf(DBG_CHN_MESG,"%s", db_reg[size][f_reg(regmodrm)]);
+                      DEBUG_Printf("%s", db_reg[size][f_reg(regmodrm)]);
                     }
                     break;
                 case MX:
                   if( db_display )
                     {
-                      DEBUG_Printf(DBG_CHN_MESG,"%%mm%d", f_reg(regmodrm));
+                      DEBUG_Printf("%%mm%d", f_reg(regmodrm));
                     }
                     break;
                 case EMX:
                   if( db_display )
                     {
-                      DEBUG_Printf(DBG_CHN_MESG,"%%mm%d", f_rm(regmodrm));
+                      DEBUG_Printf("%%mm%d", f_rm(regmodrm));
                     }
                     break;
                 case XMM:
                   if( db_display )
                     {
-                      DEBUG_Printf(DBG_CHN_MESG,"%%xmm%d", f_reg(regmodrm));
+                      DEBUG_Printf("%%xmm%d", f_reg(regmodrm));
                     }
                     break;
                 case EXMM:
                   if( db_display )
                     {
-                      DEBUG_Printf(DBG_CHN_MESG,"%%xmm%d", f_rm(regmodrm));
+                      DEBUG_Printf("%%xmm%d", f_rm(regmodrm));
                     }
                     break;
 
@@ -1593,35 +1580,35 @@
                 case Rw:
                   if( db_display )
                     {
-                      DEBUG_Printf(DBG_CHN_MESG,"%s", db_reg[WORD][f_reg(regmodrm)]);
+                      DEBUG_Printf("%s", db_reg[WORD][f_reg(regmodrm)]);
                     }
                     break;
 
                 case Ri:
                   if( db_display )
                     {
-                      DEBUG_Printf(DBG_CHN_MESG,"%s", db_reg[size][f_rm(inst)]);
+                      DEBUG_Printf("%s", db_reg[size][f_rm(inst)]);
                     }
                     break;
 
                 case S:
                   if( db_display )
                     {
-                      DEBUG_Printf(DBG_CHN_MESG,"%s", db_seg_reg[f_reg(regmodrm)]);
+                      DEBUG_Printf("%s", db_seg_reg[f_reg(regmodrm)]);
                     }
                     break;
 
                 case Si:
                   if( db_display )
                     {
-                      DEBUG_Printf(DBG_CHN_MESG,"%s", db_seg_reg[f_reg(inst)]);
+                      DEBUG_Printf("%s", db_seg_reg[f_reg(inst)]);
                     }
                     break;
 
                 case A:
                   if( db_display )
                     {
-                      DEBUG_Printf(DBG_CHN_MESG,"%s", db_reg[size][0]);        /* acc */
+                      DEBUG_Printf("%s", db_reg[size][0]);        /* acc */
                     }
                     break;
 
@@ -1629,22 +1616,22 @@
                   if( db_display )
                     {
                       if (seg)
-                        DEBUG_Printf(DBG_CHN_MESG,"%s:", seg);
-                      DEBUG_Printf(DBG_CHN_MESG,"(%s)", short_addr ? "%bx" : "%ebx");
+                        DEBUG_Printf("%s:", seg);
+                      DEBUG_Printf("(%s)", short_addr ? "%bx" : "%ebx");
                     }
                     break;
 
                 case CL:
                   if( db_display )
                     {
-                      DEBUG_Printf(DBG_CHN_MESG,"%%cl");
+                      DEBUG_Printf("%%cl");
                     }
                     break;
 
                 case DX:
                   if( db_display )
                     {
-                      DEBUG_Printf(DBG_CHN_MESG,"%%dx");
+                      DEBUG_Printf("%%dx");
                     }
                     break;
 
@@ -1652,36 +1639,36 @@
                   if( db_display )
                     {
                       if (seg)
-                        DEBUG_Printf(DBG_CHN_MESG,"%s:", seg);
-                      DEBUG_Printf(DBG_CHN_MESG,"(%s)", short_addr ? "%si" : "%esi");
+                        DEBUG_Printf("%s:", seg);
+                      DEBUG_Printf("(%s)", short_addr ? "%si" : "%esi");
                     }
                     break;
 
                 case DI:
                   if( db_display )
                     {
-                      DEBUG_Printf(DBG_CHN_MESG,"%%es:(%s)", short_addr ? "%di" : "%edi");
+                      DEBUG_Printf("%%es:(%s)", short_addr ? "%di" : "%edi");
                     }
                     break;
 
                 case CR:
                   if( db_display )
                     {
-                      DEBUG_Printf(DBG_CHN_MESG,"%%cr%d", f_reg(regmodrm));
+                      DEBUG_Printf("%%cr%d", f_reg(regmodrm));
                     }
                     break;
 
                 case DR:
                   if( db_display )
                     {
-                      DEBUG_Printf(DBG_CHN_MESG,"%%dr%d", f_reg(regmodrm));
+                      DEBUG_Printf("%%dr%d", f_reg(regmodrm));
                     }
                     break;
 
                 case TR:
                   if( db_display )
                     {
-                      DEBUG_Printf(DBG_CHN_MESG,"%%tr%d", f_reg(regmodrm));
+                      DEBUG_Printf("%%tr%d", f_reg(regmodrm));
                     }
                     break;
 
@@ -1690,7 +1677,7 @@
                     get_value_inc(imm, addr, len, FALSE);/* unsigned */
                     if( db_display )
                       {
-                        DEBUG_Printf(DBG_CHN_MESG,"$0x%x", imm);
+                        DEBUG_Printf("$0x%x", imm);
                       }
                     break;
 
@@ -1699,7 +1686,7 @@
                     get_value_inc(imm, addr, len, TRUE); /* signed */
                   if( db_display )
                     {
-                      DEBUG_Printf(DBG_CHN_MESG,"$%d", imm);
+                      DEBUG_Printf("$%d", imm);
                     }
                     break;
 
@@ -1707,7 +1694,7 @@
                     get_value_inc(imm, addr, 1, FALSE); /* unsigned */
                   if( db_display )
                     {
-                      DEBUG_Printf(DBG_CHN_MESG,"$0x%x", imm);
+                      DEBUG_Printf("$0x%x", imm);
                     }
                     break;
 
@@ -1715,7 +1702,7 @@
                     get_value_inc(imm, addr, 1, TRUE); /* signed */
                   if( db_display )
                     {
-                      DEBUG_Printf(DBG_CHN_MESG,"$%d", imm);
+                      DEBUG_Printf("$%d", imm);
                     }
                     break;
 
@@ -1723,7 +1710,7 @@
                     get_value_inc(imm, addr, 2, FALSE); /* unsigned */
                   if( db_display )
                     {
-                      DEBUG_Printf(DBG_CHN_MESG,"$0x%x", imm);
+                      DEBUG_Printf("$0x%x", imm);
                     }
                     break;
 
@@ -1731,7 +1718,7 @@
                     get_value_inc(imm, addr, 4, FALSE);
                   if( db_display )
                     {
-                      DEBUG_Printf(DBG_CHN_MESG,"$0x%x", imm);
+                      DEBUG_Printf("$0x%x", imm);
                     }
                     break;
 
@@ -1748,7 +1735,7 @@
                       }
 
                     if (seg)
-                        DEBUG_Printf(DBG_CHN_MESG,"%s:0x%x",seg, displ);
+                        DEBUG_Printf("%s:0x%x",seg, displ);
                     else
                         db_task_printsym(displ, short_addr ? WORD : LONG);
                     break;
@@ -1790,14 +1777,14 @@
                 case o1:
                   if( db_display )
                     {
-                      DEBUG_Printf(DBG_CHN_MESG,"$1");
+                      DEBUG_Printf("$1");
                     }
                     break;
 
                 case o3:
                   if( db_display )
                     {
-                      DEBUG_Printf(DBG_CHN_MESG,"$3");
+                      DEBUG_Printf("$3");
                     }
                     break;
 
Index: programs/winedbg/dbg.y
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/programs/winedbg/dbg.y,v
retrieving revision 1.12
diff -u -r1.12 dbg.y
--- programs/winedbg/dbg.y        27 Nov 2003 00:59:36 -0000        1.12
+++ programs/winedbg/dbg.y        13 Dec 2003 07:34:57 -0000
@@ -60,7 +60,7 @@
 %token <string> tPATH
 %token <string> tIDENTIFIER tSTRING tDEBUGSTR tINTVAR
 %token <integer> tNUM tFORMAT
-%token tSYMBOLFILE tRUN tATTACH tDETACH tNOPROCESS
+%token tSYMBOLFILE tRUN tATTACH tDETACH tNOPROCESS tMAINTENANCE tTYPE
 
 %token tCHAR tSHORT tINT tLONG tFLOAT tDOUBLE tUNSIGNED tSIGNED
 %token tSTRUCT tUNION tENUM
@@ -152,6 +152,7 @@
     | info_command
     | walk_command
     | run_command
+    | maintenance_command
     | noprocess_state
     ;
 
@@ -266,9 +267,13 @@
     | tRUN tSTRING tEOL         { DEBUG_Run($2); }
     ;
 
+maintenance_command:
+      tMAINTENANCE tTYPE        { DEBUG_DumpTypes(); }
+    ;
+
 noprocess_state:
       tNOPROCESS tEOL                {} /* <CR> shall not barf anything */
-    | tNOPROCESS tSTRING tEOL        { DEBUG_Printf(DBG_CHN_MESG, "No process loaded, cannot execute '%s'\n", $2); }
+    | tNOPROCESS tSTRING tEOL        { DEBUG_Printf("No process loaded, cannot execute '%s'\n", $2); }
     ;
 
 type_expr:
@@ -385,7 +390,7 @@
     {
     case 16: DEBUG_CurrThread->dbg_mode = MODE_16; break;
     case 32: DEBUG_CurrThread->dbg_mode = MODE_32; break;
-    default: DEBUG_Printf(DBG_CHN_MESG,"Invalid mode (use 16, 32 or vm86)\n");
+    default: DEBUG_Printf("Invalid mode (use 16, 32 or vm86)\n");
     }
 }
 
@@ -398,37 +403,37 @@
 {
     if (DBG_IVAR(ExtDbgOnInternalException))
         DEBUG_ExternalDebugger();
-    DEBUG_Printf(DBG_CHN_MESG, "\nwine_dbg_cmd: ");
+    DEBUG_Printf("\nwine_dbg_cmd: ");
     switch (GetExceptionCode()) {
     case DEBUG_STATUS_INTERNAL_ERROR:
-        DEBUG_Printf(DBG_CHN_MESG, "WineDbg internal error\n");
+        DEBUG_Printf("WineDbg internal error\n");
         if (DBG_IVAR(ExtDbgOnInternalException))
             DEBUG_ExternalDebugger();
         break;
     case DEBUG_STATUS_NO_SYMBOL:
-        DEBUG_Printf(DBG_CHN_MESG, "Undefined symbol\n");
+        DEBUG_Printf("Undefined symbol\n");
         break;
     case DEBUG_STATUS_DIV_BY_ZERO:
-        DEBUG_Printf(DBG_CHN_MESG, "Division by zero\n");
+        DEBUG_Printf("Division by zero\n");
         break;
     case DEBUG_STATUS_BAD_TYPE:
-        DEBUG_Printf(DBG_CHN_MESG, "No type or type mismatch\n");
+        DEBUG_Printf("No type or type mismatch\n");
         break;
     case DEBUG_STATUS_NO_FIELD:
-        DEBUG_Printf(DBG_CHN_MESG, "No such field in structure or union\n");
+        DEBUG_Printf("No such field in structure or union\n");
         break;
     case DEBUG_STATUS_ABORT:
         break;
     case CONTROL_C_EXIT:
         /* this is generally sent by a ctrl-c when we run winedbg outside of wineconsole */
-        DEBUG_Printf(DBG_CHN_MESG, "Ctrl-C\n");
+        DEBUG_Printf("Ctrl-C\n");
         /* stop the debuggee, and continue debugger execution, we will be reintered by the
          * debug events generated by stopping
          */
         DEBUG_InterruptDebuggee();
         return EXCEPTION_CONTINUE_EXECUTION;
     default:
-        DEBUG_Printf(DBG_CHN_MESG, "Exception %lx\n", GetExceptionCode());
+        DEBUG_Printf("Exception %lx\n", GetExceptionCode());
         DEBUG_ExternalDebugger();
         break;
     }
@@ -491,6 +496,6 @@
 
 int yyerror(const char* s)
 {
-   DEBUG_Printf(DBG_CHN_MESG, "%s\n", s);
+   DEBUG_Printf("%s\n", s);
    return 0;
 }
Index: programs/winedbg/debug.l
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/programs/winedbg/debug.l,v
retrieving revision 1.7
diff -u -r1.7 debug.l
--- programs/winedbg/debug.l        30 Nov 2003 02:53:29 -0000        1.7
+++ programs/winedbg/debug.l        13 Dec 2003 07:35:05 -0000
@@ -62,6 +62,7 @@
 %s WALK_CMD
 %s SHOW_CMD
 %s MODE_CMD
+%s MAINT_CMD
 %s NOCMD
 
 %x ASTRING_EXPECTED
@@ -145,6 +146,7 @@
 <INITIAL>whatis|whati|what                { BEGIN(NOCMD); return tWHATIS; }
 <INITIAL,NOPROCESS>run|ru|r             { BEGIN(ASTRING_EXPECTED); return tRUN;}
 <INITIAL>detach|detac|deta|det           { BEGIN(NOCMD); return tDETACH; }
+<INITIAL>maintenance|maint              { BEGIN(MAINT_CMD); return tMAINTENANCE; }
 <NOPROCESS>attach|attac|atta|att         { BEGIN(NOCMD); return tATTACH; }
 <INFO_CMD>share|shar|sha                { return tSHARE; }
 <INFO_CMD>locals|local|loca|loc                { return tLOCAL; }
@@ -156,11 +158,12 @@
 <INFO_CMD>registers|regs|reg|re                { return tREGS; }
 <INFO_CMD>segments|segment|segm|seg|se        { return tSEGMENTS; }
 <INFO_CMD>stack|stac|sta|st             { return tSTACK; }
-<INFO_CMD>symbol|sym                    { BEGIN(ASTRING_EXPECTED); return tSYMBOL; }
+<INFO_CMD>symbol|symbo|symb|sym         { BEGIN(ASTRING_EXPECTED); return tSYMBOL; }
 <WALK_CMD>maps|map                        { return tMAPS; }
 <INFO_CMD,WALK_CMD>window|windo|wind|win|wnd        { return tWND; }
 <HELP_CMD>info|inf|in                   { return tINFO; }
 <MODE_CMD>vm86                          { return tVM86; }
+<MAINT_CMD>type                         { return tTYPE; }
 
 <INITIAL,SHOW_CMD>directories|directorie|directori|director|directo|direct|direc|direc|dir {
                                           BEGIN(PATH_EXPECTED); return tDIR; }
@@ -187,7 +190,7 @@
 <NOPROCESS>.                            { BEGIN(ASTRING_EXPECTED); yyless(0); return tNOPROCESS;}
 <*>.                                    { if (syntax_error == 0) {
                                              syntax_error++;
-                                             DEBUG_Printf(DBG_CHN_MESG, "Syntax Error (%s)\n", yytext); }
+                                             DEBUG_Printf("Syntax Error (%s)\n", yytext); }
                                         }
 %%
 
@@ -241,7 +244,10 @@
         /* store stuff at the end of last_line */
         if (len + nread + 1 > *alloc)
         {
-            *line = HeapReAlloc(GetProcessHeap(), 0, *line, *alloc += nread + 1);
+            if (*line)
+                *line = HeapReAlloc(GetProcessHeap(), 0, *line, *alloc += nread + 1);
+            else
+                *line = HeapAlloc(GetProcessHeap(), 0, *alloc += nread + 1);
         }
         strcpy(*line + len, buf_line);
         len += nread;
Index: programs/winedbg/debugger.h
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/programs/winedbg/debugger.h,v
retrieving revision 1.15
diff -u -r1.15 debugger.h
--- programs/winedbg/debugger.h        27 Nov 2003 00:59:36 -0000        1.15
+++ programs/winedbg/debugger.h        13 Dec 2003 09:45:46 -0000
@@ -428,8 +428,8 @@
 extern void DEBUG_FixAddress( DBG_ADDR *address, DWORD def );
 extern int  DEBUG_IsSelectorSystem( WORD sel );
 #endif
-extern int  DEBUG_PrintStringA( int chnl, const DBG_ADDR* address, int len );
-extern int  DEBUG_PrintStringW( int chnl, const DBG_ADDR* address, int len );
+extern int  DEBUG_PrintStringA(const DBG_ADDR* address, int len);
+extern int  DEBUG_PrintStringW(const DBG_ADDR* address, int len);
 
   /* debugger/module.c */
 extern int  DEBUG_LoadEntryPoints( const char * prefix );
@@ -512,22 +512,17 @@
 extern enum debug_type DEBUG_GetType(struct datatype * dt);
 extern struct datatype * DEBUG_TypeCast(enum debug_type, const char *);
 extern int DEBUG_PrintTypeCast(const struct datatype *);
-extern int DEBUG_PrintType( const DBG_VALUE* addr );
+extern int DEBUG_PrintType(const DBG_VALUE* addr);
 extern struct datatype * DEBUG_GetBasicType(enum debug_type_basic);
 extern int DEBUG_DumpTypes(void);
 
   /* debugger/winedbg.c */
-#define DBG_CHN_MESG        1
-#define DBG_CHN_ERR        2
-#define DBG_CHN_WARN        4
-#define DBG_CHN_FIXME        8
-#define DBG_CHN_TRACE        16
-extern void                DEBUG_OutputA(int chn, const char* buffer, int len);
-extern void                DEBUG_OutputW(int chn, const WCHAR* buffer, int len);
+extern void                DEBUG_OutputA(const char* buffer, int len);
+extern void                DEBUG_OutputW(const WCHAR* buffer, int len);
 #ifdef __GNUC__
-extern int                DEBUG_Printf(int chn, const char* format, ...) __attribute__((format (printf,2,3)));
+extern int                DEBUG_Printf(const char* format, ...) __attribute__((format (printf,1,2)));
 #else
-extern int                DEBUG_Printf(int chn, const char* format, ...);
+extern int                DEBUG_Printf(const char* format, ...);
 #endif
 extern DBG_INTVAR*        DEBUG_GetIntVar(const char*);
 extern BOOL             DEBUG_Attach(DWORD pid, BOOL cofe, BOOL wfe);
Index: programs/winedbg/display.c
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/programs/winedbg/display.c,v
retrieving revision 1.2
diff -u -r1.2 display.c
--- programs/winedbg/display.c        14 Oct 2003 20:25:16 -0000        1.2
+++ programs/winedbg/display.c        13 Dec 2003 07:10:10 -0000
@@ -85,7 +85,7 @@
                         continue;
 
                 if (displaypoints[i].function_name)
-                        DEBUG_Printf(DBG_CHN_MESG, "%d in %s%s : ", i + 1,
+                        DEBUG_Printf("%d in %s%s : ", i + 1,
                                 DEBUG_GetSymbolName(displaypoints[i].function_name),
                                 (displaypoints[i].enabled ?
                                         (displaypoints[i].function_name != DEBUG_GetCurrentFrameFunctionName() ?
@@ -93,10 +93,10 @@
                                         : " (disabled)")
                                 );
                 else
-                        DEBUG_Printf(DBG_CHN_MESG, "%d%s : ", i + 1,
-                                (displaypoints[i].enabled ? "" : " (disabled)"));
+                        DEBUG_Printf("%d%s : ", i + 1,
+                                     (displaypoints[i].enabled ? "" : " (disabled)"));
                 DEBUG_DisplayExpr(displaypoints[i].exp);
-                DEBUG_Printf(DBG_CHN_MESG, "\n");
+                DEBUG_Printf("\n");
         }
 
         return TRUE;
@@ -109,19 +109,19 @@
         if (displaypoints[i].enabled) {
                 value = DEBUG_EvalExpr(displaypoints[i].exp);
                 if (value.type == NULL) {
-                        DEBUG_Printf(DBG_CHN_MESG, "Unable to evaluate expression ");
+                        DEBUG_Printf("Unable to evaluate expression ");
                         DEBUG_DisplayExpr(displaypoints[i].exp);
-                        DEBUG_Printf(DBG_CHN_MESG, "\nDisabling display %d ...\n", i + 1);
+                        DEBUG_Printf("\nDisabling display %d ...\n", i + 1);
                         displaypoints[i].enabled = FALSE;
                         return;
                 }
         }
 
-        DEBUG_Printf(DBG_CHN_MESG, "%d  : ", i + 1);
+        DEBUG_Printf("%d  : ", i + 1);
         DEBUG_DisplayExpr(displaypoints[i].exp);
-        DEBUG_Printf(DBG_CHN_MESG, " = ");
+        DEBUG_Printf(" = ");
         if (!displaypoints[i].enabled)
-                DEBUG_Printf(DBG_CHN_MESG, "(disabled)\n");
+                DEBUG_Printf("(disabled)\n");
         else
         if (displaypoints[i].format == 'i')
                 DEBUG_ExamineMemory(&value, displaypoints[i].count, displaypoints[i].format);
@@ -152,7 +152,7 @@
 
         if (displaynum > ndisplays || displaynum == 0 || displaynum < -1
             || displaypoints[displaynum - 1].exp == NULL) {
-                DEBUG_Printf(DBG_CHN_MESG, "Invalid display number\n");
+                DEBUG_Printf("Invalid display number\n");
                 return TRUE;
         }
 
@@ -185,7 +185,7 @@
 {
         --displaynum;
         if (displaynum >= ndisplays || displaynum < 0 || displaypoints[displaynum].exp == NULL) {
-                DEBUG_Printf(DBG_CHN_MESG, "Invalid display number\n");
+                DEBUG_Printf("Invalid display number\n");
                 return TRUE;
         }
 
Index: programs/winedbg/expr.c
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/programs/winedbg/expr.c,v
retrieving revision 1.4
diff -u -r1.4 expr.c
--- programs/winedbg/expr.c        5 Sep 2003 23:15:41 -0000        1.4
+++ programs/winedbg/expr.c        13 Dec 2003 07:14:24 -0000
@@ -325,7 +325,7 @@
     case EXPR_TYPE_CAST:
       if (!exp->un.cast.cast)
       {
-          DEBUG_Printf(DBG_CHN_MESG, "Can't cast to unknown type\n");
+          DEBUG_Printf("Can't cast to unknown type\n");
           RaiseException(DEBUG_STATUS_BAD_TYPE, 0, 0, NULL);
       }
       rtn = DEBUG_EvalExpr(exp->un.cast.expr);
@@ -377,7 +377,7 @@
       if (!DEBUG_FindStructElement(&rtn, exp->un.structure.element_name,
                                    &exp->un.structure.result))
       {
-          DEBUG_Printf(DBG_CHN_MESG, "%s\n", exp->un.structure.element_name);
+          DEBUG_Printf("%s\n", exp->un.structure.element_name);
           RaiseException(DEBUG_STATUS_NO_FIELD, 0, 0, NULL);
       }
 
@@ -392,7 +392,7 @@
       if (!DEBUG_FindStructElement(&rtn, exp->un.structure.element_name,
                                    &exp->un.structure.result))
       {
-          DEBUG_Printf(DBG_CHN_MESG, "%s\n", exp->un.structure.element_name);
+          DEBUG_Printf("%s\n", exp->un.structure.element_name);
           RaiseException(DEBUG_STATUS_NO_FIELD, 0, 0, NULL);
       }
       break;
@@ -456,7 +456,7 @@
           break;
         }
 #else
-      DEBUG_Printf(DBG_CHN_MESG, "Function call no longer implemented\n");
+      DEBUG_Printf("Function call no longer implemented\n");
       /* would need to set up a call to this function, and then restore the current
        * context afterwards...
        */
@@ -685,7 +685,7 @@
         }
       break;
     default:
-      DEBUG_Printf(DBG_CHN_MESG,"Unexpected expression (%d).\n", exp->type);
+      DEBUG_Printf("Unexpected expression (%d).\n", exp->type);
       RaiseException(DEBUG_STATUS_INTERNAL_ERROR, 0, 0, NULL);
       break;
     }
@@ -704,111 +704,111 @@
   switch(exp->type)
     {
     case EXPR_TYPE_CAST:
-      DEBUG_Printf(DBG_CHN_MESG, "((");
+      DEBUG_Printf("((");
       DEBUG_PrintTypeCast(exp->un.cast.cast);
-      DEBUG_Printf(DBG_CHN_MESG, ")");
+      DEBUG_Printf(")");
       DEBUG_DisplayExpr(exp->un.cast.expr);
-      DEBUG_Printf(DBG_CHN_MESG, ")");
+      DEBUG_Printf(")");
       break;
     case EXPR_TYPE_INTVAR:
-      DEBUG_Printf(DBG_CHN_MESG, "$%s", exp->un.intvar.name);
+      DEBUG_Printf("$%s", exp->un.intvar.name);
       break;
     case EXPR_TYPE_US_CONST:
-      DEBUG_Printf(DBG_CHN_MESG, "%ud", exp->un.u_const.value);
+      DEBUG_Printf("%ud", exp->un.u_const.value);
       break;
     case EXPR_TYPE_CONST:
-      DEBUG_Printf(DBG_CHN_MESG, "%d", exp->un.u_const.value);
+      DEBUG_Printf("%d", exp->un.u_const.value);
       break;
     case EXPR_TYPE_STRING:
-      DEBUG_Printf(DBG_CHN_MESG, "\"%s\"", exp->un.string.str);
+      DEBUG_Printf("\"%s\"", exp->un.string.str);
       break;
     case EXPR_TYPE_SYMBOL:
-      DEBUG_Printf(DBG_CHN_MESG, "%s" , exp->un.symbol.name);
+      DEBUG_Printf("%s" , exp->un.symbol.name);
       break;
     case EXPR_TYPE_PSTRUCT:
       DEBUG_DisplayExpr(exp->un.structure.exp1);
-      DEBUG_Printf(DBG_CHN_MESG, "->%s", exp->un.structure.element_name);
+      DEBUG_Printf("->%s", exp->un.structure.element_name);
       break;
     case EXPR_TYPE_STRUCT:
       DEBUG_DisplayExpr(exp->un.structure.exp1);
-      DEBUG_Printf(DBG_CHN_MESG, ".%s", exp->un.structure.element_name);
+      DEBUG_Printf(".%s", exp->un.structure.element_name);
       break;
     case EXPR_TYPE_CALL:
-      DEBUG_Printf(DBG_CHN_MESG, "%s(",exp->un.call.funcname);
+      DEBUG_Printf("%s(",exp->un.call.funcname);
       for(i=0; i < exp->un.call.nargs; i++)
         {
           DEBUG_DisplayExpr(exp->un.call.arg[i]);
           if( i != exp->un.call.nargs - 1 )
             {
-              DEBUG_Printf(DBG_CHN_MESG, ", ");
+              DEBUG_Printf(", ");
             }
         }
-      DEBUG_Printf(DBG_CHN_MESG, ")");
+      DEBUG_Printf(")");
       break;
     case EXPR_TYPE_BINOP:
-      DEBUG_Printf(DBG_CHN_MESG, "( ");
+      DEBUG_Printf("( ");
       DEBUG_DisplayExpr(exp->un.binop.exp1);
       switch(exp->un.binop.binop_type)
         {
         case EXP_OP_ADD:
-           DEBUG_Printf(DBG_CHN_MESG, " + ");
+           DEBUG_Printf(" + ");
           break;
         case EXP_OP_SUB:
-           DEBUG_Printf(DBG_CHN_MESG, " - ");
+           DEBUG_Printf(" - ");
           break;
         case EXP_OP_SEG:
-           DEBUG_Printf(DBG_CHN_MESG, ":");
+           DEBUG_Printf(":");
           break;
         case EXP_OP_LOR:
-           DEBUG_Printf(DBG_CHN_MESG, " || ");
+           DEBUG_Printf(" || ");
           break;
         case EXP_OP_LAND:
-           DEBUG_Printf(DBG_CHN_MESG, " && ");
+           DEBUG_Printf(" && ");
           break;
         case EXP_OP_OR:
-           DEBUG_Printf(DBG_CHN_MESG, " | ");
+           DEBUG_Printf(" | ");
           break;
         case EXP_OP_AND:
-           DEBUG_Printf(DBG_CHN_MESG, " & ");
+           DEBUG_Printf(" & ");
           break;
         case EXP_OP_XOR:
-           DEBUG_Printf(DBG_CHN_MESG, " ^ ");
+           DEBUG_Printf(" ^ ");
            break;
         case EXP_OP_EQ:
-           DEBUG_Printf(DBG_CHN_MESG, " == ");
+           DEBUG_Printf(" == ");
           break;
         case EXP_OP_GT:
-           DEBUG_Printf(DBG_CHN_MESG, " > ");
+           DEBUG_Printf(" > ");
           break;
         case EXP_OP_LT:
-           DEBUG_Printf(DBG_CHN_MESG, " < ");
+           DEBUG_Printf(" < ");
           break;
         case EXP_OP_GE:
-           DEBUG_Printf(DBG_CHN_MESG, " >= ");
+           DEBUG_Printf(" >= ");
           break;
         case EXP_OP_LE:
-           DEBUG_Printf(DBG_CHN_MESG, " <= ");
+           DEBUG_Printf(" <= ");
           break;
         case EXP_OP_NE:
-           DEBUG_Printf(DBG_CHN_MESG, " != ");
+           DEBUG_Printf(" != ");
           break;
         case EXP_OP_SHL:
-           DEBUG_Printf(DBG_CHN_MESG, " << ");
+           DEBUG_Printf(" << ");
           break;
         case EXP_OP_SHR:
-           DEBUG_Printf(DBG_CHN_MESG, " >> ");
+           DEBUG_Printf(" >> ");
           break;
         case EXP_OP_MUL:
-           DEBUG_Printf(DBG_CHN_MESG, " * ");
+           DEBUG_Printf(" * ");
           break;
         case EXP_OP_DIV:
-           DEBUG_Printf(DBG_CHN_MESG, " / ");
+           DEBUG_Printf(" / ");
           break;
         case EXP_OP_REM:
-           DEBUG_Printf(DBG_CHN_MESG, " %% ");
+           DEBUG_Printf(" %% ");
           break;
         case EXP_OP_ARR:
-           DEBUG_Printf(DBG_CHN_MESG, "[");
+           DEBUG_Printf("[");
           break;
         default:
           break;
@@ -816,33 +816,33 @@
       DEBUG_DisplayExpr(exp->un.binop.exp2);
       if( exp->un.binop.binop_type == EXP_OP_ARR )
         {
-           DEBUG_Printf(DBG_CHN_MESG, "]");
+           DEBUG_Printf("]");
         }
-      DEBUG_Printf(DBG_CHN_MESG, " )");
+      DEBUG_Printf(" )");
       break;
     case EXPR_TYPE_UNOP:
       switch(exp->un.unop.unop_type)
         {
         case EXP_OP_NEG:
-           DEBUG_Printf(DBG_CHN_MESG, "-");
+           DEBUG_Printf("-");
           break;
         case EXP_OP_NOT:
-          DEBUG_Printf(DBG_CHN_MESG, "!");
+          DEBUG_Printf("!");
           break;
         case EXP_OP_LNOT:
-          DEBUG_Printf(DBG_CHN_MESG, "~");
+          DEBUG_Printf("~");
            break;
         case EXP_OP_DEREF:
-          DEBUG_Printf(DBG_CHN_MESG, "*");
+          DEBUG_Printf("*");
           break;
         case EXP_OP_ADDR:
-          DEBUG_Printf(DBG_CHN_MESG, "&");
+          DEBUG_Printf("&");
           break;
         }
       DEBUG_DisplayExpr(exp->un.unop.exp1);
       break;
     default:
-      DEBUG_Printf(DBG_CHN_MESG,"Unexpected expression.\n");
+      DEBUG_Printf("Unexpected expression.\n");
       RaiseException(DEBUG_STATUS_INTERNAL_ERROR, 0, 0, NULL);
       break;
     }
@@ -901,7 +901,7 @@
       rtn->un.unop.exp1 = DEBUG_CloneExpr(exp->un.unop.exp1);
       break;
     default:
-      DEBUG_Printf(DBG_CHN_MESG,"Unexpected expression.\n");
+      DEBUG_Printf("Unexpected expression.\n");
       RaiseException(DEBUG_STATUS_INTERNAL_ERROR, 0, 0, NULL);
       break;
     }
@@ -956,7 +956,7 @@
       DEBUG_FreeExpr(exp->un.unop.exp1);
       break;
     default:
-      DEBUG_Printf(DBG_CHN_MESG,"Unexpected expression.\n");
+      DEBUG_Printf("Unexpected expression.\n");
       RaiseException(DEBUG_STATUS_INTERNAL_ERROR, 0, 0, NULL);
       break;
     }
Index: programs/winedbg/gdbproxy.c
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/programs/winedbg/gdbproxy.c,v
retrieving revision 1.15
diff -u -r1.15 gdbproxy.c
--- programs/winedbg/gdbproxy.c        9 Oct 2003 04:39:01 -0000        1.15
+++ programs/winedbg/gdbproxy.c        13 Dec 2003 07:36:20 -0000
@@ -665,7 +665,7 @@
         DEBUG_CheckDelayedBP();
         if (DBG_IVAR(BreakOnDllLoad))
         {
-            DEBUG_Printf(DBG_CHN_MESG, "Stopping on DLL %s loading at %08lx\n",
+            DEBUG_Printf("Stopping on DLL %s loading at %08lx\n",
                          buffer, (unsigned long)de->u.LoadDll.lpBaseOfDll);
             DEBUG_Parser();
         }
Index: programs/winedbg/hash.c
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/programs/winedbg/hash.c,v
retrieving revision 1.14
diff -u -r1.14 hash.c
--- programs/winedbg/hash.c        14 Oct 2003 20:25:16 -0000        1.14
+++ programs/winedbg/hash.c        13 Dec 2003 09:43:31 -0000
@@ -26,6 +26,10 @@
 #include <limits.h>
 #include <sys/types.h>
 #include "debugger.h"
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(winedbg);
+WINE_DECLARE_DEBUG_CHANNEL(winedbg_sym);
 
 #define NR_NAME_HASH 16384
 #ifndef PATH_MAX
@@ -148,8 +152,8 @@
             if( (nh->flags & SYM_INVALID) == 0 )
                nsym++;
             else
-               DEBUG_Printf( DBG_CHN_MESG, "Symbol %s (%04lx:%08lx) is invalid\n", 
-                             nh->name, nh->value.addr.seg, nh->value.addr.off );
+               DEBUG_Printf("Symbol %s (%04lx:%08lx) is invalid\n", 
+                            nh->name, nh->value.addr.seg, nh->value.addr.off );
           }
     }
 
@@ -219,10 +223,9 @@
                  */
                 if (nh->value.addr.seg == 0 && nh->value.addr.off == 0 && c != 0)
                 {
-#if 0
-                    DEBUG_Printf(DBG_CHN_MESG, "Changing address for symbol %s (%04lx:%08lx => %04lx:%08lx)\n",
-                                 name, nh->value.addr.seg, nh->value.addr.off, value->addr.seg, value->addr.off);
-#endif
+                    WINE_TRACE_(winedbg_sym)(
+                        "Changing address for symbol %s (%04lx:%08lx => %04lx:%08lx)\n",
+                        name, nh->value.addr.seg, nh->value.addr.off, value->addr.seg, value->addr.off);
                     nh->value.addr = value->addr;
                 }
                 if (nh->value.type == NULL && value->type != NULL)
@@ -244,10 +247,9 @@
         }
     }
 
-#if 0
-    DEBUG_Printf(DBG_CHN_TRACE, "adding %s symbol (%s) from file '%s' at %04lx:%08lx\n",
-                 (flags & SYM_INVALID) ? "invalid" : "  valid", name, source, value->addr.seg, value->addr.off);
-#endif
+    WINE_TRACE_(winedbg_sym)(
+        "adding %s symbol (%s) from file '%s' at %04lx:%08lx\n",
+        (flags & SYM_INVALID) ? "invalid" : "  valid", name, source, value->addr.seg, value->addr.off);
 
     /*
      * First see if we already have an entry for this symbol.  If so
@@ -383,7 +385,7 @@
                                        const int lineno,
                                        DBG_VALUE *rtn, int bp_flag )
 {
-#define NUMDBGV 10
+#define NUMDBGV 100
    /* FIXME: NUMDBGV should be made variable */
    DBG_VALUE         value[NUMDBGV];
    DBG_VALUE        vtmp;
@@ -400,7 +402,7 @@
           strcpy(buffer + 1, name);
           num = DEBUG_GSV_Helper(buffer, lineno, value, NUMDBGV, bp_flag);
       }
-      else DEBUG_Printf(DBG_CHN_WARN, "Way too long symbol (%s)\n", name);
+      else WINE_WARN("Way too long symbol (%s)\n", name);
    }
 
    /* now get the local symbols if any */
@@ -419,24 +421,24 @@
       char        buffer[256];
 
       if (num == NUMDBGV+1) {
-         DEBUG_Printf(DBG_CHN_MESG, "Too many addresses for symbol '%s', limiting the first %d\n", name, NUMDBGV);
+         DEBUG_Printf("Too many addresses for symbol '%s', limiting the first %d\n", name, NUMDBGV);
          num = NUMDBGV;
       }
-      DEBUG_Printf(DBG_CHN_MESG, "Many symbols with name '%s', choose the one you want (<cr> to abort):\n", name);
+      DEBUG_Printf("Many symbols with name '%s', choose the one you want (<cr> to abort):\n", name);
       for (i = 0; i < num; i++) {
-         DEBUG_Printf(DBG_CHN_MESG, "[%d]: ", i + 1);
+         DEBUG_Printf("[%d]: ", i + 1);
          if (i == local) {
              struct name_hash*func;
              unsigned int     ebp;
              unsigned int     eip;
 
              if (DEBUG_GetCurrentFrame(&func, &eip, &ebp))
-                 DEBUG_Printf(DBG_CHN_MESG, "local variable of %s in %s\n", func->name, func->sourcefile);
+                 DEBUG_Printf("local variable of %s in %s\n", func->name, func->sourcefile);
              else
-                 DEBUG_Printf(DBG_CHN_MESG, "local variable\n");
+                 DEBUG_Printf("local variable\n");
          } else {
              DEBUG_PrintAddress( &value[i].addr, DEBUG_GetSelectorType(value[i].addr.seg), TRUE);
-             DEBUG_Printf(DBG_CHN_MESG, "\n");
+             DEBUG_Printf("\n");
          }
       }
       do {
@@ -446,7 +448,7 @@
               if (buffer[0] == '\0') return gsv_aborted;
               i = atoi(buffer);
               if (i < 1 || i > num)
-                  DEBUG_Printf(DBG_CHN_MESG, "Invalid choice %d\n", i);
+                  DEBUG_Printf("Invalid choice %d\n", i);
           }
       } while (i < 1 || i > num);
 
@@ -612,14 +614,13 @@
                       }
                   }
                 nearest = addr_sorttab[mid];
-#if 0
-                DEBUG_Printf(DBG_CHN_MESG, "Found %x:%x when looking for %x:%x %x %s\n",
-                             addr_sorttab[mid ]->value.addr.seg,
-                             addr_sorttab[mid ]->value.addr.off,
-                             addr->seg, addr->off,
-                             addr_sorttab[mid ]->linetab,
-                             addr_sorttab[mid ]->name);
-#endif
+                WINE_TRACE_(winedbg_sym)(
+                    "Found %lx:%lx when looking for %lx:%lx %p %s\n",
+                    addr_sorttab[mid ]->value.addr.seg,
+                    addr_sorttab[mid ]->value.addr.off,
+                    addr->seg, addr->off,
+                    addr_sorttab[mid ]->linetab,
+                    addr_sorttab[mid ]->name);
                 break;
               }
             if(    (addr_sorttab[mid]->value.addr.seg < addr->seg)
@@ -788,11 +789,11 @@
 
     if (!(symbolfile = fopen(filename, "r")))
     {
-        DEBUG_Printf( DBG_CHN_WARN, "Unable to open symbol table %s\n", filename );
+        WINE_WARN("Unable to open symbol table %s\n", filename);
         return;
     }
 
-    DEBUG_Printf( DBG_CHN_MESG, "Reading symbols from file %s\n", filename );
+    DEBUG_Printf("Reading symbols from file %s\n", filename);
 
     value.type = NULL;
     value.addr.seg = 0;
@@ -821,7 +822,7 @@
         if (sscanf(buffer, "%lx %c %s", &value.addr.off, &type, name) == 3)
         {
            if (value.addr.off + offset < value.addr.off)
-              DEBUG_Printf( DBG_CHN_WARN, "Address wrap around\n");
+              WINE_WARN("Address wrap around\n");
            value.addr.off += offset;
            DEBUG_AddSymbol( name, &value, NULL, SYM_WINE );
         }
@@ -900,7 +901,7 @@
         {
           depth++;
         }
-      DEBUG_Printf(DBG_CHN_MESG, "Bucket %d: %d\n", i, depth);
+      DEBUG_Printf("Bucket %d: %d\n", i, depth);
     }
 }
 
@@ -975,14 +976,13 @@
                       }
                   }
                 nearest = addr_sorttab[mid];
-#if 0
-                DEBUG_Printf(DBG_CHN_MESG, "Found %x:%x when looking for %x:%x %x %s\n",
-                             addr_sorttab[mid ]->value.addr.seg,
-                             addr_sorttab[mid ]->value.addr.off,
-                             addr->seg, addr->off,
-                             addr_sorttab[mid ]->linetab,
-                             addr_sorttab[mid ]->name);
-#endif
+                WINE_TRACE_(winedbg_sym)(
+                    "Found %lx:%lx when looking for %lx:%lx %p %s\n",
+                    addr_sorttab[mid ]->value.addr.seg,
+                    addr_sorttab[mid ]->value.addr.off,
+                    addr->seg, addr->off,
+                    addr_sorttab[mid ]->linetab,
+                    addr_sorttab[mid ]->name);
                 break;
               }
             if(    (addr_sorttab[mid]->value.addr.seg < addr->seg)
@@ -1118,11 +1118,11 @@
       {
         if( filename != NULL )
           {
-            DEBUG_Printf(DBG_CHN_MESG, "No such function %s in %s\n", name, filename);
+            DEBUG_Printf("No such function %s in %s\n", name, filename);
           }
         else
           {
-            DEBUG_Printf(DBG_CHN_MESG, "No such function %s\n", name);
+            DEBUG_Printf("No such function %s\n", name);
           }
         ret->sourcefile = NULL;
         ret->line = -1;
@@ -1228,7 +1228,7 @@
       return FALSE;
     }
 
-  DEBUG_Printf(DBG_CHN_MESG, "%s:\n", curr_func->name);
+  DEBUG_Printf("%s:\n", curr_func->name);
 
   for(i=0; i < curr_func->n_locals; i++ )
     {
@@ -1256,7 +1256,7 @@
         {
           ptr = (unsigned int *)(((DWORD)&DEBUG_context)
                                  + reg_ofs[curr_func->local_vars[i].regno - 1]);
-          DEBUG_Printf(DBG_CHN_MESG, " %s (optimized into register $%s) == 0x%8.8x\n",
+          DEBUG_Printf(" %s (optimized into register $%s) == 0x%8.8x\n",
                        curr_func->local_vars[i].name,
                        reg_name[curr_func->local_vars[i].regno - 1],
                        *ptr);
@@ -1265,7 +1265,7 @@
         {
           DEBUG_READ_MEM_VERBOSE((void*)(ebp + curr_func->local_vars[i].offset),
                                  &val, sizeof(val));
-          DEBUG_Printf(DBG_CHN_MESG, " %s == 0x%8.8x\n",
+          DEBUG_Printf(" %s == 0x%8.8x\n",
                        curr_func->local_vars[i].name, val);
         }
     }
@@ -1366,18 +1366,18 @@
                                         NULL, 0, NULL );
 
         if (mode != MODE_32) 
-            DEBUG_Printf( DBG_CHN_MESG, "%04lx:%04lx :", 
-                          array[i]->value.addr.seg & 0xFFFF,
-                          array[i]->value.addr.off );
+            DEBUG_Printf("%04lx:%04lx :", 
+                         array[i]->value.addr.seg & 0xFFFF,
+                         array[i]->value.addr.off);
         else
-            DEBUG_Printf( DBG_CHN_MESG, "%08lx  :", array[i]->value.addr.off );
+            DEBUG_Printf("%08lx  :", array[i]->value.addr.off);
         if (array[i]->value.type)
         {
-            DEBUG_Printf( DBG_CHN_MESG, " (");
+            DEBUG_Printf(" (");
             DEBUG_PrintTypeCast(array[i]->value.type);
-            DEBUG_Printf( DBG_CHN_MESG, ")");
+            DEBUG_Printf(")");
         }
-        if (name) DEBUG_Printf( DBG_CHN_MESG, " %s\n", name );
+        if (name) DEBUG_Printf(" %s\n", name);
     }
     HeapFree(GetProcessHeap(), 0, array);
 }
@@ -1386,7 +1386,7 @@
 
 void DEBUG_InfoSymbols(const char* str)
 {
-    DEBUG_Printf( DBG_CHN_MESG, "FIXME: needs regex support\n" );
+    WINE_FIXME("Requires regex support\n");
 }
 
 #endif /* HAVE_REGEX_H */
Index: programs/winedbg/info.c
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/programs/winedbg/info.c,v
retrieving revision 1.10
diff -u -r1.10 info.c
--- programs/winedbg/info.c        5 Nov 2003 00:36:23 -0000        1.10
+++ programs/winedbg/info.c        13 Dec 2003 07:35:07 -0000
@@ -32,6 +32,9 @@
 #include "tlhelp32.h"
 #include "debugger.h"
 #include "expr.h"
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(winedbg);
 
 /***********************************************************************
  *           DEBUG_PrintBasic
@@ -46,7 +49,7 @@
     assert(value->cookie == DV_TARGET || value->cookie == DV_HOST);
     if (value->type == NULL)
     {
-        DEBUG_Printf(DBG_CHN_MESG, "Unable to evaluate expression\n");
+        DEBUG_Printf("Unable to evaluate expression\n");
         return;
     }
 
@@ -58,29 +61,29 @@
     case 'x':
         if (value->addr.seg)
         {
-            DEBUG_nchar += DEBUG_Printf(DBG_CHN_MESG, "0x%04lx", (long unsigned int)res);
+            DEBUG_nchar += DEBUG_Printf("0x%04lx", (long unsigned int)res);
         }
         else
         {
-            DEBUG_nchar += DEBUG_Printf(DBG_CHN_MESG, "0x%08lx", (long unsigned int)res);
+            DEBUG_nchar += DEBUG_Printf("0x%08lx", (long unsigned int)res);
         }
         break;
 
     case 'd':
-        DEBUG_nchar += DEBUG_Printf(DBG_CHN_MESG, "%ld\n", (long int)res);
+        DEBUG_nchar += DEBUG_Printf("%ld\n", (long int)res);
         break;
 
     case 'c':
-        DEBUG_nchar += DEBUG_Printf(DBG_CHN_MESG, "%d = '%c'",
+        DEBUG_nchar += DEBUG_Printf("%d = '%c'",
                                     (char)(res & 0xff), (char)(res & 0xff));
         break;
 
     case 'u':
     {
         WCHAR wch = (WCHAR)(res & 0xFFFF);
-        DEBUG_nchar += DEBUG_Printf(DBG_CHN_MESG, "%d = '", (unsigned)(res & 0xffff));
-        DEBUG_OutputW(DBG_CHN_MESG, &wch, 1);
-        DEBUG_Printf(DBG_CHN_MESG, "'");
+        DEBUG_nchar += DEBUG_Printf("%d = '", (unsigned)(res & 0xffff));
+        DEBUG_OutputW(&wch, 1);
+        DEBUG_Printf("'");
     }
     break;
 
@@ -88,7 +91,7 @@
     case 's':
     case 'w':
     case 'b':
-        DEBUG_Printf(DBG_CHN_MESG, "Format specifier '%c' is meaningless in 'print' command\n", format);
+        DEBUG_Printf("Format specifier '%c' is meaningless in 'print' command\n", format);
     case 0:
         if (default_format == NULL) break;
 
@@ -114,38 +117,38 @@
 
                         addr.seg = 0;
                         addr.off = (long)res;
-                        DEBUG_nchar += DEBUG_PrintStringA(DBG_CHN_MESG, &addr, -1);
+                        DEBUG_nchar += DEBUG_PrintStringA(&addr, -1);
                     }
                     else
                     {
                         /* shouldn't happen */
-                        DEBUG_Printf(DBG_CHN_MESG, "%%%c", *ptr);
+                        DEBUG_Printf("%%%c", *ptr);
                         DEBUG_nchar += 2;
                     }
                     state = 0;
                 }
                 else
                 {
-                    DEBUG_OutputA(DBG_CHN_MESG, ptr, 1);
+                    DEBUG_OutputA(ptr, 1);
                     DEBUG_nchar++;
                 }
             }
         }
         else if (strcmp(default_format, "%B") == 0)
         {
-            DEBUG_nchar += DEBUG_Printf(DBG_CHN_MESG, "%s", res ? "true" : "false");
+            DEBUG_nchar += DEBUG_Printf("%s", res ? "true" : "false");
         }
         else if (strcmp(default_format, "%R") == 0)
         {
             if (value->cookie == DV_HOST)
                 DEBUG_InfoRegisters((CONTEXT*)value->addr.off);
             else
-                DEBUG_Printf(DBG_CHN_MESG, "NIY: info on register struct in debuggee address space\n");
+                DEBUG_Printf("NIY: info on register struct in debuggee address space\n");
             DEBUG_nchar = 0;
         }
         else
         {
-            DEBUG_nchar += DEBUG_Printf(DBG_CHN_MESG, default_format, res);
+            DEBUG_nchar += DEBUG_Printf(default_format, res);
         }
         break;
     }
@@ -165,10 +168,10 @@
     const char *name = DEBUG_FindNearestSymbol( addr, flag, &rtn.sym, 0,
                                                 &rtn.list );
 
-    if (addr->seg) DEBUG_Printf( DBG_CHN_MESG, "0x%04lx:", addr->seg&0xFFFF );
-    if (mode != MODE_32) DEBUG_Printf( DBG_CHN_MESG, "0x%04lx", addr->off );
-    else DEBUG_Printf( DBG_CHN_MESG, "0x%08lx", addr->off );
-    if (name) DEBUG_Printf( DBG_CHN_MESG, " (%s)", name );
+    if (addr->seg) DEBUG_Printf("0x%04lx:", addr->seg & 0xFFFF);
+    if (mode != MODE_32) DEBUG_Printf("0x%04lx", addr->off);
+    else DEBUG_Printf("0x%08lx", addr->off);
+    if (name) DEBUG_Printf(" (%s)", name);
     return rtn;
 }
 /***********************************************************************
@@ -187,10 +190,10 @@
     const char *name = DEBUG_FindNearestSymbol( addr, flag, &rtn.sym, ebp,
                                                 &rtn.list );
 
-    if (addr->seg) DEBUG_Printf( DBG_CHN_MESG, "0x%04lx:", addr->seg );
-    if (mode != MODE_32) DEBUG_Printf( DBG_CHN_MESG, "0x%04lx", addr->off );
-    else DEBUG_Printf( DBG_CHN_MESG, "0x%08lx", addr->off );
-    if (name) DEBUG_Printf( DBG_CHN_MESG, " (%s)", name );
+    if (addr->seg) DEBUG_Printf("0x%04lx:", addr->seg);
+    if (mode != MODE_32) DEBUG_Printf("0x%04lx", addr->off);
+    else DEBUG_Printf("0x%08lx", addr->off);
+    if (name) DEBUG_Printf(" (%s)", name);
 
     return rtn;
 }
@@ -241,7 +244,7 @@
 NULL
 };
 
-    while(helptext[i]) DEBUG_Printf(DBG_CHN_MESG,"%s\n", helptext[i++]);
+    while(helptext[i]) DEBUG_Printf("%s\n", helptext[i++]);
 }
 
 
@@ -270,7 +273,7 @@
 NULL
 };
 
-    while(infotext[i]) DEBUG_Printf(DBG_CHN_MESG,"%s\n", infotext[i++]);
+    while(infotext[i]) DEBUG_Printf("%s\n", infotext[i++]);
 }
 
 /* FIXME: merge InfoClass and InfoClass2 */
@@ -279,13 +282,12 @@
    WNDCLASSEXA        wca;
 
    if (!GetClassInfoEx(0, name, &wca)) {
-      DEBUG_Printf(DBG_CHN_MESG, "Cannot find class '%s'\n", name);
+      DEBUG_Printf("Cannot find class '%s'\n", name);
       return;
    }
 
-   DEBUG_Printf(DBG_CHN_MESG,  "Class '%s':\n", name);
-   DEBUG_Printf(DBG_CHN_MESG,
-                "style=%08x  wndProc=%08lx\n"
+   DEBUG_Printf("Class '%s':\n", name);
+   DEBUG_Printf("style=%08x  wndProc=%08lx\n"
                 "inst=%p  icon=%p  cursor=%p  bkgnd=%p\n"
                 "clsExtra=%d  winExtra=%d\n",
                 wca.style, (DWORD)wca.lpfnWndProc, wca.hInstance,
@@ -303,13 +305,12 @@
    WNDCLASSEXA        wca;
 
    if (!GetClassInfoEx((HINSTANCE)GetWindowLong(hWnd, GWL_HINSTANCE), name, &wca)) {
-      DEBUG_Printf(DBG_CHN_MESG, "Cannot find class '%s'\n", name);
+      DEBUG_Printf("Cannot find class '%s'\n", name);
       return;
    }
 
-   DEBUG_Printf(DBG_CHN_MESG,  "Class '%s':\n", name);
-   DEBUG_Printf(DBG_CHN_MESG,
-                "style=%08x  wndProc=%08lx\n"
+   DEBUG_Printf("Class '%s':\n", name);
+   DEBUG_Printf("style=%08x  wndProc=%08lx\n"
                 "inst=%p  icon=%p  cursor=%p  bkgnd=%p\n"
                 "clsExtra=%d  winExtra=%d\n",
                 wca.style, (DWORD)wca.lpfnWndProc, wca.hInstance,
@@ -320,16 +321,15 @@
       int                i;
       WORD                w;
 
-      DEBUG_Printf(DBG_CHN_MESG,  "Extra bytes:" );
+      DEBUG_Printf("Extra bytes:");
       for (i = 0; i < wca.cbClsExtra / 2; i++) {
          w = GetClassWord(hWnd, i * 2);
          /* FIXME: depends on i386 endian-ity */
-         DEBUG_Printf(DBG_CHN_MESG,  " %02x", HIBYTE(w));
-         DEBUG_Printf(DBG_CHN_MESG,  " %02x", LOBYTE(w));
+         DEBUG_Printf(" %02x %02x", HIBYTE(w), LOBYTE(w));
       }
-      DEBUG_Printf(DBG_CHN_MESG,  "\n" );
+      DEBUG_Printf("\n");
     }
-    DEBUG_Printf(DBG_CHN_MESG,  "\n" );
+    DEBUG_Printf("\n");
 }
 
 struct class_walker {
@@ -398,8 +398,7 @@
       SetRectEmpty(&windowRect);
 
    /* FIXME missing fields: hmemTaskQ, hrgnUpdate, dce, flags, pProp, scroll */
-   DEBUG_Printf(DBG_CHN_MESG,
-                "next=%p  child=%p  parent=%p  owner=%p  class='%s'\n"
+   DEBUG_Printf("next=%p  child=%p  parent=%p  owner=%p  class='%s'\n"
                 "inst=%p  active=%p  idmenu=%08lx\n"
                 "style=%08lx  exstyle=%08lx  wndproc=%08lx  text='%s'\n"
                 "client=%ld,%ld-%ld,%ld  window=%ld,%ld-%ld,%ld sysmenu=%p\n",
@@ -420,16 +419,15 @@
                 GetSystemMenu(hWnd, FALSE));
 
     if (GetClassLong(hWnd, GCL_CBWNDEXTRA)) {
-        DEBUG_Printf(DBG_CHN_MESG,  "Extra bytes:" );
+        DEBUG_Printf("Extra bytes:" );
         for (i = 0; i < GetClassLong(hWnd, GCL_CBWNDEXTRA) / 2; i++) {
            w = GetWindowWord(hWnd, i * 2);
            /* FIXME: depends on i386 endian-ity */
-           DEBUG_Printf(DBG_CHN_MESG, " %02x", HIBYTE(w));
-           DEBUG_Printf(DBG_CHN_MESG, " %02x", LOBYTE(w));
+           DEBUG_Printf(" %02x %02x", HIBYTE(w), LOBYTE(w));
         }
-        DEBUG_Printf(DBG_CHN_MESG, "\n");
+        DEBUG_Printf("\n");
     }
-    DEBUG_Printf(DBG_CHN_MESG, "\n");
+    DEBUG_Printf("\n");
 }
 
 void DEBUG_WalkWindows(HWND hWnd, int indent)
@@ -442,8 +440,7 @@
       hWnd = GetDesktopWindow();
 
     if (!indent)  /* first time around */
-       DEBUG_Printf(DBG_CHN_MESG,
-                    "%-16.16s %-17.17s %-8.8s %s\n",
+       DEBUG_Printf("%-16.16s %-17.17s %-8.8s %s\n",
                     "hwnd", "Class Name", " Style", " WndProc Text");
 
     do {
@@ -453,8 +450,8 @@
           strcpy(wndName, "-- Empty --");
 
        /* FIXME: missing hmemTaskQ */
-       DEBUG_Printf(DBG_CHN_MESG, "%*s%04x%*s", indent, "", (UINT)hWnd, 13-indent,"");
-       DEBUG_Printf(DBG_CHN_MESG, "%-17.17s %08lx %08lx %.14s\n",
+       DEBUG_Printf("%*s%04x%*s", indent, "", (UINT)hWnd, 13-indent,"");
+       DEBUG_Printf("%-17.17s %08lx %08lx %.14s\n",
                     clsName, GetWindowLong(hWnd, GWL_STYLE),
                     GetWindowLong(hWnd, GWL_WNDPROC), wndName);
 
@@ -475,12 +472,12 @@
         entry.dwSize = sizeof(entry);
         ok = Process32First( snap, &entry );
 
-        DEBUG_Printf(DBG_CHN_MESG, " %-8.8s %-8.8s %-8.8s %s\n",
+        DEBUG_Printf(" %-8.8s %-8.8s %-8.8s %s\n",
                      "pid", "threads", "parent", "executable" );
         while (ok)
         {
             if (entry.th32ProcessID != GetCurrentProcessId())
-                DEBUG_Printf(DBG_CHN_MESG, "%c%08lx %-8ld %08lx '%s'\n",
+                DEBUG_Printf("%c%08lx %-8ld %08lx '%s'\n",
                              (entry.th32ProcessID == current) ? '>' : ' ',
                              entry.th32ProcessID, entry.cntThreads,
                              entry.th32ParentProcessID, entry.szExeFile);
@@ -503,7 +500,7 @@
         entry.dwSize = sizeof(entry);
         ok = Thread32First( snap, &entry );
 
-        DEBUG_Printf(DBG_CHN_MESG, "%-8.8s %-8.8s %s\n", "process", "tid", "prio" );
+        DEBUG_Printf("%-8.8s %-8.8s %s\n", "process", "tid", "prio" );
         while (ok)
         {
             if (entry.th32OwnerProcessID != GetCurrentProcessId())
@@ -516,11 +513,11 @@
                 {
                     DBG_PROCESS*        p = DEBUG_GetProcess(entry.th32OwnerProcessID);
 
-                    DEBUG_Printf(DBG_CHN_MESG, "%08lx%s %s\n",
-                                 entry.th32OwnerProcessID,  p ? " (D)" : "", p ? p->imageName : "");
+                    DEBUG_Printf("%08lx%s %s\n",
+                                 entry.th32OwnerProcessID, p ? " (D)" : "", p ? p->imageName : "");
                     lastProcessId = entry.th32OwnerProcessID;
                 }
-                DEBUG_Printf(DBG_CHN_MESG, "\t%08lx %4ld%s\n",
+                DEBUG_Printf("\t%08lx %4ld%s\n",
                              entry.th32ThreadID, entry.tpBasePri,
                              (entry.th32ThreadID == current) ? " <==" : "");
 
@@ -544,12 +541,11 @@
 
     if (!DEBUG_CurrProcess || !DEBUG_CurrThread)
     {
-        DEBUG_Printf(DBG_CHN_MESG, 
-                     "Cannot walk exceptions while no process is loaded\n");
+        DEBUG_Printf("Cannot walk exceptions while no process is loaded\n");
         return;
     }
 
-    DEBUG_Printf( DBG_CHN_MESG, "Exception frames:\n" );
+    DEBUG_Printf("Exception frames:\n");
 
     if (tid == DEBUG_CurrTid) thread = DEBUG_CurrThread;
     else
@@ -558,19 +554,19 @@
 
          if (!thread)
          {
-              DEBUG_Printf( DBG_CHN_MESG, "Unknown thread id (0x%08lx) in current process\n", tid);
+              DEBUG_Printf("Unknown thread id (0x%08lx) in current process\n", tid);
               return;
          }
          if (SuspendThread( thread->handle ) == -1)
          {
-              DEBUG_Printf( DBG_CHN_MESG, "Can't suspend thread id (0x%08lx)\n", tid);
+              DEBUG_Printf("Can't suspend thread id (0x%08lx)\n", tid);
               return;
          }
     }
 
     if (!DEBUG_READ_MEM(thread->teb, &next_frame, sizeof(next_frame)))
     {
-        DEBUG_Printf( DBG_CHN_MESG, "Can't read TEB:except_frame\n");
+        DEBUG_Printf("Can't read TEB:except_frame\n");
         return;
     }
 
@@ -578,13 +574,13 @@
     {
         EXCEPTION_REGISTRATION_RECORD frame;
 
-        DEBUG_Printf( DBG_CHN_MESG, "%p: ", next_frame );
+        DEBUG_Printf("%p: ", next_frame);
         if (!DEBUG_READ_MEM(next_frame, &frame, sizeof(frame)))
         {
-            DEBUG_Printf( DBG_CHN_MESG, "Invalid frame address\n" );
+            DEBUG_Printf("Invalid frame address\n");
             break;
         }
-        DEBUG_Printf( DBG_CHN_MESG, "prev=%p handler=%p\n", frame.Prev, frame.Handler );
+        DEBUG_Printf("prev=%p handler=%p\n", frame.Prev, frame.Handler);
         next_frame = frame.Prev;
     }
 
@@ -617,8 +613,7 @@
             flags[1] = (le.HighWord.Bits.Type & 0x2) ? 'w' : '-';
             flags[2] = '-';
         }
-        DEBUG_Printf(DBG_CHN_MESG,
-                     "%04lx: sel=%04lx base=%08x limit=%08x %d-bit %c%c%c\n",
+        DEBUG_Printf("%04lx: sel=%04lx base=%08x limit=%08x %d-bit %c%c%c\n",
                      i, (i<<3)|7,
                      (le.HighWord.Bits.BaseHi << 24) +
                      (le.HighWord.Bits.BaseMid << 16) + le.BaseLow,
@@ -642,8 +637,7 @@
     {
         if (DEBUG_CurrProcess == NULL)
         {
-            DEBUG_Printf(DBG_CHN_MESG, 
-                         "Cannot look at mapping of current process, while no process is loaded\n");
+            DEBUG_Printf("Cannot look at mapping of current process, while no process is loaded\n");
             return;
         }
         hProc = DEBUG_CurrProcess->handle;
@@ -653,12 +647,12 @@
         hProc = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, pid);
         if (hProc == NULL)
         {
-            DEBUG_Printf(DBG_CHN_MESG, "Cannot open process <%lu>\n", pid);
+            DEBUG_Printf("Cannot open process <%lu>\n", pid);
             return;
         }
     }
 
-    DEBUG_Printf(DBG_CHN_MESG, "Address  Size     State   Type    RWX\n");
+    DEBUG_Printf("Address  Size     State   Type    RWX\n");
 
     while (VirtualQueryEx(hProc, addr, &mbi, sizeof(mbi)) >= sizeof(mbi))
     {
@@ -695,7 +689,7 @@
             type = "";
             prot[0] = '\0';
         }
-        DEBUG_Printf(DBG_CHN_MESG, "%08lx %08lx %s %s %s\n",
+        DEBUG_Printf("%08lx %08lx %s %s %s\n",
                      (DWORD)addr, mbi.RegionSize, state, type, prot);
         if (addr + mbi.RegionSize < addr) /* wrap around ? */
             break;
@@ -726,7 +720,7 @@
 
     if (DEBUG_GetSymbolValue("first_dll", -1, &val, FALSE) != gsv_found)
     {
-        DEBUG_Printf(DBG_CHN_MESG, "Can't get first_option symbol");
+        DEBUG_Printf("Can't get first_option symbol");
         return;
     }
     addr = (void*)DEBUG_ToLinear(&val.addr);
@@ -735,7 +729,7 @@
     else if (!strcmp(chnl, "err"))      mask = 2;
     else if (!strcmp(chnl, "warn"))     mask = 4;
     else if (!strcmp(chnl, "trace"))    mask = 8;
-    else { DEBUG_Printf(DBG_CHN_MESG, "Unknown channel %s\n", chnl); return; }
+    else { DEBUG_Printf("Unknown channel %s\n", chnl); return; }
 
     bAll = !strcmp("all", name);
     while (addr && DEBUG_READ_MEM(addr, &dol, sizeof(dol)))
@@ -752,6 +746,6 @@
         }
         addr = dol.next;
     }
-    if (!done) DEBUG_Printf(DBG_CHN_MESG, "Unable to find debug channel %s\n", name);
-    else DEBUG_Printf(DBG_CHN_TRACE, "Changed %d channel instances\n", done);
+    if (!done) DEBUG_Printf("Unable to find debug channel %s\n", name);
+    else WINE_TRACE("Changed %d channel instances\n", done);
 }
Index: programs/winedbg/intvar.h
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/programs/winedbg/intvar.h,v
retrieving revision 1.3
diff -u -r1.3 intvar.h
--- programs/winedbg/intvar.h        4 Mar 2003 02:18:20 -0000        1.3
+++ programs/winedbg/intvar.h        13 Dec 2003 07:27:59 -0000
@@ -27,10 +27,6 @@
 INTERNAL_VAR(BreakOnDllLoad,                FALSE,                 NULL,                         DT_BASIC_CONST_INT)
 INTERNAL_VAR(CanDeferOnBPByAddr,        FALSE,          NULL,                   DT_BASIC_CONST_INT)
 
-   /* console handling */
-INTERNAL_VAR(ConChannelMask,                DBG_CHN_MESG,        NULL,                          DT_BASIC_CONST_INT)
-INTERNAL_VAR(StdChannelMask,                0,                NULL,                          DT_BASIC_CONST_INT)
-
    /* debugging debugger */
 INTERNAL_VAR(ExtDbgOnInvalidAddress,        FALSE,                NULL,                          DT_BASIC_CONST_INT)
 INTERNAL_VAR(ExtDbgOnInternalException, FALSE,          NULL,                   DT_BASIC_CONST_INT)
Index: programs/winedbg/memory.c
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/programs/winedbg/memory.c,v
retrieving revision 1.5
diff -u -r1.5 memory.c
--- programs/winedbg/memory.c        15 Oct 2003 21:14:08 -0000        1.5
+++ programs/winedbg/memory.c        13 Dec 2003 07:35:51 -0000
@@ -35,7 +35,7 @@
 
 static        void        DEBUG_Die(const char* msg)
 {
-   DEBUG_Printf(DBG_CHN_MESG, msg);
+   DEBUG_Printf(msg);
    exit(1);
 }
 
@@ -139,9 +139,9 @@
 
 void        DEBUG_InvalAddr( const DBG_ADDR* addr )
 {
-   DEBUG_Printf(DBG_CHN_MESG,"*** Invalid address ");
+   DEBUG_Printf("*** Invalid address ");
    DEBUG_PrintAddress(addr, DEBUG_CurrThread->dbg_mode, FALSE);
-   DEBUG_Printf(DBG_CHN_MESG,"\n");
+   DEBUG_Printf("\n");
    if (DBG_IVAR(ExtDbgOnInvalidAddress)) DEBUG_ExternalDebugger();
 }
 
@@ -255,7 +255,7 @@
                 value->addr.off = DEBUG_GetExprValue(value, NULL);
         }
     } else if (!value->addr.seg && !value->addr.off) {
-        DEBUG_Printf(DBG_CHN_MESG,"Invalid expression\n");
+        DEBUG_Printf("Invalid expression\n");
         return FALSE;
     }
     return TRUE;
@@ -277,7 +277,7 @@
     if (format != 'i' && count > 1)
     {
         DEBUG_PrintAddress( &value.addr, DEBUG_CurrThread->dbg_mode, FALSE );
-        DEBUG_Printf(DBG_CHN_MESG,": ");
+        DEBUG_Printf(": ");
     }
 
     pnt = (void*)DEBUG_ToLinear( &value.addr );
@@ -286,13 +286,13 @@
     {
          case 'u':
                 if (count == 1) count = 256;
-                DEBUG_nchar += DEBUG_PrintStringW(DBG_CHN_MESG, &value.addr, count);
-                DEBUG_Printf(DBG_CHN_MESG, "\n");
+                DEBUG_nchar += DEBUG_PrintStringW(&value.addr, count);
+                DEBUG_Printf("\n");
                 return;
         case 's':
                 if (count == 1) count = 256;
-                DEBUG_nchar += DEBUG_PrintStringA(DBG_CHN_MESG, &value.addr, count);
-                DEBUG_Printf(DBG_CHN_MESG, "\n");
+                DEBUG_nchar += DEBUG_PrintStringA(&value.addr, count);
+                DEBUG_Printf("\n");
                 return;
         case 'i':
                 while (count-- && DEBUG_DisassembleInstruction( &value.addr ));
@@ -302,7 +302,7 @@
                 {
                     GUID guid;
                     if (!DEBUG_READ_MEM_VERBOSE(pnt, &guid, sizeof(guid))) break;
-                    DEBUG_Printf(DBG_CHN_MESG,"{%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}\n",
+                    DEBUG_Printf("{%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}\n",
                                  guid.Data1, guid.Data2, guid.Data3,
                                  guid.Data4[0], guid.Data4[1], guid.Data4[2], guid.Data4[3],
                                  guid.Data4[4], guid.Data4[5], guid.Data4[6], guid.Data4[7] );
@@ -311,7 +311,7 @@
                     if (count)
                     {
                         DEBUG_PrintAddress( &value.addr, DEBUG_CurrThread->dbg_mode, FALSE );
-                        DEBUG_Printf(DBG_CHN_MESG,": ");
+                        DEBUG_Printf(": ");
                     }
                 }
                 return;
@@ -320,15 +320,15 @@
                 _t _v; \
                 for(i=0; i<count; i++) { \
                     if (!DEBUG_READ_MEM_VERBOSE(pnt, &_v, sizeof(_t))) break; \
-                    DEBUG_Printf(DBG_CHN_MESG,_f,(_vv)); \
+                    DEBUG_Printf(_f,(_vv)); \
                     pnt += sizeof(_t); value.addr.off += sizeof(_t); \
                     if ((i % (_l)) == (_l)-1) { \
-                        DEBUG_Printf(DBG_CHN_MESG,"\n"); \
+                        DEBUG_Printf("\n"); \
                         DEBUG_PrintAddress( &value.addr, DEBUG_CurrThread->dbg_mode, FALSE );\
-                        DEBUG_Printf(DBG_CHN_MESG,": ");\
+                        DEBUG_Printf(": ");\
                     } \
                 } \
-                DEBUG_Printf(DBG_CHN_MESG,"\n"); \
+                DEBUG_Printf("\n"); \
         } \
         return
 #define DO_DUMP(_t,_l,_f) DO_DUMP2(_t,_l,_f,_v)
@@ -350,7 +350,7 @@
  * address space. The string stops when either len chars (if <> -1)
  * have been printed, or the '\0' char is printed
  */
-int  DEBUG_PrintStringA(int chnl, const DBG_ADDR* address, int len)
+int  DEBUG_PrintStringA(const DBG_ADDR* address, int len)
 {
     char*       lin = (void*)DEBUG_ToLinear(address);
     char        ch[CHARBUFSIZE+1];
@@ -364,7 +364,7 @@
         if (!DEBUG_READ_MEM_VERBOSE(lin, ch, to_write)) break;
         ch[to_write] = '\0';  /* protect from displaying junk */
         to_write = lstrlenA(ch);
-        DEBUG_OutputA(chnl, ch, to_write);
+        DEBUG_OutputA(ch, to_write);
         lin += to_write;
         written += to_write;
         if (to_write < CHARBUFSIZE) break;
@@ -372,7 +372,7 @@
     return written; /* number of actually written chars */
 }
 
-int  DEBUG_PrintStringW(int chnl, const DBG_ADDR* address, int len)
+int  DEBUG_PrintStringW(const DBG_ADDR* address, int len)
 {
     char*       lin = (void*)DEBUG_ToLinear(address);
     WCHAR       ch[CHARBUFSIZE+1];
@@ -386,7 +386,7 @@
         if (!DEBUG_READ_MEM_VERBOSE(lin, ch, to_write * sizeof(WCHAR))) break;
         ch[to_write] = 0;  /* protect from displaying junk */
         to_write = lstrlenW(ch);
-        DEBUG_OutputW(chnl, ch, to_write);
+        DEBUG_OutputW(ch, to_write);
         lin += to_write;
         written += to_write;
         if (to_write < CHARBUFSIZE) break;
Index: programs/winedbg/module.c
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/programs/winedbg/module.c,v
retrieving revision 1.4
diff -u -r1.4 module.c
--- programs/winedbg/module.c        1 Apr 2003 00:02:36 -0000        1.4
+++ programs/winedbg/module.c        13 Dec 2003 07:37:05 -0000
@@ -26,6 +26,9 @@
 #include "debugger.h"
 #include "wingdi.h"
 #include "winuser.h"
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(winedbg);
 
 /***********************************************************************
  * Creates and links a new module to the current process
@@ -445,25 +448,25 @@
             (module.flags & NE_FFLAGS_WIN32) /* NE module */)
             continue;
         if (!first) {
-            if (pfx) DEBUG_Printf(DBG_CHN_MESG, pfx);
-            DEBUG_Printf(DBG_CHN_MESG, "   ");
+            if (pfx) DEBUG_Printf(pfx);
+            DEBUG_Printf("   ");
             rowcount = 3 + (pfx ? strlen(pfx) : 0);
             first = 1;
         }
 
         len = strlen(entry.szModule);
         if ((rowcount + len) > 76) {
-            DEBUG_Printf(DBG_CHN_MESG, "\n   ");
+            DEBUG_Printf("\n   ");
             rowcount = 3;
         }
-        DEBUG_Printf(DBG_CHN_MESG, " %s", entry.szModule);
+        DEBUG_Printf(" %s", entry.szModule);
         rowcount += len + 1;
 
         DEBUG_LoadModule16(entry.hModule, &module, moduleAddr, entry.szModule);
     } while (ModuleNext16(&entry));
 #endif
 
-    if (first) DEBUG_Printf(DBG_CHN_MESG, "\n");
+    if (first) DEBUG_Printf("\n");
     return first;
 }
 
@@ -485,11 +488,11 @@
         fmt = "Can't find file for %s '%s' (%p)\n";
         break;
     default:
-        DEBUG_Printf(DBG_CHN_ERR, "Oooocch (%d)\n", dil);
+        WINE_ERR("Oooocch (%d)\n", dil);
         return;
     }
 
-    DEBUG_Printf(DBG_CHN_MESG, fmt, pfx, filename, load_addr);
+    DEBUG_Printf(fmt, pfx, filename, load_addr);
 }
 
 static const char*      DEBUG_GetModuleType(enum DbgModuleType type)
@@ -540,8 +543,8 @@
 
 static void        DEBUG_InfoShareModule(const DBG_MODULE* module, int ident)
 {
-    if (ident) DEBUG_Printf(DBG_CHN_MESG, "  \\-");
-    DEBUG_Printf(DBG_CHN_MESG, "%s\t0x%08lx-%08lx\t%s\n",
+    if (ident) DEBUG_Printf("  \\-");
+    DEBUG_Printf("%s\t0x%08lx-%08lx\t%s\n",
                  DEBUG_GetModuleType(module->type),
                  (DWORD)module->load_addr, (DWORD)module->load_addr + module->size,
                  module->module_name);
@@ -560,7 +563,7 @@
     ref = DBG_alloc(sizeof(DBG_MODULE*) * DEBUG_CurrProcess->num_modules);
     if (!ref) return;
 
-    DEBUG_Printf(DBG_CHN_MESG, "Module\tAddress\t\t\tName\t%d modules\n",
+    DEBUG_Printf("Module\tAddress\t\t\tName\t%d modules\n",
                  DEBUG_CurrProcess->num_modules);
 
     memcpy(ref, DEBUG_CurrProcess->modules,
@@ -588,7 +591,7 @@
                 DEBUG_InfoShareModule(ref[i], 0);
             break;
         default:
-            DEBUG_Printf(DBG_CHN_ERR, "Unknown type (%d)\n", ref[i]->type);
+            WINE_ERR("Unknown type (%d)\n", ref[i]->type);
         }
     }
     DBG_free(ref);
@@ -604,11 +607,11 @@
 
     if (!(wmod = DEBUG_FindModuleByHandle((HANDLE)mod, DMT_UNKNOWN)) &&
         !(wmod = DEBUG_FindModuleByAddr((void*)mod, DMT_UNKNOWN))) {
-        DEBUG_Printf(DBG_CHN_MESG, "'0x%08lx' is not a valid module handle or address\n", mod);
+        DEBUG_Printf("'0x%08lx' is not a valid module handle or address\n", mod);
         return;
     }
 
-    DEBUG_Printf(DBG_CHN_MESG, "Module '%s' (handle=%p) 0x%08lx-0x%08lx (%s, debug info %s)\n",
+    DEBUG_Printf("Module '%s' (handle=%p) 0x%08lx-0x%08lx (%s, debug info %s)\n",
                  wmod->module_name, wmod->handle, (DWORD)wmod->load_addr,
                  (DWORD)wmod->load_addr + wmod->size,
                  DEBUG_GetModuleType(wmod->type), DEBUG_GetDbgInfo(wmod->dil));
@@ -626,12 +629,11 @@
 
     if (!DEBUG_CurrProcess)
     {
-        DEBUG_Printf(DBG_CHN_MESG, 
-                     "Cannot walk classes while no process is loaded\n");
+        DEBUG_Printf("Cannot walk classes while no process is loaded\n");
         return;
     }
 
-    DEBUG_Printf(DBG_CHN_MESG, "Address\t\t\tModule\tName\n");
+    DEBUG_Printf("Address\t\t\tModule\tName\n");
 
     amod = DBG_alloc(sizeof(DBG_MODULE*) * DEBUG_CurrProcess->num_modules);
     if (!amod) return;
@@ -643,7 +645,7 @@
     for (i = 0; i < DEBUG_CurrProcess->num_modules; i++) {
         if (amod[i]->type == DMT_ELF)        continue;
 
-        DEBUG_Printf(DBG_CHN_MESG, "0x%08lx-%08lx\t(%s)\t%s\n",
+        DEBUG_Printf("0x%08lx-%08lx\t(%s)\t%s\n",
                      (DWORD)amod[i]->load_addr,
                      (DWORD)amod[i]->load_addr + amod[i]->size,
                      DEBUG_GetModuleType(amod[i]->type), amod[i]->module_name);
Index: programs/winedbg/msc.c
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/programs/winedbg/msc.c,v
retrieving revision 1.5
diff -u -r1.5 msc.c
--- programs/winedbg/msc.c        27 Nov 2003 00:59:36 -0000        1.5
+++ programs/winedbg/msc.c        13 Dec 2003 07:52:42 -0000
@@ -42,9 +42,13 @@
 #define PATH_MAX MAX_PATH
 #endif
 #include "wine/exception.h"
+#include "wine/debug.h"
 #include "excpt.h"
 #include "debugger.h"
 
+WINE_DEFAULT_DEBUG_CHANNEL(winedbg);
+WINE_DECLARE_DEBUG_CHANNEL(winedbg_msc);
+
 #define MAX_PATHNAME_LEN 1024
 
 typedef struct
@@ -251,7 +255,7 @@
   DBG_VALUE                               new_value;
   enum DbgInfoLoad                dil = DIL_ERROR;
 
-  DEBUG_Printf(DBG_CHN_TRACE, "Processing COFF symbols...\n");
+  WINE_TRACE("Processing COFF symbols...\n");
 
   assert(sizeof(IMAGE_SYMBOL) == IMAGE_SIZEOF_SYMBOL);
   assert(sizeof(IMAGE_LINENUMBER) == IMAGE_SIZEOF_LINENUMBER);
@@ -278,7 +282,7 @@
       if( coff_sym->StorageClass == IMAGE_SYM_CLASS_FILE )
         {
           curr_file_idx = DEBUG_AddCoffFile( &coff_files, (char *) (coff_sym + 1) );
-          DEBUG_Printf(DBG_CHN_TRACE,"New file %s\n", coff_files.files[curr_file_idx].filename);
+          WINE_TRACE("New file %s\n", coff_files.files[curr_file_idx].filename);
           i += naux;
           continue;
         }
@@ -286,7 +290,7 @@
       if (curr_file_idx < 0) {
           assert(coff_files.nfiles == 0 && coff_files.nfiles_alloc == 0);
           curr_file_idx = DEBUG_AddCoffFile( &coff_files, "<none>" );
-          DEBUG_Printf(DBG_CHN_TRACE,"New file %s\n", coff_files.files[curr_file_idx].filename);
+          WINE_TRACE("New file %s\n", coff_files.files[curr_file_idx].filename);
       }
 
       /*
@@ -309,22 +313,22 @@
                */
               const char* fn = coff_files.files[curr_file_idx].filename;
 
-#ifdef MORE_DBG
-              DEBUG_Printf(DBG_CHN_TRACE, "Duplicating sect from %s: %lx %x %x %d %d\n",
-                           coff_files.files[curr_file_idx].filename,
-                           aux->Section.Length,
-                           aux->Section.NumberOfRelocations,
-                           aux->Section.NumberOfLinenumbers,
-                           aux->Section.Number,
-                           aux->Section.Selection);
-              DEBUG_Printf(DBG_CHN_TRACE, "More sect %d %s %08lx %d %d %d\n",
-                           coff_sym->SectionNumber,
-                           DEBUG_GetCoffName( coff_sym, coff_strtab ),
-                           coff_sym->Value,
-                           coff_sym->Type,
-                           coff_sym->StorageClass,
-                           coff_sym->NumberOfAuxSymbols);
-#endif
+              WINE_TRACE_(winedbg_msc)(
+                  "Duplicating sect from %s: %lx %x %x %d %d\n",
+                  coff_files.files[curr_file_idx].filename,
+                  aux->Section.Length,
+                  aux->Section.NumberOfRelocations,
+                  aux->Section.NumberOfLinenumbers,
+                  aux->Section.Number,
+                  aux->Section.Selection);
+              WINE_TRACE_(winedbg_msc)(
+                  "More sect %d %s %08lx %d %d %d\n",
+                  coff_sym->SectionNumber,
+                  DEBUG_GetCoffName( coff_sym, coff_strtab ),
+                  coff_sym->Value,
+                  coff_sym->Type,
+                  coff_sym->StorageClass,
+                  coff_sym->NumberOfAuxSymbols);
 
               /*
                * Duplicate the file entry.  We have no way to describe
@@ -332,18 +336,17 @@
                */
               DEBUG_AddCoffFile( &coff_files, fn );
             }
-#ifdef MORE_DBG
           else
             {
-              DEBUG_Printf(DBG_CHN_TRACE, "New text sect from %s: %lx %x %x %d %d\n",
-                           coff_files.files[curr_file_idx].filename,
-                           aux->Section.Length,
-                           aux->Section.NumberOfRelocations,
-                           aux->Section.NumberOfLinenumbers,
-                           aux->Section.Number,
-                           aux->Section.Selection);
+              WINE_TRACE_(winedbg_msc)(
+                  "New text sect from %s: %lx %x %x %d %d\n",
+                  coff_files.files[curr_file_idx].filename,
+                  aux->Section.Length,
+                  aux->Section.NumberOfRelocations,
+                  aux->Section.NumberOfLinenumbers,
+                  aux->Section.Number,
+                  aux->Section.Selection);
             }
-#endif
 
           if( coff_files.files[curr_file_idx].startaddr > coff_sym->Value )
             {
@@ -377,9 +380,7 @@
           new_value.addr.seg = 0;
           new_value.addr.off = (int) ((char *)module->load_addr + base + coff_sym->Value);
 
-#ifdef MORE_DBG
-          DEBUG_Printf(DBG_CHN_TRACE,"\tAdding static symbol %s\n", nampnt);
-#endif
+          WINE_TRACE_(winedbg_msc)("\tAdding static symbol %s\n", nampnt);
 
           /* FIXME: was adding symbol to this_file ??? */
           DEBUG_AddCoffSymbol( &coff_files.files[curr_file_idx],
@@ -401,12 +402,10 @@
           new_value.addr.seg = 0;
           new_value.addr.off = (int) ((char *)module->load_addr + base + coff_sym->Value);
 
-#ifdef MORE_DBG
-          DEBUG_Printf(DBG_CHN_TRACE, "%d: %lx %s\n", i, new_value.addr.off, nampnt);
-
-          DEBUG_Printf(DBG_CHN_TRACE,"\tAdding global symbol %s (sect=%s)\n",
-                       nampnt, MSC_INFO(module)->sectp[coff_sym->SectionNumber - 1].Name);
-#endif
+          WINE_TRACE_(winedbg_msc)("%d: %lx %s\n", i, new_value.addr.off, nampnt);
+          WINE_TRACE_(winedbg_msc)(
+              "\tAdding global symbol %s (sect=%s)\n",
+              nampnt, module->msc_info->sectp[coff_sym->SectionNumber - 1].Name);
 
           /*
            * Now we need to figure out which file this guy belongs to.
@@ -443,11 +442,8 @@
           new_value.addr.seg = 0;
           new_value.addr.off = (int) ((char *)module->load_addr + base + coff_sym->Value);
 
-#ifdef MORE_DBG
-          DEBUG_Printf(DBG_CHN_TRACE, "%d: %lx %s\n", i, new_value.addr.off, nampnt);
-
-          DEBUG_Printf(DBG_CHN_TRACE,"\tAdding global data symbol %s\n", nampnt);
-#endif
+          WINE_TRACE_(winedbg_msc)("%d: %lx %s\n", i, new_value.addr.off, nampnt);
+          WINE_TRACE_(winedbg_msc)("\tAdding global data symbol %s\n", nampnt);
 
           /*
            * Now we need to figure out which file this guy belongs to.
@@ -468,11 +464,10 @@
           continue;
         }
 
-#ifdef MORE_DBG
-      DEBUG_Printf(DBG_CHN_TRACE,"Skipping unknown entry '%s' %d %d %d\n",
-                   DEBUG_GetCoffName( coff_sym, coff_strtab ),
-                   coff_sym->StorageClass, coff_sym->SectionNumber, naux);
-#endif
+      WINE_TRACE_(winedbg_msc)(
+          "Skipping unknown entry '%s' %d %d %d\n",
+          DEBUG_GetCoffName( coff_sym, coff_strtab ),
+          coff_sym->StorageClass, coff_sym->SectionNumber, naux);
 
       /*
        * For now, skip past the aux entries.
@@ -1261,7 +1256,7 @@
             break;
 
         default:
-            DEBUG_Printf( DBG_CHN_MESG, "Unknown numeric leaf type %04x\n", type );
+            DEBUG_Printf("Unknown numeric leaf type %04x\n", type);
             *value = 0;
             break;
         }
@@ -1408,8 +1403,8 @@
         }
 
         default:
-            DEBUG_Printf( DBG_CHN_MESG, "Unhandled type %04x in ENUM field list\n",
-                                         type->generic.id );
+            DEBUG_Printf("Unhandled type %04x in ENUM field list\n",
+                         type->generic.id);
             return FALSE;
         }
     }
@@ -1580,8 +1575,8 @@
             break;
 
         default:
-            DEBUG_Printf( DBG_CHN_MESG, "Unhandled type %04x in STRUCT field list\n",
-                                        type->generic.id );
+            DEBUG_Printf("Unhandled type %04x in STRUCT field list\n",
+                         type->generic.id);
             return FALSE;
         }
     }
@@ -2570,7 +2565,7 @@
     int header_size = 0;
     char *modimage, *file;
 
-    DEBUG_Printf( DBG_CHN_TRACE, "Processing PDB file %s\n", filename );
+    WINE_TRACE("Processing PDB file %s\n", filename);
 
     /*
      * Open and map() .PDB file
@@ -2578,7 +2573,7 @@
     image = DEBUG_MapDebugInfoFile( filename, 0, 0, &hFile, &hMap );
     if ( !image )
     {
-        DEBUG_Printf( DBG_CHN_ERR, "-Unable to peruse .PDB file %s\n", filename );
+        WINE_ERR("-Unable to peruse .PDB file %s\n", filename);
         goto leave;
     }
 
@@ -2597,9 +2592,7 @@
 
     if ( !root )
     {
-        DEBUG_Printf( DBG_CHN_ERR,
-                      "-Unable to get root from .PDB file %s\n",
-                      filename );
+        WINE_ERR("-Unable to get root from .PDB file %s\n", filename);
         goto leave;
     }
 
@@ -2615,7 +2608,7 @@
         case 19970604:      /* VC 6.0 */
             break;
         default:
-            DEBUG_Printf( DBG_CHN_ERR, "-Unknown root block version %ld\n", root->version );
+            WINE_ERR("-Unknown root block version %ld\n", root->version);
     }
 
     switch ( types.version )
@@ -2625,7 +2618,7 @@
         case 19961031:      /* VC 5.0 / 6.0 */
             break;
         default:
-            DEBUG_Printf( DBG_CHN_ERR, "-Unknown type info version %ld\n", types.version );
+            WINE_ERR("-Unknown type info version %ld\n", types.version);
     }
 
     switch ( symbols.version )
@@ -2635,7 +2628,7 @@
         case 19970606:     /* VC 6.0 */
             break;
         default:
-            DEBUG_Printf( DBG_CHN_ERR, "-Unknown symbol info version %ld\n", symbols.version );
+            WINE_ERR("-Unknown symbol info version %ld\n", symbols.version);
     }
 
 
@@ -2645,8 +2638,8 @@
 
     if ( root->TimeDateStamp != timestamp )
     {
-        DEBUG_Printf( DBG_CHN_ERR, "-Wrong time stamp of .PDB file %s (0x%08lx, 0x%08lx)\n",
-                      filename, root->TimeDateStamp, timestamp );
+        WINE_ERR("-Wrong time stamp of .PDB file %s (0x%08lx, 0x%08lx)\n",
+                 filename, root->TimeDateStamp, timestamp );
     }
 
     /*
@@ -2662,7 +2655,7 @@
     if ( symbols.pdbimport_size )
     {
         /* FIXME */
-        DEBUG_Printf(DBG_CHN_ERR, "-Type server .PDB imports ignored!\n" );
+        WINE_ERR("-Type server .PDB imports ignored!\n");
     }
 
     /*
@@ -2855,8 +2848,8 @@
     }
 
     default:
-        DEBUG_Printf( DBG_CHN_ERR, "Unknown CODEVIEW signature %08lX in module %s\n",
-                      cv->dwSignature, module->module_name );
+        WINE_ERR("Unknown CODEVIEW signature %08lX in module %s\n",
+                 cv->dwSignature, module->module_name );
         break;
     }
 
@@ -2909,7 +2902,7 @@
           */
         for ( i = 0; i < nDbg; i++ )
             if ( dbg[i].Type == IMAGE_DEBUG_TYPE_FPO )
-                DEBUG_Printf(DBG_CHN_MESG, "This guy has FPO information\n");
+                DEBUG_Printf("This guy has FPO information\n");
 
 #define FRAME_FPO   0
 #define FRAME_TRAP  1
@@ -2952,13 +2945,12 @@
     PIMAGE_DEBUG_DIRECTORY dbg;
     int nDbg;
 
-
-    DEBUG_Printf( DBG_CHN_TRACE, "Processing DBG file %s\n", filename );
+    WINE_TRACE("Processing DBG file %s\n", filename);
 
     file_map = DEBUG_MapDebugInfoFile( filename, 0, 0, &hFile, &hMap );
     if ( !file_map )
     {
-        DEBUG_Printf( DBG_CHN_ERR, "-Unable to peruse .DBG file %s\n", filename );
+        WINE_ERR("-Unable to peruse .DBG file %s\n", filename);
         goto leave;
     }
 
@@ -2966,8 +2958,7 @@
 
     if ( hdr->TimeDateStamp != timestamp )
     {
-        DEBUG_Printf( DBG_CHN_ERR, "Warning - %s has incorrect internal timestamp\n",
-                      filename );
+        WINE_ERR("Warning - %s has incorrect internal timestamp\n", filename);
         /*
          *  Well, sometimes this happens to DBG files which ARE REALLY the right .DBG
          *  files but nonetheless this check fails. Anyway, WINDBG (debugger for
@@ -3054,8 +3045,8 @@
         if ( nDbg != 1 || dbg->Type != IMAGE_DEBUG_TYPE_MISC
                        || misc->DataType != IMAGE_DEBUG_MISC_EXENAME )
         {
-            DEBUG_Printf( DBG_CHN_ERR, "-Debug info stripped, but no .DBG file in module %s\n",
-                          module->module_name );
+            WINE_ERR("-Debug info stripped, but no .DBG file in module %s\n",
+                     module->module_name );
             goto leave;
         }
 
@@ -3141,12 +3132,11 @@
                                      s1 + stabsize, stabstrsize)) {
              dil = DEBUG_ParseStabs(s1, 0, 0, stabsize, stabsize, stabstrsize);
           } else {
-             DEBUG_Printf(DBG_CHN_MESG, "couldn't read data block\n");
+             DEBUG_Printf("couldn't read data block\n");
           }
           DBG_free(s1);
        } else {
-          DEBUG_Printf(DBG_CHN_MESG, "couldn't alloc %d bytes\n",
-                       stabsize + stabstrsize);
+          DEBUG_Printf("couldn't alloc %d bytes\n", stabsize + stabstrsize);
        }
     } else {
        dil = DIL_NOINFO;
Index: programs/winedbg/registers.c
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/programs/winedbg/registers.c,v
retrieving revision 1.2
diff -u -r1.2 registers.c
--- programs/winedbg/registers.c        18 Jun 2003 03:30:40 -0000        1.2
+++ programs/winedbg/registers.c        13 Dec 2003 07:20:08 -0000
@@ -88,40 +88,40 @@
  */
 void DEBUG_InfoRegisters(const CONTEXT* ctx)
 {
-    DEBUG_Printf(DBG_CHN_MESG,"Register dump:\n");
+    DEBUG_Printf("Register dump:\n");
 
 #ifdef __i386__
     /* First get the segment registers out of the way */
-    DEBUG_Printf( DBG_CHN_MESG," CS:%04x SS:%04x DS:%04x ES:%04x FS:%04x GS:%04x",
-                  (WORD)ctx->SegCs, (WORD)ctx->SegSs,
-                  (WORD)ctx->SegDs, (WORD)ctx->SegEs,
-                  (WORD)ctx->SegFs, (WORD)ctx->SegGs );
+    DEBUG_Printf(" CS:%04x SS:%04x DS:%04x ES:%04x FS:%04x GS:%04x",
+                 (WORD)ctx->SegCs, (WORD)ctx->SegSs,
+                 (WORD)ctx->SegDs, (WORD)ctx->SegEs,
+                 (WORD)ctx->SegFs, (WORD)ctx->SegGs);
     if (DEBUG_CurrThread->dbg_mode != MODE_32)
     {
         char flag[33];
 
-        DEBUG_Printf( DBG_CHN_MESG,"\n IP:%04x SP:%04x BP:%04x FLAGS:%04x(%s)\n",
-                      LOWORD(ctx->Eip), LOWORD(ctx->Esp),
-                      LOWORD(ctx->Ebp), LOWORD(ctx->EFlags),
-                      DEBUG_Flags(LOWORD(ctx->EFlags), flag));
-        DEBUG_Printf( DBG_CHN_MESG," AX:%04x BX:%04x CX:%04x DX:%04x SI:%04x DI:%04x\n",
-                      LOWORD(ctx->Eax), LOWORD(ctx->Ebx),
-                      LOWORD(ctx->Ecx), LOWORD(ctx->Edx),
-                      LOWORD(ctx->Esi), LOWORD(ctx->Edi) );
+        DEBUG_Printf("\n IP:%04x SP:%04x BP:%04x FLAGS:%04x(%s)\n",
+                     LOWORD(ctx->Eip), LOWORD(ctx->Esp),
+                     LOWORD(ctx->Ebp), LOWORD(ctx->EFlags),
+                     DEBUG_Flags(LOWORD(ctx->EFlags), flag));
+        DEBUG_Printf(" AX:%04x BX:%04x CX:%04x DX:%04x SI:%04x DI:%04x\n",
+                     LOWORD(ctx->Eax), LOWORD(ctx->Ebx),
+                     LOWORD(ctx->Ecx), LOWORD(ctx->Edx),
+                     LOWORD(ctx->Esi), LOWORD(ctx->Edi));
     }
     else  /* 32-bit mode */
     {
         char flag[33];
 
-        DEBUG_Printf( DBG_CHN_MESG, "\n EIP:%08lx ESP:%08lx EBP:%08lx EFLAGS:%08lx(%s)\n",
-                      ctx->Eip, ctx->Esp,
-                      ctx->Ebp, ctx->EFlags,
-                      DEBUG_Flags(ctx->EFlags, flag));
-        DEBUG_Printf( DBG_CHN_MESG, " EAX:%08lx EBX:%08lx ECX:%08lx EDX:%08lx\n",
-                      ctx->Eax, ctx->Ebx,
-                      ctx->Ecx, ctx->Edx );
-        DEBUG_Printf( DBG_CHN_MESG, " ESI:%08lx EDI:%08lx\n",
-                      ctx->Esi, ctx->Edi );
+        DEBUG_Printf("\n EIP:%08lx ESP:%08lx EBP:%08lx EFLAGS:%08lx(%s)\n",
+                     ctx->Eip, ctx->Esp,
+                     ctx->Ebp, ctx->EFlags,
+                     DEBUG_Flags(ctx->EFlags, flag));
+        DEBUG_Printf(" EAX:%08lx EBX:%08lx ECX:%08lx EDX:%08lx\n",
+                     ctx->Eax, ctx->Ebx,
+                     ctx->Ecx, ctx->Edx );
+        DEBUG_Printf(" ESI:%08lx EDI:%08lx\n",
+                     ctx->Esi, ctx->Edi );
     }
 #endif
 }
@@ -145,8 +145,8 @@
 /* Check that a selector is a valid ring-3 LDT selector, or a NULL selector */
 #define CHECK_SEG(seg,name) \
     if (((seg) & ~3) && ((((seg) & 7) != 7) || !DEBUG_IsSelector(seg))) { \
-        DEBUG_Printf( DBG_CHN_MESG, "*** Invalid value for %s register: %04x\n", \
-                      (name), (WORD)(seg) ); \
+        DEBUG_Printf("*** Invalid value for %s register: %04x\n", \
+                     (name), (WORD)(seg) ); \
         return FALSE; \
     }
 
@@ -164,14 +164,14 @@
 
     if (!(DEBUG_context.SegCs & ~3))
     {
-        DEBUG_Printf( DBG_CHN_MESG, "*** Invalid value for CS register: %04x\n",
-                      (WORD)DEBUG_context.SegCs );
+        DEBUG_Printf("*** Invalid value for CS register: %04x\n",
+                     (WORD)DEBUG_context.SegCs );
         return FALSE;
     }
     if (!(DEBUG_context.SegSs & ~3))
     {
-        DEBUG_Printf( DBG_CHN_MESG, "*** Invalid value for SS register: %04x\n",
-                      (WORD)DEBUG_context.SegSs );
+        DEBUG_Printf("*** Invalid value for SS register: %04x\n",
+                     (WORD)DEBUG_context.SegSs );
         return FALSE;
     }
 
Index: programs/winedbg/source.c
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/programs/winedbg/source.c,v
retrieving revision 1.4
diff -u -r1.4 source.c
--- programs/winedbg/source.c        16 Oct 2003 19:12:49 -0000        1.4
+++ programs/winedbg/source.c        13 Dec 2003 07:19:17 -0000
@@ -68,12 +68,12 @@
 {
   struct searchlist * sl;
 
-  DEBUG_Printf(DBG_CHN_MESG,"Search list :\n");
+  DEBUG_Printf("Search list :\n");
   for(sl = listhead; sl; sl = sl->next)
     {
-      DEBUG_Printf(DBG_CHN_MESG, "\t%s\n", sl->path);
+      DEBUG_Printf("\t%s\n", sl->path);
     }
-  DEBUG_Printf(DBG_CHN_MESG, "\n");
+  DEBUG_Printf("\n");
 }
 
 void
@@ -250,7 +250,7 @@
                     ol->nlines = 0;
                     ol->linelist = NULL;
                     ofiles = ol;
-                    DEBUG_Printf(DBG_CHN_MESG,"Unable to open file %s\n", tmppath);
+                    DEBUG_Printf("Unable to open file %s\n", tmppath);
                     return FALSE;
                 }
             }
@@ -329,7 +329,7 @@
             memcpy(&buffer, addr + ol->linelist[i],
                    (ol->linelist[i+1] - ol->linelist[i]) - 1);
         }
-        DEBUG_Printf(DBG_CHN_MESG,"%d\t%s\n", i + 1,  buffer);
+        DEBUG_Printf("%d\t%s\n", i + 1,  buffer);
     }
 
     DEBUG_UnmapFile(addr, hMap);
@@ -355,7 +355,7 @@
       && source2->sourcefile != NULL
       && strcmp(source1->sourcefile, source2->sourcefile) != 0 )
     {
-      DEBUG_Printf(DBG_CHN_MESG, "Ambiguous source file specification.\n");
+      DEBUG_Printf("Ambiguous source file specification.\n");
       return;
     }
 
@@ -379,7 +379,7 @@
 
   if( sourcefile == NULL )
     {
-      DEBUG_Printf(DBG_CHN_MESG, "No source file specified.\n");
+      DEBUG_Printf("No source file specified.\n");
       return;
     }
 
@@ -442,14 +442,14 @@
    BOOL                ret = TRUE;
 
    DEBUG_PrintAddress(addr, DEBUG_CurrThread->dbg_mode, TRUE);
-   DEBUG_Printf(DBG_CHN_MESG, ": ");
+   DEBUG_Printf(": ");
    if (!DEBUG_READ_MEM_VERBOSE((void*)DEBUG_ToLinear(addr), &ch, sizeof(ch))) {
-      DEBUG_Printf(DBG_CHN_MESG, "-- no code --");
+      DEBUG_Printf("-- no code --");
       ret = FALSE;
    } else {
       DEBUG_Disasm(addr, TRUE);
    }
-   DEBUG_Printf(DBG_CHN_MESG,"\n");
+   DEBUG_Printf("\n");
    return ret;
 }
 
Index: programs/winedbg/stabs.c
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/programs/winedbg/stabs.c,v
retrieving revision 1.10
diff -u -r1.10 stabs.c
--- programs/winedbg/stabs.c        23 Sep 2003 22:54:57 -0000        1.10
+++ programs/winedbg/stabs.c        13 Dec 2003 09:35:41 -0000
@@ -68,6 +68,11 @@
 #endif
 #endif
 
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(winedbg);
+WINE_DECLARE_DEBUG_CHANNEL(winedbg_stabs);
+
 #ifndef N_UNDF
 #define N_UNDF                0x00
 #endif
@@ -230,7 +235,7 @@
 {
   struct datatype** ret;
 
-  /* DEBUG_Printf(DBG_CHN_MESG, "creating type id for (%d,%d)\n", filenr, subnr); */
+  WINE_TRACE_(winedbg_stabs)("creating type id for (%d,%d)\n", filenr, subnr);
 
   /* FIXME: I could perhaps create a dummy include_def for each compilation
    * unit which would allow not to handle those two cases separately
@@ -261,7 +266,7 @@
         }
       ret = &idef->vector[subnr];
     }
-  /* DEBUG_Printf(DBG_CHN_MESG,"(%d,%d) is %d\n",filenr,subnr,ret); */
+  WINE_TRACE_(winedbg_stabs)("(%d,%d) is %p\n",filenr,subnr,ret);
   return ret;
 }
 
@@ -606,7 +611,7 @@
             if (*++ptd->ptr == 's') {
                 ptd->ptr++;
                 if (DEBUG_PTS_ReadNum(ptd, &sz) == -1) {
-                    DEBUG_Printf(DBG_CHN_MESG, "Not an attribute... NIY\n");
+                    WINE_ERR_(winedbg_stabs)("Not an attribute... NIY\n");
                     ptd->ptr -= 2;
                     return -1;
                 }
@@ -664,8 +669,7 @@
                 *DEBUG_FileSubNr2StabEnum(filenr1, subnr1) = new_dt;
             } else {
                 if (DEBUG_GetType(dt1) != DT_STRUCT) {
-                    DEBUG_Printf(DBG_CHN_MESG,
-                                 "Forward declaration is not an aggregate\n");
+                    WINE_ERR_(winedbg_stabs)("Forward declaration is not an aggregate\n");
                     return -1;
                 }
 
@@ -780,7 +784,7 @@
             }
             break;
         default:
-            DEBUG_Printf(DBG_CHN_MESG, "Unknown type '%c'\n", ptd->ptr[-1]);
+            WINE_ERR_(winedbg_stabs)("Unknown type '%c'\n", ptd->ptr[-1]);
             return -1;
         }
     }
@@ -796,13 +800,11 @@
 
     *DEBUG_FileSubNr2StabEnum(filenr1, subnr1) = *ret_dt = new_dt;
 
-#if 0
-    if (typename) {
-        DEBUG_Printf(DBG_CHN_MESG, "Adding (%d,%d) %s => ", filenr1, subnr1, typename);
+    if (typename && WINE_TRACE_ON(winedbg_stabs)) {
+        DEBUG_Printf("Adding (%d,%d) %s => ", filenr1, subnr1, typename);
         DEBUG_PrintTypeCast(new_dt);
-        DEBUG_Printf(DBG_CHN_MESG, "\n");
+        DEBUG_Printf("\n");
     }
-#endif
 
     return 0;
 }
@@ -836,20 +838,20 @@
     if (ret == -1 || *ptd.ptr) {
 #ifdef PTS_DEBUG
         int     i;
-        DEBUG_Printf(DBG_CHN_MESG, "Failure on %s\n", ptr);
+        WINE_TRACE_(winedbg_stabs)("Failure on %s\n", ptr);
         if (ret == -1)
         {
             for (i = 0; i < ptd.err_idx; i++)
             {
-                DEBUG_Printf(DBG_CHN_MESG, "[%d]: line %d => %s\n", 
-                             i, ptd.errors[i].line, ptd.errors[i].ptr);
+                WINE_TRACE_(winedbg_stabs)("[%d]: line %d => %s\n", 
+                                           i, ptd.errors[i].line, ptd.errors[i].ptr);
             }
         }
         else
-            DEBUG_Printf(DBG_CHN_MESG, "[0]: => %s\n", ptd.ptr);
+            WINE_TRACE_(winedbg_stabs)("[0]: => %s\n", ptd.ptr);
             
 #else
-        DEBUG_Printf(DBG_CHN_MESG, "Failure on %s at %s\n", ptr, ptd.ptr);
+        WINE_ERR_(winedbg_stabs)("Failure on %s at %s\n", ptr, ptd.ptr);
 #endif
         return FALSE;
     }
@@ -988,7 +990,8 @@
 
           stab_strcpy(symname, sizeof(symname), ptr);
 #ifdef __ELF__
-          new_value.addr.off = 0;
+          // EPP used to be: new_value.addr.off = 0;
+          new_value.addr.off = (unsigned long)load_offset + stab_ptr->n_value;
           curr_sym = DEBUG_AddSymbol( symname, &new_value, currpath,
                                       SYM_WINE | SYM_DATA | SYM_INVALID );
 #else
@@ -1197,17 +1200,15 @@
            */
           break;
         default:
-          DEBUG_Printf(DBG_CHN_MESG, "Unknown stab type 0x%02x\n", stab_ptr->n_type);
+          WINE_ERR_(winedbg_stabs)("Unknown stab type 0x%02x\n", stab_ptr->n_type);
           break;
         }
 
       stabbuff[0] = '\0';
 
-#if 0
-      DEBUG_Printf(DBG_CHN_MESG, "0x%02x %x %s\n", stab_ptr->n_type,
-                   (unsigned int) stab_ptr->n_value,
-                   strs + (unsigned int) stab_ptr->n_un.n_name);
-#endif
+      WINE_TRACE_(winedbg_stabs)("0x%02x %x %s\n", stab_ptr->n_type,
+                                 (unsigned int) stab_ptr->n_value,
+                                 strs + (unsigned int) stab_ptr->n_un.n_name);
     }
 
   DEBUG_FreeIncludes();
@@ -1314,7 +1315,7 @@
     int                stabstrsect;
 
     if (module->type != DMT_ELF || !module->elf_info) {
-        DEBUG_Printf(DBG_CHN_ERR, "Bad elf module '%s'\n", module->module_name);
+        WINE_ERR("Bad elf module '%s'\n", module->module_name);
         return DIL_ERROR;
     }
 
@@ -1354,7 +1355,7 @@
     }
 
     if (stabsect == -1 || stabstrsect == -1) {
-        DEBUG_Printf(DBG_CHN_WARN, "No .stab section\n");
+        WINE_WARN("No .stab section\n");
         goto leave;
     }
 
@@ -1370,7 +1371,7 @@
         dil = DIL_LOADED;
     } else {
         dil = DIL_ERROR;
-        DEBUG_Printf(DBG_CHN_WARN, "Couldn't read correctly read stabs\n");
+        WINE_WARN("Couldn't read correctly read stabs\n");
         goto leave;
     }
 
@@ -1420,7 +1421,7 @@
     DWORD        size;
     DWORD        delta;
 
-    DEBUG_Printf(DBG_CHN_TRACE, "Processing elf file '%s'\n", filename);
+    WINE_TRACE("Processing elf file '%s'\n", filename);
 
     /* check that the file exists, and that the module hasn't been loaded yet */
     if (stat(filename, &statbuf) == -1) goto leave;
@@ -1486,7 +1487,7 @@
     }
 
     if ((module->elf_info = DBG_alloc(sizeof(ELF_DBG_INFO))) == NULL) {
-        DEBUG_Printf(DBG_CHN_ERR, "OOM\n");
+        WINE_ERR("OOM\n");
         exit(0);
     }
 
@@ -1640,8 +1641,7 @@
     if (dbg_hdr.r_brk) {
         DBG_VALUE        value;
 
-        DEBUG_Printf(DBG_CHN_TRACE, "Setting up a breakpoint on r_brk(%lx)\n",
-                     (unsigned long)dbg_hdr.r_brk);
+        WINE_TRACE("Setting up a breakpoint on r_brk(%lx)\n", (unsigned long)dbg_hdr.r_brk);
 
         DEBUG_SetBreakpoints(FALSE);
         value.type = NULL;
Index: programs/winedbg/stack.c
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/programs/winedbg/stack.c,v
retrieving revision 1.1
diff -u -r1.1 stack.c
--- programs/winedbg/stack.c        13 Sep 2002 17:54:28 -0000        1.1
+++ programs/winedbg/stack.c        13 Dec 2003 07:24:15 -0000
@@ -76,7 +76,7 @@
     value.addr.seg = DEBUG_context.SegSs;
     value.addr.off = DEBUG_context.Esp;
 
-    DEBUG_Printf(DBG_CHN_MESG,"Stack dump:\n");
+    DEBUG_Printf("Stack dump:\n");
     switch (DEBUG_GetSelectorType(value.addr.seg))
     {
     case MODE_32: /* 32-bit mode */
@@ -88,9 +88,9 @@
         DEBUG_ExamineMemory( &value, 24, 'w' );
         break;
     default:
-       DEBUG_Printf(DBG_CHN_MESG, "Bad segment (%ld)\n", value.addr.seg);
+       DEBUG_Printf("Bad segment (%ld)\n", value.addr.seg);
     }
-    DEBUG_Printf(DBG_CHN_MESG,"\n");
+    DEBUG_Printf("\n");
 #endif
 }
 
@@ -102,7 +102,7 @@
     frames = (struct bt_info *)DBG_realloc(frames,
                                            nframe*sizeof(struct bt_info));
     if (noisy)
-      DEBUG_Printf(DBG_CHN_MESG,"%s%d ", (theframe == curr_frame ? "=>" : "  "),
+      DEBUG_Printf("%s%d ", (theframe == curr_frame ? "=>" : "  "),
               frameno);
     frames[theframe].cs = code->seg;
     frames[theframe].eip = code->off;
@@ -115,8 +115,8 @@
     frames[theframe].ss = stack->seg;
     frames[theframe].ebp = stack->off;
     if (noisy) {
-      DEBUG_Printf( DBG_CHN_MESG, (mode != MODE_32) ? " (bp=%04lx%s)\n" : " (ebp=%08lx%s)\n",
-                    stack->off, caveat?caveat:"" );
+      DEBUG_Printf((mode != MODE_32) ? " (bp=%04lx%s)\n" : " (ebp=%08lx%s)\n",
+                   stack->off, caveat ? caveat : "");
     }
 }
 
@@ -205,7 +205,7 @@
     int                        copy_curr_frame = 0;
     struct bt_info*         copy_frames = NULL;
 
-    if (noisy) DEBUG_Printf( DBG_CHN_MESG, "Backtrace:\n" );
+    if (noisy) DEBUG_Printf("Backtrace:\n");
 
     if (tid == DEBUG_CurrTid)
     {
@@ -221,7 +221,7 @@
 
          if (!thread)
          {
-              DEBUG_Printf( DBG_CHN_MESG, "Unknown thread id (0x%08lx) in current process\n", tid);
+              DEBUG_Printf("Unknown thread id (0x%08lx) in current process\n", tid);
               return;
          }
          memset(&ctx, 0, sizeof(ctx));
@@ -230,7 +230,7 @@
          if ( SuspendThread( thread->handle ) == -1 ||
               !GetThreadContext( thread->handle, &ctx ))
          {
-              DEBUG_Printf( DBG_CHN_MESG, "Can't get context for thread id (0x%08lx) in current process\n", tid);
+              DEBUG_Printf("Can't get context for thread id (0x%08lx) in current process\n", tid);
               return;
          }
          /* need to avoid trashing stack frame for current thread */
@@ -280,7 +280,7 @@
         is16 = TRUE;
         break;
     default:
-        if (noisy) DEBUG_Printf( DBG_CHN_MESG, "Bad segment '%x'\n", ss);
+        if (noisy) DEBUG_Printf("Bad segment '%x'\n", ss);
         return;
     }
 
@@ -289,14 +289,14 @@
      */
     cur_switch = (DWORD)thread->teb + OFFSET_OF(TEB, cur_stack);
     if (!DEBUG_READ_MEM((void*)cur_switch, &next_switch, sizeof(next_switch))) {
-        if (noisy) DEBUG_Printf( DBG_CHN_MESG, "Can't read TEB:cur_stack\n");
+        if (noisy) DEBUG_Printf("Can't read TEB:cur_stack\n");
         return;
     }
 
     if (is16) {
         if (!DEBUG_READ_MEM((void*)next_switch, &frame32, sizeof(STACK32FRAME))) {
-            if (noisy) DEBUG_Printf( DBG_CHN_MESG, "Bad stack frame 0x%08lx\n",
-                                     (unsigned long)(STACK32FRAME*)next_switch );
+            if (noisy) DEBUG_Printf("Bad stack frame 0x%08lx\n",
+                                    (unsigned long)(STACK32FRAME*)next_switch );
             return;
         }
         cur_switch = (DWORD)frame32.frame16;
@@ -308,8 +308,8 @@
         p = DEBUG_ToLinear(&tmp);
 
         if (!DEBUG_READ_MEM((void*)p, &frame16, sizeof(STACK16FRAME))) {
-            if (noisy) DEBUG_Printf( DBG_CHN_MESG, "Bad stack frame 0x%08lx\n",
-                                     (unsigned long)(STACK16FRAME*)p );
+            if (noisy) DEBUG_Printf("Bad stack frame 0x%08lx\n",
+                                    (unsigned long)(STACK16FRAME*)p );
             return;
         }
         cur_switch = (DWORD)frame16.frame32;
@@ -330,8 +330,8 @@
            if (is16) {
 
                if (!DEBUG_READ_MEM((void*)next_switch, &frame32, sizeof(STACK32FRAME))) {
-                  if (noisy) DEBUG_Printf( DBG_CHN_MESG, "Bad stack frame 0x%08lx\n",
-                                           (unsigned long)(STACK32FRAME*)next_switch );
+                  if (noisy) DEBUG_Printf("Bad stack frame 0x%08lx\n",
+                                          (unsigned long)(STACK32FRAME*)next_switch );
                   return;
                }
 
@@ -349,8 +349,8 @@
                p = DEBUG_ToLinear(&tmp);
 
                if (!DEBUG_READ_MEM((void*)p, &frame16, sizeof(STACK16FRAME))) {
-                   if (noisy) DEBUG_Printf( DBG_CHN_MESG, "Bad stack frame 0x%08lx\n",
-                                            (unsigned long)(STACK16FRAME*)p );
+                   if (noisy) DEBUG_Printf("Bad stack frame 0x%08lx\n",
+                                           (unsigned long)(STACK16FRAME*)p );
                    return;
                }
                cur_switch = (DWORD)frame16.frame32;
@@ -364,8 +364,8 @@
               p = DEBUG_ToLinear(&tmp);
 
               if (!DEBUG_READ_MEM((void*)p, &frame16, sizeof(STACK16FRAME))) {
-                  if (noisy) DEBUG_Printf( DBG_CHN_MESG, "Bad stack frame 0x%08lx\n",
-                                           (unsigned long)(STACK16FRAME*)p );
+                  if (noisy) DEBUG_Printf("Bad stack frame 0x%08lx\n",
+                                          (unsigned long)(STACK16FRAME*)p );
                   return;
               }
 
@@ -379,8 +379,8 @@
 
               next_switch = cur_switch;
               if (!DEBUG_READ_MEM((void*)next_switch, &frame32, sizeof(STACK32FRAME))) {
-                 if (noisy) DEBUG_Printf( DBG_CHN_MESG, "Bad stack frame 0x%08lx\n",
-                                          (unsigned long)(STACK32FRAME*)next_switch );
+                 if (noisy) DEBUG_Printf("Bad stack frame 0x%08lx\n",
+                                         (unsigned long)(STACK32FRAME*)next_switch );
                  return;
               }
               cur_switch = (DWORD)frame32.frame16;
@@ -399,7 +399,7 @@
               : DEBUG_Frame32( &addr, &cs, ++frameno, noisy);
         }
     }
-    if (noisy) DEBUG_Printf( DBG_CHN_MESG, "\n" );
+    if (noisy) DEBUG_Printf("\n");
 
     if (tid != DEBUG_CurrTid)
     {
Index: programs/winedbg/types.c
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/programs/winedbg/types.c,v
retrieving revision 1.5
diff -u -r1.5 types.c
--- programs/winedbg/types.c        9 Oct 2003 04:39:01 -0000        1.5
+++ programs/winedbg/types.c        13 Dec 2003 08:06:59 -0000
@@ -34,6 +34,9 @@
 #endif
 
 #include "debugger.h"
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(winedbg);
 
 #define NR_TYPE_HASH 521
 
@@ -368,8 +371,7 @@
    case DT_BASIC:
 
       if (value.type->un.basic.basic_size > sizeof(rtn)) {
-         DEBUG_Printf(DBG_CHN_ERR, "Size too large (%d)\n",
-                      value.type->un.basic.basic_size);
+         WINE_ERR("Size too large (%d)\n", value.type->un.basic.basic_size);
          return 0;
       }
       /* FIXME: following code implies i386 byte ordering */
@@ -576,11 +578,11 @@
 DEBUG_CopyFieldlist(struct datatype * dt, struct datatype * dt2)
 {
   if (!(dt->type == dt2->type && ((dt->type == DT_STRUCT) || (dt->type == DT_ENUM)))) {
-    DEBUG_Printf(DBG_CHN_MESG, "Error: Copyfield list mismatch (%d<>%d): ", dt->type, dt2->type);
+    DEBUG_Printf("Error: Copyfield list mismatch (%d<>%d): ", dt->type, dt2->type);
     DEBUG_PrintTypeCast(dt);
-    DEBUG_Printf(DBG_CHN_MESG, " ");
+    DEBUG_Printf(" ");
     DEBUG_PrintTypeCast(dt2);
-    DEBUG_Printf(DBG_CHN_MESG, "\n");
+    DEBUG_Printf("\n");
     return FALSE;
   }
 
@@ -750,7 +752,7 @@
     case DT_FUNC:
       assert(FALSE);
     default:
-      DEBUG_Printf(DBG_CHN_ERR, "Unknown type???\n");
+      WINE_ERR("Unknown type???\n");
       break;
     }
   return 0;
@@ -814,7 +816,7 @@
 
   if (count != 1)
     {
-      DEBUG_Printf( DBG_CHN_MESG, "Count other than 1 is meaningless in 'print' command\n" );
+      DEBUG_Printf("Count other than 1 is meaningless in 'print' command\n");
       return;
     }
 
@@ -822,8 +824,8 @@
   {
       /* No type, just print the addr value */
       if (value->addr.seg && (value->addr.seg != 0xffffffff))
-          DEBUG_nchar += DEBUG_Printf( DBG_CHN_MESG, "0x%04lx: ", value->addr.seg );
-      DEBUG_nchar += DEBUG_Printf( DBG_CHN_MESG, "0x%08lx", value->addr.off );
+          DEBUG_nchar += DEBUG_Printf("0x%04lx: ", value->addr.seg);
+      DEBUG_nchar += DEBUG_Printf("0x%08lx", value->addr.off);
       goto leave;
   }
 
@@ -834,13 +836,13 @@
 
   if( DEBUG_nchar > DEBUG_maxchar )
     {
-      DEBUG_Printf(DBG_CHN_MESG, "...");
+      DEBUG_Printf("...");
       goto leave;
     }
 
   if( format == 'i' || format == 's' || format == 'w' || format == 'b' || format == 'g')
     {
-      DEBUG_Printf( DBG_CHN_MESG, "Format specifier '%c' is meaningless in 'print' command\n", format );
+      DEBUG_Printf("Format specifier '%c' is meaningless in 'print' command\n", format);
       format = '\0';
     }
 
@@ -852,24 +854,24 @@
       DEBUG_PrintBasic(value, 1, format);
       break;
     case DT_STRUCT:
-      DEBUG_nchar += DEBUG_Printf(DBG_CHN_MESG, "{");
+      DEBUG_nchar += DEBUG_Printf("{");
       for(m = value->type->un.structure.members; m; m = m->next)
         {
           val1 = *value;
           DEBUG_FindStructElement(&val1, m->name, &xval);
-          DEBUG_nchar += DEBUG_Printf(DBG_CHN_MESG, "%s=", m->name);
+          DEBUG_nchar += DEBUG_Printf("%s=", m->name);
           DEBUG_Print(&val1, 1, format, level + 1);
           if( m->next != NULL )
             {
-              DEBUG_nchar += DEBUG_Printf(DBG_CHN_MESG, ", ");
+              DEBUG_nchar += DEBUG_Printf(", ");
             }
           if( DEBUG_nchar > DEBUG_maxchar )
             {
-              DEBUG_Printf(DBG_CHN_MESG, "...}");
+              DEBUG_Printf("...}");
               goto leave;
             }
         }
-      DEBUG_nchar += DEBUG_Printf(DBG_CHN_MESG, "}");
+      DEBUG_nchar += DEBUG_Printf("}");
       break;
     case DT_ARRAY:
       /*
@@ -888,47 +890,47 @@
           clen = (DEBUG_nchar + len < DEBUG_maxchar)
               ? len : (DEBUG_maxchar - DEBUG_nchar);
 
-          DEBUG_nchar += DEBUG_Printf(DBG_CHN_MESG, "\"");
+          DEBUG_nchar += DEBUG_Printf("\"");
           switch (value->cookie)
           {
           case DV_TARGET:
-              DEBUG_nchar += DEBUG_PrintStringA(DBG_CHN_MESG, &value->addr, clen);
+              DEBUG_nchar += DEBUG_PrintStringA(&value->addr, clen);
               break;
           case DV_HOST:
-              DEBUG_OutputA(DBG_CHN_MESG, pnt, clen);
+              DEBUG_OutputA(pnt, clen);
               break;
           default: assert(0);
           }
-          DEBUG_nchar += DEBUG_Printf(DBG_CHN_MESG, (len > clen) ? "...\"" : "\"");
+          DEBUG_nchar += DEBUG_Printf((len > clen) ? "...\"" : "\"");
           break;
         }
       val1 = *value;
       val1.type = value->type->un.array.basictype;
-      DEBUG_nchar += DEBUG_Printf(DBG_CHN_MESG, "{");
+      DEBUG_nchar += DEBUG_Printf("{");
       for( i=value->type->un.array.start; i <= value->type->un.array.end; i++ )
         {
           DEBUG_Print(&val1, 1, format, level + 1);
           val1.addr.off += size;
           if( i == value->type->un.array.end )
             {
-              DEBUG_nchar += DEBUG_Printf(DBG_CHN_MESG, "}");
+              DEBUG_nchar += DEBUG_Printf("}");
             }
           else
             {
-              DEBUG_nchar += DEBUG_Printf(DBG_CHN_MESG, ", ");
+              DEBUG_nchar += DEBUG_Printf(", ");
             }
           if( DEBUG_nchar > DEBUG_maxchar )
             {
-              DEBUG_Printf(DBG_CHN_MESG, "...}");
+              DEBUG_Printf("...}");
               goto leave;
             }
         }
       break;
     case DT_FUNC:
-      DEBUG_Printf(DBG_CHN_MESG, "Function at ???\n");
+      DEBUG_Printf("Function at ???\n");
       break;
     default:
-      DEBUG_Printf(DBG_CHN_MESG, "Unknown type (%d)\n", value->type->type);
+      DEBUG_Printf("Unknown type (%d)\n", value->type->type);
       assert(FALSE);
       break;
     }
@@ -937,7 +939,7 @@
 
   if( level == 0 )
     {
-      DEBUG_nchar += DEBUG_Printf(DBG_CHN_MESG, "\n");
+      DEBUG_nchar += DEBUG_Printf("\n");
     }
 }
 
@@ -945,58 +947,56 @@
 {
     const char* name = (dt->name) ? dt->name : "--none--";
 
-/* EPP     DEBUG_Printf(DBG_CHN_MESG, "0x%08lx ", (unsigned long)dt); */
     switch (dt->type)
     {
     case DT_BASIC:
-        DEBUG_Printf(DBG_CHN_MESG, "BASIC(%s)", name);
+        DEBUG_Printf("BASIC(%s)", name);
         break;
     case DT_POINTER:
-        DEBUG_Printf(DBG_CHN_MESG, "POINTER(%s)<", name);
+        DEBUG_Printf("POINTER(%s)<", name);
         DEBUG_DumpAType(dt->un.pointer.pointsto, FALSE);
-        DEBUG_Printf(DBG_CHN_MESG, ">");
+        DEBUG_Printf(">");
         break;
     case DT_STRUCT:
-        DEBUG_Printf(DBG_CHN_MESG, "STRUCT(%s) %d {",
+        DEBUG_Printf("STRUCT(%s) %d {",
                      name, dt->un.structure.size);
         if (dt->un.structure.members != NULL)
         {
             struct member * m;
             for (m = dt->un.structure.members; m; m = m->next)
             {
-                DEBUG_Printf(DBG_CHN_MESG, " %s(%d", 
-                             m->name, m->offset / 8);
+                DEBUG_Printf(" %s(%d", m->name, m->offset / 8);
                 if (m->offset % 8 != 0)
-                    DEBUG_Printf(DBG_CHN_MESG, ".%d", m->offset / 8);
-                DEBUG_Printf(DBG_CHN_MESG, "/%d", m->size / 8);
+                    DEBUG_Printf(".%d", m->offset / 8);
+                DEBUG_Printf("/%d", m->size / 8);
                 if (m->size % 8 != 0)
-                    DEBUG_Printf(DBG_CHN_MESG, ".%d", m->size % 8);
-                DEBUG_Printf(DBG_CHN_MESG, ")");
+                    DEBUG_Printf(".%d", m->size % 8);
+                DEBUG_Printf(")");
             }
         }
-        DEBUG_Printf(DBG_CHN_MESG, " }");
+        DEBUG_Printf(" }");
         break;
     case DT_ARRAY:
-        DEBUG_Printf(DBG_CHN_MESG, "ARRAY(%s)[", name);
+        DEBUG_Printf("ARRAY(%s)[", name);
         DEBUG_DumpAType(dt->un.array.basictype, FALSE);
-        DEBUG_Printf(DBG_CHN_MESG, "]");
+        DEBUG_Printf("]");
         break;
     case DT_ENUM:
-        DEBUG_Printf(DBG_CHN_MESG, "ENUM(%s)", name);
+        DEBUG_Printf("ENUM(%s)", name);
         break;
     case DT_BITFIELD:
-        DEBUG_Printf(DBG_CHN_MESG, "BITFIELD(%s)", name);
+        DEBUG_Printf("BITFIELD(%s)", name);
         break;
     case DT_FUNC:
-        DEBUG_Printf(DBG_CHN_MESG, "FUNC(%s)(", name);
+        DEBUG_Printf("FUNC(%s)(", name);
         DEBUG_DumpAType(dt->un.funct.rettype, FALSE);
-        DEBUG_Printf(DBG_CHN_MESG, ")");
+        DEBUG_Printf(")");
         break;
     default:
-        DEBUG_Printf(DBG_CHN_ERR, "Unknown type???");
+        WINE_ERR("Unknown type???");
         break;
     }
-    if (deep) DEBUG_Printf(DBG_CHN_MESG, "\n");
+    if (deep) DEBUG_Printf("\n");
 }
 
 int DEBUG_DumpTypes(void)
@@ -1051,7 +1051,7 @@
 
   if(dt == NULL)
     {
-      DEBUG_Printf(DBG_CHN_MESG, "--invalid--");
+      DEBUG_Printf("--invalid--");
       return FALSE;
     }
 
@@ -1063,31 +1063,31 @@
   switch(dt->type)
     {
     case DT_BASIC:
-      DEBUG_Printf(DBG_CHN_MESG, "%s", name);
+      DEBUG_Printf("%s", name);
       break;
     case DT_POINTER:
       DEBUG_PrintTypeCast(dt->un.pointer.pointsto);
-      DEBUG_Printf(DBG_CHN_MESG, "*");
+      DEBUG_Printf("*");
       break;
     case DT_STRUCT:
-      DEBUG_Printf(DBG_CHN_MESG, "struct %s", name);
+      DEBUG_Printf("struct %s", name);
       break;
     case DT_ARRAY:
-      DEBUG_Printf(DBG_CHN_MESG, "%s[]", name);
+      DEBUG_Printf("%s[]", name);
       break;
     case DT_ENUM:
-      DEBUG_Printf(DBG_CHN_MESG, "enum %s", name);
+      DEBUG_Printf("enum %s", name);
       break;
     case DT_BITFIELD:
-      DEBUG_Printf(DBG_CHN_MESG, "unsigned %s", name);
+      DEBUG_Printf("unsigned %s", name);
       break;
     case DT_FUNC:
       DEBUG_PrintTypeCast(dt->un.funct.rettype);
-      DEBUG_Printf(DBG_CHN_MESG, "(*%s)()", name);
+      DEBUG_Printf("(*%s)()", name);
       break;
     default:
-       DEBUG_Printf(DBG_CHN_ERR, "Unknown type???\n");
-       break;
+      WINE_ERR("Unknown type???\n");
+      break;
     }
 
   return TRUE;
@@ -1099,11 +1099,11 @@
 
    if (!value->type)
    {
-      DEBUG_Printf(DBG_CHN_MESG, "Unknown type\n");
+      DEBUG_Printf("Unknown type\n");
       return FALSE;
    }
    if (!DEBUG_PrintTypeCast(value->type))
       return FALSE;
-   DEBUG_Printf(DBG_CHN_MESG, "\n");
+   DEBUG_Printf("\n");
    return TRUE;
 }
Index: programs/winedbg/winedbg.c
===================================================================
RCS file: /home/cvs/cvsroot/wine/wine/programs/winedbg/winedbg.c,v
retrieving revision 1.16
diff -u -r1.16 winedbg.c
--- programs/winedbg/winedbg.c        27 Nov 2003 00:59:36 -0000        1.16
+++ programs/winedbg/winedbg.c        13 Dec 2003 08:07:23 -0000
@@ -38,6 +38,10 @@
 #include "wine/library.h"
 #include "winnls.h"
 
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(winedbg);
+
 DBG_PROCESS*        DEBUG_CurrProcess = NULL;
 DBG_THREAD*        DEBUG_CurrThread = NULL;
 DWORD                DEBUG_CurrTid;
@@ -53,15 +57,12 @@
 
 DBG_INTVAR DEBUG_IntVars[DBG_IV_LAST];
 
-void        DEBUG_OutputA(int chn, const char* buffer, int len)
+void        DEBUG_OutputA(const char* buffer, int len)
 {
-    if (DBG_IVAR(ConChannelMask) & chn)
-        WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), buffer, len, NULL, NULL);
-    if (DBG_IVAR(StdChannelMask) & chn)
-        fwrite(buffer, len, 1, stderr);
+    WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), buffer, len, NULL, NULL);
 }
 
-void        DEBUG_OutputW(int chn, const WCHAR* buffer, int len)
+void        DEBUG_OutputW(const WCHAR* buffer, int len)
 {
         char* ansi = NULL;
         int newlen;
@@ -97,12 +98,12 @@
         
         if(ansi)
         {
-                DEBUG_OutputA(chn, ansi, newlen);
+                DEBUG_OutputA(ansi, newlen);
                 DBG_free(ansi);
         }
 }
 
-int        DEBUG_Printf(int chn, const char* format, ...)
+int        DEBUG_Printf(const char* format, ...)
 {
 static    char        buf[4*1024];
     va_list         valist;
@@ -117,7 +118,7 @@
         buf[len] = 0;
         buf[len - 1] = buf[len - 2] = buf[len - 3] = '.';
     }
-    DEBUG_OutputA(chn, buf, len);
+    DEBUG_OutputA(buf, len);
     return len;
 }
 
@@ -140,9 +141,7 @@
     }
 
     if (RegCreateKeyA(HKEY_CURRENT_USER, "Software\\Wine\\WineDbg", &hkey)) {
-        /* since the IVars are not yet setup, DEBUG_Printf doesn't work,
-         * so don't use it */
-        fprintf(stderr, "Cannot create WineDbg key in registry\n");
+        WINE_ERR("Cannot create WineDbg key in registry\n");
         return FALSE;
     }
 
@@ -195,7 +194,7 @@
     {
         if (p->handle != 0)
         {
-            DEBUG_Printf(DBG_CHN_ERR, "Process (%lu) is already defined\n", pid);
+            WINE_ERR("Process (%lu) is already defined\n", pid);
         }
         else
         {
@@ -362,7 +361,7 @@
     if (!(DEBUG_CurrProcess = DEBUG_AddProcess(pid, 0, NULL))) return FALSE;
 
     if (!DebugActiveProcess(pid)) {
-        DEBUG_Printf(DBG_CHN_MESG, "Can't attach process %lx: error %ld\n", pid, GetLastError());
+        DEBUG_Printf("Can't attach process %lx: error %ld\n", pid, GetLastError());
         DEBUG_DelProcess(DEBUG_CurrProcess);
         return FALSE;
     }
@@ -409,7 +408,7 @@
                                ;
     if (!GetThreadContext(DEBUG_CurrThread->handle, &DEBUG_context))
     {
-        DEBUG_Printf(DBG_CHN_WARN, "Can't get thread's context\n");
+        WINE_WARN("Can't get thread's context\n");
         return FALSE;
     }
     return TRUE;
@@ -427,27 +426,32 @@
     if (!is_debug)
     {
         if (!addr.seg)
-            DEBUG_Printf(DBG_CHN_MESG, " in 32-bit code (0x%08lx)", addr.off);
+            DEBUG_Printf(" in 32-bit code (0x%08lx)", addr.off);
         else
-            switch(DEBUG_GetSelectorType(addr.seg))
+            switch (DEBUG_GetSelectorType(addr.seg))
             {
             case MODE_32:
-                DEBUG_Printf(DBG_CHN_MESG, " in 32-bit code (%04lx:%08lx)", addr.seg, addr.off);
+                DEBUG_Printf(" in 32-bit code (%04lx:%08lx)", addr.seg, addr.off);
                 break;
             case MODE_16:
-                DEBUG_Printf(DBG_CHN_MESG, " in 16-bit code (%04lx:%04lx)", addr.seg, addr.off);
+                DEBUG_Printf(" in 16-bit code (%04lx:%04lx)", addr.seg, addr.off);
                 break;
             case MODE_VM86:
-                DEBUG_Printf(DBG_CHN_MESG, " in vm86 code (%04lx:%04lx)", addr.seg, addr.off);
+                DEBUG_Printf(" in vm86 code (%04lx:%04lx)", addr.seg, addr.off);
                 break;
             case MODE_INVALID:
-                DEBUG_Printf(DBG_CHN_MESG, " bad CS (%lx)", addr.seg);
+                DEBUG_Printf(" bad CS (%lx)", addr.seg);
                 break;
         }
-        DEBUG_Printf(DBG_CHN_MESG, ".\n");
+        DEBUG_Printf(".\n");
     }
 
     DEBUG_LoadEntryPoints("Loading new modules symbols:\n");
+    /*
+     * Do a quiet backtrace so that we have an idea of what the situation
+     * is WRT the source files.
+     */
+    DEBUG_BackTrace(DEBUG_CurrTid, FALSE);
 
     if (!force && is_debug &&
         DEBUG_ShouldContinue(&addr, code,
@@ -458,19 +462,13 @@
     if (newmode != DEBUG_CurrThread->dbg_mode)
     {
         static const char * const names[] = { "???", "16-bit", "32-bit", "vm86" };
-        DEBUG_Printf(DBG_CHN_MESG,"In %s mode.\n", names[newmode] );
+        DEBUG_Printf("In %s mode.\n", names[newmode] );
         DEBUG_CurrThread->dbg_mode = newmode;
     }
 
     DEBUG_DoDisplay();
 
-    if (is_debug || force) {
-        /*
-         * Do a quiet backtrace so that we have an idea of what the situation
-         * is WRT the source files.
-         */
-        DEBUG_BackTrace(DEBUG_CurrTid, FALSE);
-    } else {
+    if (!is_debug && !force) {
         /* This is a real crash, dump some info */
         DEBUG_InfoRegisters(&DEBUG_context);
         DEBUG_InfoStack();
@@ -538,9 +536,8 @@
 
         if (ReadProcessMemory(DEBUG_CurrThread->process->handle, pThreadName->szName,
                               pThread->name, 9, NULL))
-            DEBUG_Printf (DBG_CHN_MESG,
-                          "Thread ID=0x%lx renamed using MS VC6 extension (name==\"%s\")\n",
-                          pThread->tid, pThread->name);
+            DEBUG_Printf("Thread ID=0x%lx renamed using MS VC6 extension (name==\"%s\")\n",
+                         pThread->tid, pThread->name);
         return DBG_CONTINUE;
     }
 
@@ -553,44 +550,44 @@
     if (!is_debug)
     {
         /* print some infos */
-        DEBUG_Printf(DBG_CHN_MESG, "%s: ",
-                      first_chance ? "First chance exception" : "Unhandled exception");
+        DEBUG_Printf("%s: ",
+                     first_chance ? "First chance exception" : "Unhandled exception");
         switch (rec->ExceptionCode)
         {
         case EXCEPTION_INT_DIVIDE_BY_ZERO:
-            DEBUG_Printf(DBG_CHN_MESG, "divide by zero");
+            DEBUG_Printf("divide by zero");
             break;
         case EXCEPTION_INT_OVERFLOW:
-            DEBUG_Printf(DBG_CHN_MESG, "overflow");
+            DEBUG_Printf("overflow");
             break;
         case EXCEPTION_ARRAY_BOUNDS_EXCEEDED:
-            DEBUG_Printf(DBG_CHN_MESG, "array bounds ");
+            DEBUG_Printf("array bounds");
             break;
         case EXCEPTION_ILLEGAL_INSTRUCTION:
-            DEBUG_Printf(DBG_CHN_MESG, "illegal instruction");
+            DEBUG_Printf("illegal instruction");
             break;
         case EXCEPTION_STACK_OVERFLOW:
-            DEBUG_Printf(DBG_CHN_MESG, "stack overflow");
+            DEBUG_Printf("stack overflow");
             break;
         case EXCEPTION_PRIV_INSTRUCTION:
-            DEBUG_Printf(DBG_CHN_MESG, "privileged instruction");
+            DEBUG_Printf("privileged instruction");
             break;
         case EXCEPTION_ACCESS_VIOLATION:
             if (rec->NumberParameters == 2)
-                DEBUG_Printf(DBG_CHN_MESG, "page fault on %s access to 0x%08lx",
-                              rec->ExceptionInformation[0] ? "write" : "read",
-                              rec->ExceptionInformation[1]);
+                DEBUG_Printf("page fault on %s access to 0x%08lx",
+                             rec->ExceptionInformation[0] ? "write" : "read",
+                             rec->ExceptionInformation[1]);
             else
-                DEBUG_Printf(DBG_CHN_MESG, "page fault");
+                DEBUG_Printf("page fault");
             break;
         case EXCEPTION_DATATYPE_MISALIGNMENT:
-            DEBUG_Printf(DBG_CHN_MESG, "Alignment");
+            DEBUG_Printf("Alignment");
             break;
         case DBG_CONTROL_C:
-            DEBUG_Printf(DBG_CHN_MESG, "^C");
+            DEBUG_Printf("^C");
             break;
         case CONTROL_C_EXIT:
-            DEBUG_Printf(DBG_CHN_MESG, "^C");
+            DEBUG_Printf("^C");
             break;
         case STATUS_POSSIBLE_DEADLOCK:
             {
@@ -599,12 +596,12 @@
                 addr.seg = 0;
                 addr.off = rec->ExceptionInformation[0];
 
-                DEBUG_Printf(DBG_CHN_MESG, "wait failed on critical section ");
+                DEBUG_Printf("wait failed on critical section ");
                 DEBUG_PrintAddress(&addr, DEBUG_CurrThread->dbg_mode, FALSE);
             }
             if (!DBG_IVAR(BreakOnCritSectTimeOut))
             {
-                DEBUG_Printf(DBG_CHN_MESG, "\n");
+                DEBUG_Printf("\n");
                 return DBG_EXCEPTION_NOT_HANDLED;
             }
             break;
@@ -615,45 +612,45 @@
                                         (char *)rec->ExceptionInformation[0] );
                 DEBUG_ProcessGetString( name, sizeof(name), DEBUG_CurrThread->process->handle,
                                         (char *)rec->ExceptionInformation[1] );
-                DEBUG_Printf(DBG_CHN_MESG, "unimplemented function %s.%s called", dll, name );
+                DEBUG_Printf("unimplemented function %s.%s called", dll, name );
             }
             break;
         case EXCEPTION_WINE_ASSERTION:
-            DEBUG_Printf(DBG_CHN_MESG, "assertion failed");
+            DEBUG_Printf("assertion failed");
             break;
         case EXCEPTION_VM86_INTx:
-            DEBUG_Printf(DBG_CHN_MESG, "interrupt %02lx in vm86 mode",
+            DEBUG_Printf("interrupt %02lx in vm86 mode",
                          rec->ExceptionInformation[0]);
             break;
         case EXCEPTION_VM86_STI:
-            DEBUG_Printf(DBG_CHN_MESG, "sti in vm86 mode");
+            DEBUG_Printf("sti in vm86 mode");
             break;
         case EXCEPTION_VM86_PICRETURN:
-            DEBUG_Printf(DBG_CHN_MESG, "PIC return in vm86 mode");
+            DEBUG_Printf("PIC return in vm86 mode");
             break;
         case EXCEPTION_FLT_DENORMAL_OPERAND:
-            DEBUG_Printf(DBG_CHN_MESG, "denormal float operand");
+            DEBUG_Printf("denormal float operand");
             break;
         case EXCEPTION_FLT_DIVIDE_BY_ZERO:
-            DEBUG_Printf(DBG_CHN_MESG, "divide by zero");
+            DEBUG_Printf("divide by zero");
             break;
         case EXCEPTION_FLT_INEXACT_RESULT:
-            DEBUG_Printf(DBG_CHN_MESG, "inexact float result");
+            DEBUG_Printf("inexact float result");
             break;
         case EXCEPTION_FLT_INVALID_OPERATION:
-            DEBUG_Printf(DBG_CHN_MESG, "invalid float operation");
+            DEBUG_Printf("invalid float operation");
             break;
         case EXCEPTION_FLT_OVERFLOW:
-            DEBUG_Printf(DBG_CHN_MESG, "floating pointer overflow");
+            DEBUG_Printf("floating pointer overflow");
             break;
         case EXCEPTION_FLT_UNDERFLOW:
-            DEBUG_Printf(DBG_CHN_MESG, "floating pointer underflow");
+            DEBUG_Printf("floating pointer underflow");
             break;
         case EXCEPTION_FLT_STACK_CHECK:
-            DEBUG_Printf(DBG_CHN_MESG, "floating point stack check");
+            DEBUG_Printf("floating point stack check");
             break;
         default:
-            DEBUG_Printf(DBG_CHN_MESG, "%08lx", rec->ExceptionCode);
+            DEBUG_Printf("%08lx", rec->ExceptionCode);
             break;
         }
     }
@@ -693,14 +690,14 @@
     case EXCEPTION_DEBUG_EVENT:
         if (!DEBUG_CurrThread)
         {
-            DEBUG_Printf(DBG_CHN_ERR, "%08lx:%08lx: not a registered process or thread (perhaps a 16 bit one ?)\n",
-                         de->dwProcessId, de->dwThreadId);
+            WINE_ERR("%08lx:%08lx: not a registered process or thread (perhaps a 16 bit one ?)\n",
+                     de->dwProcessId, de->dwThreadId);
             break;
         }
 
-        DEBUG_Printf(DBG_CHN_TRACE, "%08lx:%08lx: exception code=%08lx\n",
-                     de->dwProcessId, de->dwThreadId,
-                     de->u.Exception.ExceptionRecord.ExceptionCode);
+        WINE_TRACE("%08lx:%08lx: exception code=%08lx\n",
+                   de->dwProcessId, de->dwThreadId,
+                   de->u.Exception.ExceptionRecord.ExceptionCode);
 
         if (DEBUG_CurrProcess->continue_on_first_exception)
         {
@@ -722,17 +719,17 @@
         break;
 
     case CREATE_THREAD_DEBUG_EVENT:
-        DEBUG_Printf(DBG_CHN_TRACE, "%08lx:%08lx: create thread D @%08lx\n", de->dwProcessId, de->dwThreadId,
-                     (unsigned long)(LPVOID)de->u.CreateThread.lpStartAddress);
+        WINE_TRACE("%08lx:%08lx: create thread D @%08lx\n", de->dwProcessId, de->dwThreadId,
+                   (unsigned long)(LPVOID)de->u.CreateThread.lpStartAddress);
 
         if (DEBUG_CurrProcess == NULL)
         {
-            DEBUG_Printf(DBG_CHN_ERR, "Unknown process\n");
+            WINE_ERR("Unknown process\n");
             break;
         }
         if (DEBUG_GetThread(DEBUG_CurrProcess, de->dwThreadId) != NULL)
         {
-            DEBUG_Printf(DBG_CHN_TRACE, "Thread already listed, skipping\n");
+            WINE_TRACE("Thread already listed, skipping\n");
             break;
         }
 
@@ -743,7 +740,7 @@
                                            de->u.CreateThread.lpThreadLocalBase);
         if (!DEBUG_CurrThread)
         {
-            DEBUG_Printf(DBG_CHN_ERR, "Couldn't create thread\n");
+            WINE_ERR("Couldn't create thread\n");
             break;
         }
         DEBUG_InitCurrThread();
@@ -755,25 +752,25 @@
                                        de->u.CreateProcessInfo.lpImageName,
                                        de->u.CreateProcessInfo.fUnicode);
 
-        DEBUG_Printf(DBG_CHN_TRACE, "%08lx:%08lx: create process '%s'/%p @%08lx (%ld<%ld>)\n",
-                     de->dwProcessId, de->dwThreadId,
-                     buffer, de->u.CreateProcessInfo.lpImageName,
-                     (unsigned long)(LPVOID)de->u.CreateProcessInfo.lpStartAddress,
-                     de->u.CreateProcessInfo.dwDebugInfoFileOffset,
-                     de->u.CreateProcessInfo.nDebugInfoSize);
+        WINE_TRACE("%08lx:%08lx: create process '%s'/%p @%08lx (%ld<%ld>)\n",
+                   de->dwProcessId, de->dwThreadId,
+                   buffer, de->u.CreateProcessInfo.lpImageName,
+                   (unsigned long)(LPVOID)de->u.CreateProcessInfo.lpStartAddress,
+                   de->u.CreateProcessInfo.dwDebugInfoFileOffset,
+                   de->u.CreateProcessInfo.nDebugInfoSize);
 
         DEBUG_CurrProcess = DEBUG_AddProcess(de->dwProcessId,
                                              de->u.CreateProcessInfo.hProcess,
                                              buffer[0] ? buffer : "<Debugged Process>");
         if (DEBUG_CurrProcess == NULL)
         {
-            DEBUG_Printf(DBG_CHN_ERR, "Couldn't create process\n");
+            WINE_ERR("Couldn't create process\n");
             break;
         }
 
-        DEBUG_Printf(DBG_CHN_TRACE, "%08lx:%08lx: create thread I @%08lx\n",
-                     de->dwProcessId, de->dwThreadId,
-                     (unsigned long)(LPVOID)de->u.CreateProcessInfo.lpStartAddress);
+        WINE_TRACE("%08lx:%08lx: create thread I @%08lx\n",
+                   de->dwProcessId, de->dwThreadId,
+                   (unsigned long)(LPVOID)de->u.CreateProcessInfo.lpStartAddress);
 
         DEBUG_CurrThread = DEBUG_AddThread(DEBUG_CurrProcess,
                                            de->dwThreadId,
@@ -782,7 +779,7 @@
                                            de->u.CreateProcessInfo.lpThreadLocalBase);
         if (!DEBUG_CurrThread)
         {
-            DEBUG_Printf(DBG_CHN_ERR, "Couldn't create thread\n");
+            WINE_ERR("Couldn't create thread\n");
             break;
         }
 
@@ -806,12 +803,12 @@
         break;
 
     case EXIT_THREAD_DEBUG_EVENT:
-        DEBUG_Printf(DBG_CHN_TRACE, "%08lx:%08lx: exit thread (%ld)\n",
-                     de->dwProcessId, de->dwThreadId, de->u.ExitThread.dwExitCode);
+        WINE_TRACE("%08lx:%08lx: exit thread (%ld)\n",
+                   de->dwProcessId, de->dwThreadId, de->u.ExitThread.dwExitCode);
 
         if (DEBUG_CurrThread == NULL)
         {
-            DEBUG_Printf(DBG_CHN_ERR, "Unknown thread\n");
+            WINE_ERR("Unknown thread\n");
             break;
         }
         /* FIXME: remove break point set on thread startup */
@@ -819,12 +816,12 @@
         break;
 
     case EXIT_PROCESS_DEBUG_EVENT:
-        DEBUG_Printf(DBG_CHN_TRACE, "%08lx:%08lx: exit process (%ld)\n",
-                     de->dwProcessId, de->dwThreadId, de->u.ExitProcess.dwExitCode);
+        WINE_TRACE("%08lx:%08lx: exit process (%ld)\n",
+                   de->dwProcessId, de->dwThreadId, de->u.ExitProcess.dwExitCode);
 
         if (DEBUG_CurrProcess == NULL)
         {
-            DEBUG_Printf(DBG_CHN_ERR, "Unknown process\n");
+            WINE_ERR("Unknown process\n");
             break;
         }
         /* just in case */
@@ -833,13 +830,13 @@
         DEBUG_DelThread(DEBUG_CurrProcess->threads);
         DEBUG_DelProcess(DEBUG_CurrProcess);
 
-        DEBUG_Printf(DBG_CHN_MESG, "Process of pid=%08lx has terminated\n", DEBUG_CurrPid);
+        DEBUG_Printf("Process of pid=%08lx has terminated\n", DEBUG_CurrPid);
         break;
 
     case LOAD_DLL_DEBUG_EVENT:
         if (DEBUG_CurrThread == NULL)
         {
-            DEBUG_Printf(DBG_CHN_ERR, "Unknown thread\n");
+            WINE_ERR("Unknown thread\n");
             break;
         }
         DEBUG_ProcessGetStringIndirect(buffer, sizeof(buffer),
@@ -847,31 +844,31 @@
                                        de->u.LoadDll.lpImageName,
                                        de->u.LoadDll.fUnicode);
 
-        DEBUG_Printf(DBG_CHN_TRACE, "%08lx:%08lx: loads DLL %s @%08lx (%ld<%ld>)\n",
-                     de->dwProcessId, de->dwThreadId,
-                     buffer, (unsigned long)de->u.LoadDll.lpBaseOfDll,
-                     de->u.LoadDll.dwDebugInfoFileOffset,
-                     de->u.LoadDll.nDebugInfoSize);
+        WINE_TRACE("%08lx:%08lx: loads DLL %s @%08lx (%ld<%ld>)\n",
+                   de->dwProcessId, de->dwThreadId,
+                   buffer, (unsigned long)de->u.LoadDll.lpBaseOfDll,
+                   de->u.LoadDll.dwDebugInfoFileOffset,
+                   de->u.LoadDll.nDebugInfoSize);
         _strupr(buffer);
         DEBUG_LoadModule32(buffer, de->u.LoadDll.hFile, de->u.LoadDll.lpBaseOfDll);
         DEBUG_CheckDelayedBP();
         if (DBG_IVAR(BreakOnDllLoad))
         {
-            DEBUG_Printf(DBG_CHN_MESG, "Stopping on DLL %s loading at %08lx\n",
+            DEBUG_Printf("Stopping on DLL %s loading at %08lx\n",
                          buffer, (unsigned long)de->u.LoadDll.lpBaseOfDll);
             if (DEBUG_FetchContext()) cont = 0;
         }
         break;
 
     case UNLOAD_DLL_DEBUG_EVENT:
-        DEBUG_Printf(DBG_CHN_TRACE, "%08lx:%08lx: unload DLL @%08lx\n", de->dwProcessId, de->dwThreadId,
-                     (unsigned long)de->u.UnloadDll.lpBaseOfDll);
+        WINE_TRACE("%08lx:%08lx: unload DLL @%08lx\n", de->dwProcessId, de->dwThreadId,
+                   (unsigned long)de->u.UnloadDll.lpBaseOfDll);
         break;
 
     case OUTPUT_DEBUG_STRING_EVENT:
         if (DEBUG_CurrThread == NULL)
         {
-            DEBUG_Printf(DBG_CHN_ERR, "Unknown thread\n");
+            WINE_ERR("Unknown thread\n");
             break;
         }
 
@@ -880,19 +877,19 @@
                                de->u.DebugString.lpDebugStringData);
 
         /* FIXME unicode de->u.DebugString.fUnicode ? */
-        DEBUG_Printf(DBG_CHN_TRACE, "%08lx:%08lx: output debug string (%s)\n",
-                     de->dwProcessId, de->dwThreadId, buffer);
+        WINE_TRACE("%08lx:%08lx: output debug string (%s)\n",
+                   de->dwProcessId, de->dwThreadId, buffer);
         break;
 
     case RIP_EVENT:
-        DEBUG_Printf(DBG_CHN_TRACE, "%08lx:%08lx: rip error=%ld type=%ld\n",
-                     de->dwProcessId, de->dwThreadId, de->u.RipInfo.dwError,
-                     de->u.RipInfo.dwType);
+        WINE_TRACE("%08lx:%08lx: rip error=%ld type=%ld\n",
+                   de->dwProcessId, de->dwThreadId, de->u.RipInfo.dwError,
+                   de->u.RipInfo.dwType);
         break;
 
     default:
-        DEBUG_Printf(DBG_CHN_TRACE, "%08lx:%08lx: unknown event (%ld)\n",
-                     de->dwProcessId, de->dwThreadId, de->dwDebugEventCode);
+        WINE_TRACE("%08lx:%08lx: unknown event (%ld)\n",
+                   de->dwProcessId, de->dwThreadId, de->dwDebugEventCode);
     }
     if (!cont) return TRUE;  /* stop execution */
     ContinueDebugEvent(de->dwProcessId, de->dwThreadId, cont);
@@ -904,27 +901,25 @@
     if (DEBUG_InException)
     {
         DEBUG_ExceptionEpilog();
-#if 1
-        DEBUG_Printf(DBG_CHN_TRACE,
-                     "Exiting debugger      PC=%lx EFL=%08lx mode=%d count=%d\n",
 #ifdef __i386__
-                     DEBUG_context.Eip, DEBUG_context.EFlags,
+        WINE_TRACE("Exiting debugger      PC=%lx EFL=%08lx mode=%d count=%d\n",
+                   DEBUG_context.Eip, DEBUG_context.EFlags,
+                   DEBUG_CurrThread->exec_mode, DEBUG_CurrThread->exec_count);
 #else
-                     0L, 0L,
-#endif
-                     DEBUG_CurrThread->exec_mode, DEBUG_CurrThread->exec_count);
+        WINE_TRACE("Exiting debugger      PC=%lx EFL=%08lx mode=%d count=%d\n",
+                   0L, 0L,
+                   DEBUG_CurrThread->exec_mode, DEBUG_CurrThread->exec_count);
 #endif
         if (DEBUG_CurrThread)
         {
             if (!SetThreadContext(DEBUG_CurrThread->handle, &DEBUG_context))
-                DEBUG_Printf(DBG_CHN_MESG, "Cannot set ctx on %lu\n", DEBUG_CurrTid);
+                DEBUG_Printf("Cannot set ctx on %lu\n", DEBUG_CurrTid);
             DEBUG_CurrThread->wait_for_first_exception = 0;
         }
     }
     DEBUG_InteractiveP = FALSE;
     if (!ContinueDebugEvent(DEBUG_CurrPid, DEBUG_CurrTid, cont))
-        DEBUG_Printf(DBG_CHN_MESG, "Cannot continue on %lu (%lu)\n",
-                     DEBUG_CurrTid, cont);
+        DEBUG_Printf("Cannot continue on %lu (%lu)\n", DEBUG_CurrTid, cont);
 }
 
 void                            DEBUG_WaitNextException(DWORD cont, int count, int mode)
@@ -944,15 +939,14 @@
     }
     if (!DEBUG_CurrProcess) return;
     DEBUG_InteractiveP = TRUE;
-#if 1
-    DEBUG_Printf(DBG_CHN_TRACE,
-                 "Entering debugger     PC=%lx EFL=%08lx mode=%d count=%d\n",
 #ifdef __i386__
-                 DEBUG_context.Eip, DEBUG_context.EFlags,
+    WINE_TRACE("Entering debugger     PC=%lx EFL=%08lx mode=%d count=%d\n",
+               DEBUG_context.Eip, DEBUG_context.EFlags,
+               DEBUG_CurrThread->exec_mode, DEBUG_CurrThread->exec_count);
 #else
-                 0L, 0L,
-#endif
-                 DEBUG_CurrThread->exec_mode, DEBUG_CurrThread->exec_count);
+    WINE_TRACE("Entering debugger     PC=%lx EFL=%08lx mode=%d count=%d\n",
+               0L, 0L,
+               DEBUG_CurrThread->exec_mode, DEBUG_CurrThread->exec_count);
 #endif
 }
 
@@ -960,7 +954,7 @@
 {
     DEBUG_EVENT                de;
 
-    DEBUG_Printf(DBG_CHN_MESG, "WineDbg starting on pid %lx\n", DEBUG_CurrPid);
+    DEBUG_Printf("WineDbg starting on pid %lx\n", DEBUG_CurrPid);
 
     /* wait for first exception */
     while (WaitForDebugEvent(&de, INFINITE))
@@ -970,9 +964,9 @@
     if (local_mode == automatic_mode)
     {
         /* print some extra information */
-        DEBUG_Printf(DBG_CHN_MESG, "Modules:\n");
+        DEBUG_Printf("Modules:\n");
         DEBUG_WalkModules();
-        DEBUG_Printf(DBG_CHN_MESG, "Threads:\n");
+        DEBUG_Printf("Threads:\n");
         DEBUG_WalkThreads();
     }
     else
@@ -980,7 +974,7 @@
         DEBUG_InteractiveP = TRUE;
         DEBUG_Parser(NULL);
     }
-    DEBUG_Printf(DBG_CHN_MESG, "WineDbg terminated on pid %lx\n", DEBUG_CurrPid);
+    DEBUG_Printf("WineDbg terminated on pid %lx\n", DEBUG_CurrPid);
 
     return 0;
 }
@@ -1002,7 +996,7 @@
                        FALSE, DEBUG_PROCESS|DEBUG_ONLY_THIS_PROCESS|CREATE_NEW_CONSOLE,
                        NULL, NULL, &startup, &info))
     {
-        DEBUG_Printf(DBG_CHN_MESG, "Couldn't start process '%s'\n", cmdLine);
+        DEBUG_Printf("Couldn't start process '%s'\n", cmdLine);
         return FALSE;
     }
     DEBUG_CurrPid = info.dwProcessId;
@@ -1017,10 +1011,10 @@
     const char* pgm = (wmod) ? wmod->module_name : "none";
 
     if (args) {
-        DEBUG_Printf(DBG_CHN_MESG, "Run (%s) with '%s'\n", pgm, args);
+        DEBUG_Printf("Run (%s) with '%s'\n", pgm, args);
     } else {
         if (!DEBUG_LastCmdLine) {
-            DEBUG_Printf(DBG_CHN_MESG, "Cannot find previously used command line.\n");
+            DEBUG_Printf("Cannot find previously used command line.\n");
             return;
         }
         DEBUG_Start(DEBUG_LastCmdLine);
@@ -1029,11 +1023,13 @@
 
 BOOL DEBUG_InterruptDebuggee(void)
 {
-    DEBUG_Printf(DBG_CHN_MESG, "Ctrl-C: stopping debuggee\n");
+    DEBUG_Printf("Ctrl-C: stopping debuggee\n");
     /* FIXME: since we likely have a single process, signal the first process
      * in list
      */
-    return DEBUG_ProcessList && DebugBreakProcess(DEBUG_ProcessList->handle);
+    if (!DEBUG_ProcessList) return FALSE;
+    DEBUG_ProcessList->continue_on_first_exception = FALSE;
+    return DebugBreakProcess(DEBUG_ProcessList->handle);
 }
 
 static BOOL WINAPI DEBUG_CtrlCHandler(DWORD dwCtrlType)
@@ -1056,7 +1052,7 @@
 
 static int DEBUG_Usage(void)
 {
-    DEBUG_Printf(DBG_CHN_MESG, "Usage: winedbg [--debugmsg dbgoptions] [--auto] [--gdb] cmdline\n" );
+    DEBUG_Printf("Usage: winedbg [--debugmsg dbgoptions] [--auto] [--gdb] cmdline\n" );
     return 1;
 }
 
@@ -1081,8 +1077,6 @@
             local_mode = automatic_mode;
             /* force some internal variables */
             DBG_IVAR(BreakOnDllLoad) = 0;
-            DBG_IVAR(ConChannelMask) = 0;
-            DBG_IVAR(StdChannelMask) = DBG_CHN_MESG;
             argc--; argv++;
             continue;
         }
@@ -1146,7 +1140,7 @@
             }
             if (!SetEvent(hEvent))
             {
-                DEBUG_Printf(DBG_CHN_ERR, "Invalid event handle: %p\n", hEvent);
+                WINE_ERR("Invalid event handle: %p\n", hEvent);
                 goto leave;
             }
             CloseHandle(hEvent);
@@ -1173,7 +1167,7 @@
 
         if (!DEBUG_Start(cmdLine))
         {
-            DEBUG_Printf(DBG_CHN_MESG, "Couldn't start process '%s'\n", cmdLine);
+            DEBUG_Printf("Couldn't start process '%s'\n", cmdLine);
             goto leave;
         }
         DBG_free(DEBUG_LastCmdLine);
@@ -1193,6 +1187,6 @@
     return retv;
 
  oom_leave:
-    DEBUG_Printf(DBG_CHN_MESG, "Out of memory\n");
+    DEBUG_Printf("Out of memory\n");
     goto leave;
 }