[Lldb-commits] [PATCH] D42488: Remove ObjectFile usage from HostLinux::GetProcessInfo

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Jan 24 08:40:19 PST 2018


labath created this revision.
labath added reviewers: eugene, krytarowski.
Herald added subscribers: hintonda, mgorny.

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.


https://reviews.llvm.org/D42488

Files:
  include/lldb/Host/common/NativeProcessProtocol.h
  include/lldb/Utility/ArchSpec.h
  source/Host/CMakeLists.txt
  source/Host/common/NativeProcessProtocol.cpp
  source/Host/linux/Host.cpp
  source/Plugins/Process/Linux/NativeProcessLinux.cpp
  source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
  source/Utility/ArchSpec.cpp
  unittests/Host/linux/HostTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42488.131281.patch
Type: text/x-patch
Size: 11326 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20180124/077834c6/attachment.bin>


More information about the lldb-commits mailing list