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
c2d84da8
Commit
c2d84da8
authored
Jun 15, 2021
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Copy the implementation of __wine_dbg_strdup and __wine_dbg_header to the PE side.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
2084fbd9
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
56 additions
and
13 deletions
+56
-13
thread.c
dlls/ntdll/thread.c
+50
-2
debug.c
dlls/ntdll/unix/debug.c
+5
-5
loader.c
dlls/ntdll/unix/loader.c
+0
-2
unixlib.h
dlls/ntdll/unixlib.h
+1
-4
No files found.
dlls/ntdll/thread.c
View file @
c2d84da8
...
...
@@ -34,12 +34,33 @@
WINE_DECLARE_DEBUG_CHANNEL
(
relay
);
WINE_DECLARE_DEBUG_CHANNEL
(
thread
);
WINE_DECLARE_DEBUG_CHANNEL
(
pid
);
WINE_DECLARE_DEBUG_CHANNEL
(
timestamp
);
struct
_KUSER_SHARED_DATA
*
user_shared_data
=
(
void
*
)
0x7ffe0000
;
struct
debug_info
{
unsigned
int
str_pos
;
/* current position in strings buffer */
unsigned
int
out_pos
;
/* current position in output buffer */
char
strings
[
1020
];
/* buffer for temporary strings */
char
output
[
1020
];
/* current output line */
};
C_ASSERT
(
sizeof
(
struct
debug_info
)
==
0x800
);
static
int
nb_debug_options
;
static
struct
__wine_debug_channel
*
debug_options
;
static
inline
struct
debug_info
*
get_info
(
void
)
{
#ifdef _WIN64
return
(
struct
debug_info
*
)((
TEB32
*
)((
char
*
)
NtCurrentTeb
()
+
0x2000
)
+
1
);
#else
return
(
struct
debug_info
*
)(
NtCurrentTeb
()
+
1
);
#endif
}
static
void
init_options
(
void
)
{
unsigned
int
offset
=
page_size
*
(
sizeof
(
void
*
)
/
4
);
...
...
@@ -81,7 +102,14 @@ unsigned char __cdecl __wine_dbg_get_channel_flags( struct __wine_debug_channel
*/
const
char
*
__cdecl
__wine_dbg_strdup
(
const
char
*
str
)
{
return
unix_funcs
->
dbg_strdup
(
str
);
struct
debug_info
*
info
=
get_info
();
unsigned
int
pos
=
info
->
str_pos
;
size_t
n
=
strlen
(
str
)
+
1
;
assert
(
n
<=
sizeof
(
info
->
strings
)
);
if
(
pos
+
n
>
sizeof
(
info
->
strings
))
pos
=
0
;
info
->
str_pos
=
pos
+
n
;
return
memcpy
(
info
->
strings
+
pos
,
str
,
n
);
}
/***********************************************************************
...
...
@@ -90,7 +118,27 @@ const char * __cdecl __wine_dbg_strdup( const char *str )
int
__cdecl
__wine_dbg_header
(
enum
__wine_debug_class
cls
,
struct
__wine_debug_channel
*
channel
,
const
char
*
function
)
{
return
unix_funcs
->
dbg_header
(
cls
,
channel
,
function
);
static
const
char
*
const
classes
[]
=
{
"fixme"
,
"err"
,
"warn"
,
"trace"
};
struct
debug_info
*
info
=
get_info
();
char
*
pos
=
info
->
output
;
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
)
return
0
;
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
))
pos
+=
snprintf
(
pos
,
sizeof
(
info
->
output
)
-
(
pos
-
info
->
output
),
"%s:%s:%s "
,
classes
[
cls
],
channel
->
name
,
function
);
info
->
out_pos
=
pos
-
info
->
output
;
return
info
->
out_pos
;
}
/***********************************************************************
...
...
dlls/ntdll/unix/debug.c
View file @
c2d84da8
...
...
@@ -277,7 +277,7 @@ int __cdecl __wine_dbg_header( enum __wine_debug_class cls, struct __wine_debug_
{
static
const
char
*
const
classes
[]
=
{
"fixme"
,
"err"
,
"warn"
,
"trace"
};
struct
debug_info
*
info
=
get_info
();
char
buffer
[
200
],
*
pos
=
buffer
;
char
*
pos
=
info
->
output
;
if
(
!
(
__wine_dbg_get_channel_flags
(
channel
)
&
(
1
<<
cls
)))
return
-
1
;
...
...
@@ -295,10 +295,10 @@ int __cdecl __wine_dbg_header( enum __wine_debug_class cls, struct __wine_debug_
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
))
;
pos
+=
snprintf
(
pos
,
sizeof
(
info
->
output
)
-
(
pos
-
info
->
output
),
"%s:%s:%s "
,
classes
[
cls
],
channel
->
name
,
function
);
info
->
out_pos
=
pos
-
info
->
output
;
return
info
->
out_pos
;
}
/***********************************************************************
...
...
dlls/ntdll/unix/loader.c
View file @
c2d84da8
...
...
@@ -1850,9 +1850,7 @@ static struct unix_funcs unix_funcs =
init_builtin_dll
,
init_unix_lib
,
unwind_builtin_dll
,
__wine_dbg_strdup
,
__wine_dbg_output
,
__wine_dbg_header
,
};
...
...
dlls/ntdll/unixlib.h
View file @
c2d84da8
...
...
@@ -26,7 +26,7 @@
struct
_DISPATCHER_CONTEXT
;
/* increment this when you change the function table */
#define NTDLL_UNIXLIB_VERSION 12
1
#define NTDLL_UNIXLIB_VERSION 12
2
struct
unix_funcs
{
...
...
@@ -80,10 +80,7 @@ struct unix_funcs
CONTEXT
*
context
);
/* debugging functions */
const
char
*
(
CDECL
*
dbg_strdup
)(
const
char
*
str
);
int
(
CDECL
*
dbg_output
)(
const
char
*
str
);
int
(
CDECL
*
dbg_header
)(
enum
__wine_debug_class
cls
,
struct
__wine_debug_channel
*
channel
,
const
char
*
function
);
};
#endif
/* __NTDLL_UNIXLIB_H */
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