2013-08-27 07:57:52 +08:00
|
|
|
//===-- PlatformPOSIX.h -----------------------------------------*- C++ -*-===//
|
|
|
|
//
|
2019-01-19 16:50:56 +08:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2013-08-27 07:57:52 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2020-02-18 07:57:45 +08:00
|
|
|
#ifndef LLDB_SOURCE_PLUGINS_PLATFORM_POSIX_PLATFORMPOSIX_H
|
|
|
|
#define LLDB_SOURCE_PLUGINS_PLATFORM_POSIX_PLATFORMPOSIX_H
|
2013-08-27 07:57:52 +08:00
|
|
|
|
2016-02-06 08:43:07 +08:00
|
|
|
#include <map>
|
2013-08-27 07:57:52 +08:00
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
#include "lldb/Interpreter/Options.h"
|
Extract common PlatformPOSIX/Windows code into a separate class
Summary:
The two classes contained a lot of duplicated code, but there wasn't a
good place to factor it to. It couldn't be the base Platform class,
since we also have platforms which are only remote (such as
PlatformGDBRemoteServer), and so it did not make sense for those to have
an m_remote_platform member.
This patch creates a new class, RemoteAwarePlatform, which can serve as
a base class for platforms which can both serve as a host, and forward
actions to a remote system. It is motivated partly by D56232 (which was
about to add a bunch of additional duplicated methods), and partly by my
own need to modify a function which happens to be implemented in both
places identically.
The patch moves the methods which are trivially identical in the two
classes into the common base class, there were one or two more methods
which could probably be merged into one, but this wasn't completely
trivial, so I did not attempt to do that now.
Reviewers: jingham, zturner, clayborg, asmith
Subscribers: emaste, mgorny, Hui, lldb-commits
Differential Revision: https://reviews.llvm.org/D58052
llvm-svn: 353812
2019-02-12 17:27:24 +08:00
|
|
|
#include "lldb/Target/RemoteAwarePlatform.h"
|
2013-08-27 07:57:52 +08:00
|
|
|
|
Extract common PlatformPOSIX/Windows code into a separate class
Summary:
The two classes contained a lot of duplicated code, but there wasn't a
good place to factor it to. It couldn't be the base Platform class,
since we also have platforms which are only remote (such as
PlatformGDBRemoteServer), and so it did not make sense for those to have
an m_remote_platform member.
This patch creates a new class, RemoteAwarePlatform, which can serve as
a base class for platforms which can both serve as a host, and forward
actions to a remote system. It is motivated partly by D56232 (which was
about to add a bunch of additional duplicated methods), and partly by my
own need to modify a function which happens to be implemented in both
places identically.
The patch moves the methods which are trivially identical in the two
classes into the common base class, there were one or two more methods
which could probably be merged into one, but this wasn't completely
trivial, so I did not attempt to do that now.
Reviewers: jingham, zturner, clayborg, asmith
Subscribers: emaste, mgorny, Hui, lldb-commits
Differential Revision: https://reviews.llvm.org/D58052
llvm-svn: 353812
2019-02-12 17:27:24 +08:00
|
|
|
class PlatformPOSIX : public lldb_private::RemoteAwarePlatform {
|
2013-08-27 07:57:52 +08:00
|
|
|
public:
|
2015-10-27 08:45:06 +08:00
|
|
|
PlatformPOSIX(bool is_host);
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2015-10-27 08:45:06 +08:00
|
|
|
~PlatformPOSIX() override;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2013-08-27 07:57:52 +08:00
|
|
|
// lldb_private::Platform functions
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2015-10-27 08:45:06 +08:00
|
|
|
lldb_private::OptionGroupOptions *
|
|
|
|
GetConnectionOptions(lldb_private::CommandInterpreter &interpreter) override;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2017-05-12 12:51:55 +08:00
|
|
|
lldb_private::Status PutFile(const lldb_private::FileSpec &source,
|
|
|
|
const lldb_private::FileSpec &destination,
|
|
|
|
uint32_t uid = UINT32_MAX,
|
|
|
|
uint32_t gid = UINT32_MAX) override;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2017-05-12 12:51:55 +08:00
|
|
|
lldb_private::Status
|
2015-05-30 03:52:29 +08:00
|
|
|
GetFile(const lldb_private::FileSpec &source,
|
|
|
|
const lldb_private::FileSpec &destination) override;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2014-07-23 07:41:36 +08:00
|
|
|
const lldb::UnixSignalsSP &GetRemoteUnixSignals() override;
|
2017-02-03 01:50:03 +08:00
|
|
|
|
2014-10-10 08:09:16 +08:00
|
|
|
lldb::ProcessSP Attach(lldb_private::ProcessAttachInfo &attach_info,
|
|
|
|
lldb_private::Debugger &debugger,
|
2015-10-27 08:45:06 +08:00
|
|
|
lldb_private::Target *target, // Can be nullptr, if
|
|
|
|
// nullptr create a new
|
|
|
|
// target, else use
|
|
|
|
// existing one
|
2017-05-12 12:51:55 +08:00
|
|
|
lldb_private::Status &error) override;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2014-07-23 07:41:36 +08:00
|
|
|
lldb::ProcessSP DebugProcess(lldb_private::ProcessLaunchInfo &launch_info,
|
|
|
|
lldb_private::Debugger &debugger,
|
2015-10-27 08:45:06 +08:00
|
|
|
lldb_private::Target *target, // Can be nullptr,
|
|
|
|
// if nullptr
|
|
|
|
// create a new
|
|
|
|
// target, else use
|
|
|
|
// existing one
|
2017-05-12 12:51:55 +08:00
|
|
|
lldb_private::Status &error) override;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2014-11-04 11:13:17 +08:00
|
|
|
std::string GetPlatformSpecificConnectionInformation() override;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2014-11-04 11:13:17 +08:00
|
|
|
void CalculateTrapHandlerSymbolNames() override;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2017-05-12 12:51:55 +08:00
|
|
|
lldb_private::Status ConnectRemote(lldb_private::Args &args) override;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2017-05-12 12:51:55 +08:00
|
|
|
lldb_private::Status DisconnectRemote() override;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2015-12-08 21:43:59 +08:00
|
|
|
uint32_t DoLoadImage(lldb_private::Process *process,
|
|
|
|
const lldb_private::FileSpec &remote_file,
|
2018-06-29 04:02:11 +08:00
|
|
|
const std::vector<std::string> *paths,
|
|
|
|
lldb_private::Status &error,
|
|
|
|
lldb_private::FileSpec *loaded_image) override;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2017-05-12 12:51:55 +08:00
|
|
|
lldb_private::Status UnloadImage(lldb_private::Process *process,
|
|
|
|
uint32_t image_token) override;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2015-12-08 22:08:19 +08:00
|
|
|
size_t ConnectToWaitingProcesses(lldb_private::Debugger &debugger,
|
2017-05-12 12:51:55 +08:00
|
|
|
lldb_private::Status &error) override;
|
2015-12-08 22:08:19 +08:00
|
|
|
|
2017-02-04 01:42:04 +08:00
|
|
|
lldb_private::ConstString GetFullNameForDylib(lldb_private::ConstString basename) override;
|
|
|
|
|
2013-08-27 07:57:52 +08:00
|
|
|
protected:
|
2016-02-06 08:43:07 +08:00
|
|
|
std::unique_ptr<lldb_private::OptionGroupPlatformRSync>
|
|
|
|
m_option_group_platform_rsync;
|
|
|
|
std::unique_ptr<lldb_private::OptionGroupPlatformSSH>
|
|
|
|
m_option_group_platform_ssh;
|
|
|
|
std::unique_ptr<lldb_private::OptionGroupPlatformCaching>
|
|
|
|
m_option_group_platform_caching;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2016-02-06 08:43:07 +08:00
|
|
|
std::map<lldb_private::CommandInterpreter *,
|
|
|
|
std::unique_ptr<lldb_private::OptionGroupOptions>>
|
|
|
|
m_options;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2017-05-12 12:51:55 +08:00
|
|
|
lldb_private::Status
|
2015-12-02 19:58:51 +08:00
|
|
|
EvaluateLibdlExpression(lldb_private::Process *process, const char *expr_cstr,
|
2017-07-05 22:54:41 +08:00
|
|
|
llvm::StringRef expr_prefix,
|
2015-12-02 19:58:51 +08:00
|
|
|
lldb::ValueObjectSP &result_valobj_sp);
|
2018-05-12 02:21:11 +08:00
|
|
|
|
|
|
|
std::unique_ptr<lldb_private::UtilityFunction>
|
|
|
|
MakeLoadImageUtilityFunction(lldb_private::ExecutionContext &exe_ctx,
|
|
|
|
lldb_private::Status &error);
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2017-08-15 00:39:16 +08:00
|
|
|
virtual
|
|
|
|
llvm::StringRef GetLibdlFunctionDeclarations(lldb_private::Process *process);
|
2015-12-03 20:58:03 +08:00
|
|
|
|
2013-08-27 07:57:52 +08:00
|
|
|
private:
|
[lldb] NFC remove DISALLOW_COPY_AND_ASSIGN
Summary:
This is how I applied my clang-tidy check (see
https://reviews.llvm.org/D80531) in order to remove
`DISALLOW_COPY_AND_ASSIGN` and have deleted copy ctors and deleted
assignment operators instead.
```
lang=bash
grep DISALLOW_COPY_AND_ASSIGN /opt/notnfs/kkleine/llvm/lldb -r -l | sort | uniq > files
for i in $(cat files);
do
clang-tidy \
--checks="-*,modernize-replace-disallow-copy-and-assign-macro" \
--format-style=LLVM \
--header-filter=.* \
--fix \
-fix-errors \
$i;
done
```
Reviewers: espindola, labath, aprantl, teemperor
Reviewed By: labath, aprantl, teemperor
Subscribers: teemperor, aprantl, labath, emaste, sbc100, aheejin, MaskRay, arphaman, usaxena95, lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D80543
2020-06-03 00:19:55 +08:00
|
|
|
PlatformPOSIX(const PlatformPOSIX &) = delete;
|
|
|
|
const PlatformPOSIX &operator=(const PlatformPOSIX &) = delete;
|
2013-08-27 07:57:52 +08:00
|
|
|
};
|
|
|
|
|
2020-02-18 07:57:45 +08:00
|
|
|
#endif // LLDB_SOURCE_PLUGINS_PLATFORM_POSIX_PLATFORMPOSIX_H
|