[Lldb-commits] [PATCH] D58167: Refactor user/group name resolving code

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Feb 13 01:32:45 PST 2019


labath created this revision.
labath added reviewers: zturner, clayborg, jingham.
Herald added a subscriber: mgorny.

This creates an abstract base class called "UserIDResolver", which can
be implemented to provide user/group ID resolution capabilities for
various objects. Posix host implement a PosixUserIDResolver, which does
that using posix apis (getpwuid and friends).  PlatformGDBRemote
forwards queries over the gdb-remote link, etc. ProcessInstanceInfo
class is refactored to make use of this interface instead of taking a
platform pointer as an argument. The base resolver class already
implements caching and thread-safety, so implementations don't have to
worry about that.

The main motivating factor for this was to remove external dependencies
from the ProcessInstanceInfo class (so it can be put next to
ProcessLaunchInfo and friends), but it has other benefits too:

- ability to test the user name caching code
- ability to test ProcessInstanceInfo dumping code
- consistent interface for user/group resolution between Platform and Host classes.


https://reviews.llvm.org/D58167

Files:
  include/lldb/Host/HostInfoBase.h
  include/lldb/Host/UserIDResolver.h
  include/lldb/Host/posix/HostInfoPosix.h
  include/lldb/Target/Platform.h
  include/lldb/Target/Process.h
  include/lldb/Target/RemoteAwarePlatform.h
  source/Commands/CommandObjectPlatform.cpp
  source/Host/CMakeLists.txt
  source/Host/common/UserIDResolver.cpp
  source/Host/posix/HostInfoPosix.cpp
  source/Plugins/Platform/Kalimba/PlatformKalimba.h
  source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
  source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
  source/Target/Platform.cpp
  source/Target/Process.cpp
  source/Target/RemoteAwarePlatform.cpp
  unittests/Host/CMakeLists.txt
  unittests/Host/UserIDResolverTest.cpp
  unittests/Target/CMakeLists.txt
  unittests/Target/ProcessInstanceInfoTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58167.186601.patch
Type: text/x-patch
Size: 35659 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190213/87741bf6/attachment-0001.bin>


More information about the lldb-commits mailing list