Commit Graph

12 Commits

Author SHA1 Message Date
Pavel Labath d813309e03 Logging: Disable logging after fork()
Summary:
We had a bug where if we had forked (in the ProcessLauncherPosixFork)
while another thread was writing a log message, we would deadlock. This
happened because the fork child inherited the locked log rwmutex, which
would never get unlocked. This meant the child got stuck trying to
disable all log channels.

The bug existed for a while but only started being apparent after
D37930, which started using ThreadLauncher (which uses logging) instead
of std::thread (which does not) for launching TaskPool threads.

The fix is to use pthread_atfork to disable logging in the forked child.

Reviewers: zturner, eugene, clayborg

Subscribers: lldb-commits

Differential Revision: https://reviews.llvm.org/D38938

llvm-svn: 316368
2017-10-23 19:41:17 +00:00
Eugene Zemtsov d4abad9a0a More precise c library feature detection for Android.
llvm-svn: 313436
2017-09-16 02:19:21 +00:00
Pavel Labath f40f8fc415 Fix NetBSD/FreeBSD build after r308304
llvm-svn: 308307
2017-07-18 14:03:47 +00:00
Pavel Labath b6dbe9a99c Clean up lldb-types.h
Summary:
It defined a couple of types (condition_t) which we don't use anymore,
as we have c++11 goodies now. I remove these definitions.

Also it unnecessarily included a couple of headers which weren't
necessary for it's operation. I remove these, and place the includes in
the relevant files (usually .cpp, usually in Host code) which use them.
This allows us to reduce namespace pollution in most of the lldb files
which don't need the OS-specific definitions.

Reviewers: zturner, jingham

Subscribers: ki.stfu, lldb-commits

Differential Revision: https://reviews.llvm.org/D35113

llvm-svn: 308304
2017-07-18 13:14:01 +00:00
Pavel Labath 6c5c542986 ProcessLauncherPosixFork: Fetch errno early
I was seeing some unlikely errno values here. I am not sure if this will
help, but it nontheless seems like a good idea to stash errno value
before issuing other syscalls.

llvm-svn: 305778
2017-06-20 08:11:37 +00:00
Pavel Labath 10c41f37b5 replace uses of strerror with llvm::sys::StrError
strerror is not thread-safe. llvm's StrError tries hard to retrieve the
string in a thread-safe way and falls back to strerror only if it does
not have another way.

llvm-svn: 304795
2017-06-06 14:06:17 +00:00
Zachary Turner 97206d5727 Rename Error -> Status.
This renames the LLDB error class to Status, as discussed
on the lldb-dev mailing list.

A change of this magnitude cannot easily be done without
find and replace, but that has potential to catch unwanted
occurrences of common strings such as "Error".  Every effort
was made to find all the obvious things such as the word "Error"
appearing in a string, etc, but it's possible there are still
some lingering occurences left around.  Hopefully nothing too
serious.

llvm-svn: 302872
2017-05-12 04:51:55 +00:00
Zachary Turner 5713a05b5b Move FileSpec from Host -> Utility.
llvm-svn: 298536
2017-03-22 18:40:07 +00:00
Pavel Labath 775588c0c3 Remove lldb streams from the Log class completely
Summary:
previously we switched to llvm streams for log output, this completes
the switch for the error streams.

I also clean up the includes and remove the unused argument from
DisableAllLogChannels().

This required adding a bit of boiler plate to convert the output in the
command interpreter, but that should go away when we switch command
results to use llvm streams as well.

Reviewers: zturner, eugene

Subscribers: lldb-commits, emaste

Differential Revision: https://reviews.llvm.org/D30894

llvm-svn: 297812
2017-03-15 09:06:58 +00:00
Zachary Turner 6f9e690199 Move Log from Core -> Utility.
All references to Host and Core have been removed, so this
class can now safely be lowered into Utility.

Differential Revision: https://reviews.llvm.org/D30559

llvm-svn: 296909
2017-03-03 20:56:28 +00:00
Pavel Labath 3eb8b1ade1 Fix android build of the new process launcher
Android does not define the "cross-platform" symbol PT_TRACE_ME. Define
it ourselves, so we can keep the rest of the code generic.

llvm-svn: 293779
2017-02-01 16:43:22 +00:00
Kamil Rytarowski 816ae4b0df Transform ProcessLauncherLinux to ProcessLauncherPosixFork
Summary:
Use ProcessLauncherPosixFork in Linux and NetBSD.

Changes to ProcessLauncherLinux:
 - Limit personality.h and ASLR code to Linux.
 - Reuse portable ptrace(2) PT_TRACE_ME operation available on Linux and BSDs.
 - Limit ETXTBSY error path from execve(2) to Linux.
 - In LaunchProcess declaration change virtual to override.

This code should be readily available for FreeBSD.

Sponsored by <The NetBSD Foundation>

Reviewers: joerg, clayborg, labath, emaste

Reviewed By: labath

Subscribers: danalbert, srhines, mgorny, #lldb

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D29347

llvm-svn: 293768
2017-02-01 14:30:40 +00:00