27#define LLDB_PROPERTIES_platformqemuuser 
   28#include "PlatformQemuUserProperties.inc" 
   31#define LLDB_PROPERTIES_platformqemuuser 
   32#include "PlatformQemuUserPropertiesEnum.inc" 
   38    m_collection_sp = std::make_shared<OptionValueProperties>(
 
   40    m_collection_sp->Initialize(g_platformqemuuser_properties);
 
   43  llvm::StringRef GetArchitecture() {
 
   44    return GetPropertyAtIndexAs<llvm::StringRef>(ePropertyArchitecture, 
"");
 
   47  FileSpec GetEmulatorPath() {
 
   48    return GetPropertyAtIndexAs<FileSpec>(ePropertyEmulatorPath, {});
 
   51  Args GetEmulatorArgs() {
 
   53    m_collection_sp->GetPropertyAtIndexAsArgs(ePropertyEmulatorArgs, result);
 
   57  Environment GetEmulatorEnvVars() {
 
   59    m_collection_sp->GetPropertyAtIndexAsArgs(ePropertyEmulatorEnvVars, args);
 
   60    return Environment(args);
 
   63  Environment GetTargetEnvVars() {
 
   65    m_collection_sp->GetPropertyAtIndexAsArgs(ePropertyTargetEnvVars, args);
 
   66    return Environment(args);
 
   73  static PluginProperties g_settings;
 
 
   78  return "Platform for debugging binaries under user mode qemu";
 
 
   96        "Properties for the qemu-user platform plugin.",
 
 
  109  llvm::Triple triple = HostInfo::GetArchitecture().GetTriple();
 
  110  triple.setEnvironment(llvm::Triple::UnknownEnvironment);
 
  112  if (triple.getArch() != llvm::Triple::UnknownArch)
 
 
  128  std::vector<std::string> set_env;
 
  129  for (
const auto &KV : target) {
 
  132    auto host_it = host.find(KV.first());
 
  133    if (host_it == host.end() || host_it->second != KV.second)
 
  138  std::vector<llvm::StringRef> unset_env;
 
  139  for (
const auto &KV : host) {
 
  142    if (target.count(KV.first()) == 0)
 
  143      unset_env.push_back(KV.first());
 
  145  llvm::sort(unset_env);
 
  149  if (!set_env.empty()) {
 
  150    host[
"QEMU_SET_ENV"] = llvm::join(set_env, 
",");
 
  151    unset_env.push_back(
"QEMU_SET_ENV");
 
  153  if (!unset_env.empty()) {
 
  154    unset_env.push_back(
"QEMU_UNSET_ENV");
 
  155    host[
"QEMU_UNSET_ENV"] = llvm::join(unset_env, 
",");
 
 
  175    qemu.
SetPath((
"qemu-" + arch).str());
 
  179  llvm::SmallString<0> socket_model, socket_path;
 
  180  HostInfo::GetProcessTempDir().GetPath(socket_model);
 
  181  llvm::sys::path::append(socket_model, 
"qemu-%%%%%%%%.socket");
 
  183    llvm::sys::fs::createUniquePath(socket_model, socket_path, 
false);
 
  187  if (!launch_info.
GetArg0().empty()) {
 
  188    args.AppendArgument(
"-0");
 
  189    args.AppendArgument(launch_info.
GetArg0());
 
  192  args.AppendArgument(
"--");
 
  194  for (
size_t i = 1; i < launch_info.
GetArguments().size(); ++i)
 
  195    args.AppendArgument(launch_info.
GetArguments()[i].ref());
 
  204    emulator_env[
"QEMU_LD_PREFIX"] = sysroot;
 
  206    emulator_env[KV.first()] = KV.second;
 
  208      std::move(launch_info.
GetEnvironment()), std::move(emulator_env));
 
  217  LLDB_LOG_ERROR(log, std::move(Err), 
"SetUpPtyRedirection failed: {0}");
 
  234  error = process_sp->ConnectRemote((
"unix-connect://" + socket_path).str());
 
  240    process_sp->SetSTDIOFileDescriptor(
 
 
  249    env[KV.first()] = KV.second;
 
 
static llvm::raw_ostream & error(Stream &strm)
static DynamicLoaderDarwinKernelProperties & GetGlobalProperties()
#define LLDB_LOG(log,...)
The LLDB_LOG* macros defined below are the way to emit log messages.
#define LLDB_LOG_ERROR(log, error,...)
#define LLDB_PLUGIN_DEFINE(PluginName)
An architecture specification class.
llvm::Triple & GetTriple()
Architecture triple accessor.
A command line argument class.
llvm::ArrayRef< const char * > GetArgumentArrayRef() const
Gets the argument as an ArrayRef.
void AppendArguments(const Args &rhs)
A class to manage flag bits.
static std::string compose(const value_type &KeyValue)
void SetPath(llvm::StringRef p)
Temporary helper for FileSystem change.
size_t GetPath(char *path, size_t max_path_length, bool denormalize=true) const
Extract the full path to the file.
bool ResolveExecutableLocation(FileSpec &file_spec)
Call into the Host to see if it can help find the file.
static FileSystem & Instance()
ValueType Clear(ValueType mask=~static_cast< ValueType >(0))
Clear one or more flags.
static Status LaunchProcess(ProcessLaunchInfo &launch_info)
Launch the process specified in launch_info.
static Environment GetEnvironment()
static bool RegisterPlugin(llvm::StringRef name, llvm::StringRef description, ABICreateInstance create_callback)
static lldb::OptionValuePropertiesSP GetSettingForPlatformPlugin(Debugger &debugger, llvm::StringRef setting_name)
static bool CreateSettingForPlatformPlugin(Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp, llvm::StringRef description, bool is_global_property)
static bool UnregisterPlugin(ABICreateInstance create_callback)
lldb::ListenerSP GetHijackListener() const
llvm::StringRef GetArg0() const
void SetArguments(const Args &args, bool first_arg_is_executable)
FileSpec & GetExecutableFile()
lldb::ListenerSP GetListener() const
Environment & GetEnvironment()
llvm::Error SetUpPtyRedirection()
PseudoTerminal & GetPTY()
static void NoOpMonitorCallback(lldb::pid_t pid, int signal, int status)
A Monitor callback which does not take any action on process events.
void SetMonitorProcessCallback(Host::MonitorChildProcessCallback callback)
void SetLaunchInSeparateProcessGroup(bool separate)
@ invalid_fd
Invalid file descriptor value.
int GetPrimaryFileDescriptor() const
The primary file descriptor accessor.
int ReleasePrimaryFileDescriptor()
Release the primary file descriptor.
static Status FromErrorString(const char *str)
const lldb::ProcessSP & CreateProcess(lldb::ListenerSP listener_sp, llvm::StringRef plugin_name, const FileSpec *crash_file, bool can_connect)
const ArchSpec & GetArchitecture() const
static llvm::StringRef GetPluginNameStatic()
A class that represents a running process on the host machine.
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
std::shared_ptr< lldb_private::Platform > PlatformSP
std::shared_ptr< lldb_private::Process > ProcessSP