The function ResumeThread on Windows returns a DWORD which is an unsigned int. In TargetThreadWindows::DoResume, there's code that determines how many times to call ResumeThread based on whether the return value is greater than 0. Since the function returns -1 (as an unsigned int) on failure, this was getting stuck in an infinite loop if ResumeThread failed for any reason. The correct thing to do is check whether the return value is -1 and then return the appropriate error instead of ignoring the return value.
Details
Details
- Reviewers
asmith zturner labath - Commits
- rG0fd67b537bdf: [Windows, Process] Fix an issue in windows thread handling that was causing…
rLLDB332670: [Windows, Process] Fix an issue in windows thread handling that was causing…
rL332670: [Windows, Process] Fix an issue in windows thread handling that was causing…
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
source/Plugins/Process/Windows/Common/TargetThreadWindows.cpp | ||
---|---|---|
127–128 | Can you move this check inside the loop and then remove the additional check from the while condition? Also, can you write == (DWORD)-1 or == 0xFFFFFFFF instead of == -1? It's the same meaning, but it makes it slightly clearer to the reader that this is intentional. |
Comment Actions
Ahh it looks like you attached the updated patch directly to this email instead of updating it through Phabricator. If you can updated it through the Phabricator UI it's more helpful since it updates the graphical diff viewer that way. Otherwise have to open the patch in a separated text editor.
In any case, lgtm.
Can you move this check inside the loop and then remove the additional check from the while condition?
Also, can you write == (DWORD)-1 or == 0xFFFFFFFF instead of == -1? It's the same meaning, but it makes it slightly clearer to the reader that this is intentional.