[Lldb-commits] [lldb] r365390 - [Windows] Convert GetLastError to std::error_code

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Mon Jul 8 15:45:47 PDT 2019


Thank you for the comments. Addressed in r365403.

On Mon, Jul 8, 2019 at 3:40 PM Jim Ingham <jingham at apple.com> wrote:

> Why is the thread ID getting checked against -1L? Did Windows not define
> LLDB_INVALID_HOST_THREAD?
>
> Jim
>
> > On Jul 8, 2019, at 3:06 PM, Pavel Labath via lldb-commits <
> lldb-commits at lists.llvm.org> wrote:
> >
> > Are you sure this will actually produce something meaningful? I know
> > llvm usually uses llvm::mapWindowsError for this kind of thing...
> >
> > On Mon, 8 Jul 2019 at 14:18, Jonas Devlieghere via lldb-commits
> > <lldb-commits at lists.llvm.org> wrote:
> >>
> >> Author: jdevlieghere
> >> Date: Mon Jul  8 14:19:02 2019
> >> New Revision: 365390
> >>
> >> URL: http://llvm.org/viewvc/llvm-project?rev=365390&view=rev
> >> Log:
> >> [Windows] Convert GetLastError to std::error_code
> >>
> >> Create a std::error_code from the result of GetLastError, which in turn
> >> we can use to return an llvm::Error.
> >>
> >> Modified:
> >>    lldb/trunk/source/Host/common/ThreadLauncher.cpp
> >>
> >> Modified: lldb/trunk/source/Host/common/ThreadLauncher.cpp
> >> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/ThreadLauncher.cpp?rev=365390&r1=365389&r2=365390&view=diff
> >>
> ==============================================================================
> >> --- lldb/trunk/source/Host/common/ThreadLauncher.cpp (original)
> >> +++ lldb/trunk/source/Host/common/ThreadLauncher.cpp Mon Jul  8
> 14:19:02 2019
> >> @@ -31,8 +31,10 @@ llvm::Expected<HostThread> ThreadLaunche
> >>   thread = (lldb::thread_t)::_beginthreadex(
> >>       0, (unsigned)min_stack_byte_size,
> >>       HostNativeThread::ThreadCreateTrampoline, info_ptr, 0, NULL);
> >> -  if (thread == (lldb::thread_t)(-1L))
> >> -    return llvm::errorCodeToError(::GetLastError());
> >> +  if (thread == (lldb::thread_t)(-1L)) {
> >> +    DWORD err = GetLastError();
> >> +    return llvm::errorCodeToError(std::error_code(err,
> std::system_category()));
> >> +  }
> >> #else
> >>
> >> // ASAN instrumentation adds a lot of bookkeeping overhead on stack
> frames.
> >>
> >>
> >> _______________________________________________
> >> lldb-commits mailing list
> >> lldb-commits at lists.llvm.org
> >> https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
> > _______________________________________________
> > lldb-commits mailing list
> > lldb-commits at lists.llvm.org
> > https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190708/ca1aa094/attachment.html>


More information about the lldb-commits mailing list