Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
cf8193df
Commit
cf8193df
authored
Apr 03, 2019
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
include: Make wine_dbg_log() into an inline function.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
9911cfde
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
62 additions
and
3 deletions
+62
-3
debugtools.c
dlls/ntdll/debugtools.c
+32
-0
ntdll.spec
dlls/ntdll/ntdll.spec
+1
-0
debug.h
include/wine/debug.h
+27
-3
debug.c
libs/wine/debug.c
+2
-0
No files found.
dlls/ntdll/debugtools.c
View file @
cf8193df
...
...
@@ -276,6 +276,38 @@ int __cdecl __wine_dbg_output( const char *str )
}
/***********************************************************************
* __wine_dbg_header (NTDLL.@)
*/
int
__cdecl
__wine_dbg_header
(
enum
__wine_debug_class
cls
,
struct
__wine_debug_channel
*
channel
,
const
char
*
function
)
{
static
const
char
*
const
classes
[]
=
{
"fixme"
,
"err"
,
"warn"
,
"trace"
};
struct
debug_info
*
info
=
get_info
();
char
buffer
[
200
],
*
pos
=
buffer
;
if
(
!
(
__wine_dbg_get_channel_flags
(
channel
)
&
(
1
<<
cls
)))
return
-
1
;
/* only print header if we are at the beginning of the line */
if
(
info
->
out_pos
>
info
->
output
)
return
0
;
if
(
init_done
)
{
if
(
TRACE_ON
(
timestamp
))
{
ULONG
ticks
=
NtGetTickCount
();
pos
+=
sprintf
(
pos
,
"%3u.%03u:"
,
ticks
/
1000
,
ticks
%
1000
);
}
if
(
TRACE_ON
(
pid
))
pos
+=
sprintf
(
pos
,
"%04x:"
,
GetCurrentProcessId
()
);
pos
+=
sprintf
(
pos
,
"%04x:"
,
GetCurrentThreadId
()
);
}
if
(
function
&&
cls
<
ARRAY_SIZE
(
classes
))
snprintf
(
pos
,
sizeof
(
buffer
)
-
(
pos
-
buffer
),
"%s:%s:%s "
,
classes
[
cls
],
channel
->
name
,
function
);
return
append_output
(
info
,
buffer
,
strlen
(
buffer
));
}
/***********************************************************************
* NTDLL_dbg_vprintf
*/
static
int
NTDLL_dbg_vprintf
(
const
char
*
format
,
va_list
args
)
...
...
dlls/ntdll/ntdll.spec
View file @
cf8193df
...
...
@@ -1507,6 +1507,7 @@
# Debugging
@ cdecl -norelay __wine_dbg_get_channel_flags(ptr)
@ cdecl -norelay __wine_dbg_header(long long str)
@ cdecl -norelay __wine_dbg_output(str)
@ cdecl -norelay __wine_dbg_strdup(str)
...
...
include/wine/debug.h
View file @
cf8193df
...
...
@@ -161,6 +161,8 @@ extern void __wine_dbg_set_functions( const struct __wine_debug_functions *new_f
struct
__wine_debug_functions
*
old_funcs
,
size_t
size
);
extern
const
char
*
__cdecl
__wine_dbg_strdup
(
const
char
*
str
);
extern
int
__cdecl
__wine_dbg_output
(
const
char
*
str
);
extern
int
__cdecl
__wine_dbg_header
(
enum
__wine_debug_class
cls
,
struct
__wine_debug_channel
*
channel
,
const
char
*
function
);
/*
* Exported definitions and macros
...
...
@@ -170,9 +172,6 @@ extern int __cdecl __wine_dbg_output( const char *str );
quotes. The string will be valid for some time, but not indefinitely
as strings are re-used. */
extern
int
wine_dbg_log
(
enum
__wine_debug_class
cls
,
struct
__wine_debug_channel
*
ch
,
const
char
*
func
,
const
char
*
format
,
...
)
__WINE_PRINTF_ATTR
(
4
,
5
);
#if (defined(__x86_64__) || defined(__aarch64__)) && defined(__GNUC__) && defined(__WINE_USE_MSVCRT)
# define __wine_dbg_cdecl __cdecl
# define __wine_dbg_va_list __builtin_ms_va_list
...
...
@@ -209,6 +208,31 @@ static inline int __wine_dbg_cdecl wine_dbg_printf( const char *format, ... )
return
__wine_dbg_output
(
buffer
);
}
static
int
__wine_dbg_cdecl
wine_dbg_log
(
enum
__wine_debug_class
cls
,
struct
__wine_debug_channel
*
channel
,
const
char
*
func
,
const
char
*
format
,
...
)
__WINE_PRINTF_ATTR
(
4
,
5
);
static
inline
int
__wine_dbg_cdecl
wine_dbg_log
(
enum
__wine_debug_class
cls
,
struct
__wine_debug_channel
*
channel
,
const
char
*
function
,
const
char
*
format
,
...
)
{
char
buffer
[
1024
];
__wine_dbg_va_list
args
;
int
ret
;
if
(
*
format
==
'\1'
)
/* special magic to avoid standard prefix */
{
format
++
;
function
=
NULL
;
}
if
((
ret
=
__wine_dbg_header
(
cls
,
channel
,
function
))
==
-
1
)
return
ret
;
__wine_dbg_va_start
(
args
,
format
);
vsnprintf
(
buffer
,
sizeof
(
buffer
),
format
,
args
);
__wine_dbg_va_end
(
args
);
ret
+=
__wine_dbg_output
(
buffer
);
return
ret
;
}
static
inline
const
char
*
wine_dbgstr_an
(
const
char
*
str
,
int
n
)
{
static
const
char
hex
[
16
]
=
"0123456789abcdef"
;
...
...
libs/wine/debug.c
View file @
cf8193df
...
...
@@ -33,6 +33,7 @@
#define __wine_dbg_get_channel_flags __wine_dbg_get_channel_flags_inline
#define wine_dbg_sprintf wine_dbg_sprintf_inline
#define wine_dbg_printf wine_dbg_printf_inline
#define wine_dbg_log wine_dbg_log_inline
#define wine_dbgstr_an wine_dbgstr_an_inline
#define wine_dbgstr_wn wine_dbgstr_wn_inline
#include "wine/debug.h"
...
...
@@ -252,6 +253,7 @@ const char *wine_dbg_sprintf( const char *format, ... )
/* varargs wrapper for funcs.dbg_vlog */
#undef wine_dbg_log
int
wine_dbg_log
(
enum
__wine_debug_class
cls
,
struct
__wine_debug_channel
*
channel
,
const
char
*
func
,
const
char
*
format
,
...
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment