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
93577c00
Commit
93577c00
authored
Oct 19, 2022
by
Brendan Shanks
Committed by
Alexandre Julliard
Nov 07, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Add native thread renaming for exception method.
parent
d3416d90
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
65 additions
and
0 deletions
+65
-0
ntdll_misc.h
dlls/ntdll/ntdll_misc.h
+2
-0
signal_arm.c
dlls/ntdll/signal_arm.c
+2
-0
signal_arm64.c
dlls/ntdll/signal_arm64.c
+2
-0
signal_i386.c
dlls/ntdll/signal_i386.c
+2
-0
signal_x86_64.c
dlls/ntdll/signal_x86_64.c
+2
-0
thread.c
dlls/ntdll/thread.c
+45
-0
thread.c
dlls/ntdll/unix/thread.c
+10
-0
No files found.
dlls/ntdll/ntdll_misc.h
View file @
93577c00
...
...
@@ -20,6 +20,7 @@
#define __WINE_NTDLL_MISC_H
#include <stdarg.h>
#include <stdlib.h>
#include <sys/types.h>
#include "windef.h"
...
...
@@ -61,6 +62,7 @@ extern RUNTIME_FUNCTION *lookup_function_info( ULONG_PTR pc, ULONG_PTR *base, LD
/* debug helpers */
extern
LPCSTR
debugstr_us
(
const
UNICODE_STRING
*
str
)
DECLSPEC_HIDDEN
;
extern
const
char
*
debugstr_exception_code
(
DWORD
code
)
DECLSPEC_HIDDEN
;
extern
void
set_native_thread_name
(
DWORD
tid
,
const
char
*
name
)
DECLSPEC_HIDDEN
;
/* init routines */
extern
void
version_init
(
void
)
DECLSPEC_HIDDEN
;
...
...
dlls/ntdll/signal_arm.c
View file @
93577c00
...
...
@@ -482,6 +482,8 @@ NTSTATUS WINAPI KiUserExceptionDispatcher( EXCEPTION_RECORD *rec, CONTEXT *conte
else
WARN_
(
threadname
)(
"Thread ID %04x renamed to %s
\n
"
,
(
DWORD
)
rec
->
ExceptionInformation
[
2
],
debugstr_a
((
char
*
)
rec
->
ExceptionInformation
[
1
])
);
set_native_thread_name
((
DWORD
)
rec
->
ExceptionInformation
[
2
],
(
char
*
)
rec
->
ExceptionInformation
[
1
]);
}
else
if
(
rec
->
ExceptionCode
==
DBG_PRINTEXCEPTION_C
)
{
...
...
dlls/ntdll/signal_arm64.c
View file @
93577c00
...
...
@@ -514,6 +514,8 @@ NTSTATUS WINAPI KiUserExceptionDispatcher( EXCEPTION_RECORD *rec, CONTEXT *conte
else
WARN_
(
threadname
)(
"Thread ID %04x renamed to %s
\n
"
,
(
DWORD
)
rec
->
ExceptionInformation
[
2
],
debugstr_a
((
char
*
)
rec
->
ExceptionInformation
[
1
])
);
set_native_thread_name
((
DWORD
)
rec
->
ExceptionInformation
[
2
],
(
char
*
)
rec
->
ExceptionInformation
[
1
]);
}
else
if
(
rec
->
ExceptionCode
==
DBG_PRINTEXCEPTION_C
)
{
...
...
dlls/ntdll/signal_i386.c
View file @
93577c00
...
...
@@ -200,6 +200,8 @@ NTSTATUS WINAPI dispatch_exception( EXCEPTION_RECORD *rec, CONTEXT *context )
else
WARN_
(
threadname
)(
"Thread ID %04x renamed to %s
\n
"
,
(
DWORD
)
rec
->
ExceptionInformation
[
2
],
debugstr_a
((
char
*
)
rec
->
ExceptionInformation
[
1
])
);
set_native_thread_name
((
DWORD
)
rec
->
ExceptionInformation
[
2
],
(
char
*
)
rec
->
ExceptionInformation
[
1
]);
}
else
if
(
rec
->
ExceptionCode
==
DBG_PRINTEXCEPTION_C
)
{
...
...
dlls/ntdll/signal_x86_64.c
View file @
93577c00
...
...
@@ -531,6 +531,8 @@ NTSTATUS WINAPI dispatch_exception( EXCEPTION_RECORD *rec, CONTEXT *context )
else
WARN_
(
threadname
)(
"Thread ID %04x renamed to %s
\n
"
,
(
DWORD
)
rec
->
ExceptionInformation
[
2
],
debugstr_a
((
char
*
)
rec
->
ExceptionInformation
[
1
])
);
set_native_thread_name
((
DWORD
)
rec
->
ExceptionInformation
[
2
],
(
char
*
)
rec
->
ExceptionInformation
[
1
]);
}
else
if
(
rec
->
ExceptionCode
==
DBG_PRINTEXCEPTION_C
)
{
...
...
dlls/ntdll/thread.c
View file @
93577c00
...
...
@@ -179,6 +179,51 @@ int __cdecl __wine_dbg_output( const char *str )
/***********************************************************************
* set_native_thread_name
*/
void
set_native_thread_name
(
DWORD
tid
,
const
char
*
name
)
{
THREAD_NAME_INFORMATION
info
;
HANDLE
h
=
GetCurrentThread
();
WCHAR
nameW
[
64
];
if
(
tid
!=
-
1
)
{
OBJECT_ATTRIBUTES
attr
;
CLIENT_ID
cid
;
attr
.
Length
=
sizeof
(
attr
);
attr
.
RootDirectory
=
0
;
attr
.
Attributes
=
0
;
attr
.
ObjectName
=
NULL
;
attr
.
SecurityDescriptor
=
NULL
;
attr
.
SecurityQualityOfService
=
NULL
;
cid
.
UniqueProcess
=
0
;
cid
.
UniqueThread
=
ULongToHandle
(
tid
);
if
(
NtOpenThread
(
&
h
,
THREAD_QUERY_LIMITED_INFORMATION
,
&
attr
,
&
cid
))
return
;
}
if
(
name
)
{
mbstowcs
(
nameW
,
name
,
ARRAY_SIZE
(
nameW
)
);
nameW
[
ARRAY_SIZE
(
nameW
)
-
1
]
=
'\0'
;
}
else
{
nameW
[
0
]
=
'\0'
;
}
RtlInitUnicodeString
(
&
info
.
ThreadName
,
nameW
);
NtSetInformationThread
(
h
,
ThreadWineNativeThreadName
,
&
info
,
sizeof
(
info
)
);
if
(
h
!=
GetCurrentThread
())
NtClose
(
h
);
}
/***********************************************************************
* RtlExitUserThread (NTDLL.@)
*/
void
WINAPI
RtlExitUserThread
(
ULONG
status
)
...
...
dlls/ntdll/unix/thread.c
View file @
93577c00
...
...
@@ -2304,6 +2304,16 @@ NTSTATUS WINAPI NtSetInformationThread( HANDLE handle, THREADINFOCLASS class,
return
status
;
}
case
ThreadWineNativeThreadName
:
{
const
THREAD_NAME_INFORMATION
*
info
=
data
;
if
(
length
!=
sizeof
(
*
info
))
return
STATUS_INFO_LENGTH_MISMATCH
;
set_native_thread_name
(
handle
,
&
info
->
ThreadName
);
return
STATUS_SUCCESS
;
}
case
ThreadWow64Context
:
return
set_thread_wow64_context
(
handle
,
data
,
length
);
...
...
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