ntdll: Copy the implementation of __wine_dbg_output to the PE side.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
0702d6b886
commit
b572cf3025
|
@ -1621,6 +1621,7 @@
|
|||
@ extern -arch=i386 __wine_ldt_copy
|
||||
|
||||
# Debugging
|
||||
@ stdcall -syscall -norelay __wine_dbg_write(ptr long)
|
||||
@ cdecl -norelay __wine_dbg_get_channel_flags(ptr)
|
||||
@ cdecl -norelay __wine_dbg_header(long long str)
|
||||
@ cdecl -norelay __wine_dbg_output(str)
|
||||
|
|
|
@ -69,6 +69,22 @@ static void init_options(void)
|
|||
while (debug_options[nb_debug_options].name[0]) nb_debug_options++;
|
||||
}
|
||||
|
||||
/* add a string to the output buffer */
|
||||
static int append_output( struct debug_info *info, const char *str, size_t len )
|
||||
{
|
||||
if (len >= sizeof(info->output) - info->out_pos)
|
||||
{
|
||||
__wine_dbg_write( info->output, info->out_pos );
|
||||
info->out_pos = 0;
|
||||
ERR_(thread)( "debug buffer overflow:\n" );
|
||||
__wine_dbg_write( str, len );
|
||||
RtlRaiseStatus( STATUS_BUFFER_OVERFLOW );
|
||||
}
|
||||
memcpy( info->output + info->out_pos, str, len );
|
||||
info->out_pos += len;
|
||||
return len;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* __wine_dbg_get_channel_flags (NTDLL.@)
|
||||
*
|
||||
|
@ -146,7 +162,19 @@ int __cdecl __wine_dbg_header( enum __wine_debug_class cls, struct __wine_debug_
|
|||
*/
|
||||
int __cdecl __wine_dbg_output( const char *str )
|
||||
{
|
||||
return unix_funcs->dbg_output( str );
|
||||
struct debug_info *info = get_info();
|
||||
const char *end = strrchr( str, '\n' );
|
||||
int ret = 0;
|
||||
|
||||
if (end)
|
||||
{
|
||||
ret += append_output( info, str, end + 1 - str );
|
||||
__wine_dbg_write( info->output, info->out_pos );
|
||||
info->out_pos = 0;
|
||||
str = end + 1;
|
||||
}
|
||||
if (*str) ret += append_output( info, str, strlen( str ));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -249,6 +249,14 @@ const char * __cdecl __wine_dbg_strdup( const char *str )
|
|||
return memcpy( info->strings + pos, str, n );
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* __wine_dbg_write (NTDLL.@)
|
||||
*/
|
||||
int WINAPI __wine_dbg_write( const char *str, unsigned int len )
|
||||
{
|
||||
return write( 2, str, len );
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* __wine_dbg_output (NTDLL.@)
|
||||
*/
|
||||
|
@ -261,7 +269,7 @@ int __cdecl __wine_dbg_output( const char *str )
|
|||
if (end)
|
||||
{
|
||||
ret += append_output( info, str, end + 1 - str );
|
||||
write( 2, info->output, info->out_pos );
|
||||
__wine_dbg_write( info->output, info->out_pos );
|
||||
info->out_pos = 0;
|
||||
str = end + 1;
|
||||
}
|
||||
|
|
|
@ -1850,7 +1850,6 @@ static struct unix_funcs unix_funcs =
|
|||
init_builtin_dll,
|
||||
init_unix_lib,
|
||||
unwind_builtin_dll,
|
||||
__wine_dbg_output,
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
struct _DISPATCHER_CONTEXT;
|
||||
|
||||
/* increment this when you change the function table */
|
||||
#define NTDLL_UNIXLIB_VERSION 122
|
||||
#define NTDLL_UNIXLIB_VERSION 123
|
||||
|
||||
struct unix_funcs
|
||||
{
|
||||
|
@ -78,9 +78,6 @@ struct unix_funcs
|
|||
NTSTATUS (CDECL *init_unix_lib)( void *module, DWORD reason, const void *ptr_in, void *ptr_out );
|
||||
NTSTATUS (CDECL *unwind_builtin_dll)( ULONG type, struct _DISPATCHER_CONTEXT *dispatch,
|
||||
CONTEXT *context );
|
||||
|
||||
/* debugging functions */
|
||||
int (CDECL *dbg_output)( const char *str );
|
||||
};
|
||||
|
||||
#endif /* __NTDLL_UNIXLIB_H */
|
||||
|
|
|
@ -143,6 +143,7 @@ struct __wine_debug_channel
|
|||
|
||||
#endif /* !__GNUC__ && !__SUNPRO_C */
|
||||
|
||||
extern int WINAPI __wine_dbg_write( const char *str, unsigned int len );
|
||||
extern unsigned char __cdecl __wine_dbg_get_channel_flags( struct __wine_debug_channel *channel );
|
||||
extern const char * __cdecl __wine_dbg_strdup( const char *str );
|
||||
extern int __cdecl __wine_dbg_output( const char *str );
|
||||
|
|
Loading…
Reference in New Issue