takes separate file handles for stdin, stdout, and stder and also allows for the working directory to be specified. Added support to "process launch" to a new option: --working-dir=PATH. We can now set the working directory. If this is not set, it defaults to that of the process that has LLDB loaded. Added the working directory to the host LaunchInNewTerminal function to allows the current working directory to be set in processes that are spawned in their own terminal. Also hooked this up to the lldb_private::Process and all mac plug-ins. The linux plug-in had its API changed, but nothing is making use of it yet. Modfied "debugserver" and "darwin-debug" to also handle the current working directory options and modified the code in LLDB that spawns these tools to pass the info along. Fixed ProcessGDBRemote to properly pass along all file handles for stdin, stdout and stderr. After clearing the default values for the stdin/out/err file handles for process to be NULL, we had a crasher in UserSettingsController::UpdateStringVariable which is now fixed. Also fixed the setting of boolean values to be able to be set as "true", "yes", "on", "1" for true (case insensitive) and "false", "no", "off", or "0" for false. Fixed debugserver to properly handle files for STDIN, STDOUT and STDERR that are not already opened. Previous to this fix debugserver would only correctly open and dupe file handles for the slave side of a pseudo terminal. It now correctly handles getting STDIN for the inferior from a file, and spitting STDOUT and STDERR out to files. Also made sure the file handles were correctly opened with the NOCTTY flag for terminals. llvm-svn: 124060
203 lines
5.4 KiB
C++
203 lines
5.4 KiB
C++
//===-- ProcessLinux.h ------------------------------------------*- C++ -*-===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef liblldb_ProcessLinux_H_
|
|
#define liblldb_ProcessLinux_H_
|
|
|
|
// C Includes
|
|
|
|
// C++ Includes
|
|
#include <queue>
|
|
|
|
// Other libraries and framework includes
|
|
#include "lldb/Target/Process.h"
|
|
#include "ProcessMessage.h"
|
|
|
|
class ProcessMonitor;
|
|
|
|
class ProcessLinux :
|
|
public lldb_private::Process
|
|
{
|
|
public:
|
|
//------------------------------------------------------------------
|
|
// Static functions.
|
|
//------------------------------------------------------------------
|
|
static Process*
|
|
CreateInstance(lldb_private::Target& target,
|
|
lldb_private::Listener &listener);
|
|
|
|
static void
|
|
Initialize();
|
|
|
|
static void
|
|
Terminate();
|
|
|
|
static const char *
|
|
GetPluginNameStatic();
|
|
|
|
static const char *
|
|
GetPluginDescriptionStatic();
|
|
|
|
//------------------------------------------------------------------
|
|
// Constructors and destructors
|
|
//------------------------------------------------------------------
|
|
ProcessLinux(lldb_private::Target& target,
|
|
lldb_private::Listener &listener);
|
|
|
|
virtual
|
|
~ProcessLinux();
|
|
|
|
//------------------------------------------------------------------
|
|
// Process protocol.
|
|
//------------------------------------------------------------------
|
|
virtual bool
|
|
CanDebug(lldb_private::Target &target);
|
|
|
|
virtual lldb_private::Error
|
|
WillLaunch(lldb_private::Module *module);
|
|
|
|
virtual lldb_private::Error
|
|
DoAttachToProcessWithID(lldb::pid_t pid);
|
|
|
|
virtual lldb_private::Error
|
|
DoLaunch(lldb_private::Module *module,
|
|
char const *argv[],
|
|
char const *envp[],
|
|
uint32_t launch_flags,
|
|
const char *stdin_path,
|
|
const char *stdout_path,
|
|
const char *stderr_path,
|
|
const char *working_directory);
|
|
|
|
virtual void
|
|
DidLaunch();
|
|
|
|
virtual lldb_private::Error
|
|
DoResume();
|
|
|
|
virtual lldb_private::Error
|
|
DoHalt(bool &caused_stop);
|
|
|
|
virtual lldb_private::Error
|
|
DoDetach();
|
|
|
|
virtual lldb_private::Error
|
|
DoSignal(int signal);
|
|
|
|
virtual lldb_private::Error
|
|
DoDestroy();
|
|
|
|
virtual void
|
|
RefreshStateAfterStop();
|
|
|
|
virtual bool
|
|
IsAlive();
|
|
|
|
virtual size_t
|
|
DoReadMemory(lldb::addr_t vm_addr,
|
|
void *buf,
|
|
size_t size,
|
|
lldb_private::Error &error);
|
|
|
|
virtual size_t
|
|
DoWriteMemory(lldb::addr_t vm_addr, const void *buf, size_t size,
|
|
lldb_private::Error &error);
|
|
|
|
virtual lldb::addr_t
|
|
DoAllocateMemory(size_t size, uint32_t permissions,
|
|
lldb_private::Error &error);
|
|
|
|
lldb::addr_t
|
|
AllocateMemory(size_t size, uint32_t permissions,
|
|
lldb_private::Error &error);
|
|
|
|
virtual lldb_private::Error
|
|
DoDeallocateMemory(lldb::addr_t ptr);
|
|
|
|
virtual size_t
|
|
GetSoftwareBreakpointTrapOpcode(lldb_private::BreakpointSite* bp_site);
|
|
|
|
virtual lldb_private::Error
|
|
EnableBreakpoint(lldb_private::BreakpointSite *bp_site);
|
|
|
|
virtual lldb_private::Error
|
|
DisableBreakpoint(lldb_private::BreakpointSite *bp_site);
|
|
|
|
virtual uint32_t
|
|
UpdateThreadListIfNeeded();
|
|
|
|
virtual lldb::ByteOrder
|
|
GetByteOrder() const;
|
|
|
|
virtual lldb::addr_t
|
|
GetImageInfoAddress();
|
|
|
|
virtual lldb_private::DynamicLoader *
|
|
GetDynamicLoader();
|
|
|
|
//------------------------------------------------------------------
|
|
// PluginInterface protocol
|
|
//------------------------------------------------------------------
|
|
virtual const char *
|
|
GetPluginName();
|
|
|
|
virtual const char *
|
|
GetShortPluginName();
|
|
|
|
virtual uint32_t
|
|
GetPluginVersion();
|
|
|
|
virtual void
|
|
GetPluginCommandHelp(const char *command, lldb_private::Stream *strm);
|
|
|
|
virtual lldb_private::Error
|
|
ExecutePluginCommand(lldb_private::Args &command,
|
|
lldb_private::Stream *strm);
|
|
|
|
virtual lldb_private::Log *
|
|
EnablePluginLogging(lldb_private::Stream *strm,
|
|
lldb_private::Args &command);
|
|
|
|
//--------------------------------------------------------------------------
|
|
// ProcessLinux internal API.
|
|
|
|
/// Registers the given message with this process.
|
|
void SendMessage(const ProcessMessage &message);
|
|
|
|
ProcessMonitor &GetMonitor() { return *m_monitor; }
|
|
|
|
private:
|
|
/// Target byte order.
|
|
lldb::ByteOrder m_byte_order;
|
|
|
|
/// Process monitor;
|
|
ProcessMonitor *m_monitor;
|
|
|
|
/// The module we are executing.
|
|
lldb_private::Module *m_module;
|
|
|
|
/// Message queue notifying this instance of inferior process state changes.
|
|
lldb_private::Mutex m_message_mutex;
|
|
std::queue<ProcessMessage> m_message_queue;
|
|
|
|
/// Dynamic loader plugin associated with this process.
|
|
std::auto_ptr<lldb_private::DynamicLoader> m_dyld_ap;
|
|
|
|
/// Updates the loaded sections provided by the executable.
|
|
///
|
|
/// FIXME: It would probably be better to delegate this task to the
|
|
/// DynamicLoader plugin, when we have one.
|
|
void UpdateLoadedSections();
|
|
|
|
/// Returns true if the process has exited.
|
|
bool HasExited();
|
|
};
|
|
|
|
#endif // liblldb_MacOSXProcess_H_
|