llvm-project/lldb/unittests/Host
Pavel Labath 36e82208c7 Remove ObjectFile usage from HostLinux::GetProcessInfo
Summary:
The ObjectFile class was used to determine the architecture of a running
process by inspecting it's main executable. There were two issues with
this:
- it's in the wrong layer
- the call can be very expensive (it can end up computing the crc of the
  whole file).

Since the process is running on the host, ideally we would be able to
just query the data straight from the OS like darwin does, but there
doesn't seem to be a reasonable way to do that. So, this fixes the
layering issue by using the llvm object library to inspect the file.
Since we know the process is already running on the host, we just need
to peek at a few bytes of the elf header to determine whether it's 32-
or 64-bit (which should make this faster as well).

Pretty much the same logic was implemented in
NativeProcessProtocol::ResolveProcessArchitecture, so I delete this
logic and replace calls with GetProcessInfo.

Reviewers: eugene, krytarowski

Subscribers: mgorny, hintonda, lldb-commits

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

llvm-svn: 323637
2018-01-29 10:46:00 +00:00
..
linux Remove ObjectFile usage from HostLinux::GetProcessInfo 2018-01-29 10:46:00 +00:00
CMakeLists.txt Invert ArchSpec<->Platform dependency 2017-10-31 10:56:03 +00:00
FileSpecTest.cpp In FileSpec::Equal, short-cut GetNormalizedPath. 2017-03-27 19:12:25 +00:00
FileSystemTest.cpp Remove TimeValue usage from FileSpec.h 2016-11-01 16:11:14 +00:00
HostInfoTest.cpp Remove last Host usage from ArchSpec 2017-11-13 15:57:20 +00:00
HostTest.cpp Add Utility/Environment class for handling... environments 2018-01-10 11:57:31 +00:00
MainLoopTest.cpp Move PseudoTerminal to the lldb_private namespace 2017-12-11 10:09:14 +00:00
SocketAddressTest.cpp Fix the new SocketAddressTest on Windows 2017-04-24 13:34:35 +00:00
SocketTest.cpp [IPv6] Fix a bug in the IPv6 listen behavior 2017-08-29 16:13:41 +00:00
SymbolsTest.cpp Fix unittest compilation on windows 2016-09-07 08:46:50 +00:00
TaskPoolTest.cpp [lldb] A few minor fixes in TaskPool 2017-11-30 22:56:11 +00:00