minor updates to try and find some debug output from the wine libs.

svn path=/trunk/; revision=4183
This commit is contained in:
Robert Dickenson 2003-02-21 14:47:34 +00:00
parent 9f3fb17e6e
commit c3ff43d969
4 changed files with 197 additions and 42 deletions

View file

@ -1,4 +1,4 @@
# $Id: Makefile,v 1.2 2003/01/12 01:54:39 robd Exp $
# $Id: Makefile,v 1.3 2003/02/21 14:47:34 robd Exp $
PATH_TO_TOP = ../..
@ -25,6 +25,7 @@ TARGET_OBJECTS = \
debug.o \
libmain.o \
porting.o \
trace.o \
winedbgc.o \
winedbgc.dll.dbg.o

View file

@ -0,0 +1,82 @@
/////////////////////////////////////////////////////////////////////////////
// Diagnostic Trace
//
#include <stdio.h>
#include <stdarg.h>
#define WIN32_LEAN_AND_MEAN
#include "windows.h"
#include "trace.h"
#ifdef _DEBUG
#ifdef WIN32
//#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
//#include <windows.h>
//#include <assert.h>
//WINBASEAPI VOID WINAPI DebugBreak(VOID);
//WINBASEAPI VOID WINAPI OutputDebugStringA(LPCSTR lpOutputString);
//WINBASEAPI VOID WINAPI OutputDebugStringW(LPCWSTR lpOutputString);
//void __stdcall DebugBreak(void);
//void __stdcall OutputDebugStringA(char* lpOutputString);
//void __stdcall OutputDebugStringW(wchar_t* lpOutputString);
#ifdef UNICODE
#define OutputDebugString OutputDebugStringW
#else
#define OutputDebugString OutputDebugStringA
#endif // !UNICODE
#else
#include "hardware.h"
#endif // WIN32
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
void _DebugBreak(void)
{
DebugBreak();
}
void Trace(TCHAR* lpszFormat, ...)
{
va_list args;
int nBuf;
TCHAR szBuffer[512];
va_start(args, lpszFormat);
// nBuf = vsprintf(szBuffer, lpszFormat, args);
// nBuf = _vsntprintf(szBuffer, _countof(szBuffer), lpszFormat, args);
#ifdef _UNICODE
nBuf = _vsnwprintf(szBuffer, sizeof(szBuffer)/sizeof(TCHAR), lpszFormat, args);
#else
nBuf = _vsnprintf(szBuffer, sizeof(szBuffer)/sizeof(TCHAR), lpszFormat, args);
#endif
OutputDebugString(szBuffer);
// was there an error? was the expanded string too long?
// ASSERT(nBuf >= 0);
va_end(args);
}
void Assert(void* assert, TCHAR* file, int line, void* msg)
{
if (msg == NULL) {
printf("ASSERT -- %s occured on line %u of file %s.\n",
assert, line, file);
} else {
printf("ASSERT -- %s occured on line %u of file %s: Message = %s.\n",
assert, line, file, msg);
}
}
#else
//inline void Trace(TCHAR* lpszFormat, ...) { };
//inline void Assert(void* assert, TCHAR* file, int line, void* msg) { };
void Trace(TCHAR* lpszFormat, ...) { };
void Assert(void* assert, TCHAR* file, int line, void* msg) { };
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////

View file

@ -0,0 +1,72 @@
/////////////////////////////////////////////////////////////////////////////
//
#ifndef __TRACE_H__
#define __TRACE_H__
#ifdef _DEBUG
//=============================================================================
// BreakPoint() macro.
//=============================================================================
#ifdef _X86_
#define BreakPoint() _asm { int 3h }
#else
#define BreakPoint() _DebugBreak()
#endif
//=============================================================================
// MACRO: ASSERT()
//=============================================================================
#ifndef ASSERT
#define ASSERT(exp) \
{ \
if ( !(exp) ) \
{ \
Assert(#exp, __FILE__, __LINE__, NULL); \
BreakPoint(); \
} \
} \
#define ASSERTMSG(exp, msg) \
{ \
if ( !(exp) ) \
{ \
Assert(#exp, __FILE__, __LINE__, msg); \
BreakPoint(); \
} \
}
#endif
//=============================================================================
// MACRO: TRACE()
//=============================================================================
void Assert(void* assert, TCHAR* file, int line, void* msg);
void Trace(TCHAR* lpszFormat, ...);
void Trace1(int code, TCHAR* lpszFormat, ...);
#define TRACE Trace
#define TRACE0 Trace
#else // _DEBUG
#ifndef ASSERT
#define ASSERT(exp)
#define ASSERTMSG(exp, msg)
#endif
//#define TRACE0 TRACE
//#define TRACE1 TRACE
void Assert(void* assert, TCHAR* file, int line, void* msg);
void Trace(TCHAR* lpszFormat, ...);
#define TRACE 0 ? (void)0 : Trace
#endif // !_DEBUG
#endif // __TRACE_H__
/////////////////////////////////////////////////////////////////////////////

View file

@ -1,15 +1,15 @@
/*
* Debugging channels functions for WINE
* Debugging channels functions for WINE support on ROS.
*/
#include <windows.h>
#include <stdlib.h>
#include <stdio.h>
#include "porting.h"
#include "trace.h"
//#include <ntddk.h>
#include <wine/debugtools.h>
//DECLARE_DEBUG_CHANNEL(tid);
DECLARE_DEBUG_CHANNEL(winedbgc);
@ -177,13 +177,10 @@ const char *wine_dbgstr_guid( const GUID *id )
char *str;
if (!id) return "(null)";
if (!((WORD)(DWORD)(id) >> 16))
{
if (!((WORD)(DWORD)(id) >> 16)) {
str = gimme1(12);
sprintf(str, "<guid-0x%04x>", (WORD)(DWORD)(id));
}
else
{
} else {
str = gimme1(40);
sprintf(str, "{%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
id->Data1, id->Data2, id->Data3,
@ -205,9 +202,9 @@ int wine_dbg_vprintf( const char *format, va_list args )
format, args);
p = strrchr(info->out_pos, '\n');
if (!p) info->out_pos += ret;
else
{
if (!p) {
info->out_pos += ret;
} else {
char *pos = info->output;
char saved_ch;
p++;
@ -231,6 +228,9 @@ int wine_dbg_printf(const char *format, ...)
va_list valist;
va_start(valist, format);
//
Trace(format, valist);
//
ret = wine_dbg_vprintf(format, valist);
va_end(valist);
return ret;