1
0
forked from 0ad/0ad

lib.h: moved assert2 to sysdep/debug.h

mmgr: remove wdbg calls (was prototype); use sysdep/debug interface
wdbg: no longer call it dbghelp63.h; should be installed normally in
compiler dir
win_internal.h: fix inevitable MS screwups in new dbghelp.h (*sigh*)

This was SVN commit r1816.
This commit is contained in:
janwas 2005-01-25 18:54:48 +00:00
parent 0d80a05aec
commit 711bff0d3a
4 changed files with 61 additions and 28 deletions

View File

@ -102,24 +102,6 @@ STMT(\
}
// superassert
// recommended use: assert2(expr && "descriptive string")
#define assert2(expr)\
{\
static int suppress__ = 0;\
if(!suppress__ && !expr)\
switch(debug_assert_failed(__FILE__, __LINE__, #expr))\
{\
case 1:\
suppress__ = 1;\
break;\
case 2:\
debug_break();\
break;\
}\
}
enum LibError
{

View File

@ -969,9 +969,6 @@ void mmgr_break_on_free(const void* p)
// actual allocator, making use of all of the above :)
//////////////////////////////////////////////////////////////////////////////
#include "sysdep/win/wdbg.h"
void* alloc_dbg(size_t user_size, AllocType type, const char* file, int line, const char* func, uint stack_frames)
{
void* ret = 0;
@ -988,8 +985,8 @@ void* alloc_dbg(size_t user_size, AllocType type, const char* file, int line, co
{
if(options & MMGR_RESOLVE_OWNER)
{
void* pfunc = wdbg_get_nth_caller(1+stack_frames);
wdbg_resolve_symbol(pfunc, func_buf, file_buf, &line);
void* pfunc = debug_get_nth_caller(1+stack_frames);
debug_resolve_symbol(pfunc, func_buf, file_buf, &line);
file = file_buf;
func = func_buf;
}
@ -1083,8 +1080,8 @@ void free_dbg(const void* user_p, AllocType type, const char* file, int line, co
{
if(options & MMGR_RESOLVE_OWNER)
{
void* pfunc = wdbg_get_nth_caller(1+stack_frames);
wdbg_resolve_symbol(pfunc, func_buf, file_buf, &line);
void* pfunc = debug_get_nth_caller(1+stack_frames);
debug_resolve_symbol(pfunc, func_buf, file_buf, &line);
file = file_buf;
func = func_buf;
}
@ -1186,8 +1183,8 @@ void* realloc_dbg(const void* user_p, size_t user_size, AllocType type, const ch
{
if(options & MMGR_RESOLVE_OWNER)
{
void* pfunc = wdbg_get_nth_caller(1+stack_frames);
wdbg_resolve_symbol(pfunc, func_buf, file_buf, &line);
void* pfunc = debug_get_nth_caller(1+stack_frames);
debug_resolve_symbol(pfunc, func_buf, file_buf, &line);
file = file_buf;
func = func_buf;
}

View File

@ -24,7 +24,7 @@
#include "win_internal.h"
#define _NO_CVCONST_H // request SymTagEnum be defined
#include "dbghelp63.h"
#include "dbghelp.h"
#include <OAIdl.h> // VARIANT
#include "wdbg.h"

View File

@ -235,6 +235,60 @@ typedef struct _SYSTEM_POWER_INFORMATION
// or there is no thermal zone defined [..]
///////////////////////////////////////////////////////////////////////////////
//
// fixes for dbghelp.h 6.3
//
///////////////////////////////////////////////////////////////////////////////
// the macros defined "for those without specstrings.h" are incorrect -
// parameter definition is missing.
#ifndef __specstrings
# define __specstrings // prevent dbghelp from changing these
# define __in
# define __out
# define __inout
# define __in_opt
# define __out_opt
# define __inout_opt
# define __in_ecount(s)
# define __out_ecount(s)
# define __inout_ecount(s)
# define __in_bcount(s)
# define __out_bcount(s)
# define __inout_bcount(s)
# define __deref_opt_out
# define __deref_out
#endif
// missing from dbghelp's list
#define __out_xcount(s)
// not defined by dbghelp; these values are taken from DIA cvconst.h
enum BasicType
{
btNoType = 0,
btVoid = 1,
btChar = 2,
btWChar = 3,
btInt = 6,
btUInt = 7,
btFloat = 8,
btBCD = 9,
btBool = 10,
btLong = 13,
btULong = 14,
btCurrency = 25,
btDate = 26,
btVariant = 27,
btComplex = 28,
btBit = 29,
btBSTR = 30,
btHresult = 31
};
///////////////////////////////////////////////////////////////////////////////