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
9911cfde
Commit
9911cfde
authored
Apr 03, 2019
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Export __wine_dbg_get_channel_flags().
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
ddf1ff2f
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
158 additions
and
4 deletions
+158
-4
debugtools.c
dlls/ntdll/debugtools.c
+153
-0
ntdll.spec
dlls/ntdll/ntdll.spec
+1
-0
debug.h
include/wine/debug.h
+1
-3
debug.c
libs/wine/debug.c
+2
-0
wine.def
libs/wine/wine.def
+1
-1
No files found.
dlls/ntdll/debugtools.c
View file @
9911cfde
...
...
@@ -43,6 +43,12 @@ WINE_DECLARE_DEBUG_CHANNEL(timestamp);
static
BOOL
init_done
;
static
struct
debug_info
initial_info
;
/* debug info for initial thread */
static
unsigned
char
default_flags
=
(
1
<<
__WINE_DBCL_ERR
)
|
(
1
<<
__WINE_DBCL_FIXME
);
static
int
nb_debug_options
=
-
1
;
static
int
options_size
;
static
struct
__wine_debug_channel
*
debug_options
;
static
const
char
*
const
debug_classes
[]
=
{
"fixme"
,
"err"
,
"warn"
,
"trace"
};
/* get the debug info pointer for the current thread */
static
inline
struct
debug_info
*
get_info
(
void
)
...
...
@@ -88,6 +94,153 @@ static int append_output( struct debug_info *info, const char *str, size_t len )
return
len
;
}
/* add a new debug option at the end of the option list */
static
void
add_option
(
const
char
*
name
,
unsigned
char
set
,
unsigned
char
clear
)
{
int
min
=
0
,
max
=
nb_debug_options
-
1
,
pos
,
res
;
if
(
!
name
[
0
])
/* "all" option */
{
default_flags
=
(
default_flags
&
~
clear
)
|
set
;
return
;
}
if
(
strlen
(
name
)
>=
sizeof
(
debug_options
[
0
].
name
))
return
;
while
(
min
<=
max
)
{
pos
=
(
min
+
max
)
/
2
;
res
=
strcmp
(
name
,
debug_options
[
pos
].
name
);
if
(
!
res
)
{
debug_options
[
pos
].
flags
=
(
debug_options
[
pos
].
flags
&
~
clear
)
|
set
;
return
;
}
if
(
res
<
0
)
max
=
pos
-
1
;
else
min
=
pos
+
1
;
}
if
(
nb_debug_options
>=
options_size
)
{
options_size
=
max
(
options_size
*
2
,
16
);
debug_options
=
realloc
(
debug_options
,
options_size
*
sizeof
(
debug_options
[
0
])
);
}
pos
=
min
;
if
(
pos
<
nb_debug_options
)
memmove
(
&
debug_options
[
pos
+
1
],
&
debug_options
[
pos
],
(
nb_debug_options
-
pos
)
*
sizeof
(
debug_options
[
0
])
);
strcpy
(
debug_options
[
pos
].
name
,
name
);
debug_options
[
pos
].
flags
=
(
default_flags
&
~
clear
)
|
set
;
nb_debug_options
++
;
}
/* parse a set of debugging option specifications and add them to the option list */
static
void
parse_options
(
const
char
*
str
)
{
char
*
opt
,
*
next
,
*
options
;
unsigned
int
i
;
if
(
!
(
options
=
strdup
(
str
)))
return
;
for
(
opt
=
options
;
opt
;
opt
=
next
)
{
const
char
*
p
;
unsigned
char
set
=
0
,
clear
=
0
;
if
((
next
=
strchr
(
opt
,
','
)))
*
next
++
=
0
;
p
=
opt
+
strcspn
(
opt
,
"+-"
);
if
(
!
p
[
0
])
p
=
opt
;
/* assume it's a debug channel name */
if
(
p
>
opt
)
{
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
debug_classes
);
i
++
)
{
int
len
=
strlen
(
debug_classes
[
i
]);
if
(
len
!=
(
p
-
opt
))
continue
;
if
(
!
memcmp
(
opt
,
debug_classes
[
i
],
len
))
/* found it */
{
if
(
*
p
==
'+'
)
set
|=
1
<<
i
;
else
clear
|=
1
<<
i
;
break
;
}
}
if
(
i
==
ARRAY_SIZE
(
debug_classes
))
/* bad class name, skip it */
continue
;
}
else
{
if
(
*
p
==
'-'
)
clear
=
~
0
;
else
set
=
~
0
;
}
if
(
*
p
==
'+'
||
*
p
==
'-'
)
p
++
;
if
(
!
p
[
0
])
continue
;
if
(
!
strcmp
(
p
,
"all"
))
default_flags
=
(
default_flags
&
~
clear
)
|
set
;
else
add_option
(
p
,
set
,
clear
);
}
free
(
options
);
}
/* print the usage message */
static
void
debug_usage
(
void
)
{
static
const
char
usage
[]
=
"Syntax of the WINEDEBUG variable:
\n
"
" WINEDEBUG=[class]+xxx,[class]-yyy,...
\n\n
"
"Example: WINEDEBUG=+relay,warn-heap
\n
"
" turns on relay traces, disable heap warnings
\n
"
"Available message classes: err, warn, fixme, trace
\n
"
;
write
(
2
,
usage
,
sizeof
(
usage
)
-
1
);
exit
(
1
);
}
/* initialize all options at startup */
static
void
init_options
(
void
)
{
char
*
wine_debug
=
getenv
(
"WINEDEBUG"
);
struct
stat
st1
,
st2
;
nb_debug_options
=
0
;
/* check for stderr pointing to /dev/null */
if
(
!
fstat
(
2
,
&
st1
)
&&
S_ISCHR
(
st1
.
st_mode
)
&&
!
stat
(
"/dev/null"
,
&
st2
)
&&
S_ISCHR
(
st2
.
st_mode
)
&&
st1
.
st_rdev
==
st2
.
st_rdev
)
{
default_flags
=
0
;
return
;
}
if
(
!
wine_debug
)
return
;
if
(
!
strcmp
(
wine_debug
,
"help"
))
debug_usage
();
parse_options
(
wine_debug
);
}
/***********************************************************************
* __wine_dbg_get_channel_flags (NTDLL.@)
*
* Get the flags to use for a given channel, possibly setting them too in case of lazy init
*/
unsigned
char
__cdecl
__wine_dbg_get_channel_flags
(
struct
__wine_debug_channel
*
channel
)
{
int
min
,
max
,
pos
,
res
;
if
(
nb_debug_options
==
-
1
)
init_options
();
min
=
0
;
max
=
nb_debug_options
-
1
;
while
(
min
<=
max
)
{
pos
=
(
min
+
max
)
/
2
;
res
=
strcmp
(
channel
->
name
,
debug_options
[
pos
].
name
);
if
(
!
res
)
return
debug_options
[
pos
].
flags
;
if
(
res
<
0
)
max
=
pos
-
1
;
else
min
=
pos
+
1
;
}
/* no option for this channel */
if
(
channel
->
flags
&
(
1
<<
__WINE_DBCL_INIT
))
channel
->
flags
=
default_flags
;
return
default_flags
;
}
/***********************************************************************
* __wine_dbg_strdup (NTDLL.@)
*/
...
...
dlls/ntdll/ntdll.spec
View file @
9911cfde
...
...
@@ -1506,6 +1506,7 @@
@ cdecl __wine_make_process_system()
# Debugging
@ cdecl -norelay __wine_dbg_get_channel_flags(ptr)
@ cdecl -norelay __wine_dbg_output(str)
@ cdecl -norelay __wine_dbg_strdup(str)
...
...
include/wine/debug.h
View file @
9911cfde
...
...
@@ -156,9 +156,7 @@ struct __wine_debug_functions
const
char
*
function
,
const
char
*
format
,
va_list
args
);
};
extern
unsigned
char
__wine_dbg_get_channel_flags
(
struct
__wine_debug_channel
*
channel
);
extern
int
__wine_dbg_set_channel_flags
(
struct
__wine_debug_channel
*
channel
,
unsigned
char
set
,
unsigned
char
clear
);
extern
unsigned
char
__cdecl
__wine_dbg_get_channel_flags
(
struct
__wine_debug_channel
*
channel
);
extern
void
__wine_dbg_set_functions
(
const
struct
__wine_debug_functions
*
new_funcs
,
struct
__wine_debug_functions
*
old_funcs
,
size_t
size
);
extern
const
char
*
__cdecl
__wine_dbg_strdup
(
const
char
*
str
);
...
...
libs/wine/debug.c
View file @
9911cfde
...
...
@@ -30,6 +30,7 @@
# include <sys/stat.h>
#endif
#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_dbgstr_an wine_dbgstr_an_inline
...
...
@@ -61,6 +62,7 @@ static int cmp_name( const void *p1, const void *p2 )
}
/* get the flags to use for a given channel, possibly setting them too in case of lazy init */
#undef __wine_dbg_get_channel_flags
unsigned
char
__wine_dbg_get_channel_flags
(
struct
__wine_debug_channel
*
channel
)
{
if
(
nb_debug_options
==
-
1
)
debug_init
();
...
...
libs/wine/wine.def
View file @
9911cfde
LIBRARY libwine.dll
EXPORTS
__wine_dbg_get_channel_flags
__wine_dbg_get_channel_flags
PRIVATE
__wine_dbg_set_channel_flags
__wine_dbg_set_functions
__wine_dll_register
...
...
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