[PATCH 1/4] winedbg: Set thread->name from MSVC exception when in GDB proxy mode.
Brendan Shanks
bshanks at codeweavers.com
Wed Mar 16 15:13:01 CDT 2022
> On Mar 16, 2022, at 12:20 AM, Eric Pouech <eric.pouech at orange.fr> wrote:
>
> Le 15/03/2022 à 20:05, Brendan Shanks a écrit :
>> Signed-off-by: Brendan Shanks <bshanks at codeweavers.com>
>> ---
>> programs/winedbg/gdbproxy.c | 9 +++++----
>> 1 file changed, 5 insertions(+), 4 deletions(-)
>>
>> diff --git a/programs/winedbg/gdbproxy.c b/programs/winedbg/gdbproxy.c
>> index 0268a288481..bcde120adeb 100644
>> --- a/programs/winedbg/gdbproxy.c
>> +++ b/programs/winedbg/gdbproxy.c
>> @@ -482,7 +482,6 @@ static BOOL handle_exception(struct gdb_context* gdbctx, EXCEPTION_DEBUG_INFO* e
>> {
>> const THREADNAME_INFO *threadname = (const THREADNAME_INFO *)rec->ExceptionInformation;
>> struct dbg_thread *thread;
>> - char name[9];
>> SIZE_T read;
>> if (threadname->dwType != 0x1000)
>> @@ -494,10 +493,12 @@ static BOOL handle_exception(struct gdb_context* gdbctx, EXCEPTION_DEBUG_INFO* e
>> if (thread)
>> {
>> if (gdbctx->process->process_io->read( gdbctx->process->handle,
>> - threadname->szName, name, sizeof(name), &read) && read == sizeof(name))
>> + threadname->szName, thread->name, sizeof(thread->name), &read) &&
>> + read == sizeof(thread->name))
>
> it looks a bit strange to me that we can always expect being able to read sizeof(thread->name) here...
>
> using existing memory_get_string helper might be a better idea
Thanks, I hadn’t seen that function before, I’ll use it. I think the end result will be the same though, since memory_get_string() uses the same read() that's implemented with ReadProcessMemory(), which doesn’t do partial reads.
ReadProcessMemory() could fail if sizeof(thread->name) would overflow into an inaccessible page, but for a convenience feature like thread names (and this is the old/deprecated way of setting them) I’m not sure it’s worth handling that rare case.
Brendan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20220316/841d175e/attachment.htm>
More information about the wine-devel
mailing list