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
20dc5f37
Commit
20dc5f37
authored
Aug 31, 2021
by
Esme Povirk
Committed by
Alexandre Julliard
Sep 01, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mscoree: Add a buffer for Mono's debug output.
Signed-off-by:
Esme Povirk
<
esme@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
6cb5f660
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
65 additions
and
14 deletions
+65
-14
metahost.c
dlls/mscoree/metahost.c
+0
-13
mscoree_main.c
dlls/mscoree/mscoree_main.c
+63
-1
mscoree_private.h
dlls/mscoree/mscoree_private.h
+2
-0
No files found.
dlls/mscoree/metahost.c
View file @
20dc5f37
...
...
@@ -137,8 +137,6 @@ static MonoAssembly* CDECL mono_assembly_preload_hook_fn(MonoAssemblyName *aname
static
void
CDECL
mono_shutdown_callback_fn
(
MonoProfiler
*
prof
);
static
void
CDECL
mono_print_handler_fn
(
const
char
*
string
,
INT
is_stdout
);
static
MonoImage
*
CDECL
image_open_module_handle_dummy
(
HMODULE
module_handle
,
char
*
fname
,
UINT
has_entry_point
,
MonoImageOpenStatus
*
status
)
{
...
...
@@ -378,17 +376,6 @@ static void CDECL mono_shutdown_callback_fn(MonoProfiler *prof)
is_mono_shutdown
=
TRUE
;
}
static
void
CDECL
mono_print_handler_fn
(
const
char
*
string
,
INT
is_stdout
)
{
const
char
*
p
;
for
(;
*
string
;
string
=
p
)
{
if
((
p
=
strstr
(
string
,
"
\n
"
)))
p
++
;
else
p
=
string
+
strlen
(
string
);
wine_dbg_printf
(
"%.*s"
,
(
int
)(
p
-
string
),
string
);
}
}
static
HRESULT
WINAPI
thread_set_fn
(
void
)
{
WARN
(
"stub
\n
"
);
...
...
dlls/mscoree/mscoree_main.c
View file @
20dc5f37
...
...
@@ -50,6 +50,14 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
mscoree
);
WINE_DECLARE_DEBUG_CHANNEL
(
winediag
);
struct
print_handler_tls
{
int
length
;
char
buffer
[
1018
];
};
static
DWORD
print_tls_index
=
TLS_OUT_OF_INDEXES
;
typedef
HRESULT
(
*
fnCreateInstance
)(
REFIID
riid
,
LPVOID
*
ppObj
);
char
*
WtoA
(
LPCWSTR
wstr
)
...
...
@@ -214,6 +222,46 @@ HRESULT WINAPI CorBindToRuntimeHost(LPCWSTR pwszVersion, LPCWSTR pwszBuildFlavor
return
ret
;
}
void
CDECL
mono_print_handler_fn
(
const
char
*
string
,
INT
is_stdout
)
{
struct
print_handler_tls
*
tls
=
TlsGetValue
(
print_tls_index
);
if
(
!
tls
)
{
tls
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
tls
));
tls
->
length
=
0
;
TlsSetValue
(
print_tls_index
,
tls
);
}
while
(
*
string
)
{
int
remaining_buffer
=
sizeof
(
tls
->
buffer
)
-
tls
->
length
;
int
length
=
strlen
(
string
);
const
char
*
newline
=
memchr
(
string
,
'\n'
,
min
(
length
,
remaining_buffer
));
if
(
newline
)
{
length
=
newline
-
string
+
1
;
wine_dbg_printf
(
"%.*s%.*s"
,
tls
->
length
,
tls
->
buffer
,
length
,
string
);
tls
->
length
=
0
;
string
+=
length
;
}
else
if
(
length
>
remaining_buffer
)
{
/* this would overflow Wine's debug buffer */
wine_dbg_printf
(
"%.*s%.*s
\n
"
,
tls
->
length
,
tls
->
buffer
,
remaining_buffer
,
string
);
tls
->
length
=
0
;
string
+=
remaining_buffer
;
}
else
{
memcpy
(
tls
->
buffer
+
tls
->
length
,
string
,
length
);
tls
->
length
+=
length
;
break
;
}
}
}
BOOL
WINAPI
DllMain
(
HINSTANCE
hinstDLL
,
DWORD
fdwReason
,
LPVOID
lpvReserved
)
{
TRACE
(
"(%p, %d, %p)
\n
"
,
hinstDLL
,
fdwReason
,
lpvReserved
);
...
...
@@ -222,12 +270,26 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
case
DLL_PROCESS_ATTACH
:
runtimehost_init
();
DisableThreadLibraryCalls
(
hinstDLL
);
print_tls_index
=
TlsAlloc
();
if
(
print_tls_index
==
TLS_OUT_OF_INDEXES
)
return
FALSE
;
break
;
case
DLL_THREAD_DETACH
:
if
(
print_tls_index
!=
TLS_OUT_OF_INDEXES
)
HeapFree
(
GetProcessHeap
(),
0
,
TlsGetValue
(
print_tls_index
));
break
;
case
DLL_PROCESS_DETACH
:
expect_no_runtimes
();
if
(
lpvReserved
)
break
;
/* process is terminating */
runtimehost_uninit
();
if
(
print_tls_index
!=
TLS_OUT_OF_INDEXES
)
{
HeapFree
(
GetProcessHeap
(),
0
,
TlsGetValue
(
print_tls_index
));
TlsFree
(
print_tls_index
);
}
break
;
}
return
TRUE
;
...
...
dlls/mscoree/mscoree_private.h
View file @
20dc5f37
...
...
@@ -219,4 +219,6 @@ extern HRESULT get_file_from_strongname(WCHAR* stringnameW, WCHAR* assemblies_pa
extern
void
runtimehost_init
(
void
)
DECLSPEC_HIDDEN
;
extern
void
runtimehost_uninit
(
void
)
DECLSPEC_HIDDEN
;
extern
void
CDECL
mono_print_handler_fn
(
const
char
*
string
,
INT
is_stdout
)
DECLSPEC_HIDDEN
;
#endif
/* __MSCOREE_PRIVATE__ */
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