Fix Clang-tidy modernize-use-override warnings in some files in source/Plugins; other minor fixes.

llvm-svn: 251167
This commit is contained in:
Eugene Zelenko 2015-10-24 01:08:35 +00:00
parent 284350e540
commit edb35d95d1
12 changed files with 274 additions and 345 deletions

View File

@ -1,4 +1,4 @@
//===-- MemoryHistoryASan.h ----------------------------------------*- C++ -*-===//
//===-- MemoryHistoryASan.h -------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@ -24,7 +24,8 @@ namespace lldb_private {
class MemoryHistoryASan : public lldb_private::MemoryHistory
{
public:
~MemoryHistoryASan() override = default;
static lldb::MemoryHistorySP
CreateInstance (const lldb::ProcessSP &process_sp);
@ -36,27 +37,28 @@ public:
static lldb_private::ConstString
GetPluginNameStatic();
lldb_private::ConstString
GetPluginName() override
{
return GetPluginNameStatic();
}
virtual
~MemoryHistoryASan () {}
uint32_t
GetPluginVersion() override
{
return 1;
}
virtual lldb_private::ConstString
GetPluginName() { return GetPluginNameStatic(); }
virtual uint32_t
GetPluginVersion() { return 1; }
virtual lldb_private::HistoryThreads
GetHistoryThreads(lldb::addr_t address);
lldb_private::HistoryThreads
GetHistoryThreads(lldb::addr_t address) override;
private:
MemoryHistoryASan(const lldb::ProcessSP &process_sp);
lldb::ProcessWP m_process_wp;
};
} // namespace lldb_private
#endif // liblldb_MemoryHistoryASan_h_
#endif // liblldb_MemoryHistoryASan_h_

View File

@ -12,9 +12,9 @@
// C Includes
// C++ Includes
#include <list>
#include <string>
#include <queue>
#include <vector>
// Other libraries and framework includes
// Project includes
@ -94,14 +94,10 @@ public:
uint32_t m_saved_timeout;
};
//------------------------------------------------------------------
// Constructors and Destructors
//------------------------------------------------------------------
GDBRemoteCommunication(const char *comm_name,
const char *listener_name);
virtual
~GDBRemoteCommunication();
~GDBRemoteCommunication() override;
PacketResult
GetAck ();
@ -117,12 +113,13 @@ public:
size_t payload_length);
bool
GetSequenceMutex (Mutex::Locker& locker, const char *failure_message = NULL);
GetSequenceMutex(Mutex::Locker& locker, const char *failure_message = nullptr);
PacketType
CheckForPacket (const uint8_t *src,
size_t src_len,
StringExtractorGDBRemote &packet);
bool
IsRunning() const
{
@ -162,21 +159,21 @@ public:
{
return m_packet_timeout * TimeValue::MicroSecPerSec;
}
//------------------------------------------------------------------
// Start a debugserver instance on the current host using the
// supplied connection URL.
//------------------------------------------------------------------
Error
StartDebugserverProcess (const char *url,
Platform *platform, // If non NULL, then check with the platform for the GDB server binary if it can't be located
ProcessLaunchInfo &launch_info,
uint16_t *port);
StartDebugserverProcess(const char *url,
Platform *platform, // If non nullptr, then check with the platform for the GDB server binary if it can't be located
ProcessLaunchInfo &launch_info,
uint16_t *port);
void
DumpHistory(Stream &strm);
protected:
class History
{
public:
@ -223,6 +220,7 @@ protected:
AddPacket (char packet_char,
PacketType type,
uint32_t bytes_transmitted);
void
AddPacket (const std::string &src,
uint32_t src_len,
@ -241,7 +239,7 @@ protected:
return m_dumped_to_log;
}
protected:
protected:
uint32_t
GetFirstSavedPacketIndex () const
{
@ -275,13 +273,30 @@ protected:
return i % m_packets.size();
}
std::vector<Entry> m_packets;
uint32_t m_curr_idx;
uint32_t m_total_packet_count;
mutable bool m_dumped_to_log;
};
uint32_t m_packet_timeout;
uint32_t m_echo_number;
LazyBool m_supports_qEcho;
#ifdef ENABLE_MUTEX_ERROR_CHECKING
TrackingMutex m_sequence_mutex;
#else
Mutex m_sequence_mutex; // Restrict access to sending/receiving packets to a single thread at a time
#endif
Predicate<bool> m_public_is_running;
Predicate<bool> m_private_is_running;
History m_history;
bool m_send_acks;
bool m_is_platform; // Set to true if this class represents a platform,
// false if this class represents a debug session for
// a single process
CompressionType m_compression_type;
PacketResult
SendPacket (const char *payload,
size_t payload_length);
@ -321,27 +336,6 @@ protected:
bool
DecompressPacket ();
//------------------------------------------------------------------
// Classes that inherit from GDBRemoteCommunication can see and modify these
//------------------------------------------------------------------
uint32_t m_packet_timeout;
uint32_t m_echo_number;
LazyBool m_supports_qEcho;
#ifdef ENABLE_MUTEX_ERROR_CHECKING
TrackingMutex m_sequence_mutex;
#else
Mutex m_sequence_mutex; // Restrict access to sending/receiving packets to a single thread at a time
#endif
Predicate<bool> m_public_is_running;
Predicate<bool> m_private_is_running;
History m_history;
bool m_send_acks;
bool m_is_platform; // Set to true if this class represents a platform,
// false if this class represents a debug session for
// a single process
CompressionType m_compression_type;
Error
StartListenThread (const char *hostname = "127.0.0.1", uint16_t port = 0);
@ -361,10 +355,12 @@ protected:
// This method is defined as part of communication.h
// when the read thread gets any bytes it will pass them on to this function
virtual void AppendBytesToCache (const uint8_t * bytes, size_t len, bool broadcast, lldb::ConnectionStatus status);
void AppendBytesToCache(const uint8_t * bytes,
size_t len,
bool broadcast,
lldb::ConnectionStatus status) override;
private:
std::queue<StringExtractorGDBRemote> m_packet_queue; // The packet queue
lldb_private::Mutex m_packet_queue_mutex; // Mutex for accessing queue
Condition m_condition_queue_not_empty; // Condition variable to wait for packets
@ -372,13 +368,10 @@ private:
HostThread m_listen_thread;
std::string m_listen_url;
//------------------------------------------------------------------
// For GDBRemoteCommunication only
//------------------------------------------------------------------
DISALLOW_COPY_AND_ASSIGN (GDBRemoteCommunication);
};
} // namespace process_gdb_remote
} // namespace lldb_private
#endif // liblldb_GDBRemoteCommunication_h_
#endif // liblldb_GDBRemoteCommunication_h_

View File

@ -12,6 +12,8 @@
// C Includes
// C++ Includes
#include <map>
#include <string>
#include <vector>
// Other libraries and framework includes
@ -28,12 +30,9 @@ namespace process_gdb_remote {
class GDBRemoteCommunicationClient : public GDBRemoteCommunication
{
public:
//------------------------------------------------------------------
// Constructors and Destructors
//------------------------------------------------------------------
GDBRemoteCommunicationClient();
~GDBRemoteCommunicationClient();
~GDBRemoteCommunicationClient() override;
//------------------------------------------------------------------
// After connecting, send the handshake to the server to make sure
@ -79,6 +78,7 @@ public:
const char *packet_payload,
size_t packet_length,
StringExtractorGDBRemote &response);
bool
SendvContPacket (ProcessGDBRemote *process,
const char *payload,
@ -164,7 +164,7 @@ public:
SendLaunchArchPacket (const char *arch);
int
SendLaunchEventDataPacket (const char *data, bool *was_supported = NULL);
SendLaunchEventDataPacket(const char *data, bool *was_supported = nullptr);
//------------------------------------------------------------------
/// Sends a "vAttach:PID" where PID is in hex.
@ -185,7 +185,6 @@ public:
SendAttach (lldb::pid_t pid,
StringExtractorGDBRemote& response);
//------------------------------------------------------------------
/// Sends a GDB remote protocol 'I' packet that delivers stdin
/// data to the remote process.
@ -399,6 +398,7 @@ public:
default: return false;
}
}
uint8_t
SendGDBStoppointTypePacket (GDBStoppointType type, // Type of breakpoint or watchpoint
bool insert, // Insert or remove?
@ -508,11 +508,11 @@ public:
GetFileExists (const FileSpec& file_spec);
Error
RunShellCommand(const char *command, // Shouldn't be NULL
RunShellCommand(const char *command, // Shouldn't be nullptr
const FileSpec &working_dir, // Pass empty FileSpec to use the current working directory
int *status_ptr, // Pass NULL if you don't want the process exit status
int *signo_ptr, // Pass NULL if you don't want the signal that caused the process to exit
std::string *command_output, // Pass NULL if you don't want the command output
int *status_ptr, // Pass nullptr if you don't want the process exit status
int *signo_ptr, // Pass nullptr if you don't want the signal that caused the process to exit
std::string *command_output, // Pass nullptr if you don't want the command output
uint32_t timeout_sec); // Timeout in seconds to wait for shell program to finish
bool
@ -570,26 +570,6 @@ public:
ServeSymbolLookups(lldb_private::Process *process);
protected:
PacketResult
SendPacketAndWaitForResponseNoLock (const char *payload,
size_t payload_length,
StringExtractorGDBRemote &response);
bool
GetCurrentProcessInfo (bool allow_lazy_pid = true);
bool
GetGDBServerVersion();
// Given the list of compression types that the remote debug stub can support,
// possibly enable compression if we find an encoding we can handle.
void
MaybeEnableCompression (std::vector<std::string> supported_compressions);
//------------------------------------------------------------------
// Classes that inherit from GDBRemoteCommunicationClient can see and modify these
//------------------------------------------------------------------
LazyBool m_supports_not_sending_acks;
LazyBool m_supports_thread_suffix;
LazyBool m_supports_threads_in_stop_reply;
@ -642,7 +622,6 @@ protected:
lldb::tid_t m_curr_tid; // Current gdb remote protocol thread index for all other operations
lldb::tid_t m_curr_tid_run; // Current gdb remote protocol thread index for continue, step, etc
uint32_t m_num_supported_hardware_watchpoints;
// If we need to send a packet while the target is running, the m_async_XXX
@ -670,18 +649,31 @@ protected:
uint32_t m_default_packet_timeout;
uint64_t m_max_packet_size; // as returned by qSupported
PacketResult
SendPacketAndWaitForResponseNoLock (const char *payload,
size_t payload_length,
StringExtractorGDBRemote &response);
bool
GetCurrentProcessInfo (bool allow_lazy_pid = true);
bool
GetGDBServerVersion();
// Given the list of compression types that the remote debug stub can support,
// possibly enable compression if we find an encoding we can handle.
void
MaybeEnableCompression (std::vector<std::string> supported_compressions);
bool
DecodeProcessInfoResponse (StringExtractorGDBRemote &response,
ProcessInstanceInfo &process_info);
private:
//------------------------------------------------------------------
// For GDBRemoteCommunicationClient only
//------------------------------------------------------------------
DISALLOW_COPY_AND_ASSIGN (GDBRemoteCommunicationClient);
};
} // namespace process_gdb_remote
} // namespace lldb_private
#endif // liblldb_GDBRemoteCommunicationClient_h_
#endif // liblldb_GDBRemoteCommunicationClient_h_

View File

@ -39,8 +39,7 @@ public:
GDBRemoteCommunicationServer(const char *comm_name,
const char *listener_name);
virtual
~GDBRemoteCommunicationServer();
~GDBRemoteCommunicationServer() override;
void RegisterPacketHandler(StringExtractorGDBRemote::ServerPacketType packet_type,
PacketHandler handler);
@ -73,13 +72,10 @@ protected:
SendOKResponse ();
private:
//------------------------------------------------------------------
// For GDBRemoteCommunicationServer only
//------------------------------------------------------------------
DISALLOW_COPY_AND_ASSIGN (GDBRemoteCommunicationServer);
};
} // namespace process_gdb_remote
} // namespace lldb_private
#endif // liblldb_GDBRemoteCommunicationServer_h_
#endif // liblldb_GDBRemoteCommunicationServer_h_

View File

@ -12,13 +12,14 @@
// C Includes
// C++ Includes
#include <string>
// Other libraries and framework includes
// Project includes
#include "lldb/lldb-private-forward.h"
#include "lldb/Host/Mutex.h"
#include "lldb/Target/Process.h"
// Project includes
#include "GDBRemoteCommunicationServer.h"
#include "GDBRemoteCommunicationServerCommon.h"
@ -35,8 +36,7 @@ class GDBRemoteCommunicationServerCommon :
public:
GDBRemoteCommunicationServerCommon(const char *comm_name, const char *listener_name);
virtual
~GDBRemoteCommunicationServerCommon();
~GDBRemoteCommunicationServerCommon() override;
protected:
ProcessLaunchInfo m_process_launch_info;
@ -204,4 +204,4 @@ protected:
} // namespace process_gdb_remote
} // namespace lldb_private
#endif // liblldb_GDBRemoteCommunicationServerCommon_h_
#endif // liblldb_GDBRemoteCommunicationServerCommon_h_

View File

@ -10,12 +10,16 @@
#ifndef liblldb_GDBRemoteCommunicationServerPlatform_h_
#define liblldb_GDBRemoteCommunicationServerPlatform_h_
#include "GDBRemoteCommunicationServerCommon.h"
#include "lldb/Host/Socket.h"
// C Includes
// C++ Includes
#include <map>
#include <set>
// Other libraries and framework includes
// Project includes
#include "GDBRemoteCommunicationServerCommon.h"
#include "lldb/Host/Socket.h"
namespace lldb_private {
namespace process_gdb_remote {
@ -27,8 +31,7 @@ public:
GDBRemoteCommunicationServerPlatform(const Socket::SocketProtocol socket_protocol);
virtual
~GDBRemoteCommunicationServerPlatform();
~GDBRemoteCommunicationServerPlatform() override;
Error
LaunchProcess () override;
@ -112,13 +115,10 @@ private:
static FileSpec
GetDomainSocketPath(const char* prefix);
//------------------------------------------------------------------
// For GDBRemoteCommunicationServerPlatform only
//------------------------------------------------------------------
DISALLOW_COPY_AND_ASSIGN (GDBRemoteCommunicationServerPlatform);
};
} // namespace process_gdb_remote
} // namespace lldb_private
#endif // liblldb_GDBRemoteCommunicationServerPlatform_h_
#endif // liblldb_GDBRemoteCommunicationServerPlatform_h_

View File

@ -42,32 +42,22 @@ public:
{
}
~GDBRemoteDynamicRegisterInfo ()
{
}
~GDBRemoteDynamicRegisterInfo() override = default;
void
HardcodeARMRegisters(bool from_scratch);
};
class GDBRemoteRegisterContext : public RegisterContext
{
public:
//------------------------------------------------------------------
// Constructors and Destructors
//------------------------------------------------------------------
GDBRemoteRegisterContext (ThreadGDBRemote &thread,
uint32_t concrete_frame_idx,
GDBRemoteDynamicRegisterInfo &reg_info,
bool read_all_at_once);
virtual
~GDBRemoteRegisterContext ();
~GDBRemoteRegisterContext() override;
//------------------------------------------------------------------
// Subclasses must override these functions
//------------------------------------------------------------------
void
InvalidateAllRegisters () override;
@ -166,13 +156,10 @@ private:
bool SetPrimordialRegister(const RegisterInfo *reg_info,
GDBRemoteCommunicationClient &gdb_comm);
//------------------------------------------------------------------
// For GDBRemoteRegisterContext only
//------------------------------------------------------------------
DISALLOW_COPY_AND_ASSIGN (GDBRemoteRegisterContext);
};
} // namespace process_gdb_remote
} // namespace lldb_private
#endif // lldb_GDBRemoteRegisterContext_h_
#endif // lldb_GDBRemoteRegisterContext_h_

View File

@ -7,8 +7,6 @@
//
//===----------------------------------------------------------------------===//
#include "lldb/Host/Config.h"
// C Includes
#include <errno.h>
#include <stdlib.h>
@ -25,6 +23,9 @@
#include <map>
#include <mutex>
// Other libraries and framework includes
// Project includes
#include "lldb/Host/Config.h"
#include "lldb/Breakpoint/Watchpoint.h"
#include "lldb/Interpreter/Args.h"
#include "lldb/Core/ArchSpec.h"
@ -65,7 +66,6 @@
#include "lldb/Target/SystemRuntime.h"
#include "lldb/Utility/PseudoTerminal.h"
// Project includes
#include "lldb/Host/Host.h"
#include "Plugins/Process/Utility/GDBRemoteSignals.h"
#include "Plugins/Process/Utility/InferiorCallPOSIX.h"
@ -78,6 +78,7 @@
#include "ThreadGDBRemote.h"
#define DEBUGSERVER_BASENAME "debugserver"
using namespace lldb;
using namespace lldb_private;
using namespace lldb_private::process_gdb_remote;
@ -98,7 +99,7 @@ namespace lldb
if (error.Success())
((ProcessGDBRemote *)p)->GetGDBRemote().DumpHistory (strm);
}
}
} // namespace lldb
namespace {
@ -119,7 +120,6 @@ namespace {
class PluginProperties : public Properties
{
public:
static ConstString
GetSettingName ()
{
@ -132,12 +132,9 @@ namespace {
m_collection_sp.reset (new OptionValueProperties(GetSettingName()));
m_collection_sp->Initialize(g_properties);
}
virtual
~PluginProperties()
{
}
~PluginProperties() override = default;
uint64_t
GetPacketTimeout()
{
@ -171,16 +168,14 @@ namespace {
return g_settings_sp;
}
} // anonymous namespace end
} // anonymous namespace
class ProcessGDBRemote::GDBLoadedModuleInfoList
{
public:
class LoadedModuleInfo
{
public:
enum e_data_point
{
e_has_name = 0,
@ -201,6 +196,7 @@ public:
m_name = name;
m_has[e_has_name] = true;
}
bool get_name (std::string & out) const
{
out = m_name;
@ -212,6 +208,7 @@ public:
m_base = base;
m_has[e_has_base] = true;
}
bool get_base (lldb::addr_t & out) const
{
out = m_base;
@ -222,6 +219,7 @@ public:
{
m_base_is_offset = is_offset;
}
bool get_base_is_offset(bool & out) const
{
out = m_base_is_offset;
@ -233,6 +231,7 @@ public:
m_link_map = addr;
m_has[e_has_link_map] = true;
}
bool get_link_map (lldb::addr_t & out) const
{
out = m_link_map;
@ -244,6 +243,7 @@ public:
m_dynamic = addr;
m_has[e_has_dynamic] = true;
}
bool get_dynamic (lldb::addr_t & out) const
{
out = m_dynamic;
@ -257,7 +257,6 @@ public:
}
protected:
bool m_has[e_num];
std::string m_name;
lldb::addr_t m_link_map;
@ -333,7 +332,6 @@ ProcessGDBRemote::Terminate()
PluginManager::UnregisterPlugin (ProcessGDBRemote::CreateInstance);
}
lldb::ProcessSP
ProcessGDBRemote::CreateInstance (lldb::TargetSP target_sp, Listener &listener, const FileSpec *crash_file_path)
{
@ -376,9 +374,6 @@ ProcessGDBRemote::CanDebug (lldb::TargetSP target_sp, bool plugin_specified_by_n
return true;
}
//----------------------------------------------------------------------
// ProcessGDBRemote constructor
//----------------------------------------------------------------------
ProcessGDBRemote::ProcessGDBRemote(lldb::TargetSP target_sp, Listener &listener) :
Process (target_sp, listener),
m_flags (0),
@ -433,9 +428,6 @@ ProcessGDBRemote::ProcessGDBRemote(lldb::TargetSP target_sp, Listener &listener)
m_gdb_comm.SetPacketTimeout(timeout_seconds);
}
//----------------------------------------------------------------------
// Destructor
//----------------------------------------------------------------------
ProcessGDBRemote::~ProcessGDBRemote()
{
// m_mach_process.UnregisterNotificationCallbacks (this);
@ -563,7 +555,6 @@ SplitCommaSeparatedRegisterNumberString(const llvm::StringRef &comma_separated_r
return regnums.size();
}
void
ProcessGDBRemote::BuildDynamicRegisterInfo (bool force)
{
@ -1156,10 +1147,8 @@ ProcessGDBRemote::DoLaunch (Module *exe_module, ProcessLaunchInfo &launch_info)
exe_module->GetArchitecture().GetArchitectureName());
}
return error;
}
Error
ProcessGDBRemote::ConnectToDebugserver (const char *connect_url)
{
@ -1206,7 +1195,6 @@ ProcessGDBRemote::ConnectToDebugserver (const char *connect_url)
return error;
}
// Start the communications read thread so all incoming data can be
// parsed into packets and queued as they arrive.
if (GetTarget().GetNonStopModeEnabled())
@ -1474,7 +1462,6 @@ ProcessGDBRemote::DidAttach (ArchSpec &process_arch)
DidLaunchOrAttach (process_arch);
}
Error
ProcessGDBRemote::WillResume ()
{
@ -1927,7 +1914,6 @@ ProcessGDBRemote::UpdateThreadList (ThreadList &old_thread_list, ThreadList &new
return true;
}
bool
ProcessGDBRemote::GetThreadStopInfoFromJSON (ThreadGDBRemote *thread, const StructuredData::ObjectSP &thread_infos_sp)
{
@ -1985,7 +1971,6 @@ ProcessGDBRemote::CalculateThreadStopInfo (ThreadGDBRemote *thread)
return false;
}
ThreadSP
ProcessGDBRemote::SetThreadStopInfo (lldb::tid_t tid,
ExpeditedRegisterMap &expedited_register_map,
@ -2359,7 +2344,6 @@ ProcessGDBRemote::SetThreadStopInfo (StructuredData::Dictionary *thread_dict)
return true; // Keep iterating through all array items
});
}
}
else if (key == g_key_signal)
signo = object->GetIntegerValue(LLDB_INVALID_SIGNAL_NUMBER);
@ -2680,7 +2664,6 @@ ProcessGDBRemote::RefreshStateAfterStop ()
// Let all threads recover from stopping and do any clean up based
// on the previous thread state (if any).
m_thread_list_real.RefreshStateAfterStop();
}
Error
@ -2742,7 +2725,6 @@ ProcessGDBRemote::DoDetach(bool keep_stopped)
return error;
}
Error
ProcessGDBRemote::DoDestroy ()
{
@ -3172,7 +3154,6 @@ Error
ProcessGDBRemote::GetMemoryRegionInfo (addr_t load_addr,
MemoryRegionInfo &region_info)
{
Error error (m_gdb_comm.GetMemoryRegionInfo (load_addr, region_info));
return error;
}
@ -3180,7 +3161,6 @@ ProcessGDBRemote::GetMemoryRegionInfo (addr_t load_addr,
Error
ProcessGDBRemote::GetWatchpointSupportInfo (uint32_t &num)
{
Error error (m_gdb_comm.GetWatchpointSupportInfo (num));
return error;
}
@ -3227,7 +3207,6 @@ ProcessGDBRemote::DoDeallocateMemory (lldb::addr_t addr)
return error;
}
//------------------------------------------------------------------
// Process STDIO
//------------------------------------------------------------------
@ -4030,7 +4009,6 @@ ProcessGDBRemote::NewThreadNotifyBreakpointHit (void *baton,
return false;
}
bool
ProcessGDBRemote::StartNoticingNewThreads()
{
@ -4198,7 +4176,6 @@ ProcessGDBRemote::GetLoadedDynamicLibrariesInfos (lldb::addr_t image_list_addres
return object_sp;
}
// Establish the largest memory read/write payloads we should use.
// If the remote stub has a max packet size, stay under that size.
//
@ -4491,7 +4468,7 @@ ParseRegisters (XMLNode feature_node, GdbServerTargetInfo &target_info, GDBRemot
return true;
}
} // namespace {}
} // anonymous namespace
// query the target of gdb-remote for extended target information
@ -4522,7 +4499,6 @@ ProcessGDBRemote::GetGDBServerRegisterInfo ()
{
return false;
}
XMLDocument xml_document;
@ -4890,7 +4866,6 @@ ProcessGDBRemote::GetFileLoadAddress(const FileSpec& file, bool& is_loaded, lldb
return Error("Unknown error happened during sending the load address packet");
}
void
ProcessGDBRemote::ModulesDidLoad (ModuleList &module_list)
{
@ -4902,7 +4877,6 @@ ProcessGDBRemote::ModulesDidLoad (ModuleList &module_list)
m_gdb_comm.ServeSymbolLookups(this);
}
class CommandObjectProcessGDBRemoteSpeedTest: public CommandObjectParsed
{
public:
@ -4924,10 +4898,7 @@ public:
m_option_group.Finalize();
}
~CommandObjectProcessGDBRemoteSpeedTest ()
{
}
~CommandObjectProcessGDBRemoteSpeedTest() override = default;
Options *
GetOptions () override
@ -4968,19 +4939,17 @@ public:
result.SetStatus (eReturnStatusFailed);
return false;
}
protected:
OptionGroupOptions m_option_group;
OptionGroupUInt64 m_num_packets;
OptionGroupUInt64 m_max_send;
OptionGroupUInt64 m_max_recv;
OptionGroupBoolean m_json;
};
class CommandObjectProcessGDBRemotePacketHistory : public CommandObjectParsed
{
private:
public:
CommandObjectProcessGDBRemotePacketHistory(CommandInterpreter &interpreter) :
CommandObjectParsed (interpreter,
@ -4989,11 +4958,9 @@ public:
NULL)
{
}
~CommandObjectProcessGDBRemotePacketHistory ()
{
}
~CommandObjectProcessGDBRemotePacketHistory() override = default;
bool
DoExecute (Args& command, CommandReturnObject &result) override
{
@ -5019,8 +4986,6 @@ public:
class CommandObjectProcessGDBRemotePacketXferSize : public CommandObjectParsed
{
private:
public:
CommandObjectProcessGDBRemotePacketXferSize(CommandInterpreter &interpreter) :
CommandObjectParsed (interpreter,
@ -5029,11 +4994,9 @@ public:
NULL)
{
}
~CommandObjectProcessGDBRemotePacketXferSize ()
{
}
~CommandObjectProcessGDBRemotePacketXferSize() override = default;
bool
DoExecute (Args& command, CommandReturnObject &result) override
{
@ -5063,11 +5026,8 @@ public:
}
};
class CommandObjectProcessGDBRemotePacketSend : public CommandObjectParsed
{
private:
public:
CommandObjectProcessGDBRemotePacketSend(CommandInterpreter &interpreter) :
CommandObjectParsed (interpreter,
@ -5077,11 +5037,9 @@ public:
NULL)
{
}
~CommandObjectProcessGDBRemotePacketSend ()
{
}
~CommandObjectProcessGDBRemotePacketSend() override = default;
bool
DoExecute (Args& command, CommandReturnObject &result) override
{
@ -5124,8 +5082,6 @@ public:
class CommandObjectProcessGDBRemotePacketMonitor : public CommandObjectRaw
{
private:
public:
CommandObjectProcessGDBRemotePacketMonitor(CommandInterpreter &interpreter) :
CommandObjectRaw (interpreter,
@ -5135,11 +5091,9 @@ public:
NULL)
{
}
~CommandObjectProcessGDBRemotePacketMonitor ()
{
}
~CommandObjectProcessGDBRemotePacketMonitor() override = default;
bool
DoExecute (const char *command, CommandReturnObject &result) override
{
@ -5177,8 +5131,6 @@ public:
class CommandObjectProcessGDBRemotePacket : public CommandObjectMultiword
{
private:
public:
CommandObjectProcessGDBRemotePacket(CommandInterpreter &interpreter) :
CommandObjectMultiword (interpreter,
@ -5192,10 +5144,8 @@ public:
LoadSubCommand ("xfer-size", CommandObjectSP (new CommandObjectProcessGDBRemotePacketXferSize (interpreter)));
LoadSubCommand ("speed-test", CommandObjectSP (new CommandObjectProcessGDBRemoteSpeedTest (interpreter)));
}
~CommandObjectProcessGDBRemotePacket ()
{
}
~CommandObjectProcessGDBRemotePacket() override = default;
};
class CommandObjectMultiwordProcessGDBRemote : public CommandObjectMultiword
@ -5210,9 +5160,7 @@ public:
LoadSubCommand ("packet", CommandObjectSP (new CommandObjectProcessGDBRemotePacket (interpreter)));
}
~CommandObjectMultiwordProcessGDBRemote ()
{
}
~CommandObjectMultiwordProcessGDBRemote() override = default;
};
CommandObject *

View File

@ -11,12 +11,14 @@
#define liblldb_ProcessGDBRemote_h_
// C Includes
// C++ Includes
#include <list>
#include <atomic>
#include <map>
#include <string>
#include <vector>
// Other libraries and framework includes
// Project includes
#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/Broadcaster.h"
#include "lldb/Core/ConstString.h"
@ -42,9 +44,10 @@ class ThreadGDBRemote;
class ProcessGDBRemote : public Process
{
public:
//------------------------------------------------------------------
// Constructors and Destructors
//------------------------------------------------------------------
ProcessGDBRemote(lldb::TargetSP target_sp, Listener &listener);
~ProcessGDBRemote() override;
static lldb::ProcessSP
CreateInstance (lldb::TargetSP target_sp,
Listener &listener,
@ -65,14 +68,6 @@ public:
static const char *
GetPluginDescriptionStatic();
//------------------------------------------------------------------
// Constructors and Destructors
//------------------------------------------------------------------
ProcessGDBRemote(lldb::TargetSP target_sp, Listener &listener);
virtual
~ProcessGDBRemote();
//------------------------------------------------------------------
// Check if a given Process
//------------------------------------------------------------------
@ -263,20 +258,62 @@ protected:
class GDBLoadedModuleInfoList;
//------------------------------------------------------------------
/// Broadcaster event bits definitions.
//------------------------------------------------------------------
enum
{
eBroadcastBitAsyncContinue = (1 << 0),
eBroadcastBitAsyncThreadShouldExit = (1 << 1),
eBroadcastBitAsyncThreadDidExit = (1 << 2)
};
Flags m_flags; // Process specific flags (see eFlags enums)
GDBRemoteCommunicationClient m_gdb_comm;
std::atomic<lldb::pid_t> m_debugserver_pid;
std::vector<StringExtractorGDBRemote> m_stop_packet_stack; // The stop packet stack replaces the last stop packet variable
Mutex m_last_stop_packet_mutex;
GDBRemoteDynamicRegisterInfo m_register_info;
Broadcaster m_async_broadcaster;
Listener m_async_listener;
HostThread m_async_thread;
Mutex m_async_thread_state_mutex;
typedef std::vector<lldb::tid_t> tid_collection;
typedef std::vector< std::pair<lldb::tid_t,int> > tid_sig_collection;
typedef std::map<lldb::addr_t, lldb::addr_t> MMapMap;
typedef std::map<uint32_t, std::string> ExpeditedRegisterMap;
tid_collection m_thread_ids; // Thread IDs for all threads. This list gets updated after stopping
StructuredData::ObjectSP m_jstopinfo_sp; // Stop info only for any threads that have valid stop infos
StructuredData::ObjectSP m_jthreadsinfo_sp; // Full stop info, expedited registers and memory for all threads if "jThreadsInfo" packet is supported
tid_collection m_continue_c_tids; // 'c' for continue
tid_sig_collection m_continue_C_tids; // 'C' for continue with signal
tid_collection m_continue_s_tids; // 's' for step
tid_sig_collection m_continue_S_tids; // 'S' for step with signal
uint64_t m_max_memory_size; // The maximum number of bytes to read/write when reading and writing memory
uint64_t m_remote_stub_max_memory_size; // The maximum memory size the remote gdb stub can handle
MMapMap m_addr_to_mmap_size;
lldb::BreakpointSP m_thread_create_bp_sp;
bool m_waiting_for_attach;
bool m_destroy_tried_resuming;
lldb::CommandObjectSP m_command_sp;
int64_t m_breakpoint_pc_offset;
lldb::tid_t m_initial_tid; // The initial thread ID, given by stub on attach
//----------------------------------------------------------------------
// Accessors
//----------------------------------------------------------------------
bool
IsRunning ( lldb::StateType state )
{
return state == lldb::eStateRunning || IsStepping(state);
return state == lldb::eStateRunning || IsStepping(state);
}
bool
IsStepping ( lldb::StateType state)
{
return state == lldb::eStateStepping;
return state == lldb::eStateStepping;
}
bool
CanResume ( lldb::StateType state)
{
@ -341,47 +378,6 @@ protected:
size_t
UpdateThreadIDsFromStopReplyThreadsValue (std::string &value);
//------------------------------------------------------------------
/// Broadcaster event bits definitions.
//------------------------------------------------------------------
enum
{
eBroadcastBitAsyncContinue = (1 << 0),
eBroadcastBitAsyncThreadShouldExit = (1 << 1),
eBroadcastBitAsyncThreadDidExit = (1 << 2)
};
Flags m_flags; // Process specific flags (see eFlags enums)
GDBRemoteCommunicationClient m_gdb_comm;
std::atomic<lldb::pid_t> m_debugserver_pid;
std::vector<StringExtractorGDBRemote> m_stop_packet_stack; // The stop packet stack replaces the last stop packet variable
Mutex m_last_stop_packet_mutex;
GDBRemoteDynamicRegisterInfo m_register_info;
Broadcaster m_async_broadcaster;
Listener m_async_listener;
HostThread m_async_thread;
Mutex m_async_thread_state_mutex;
typedef std::vector<lldb::tid_t> tid_collection;
typedef std::vector< std::pair<lldb::tid_t,int> > tid_sig_collection;
typedef std::map<lldb::addr_t, lldb::addr_t> MMapMap;
typedef std::map<uint32_t, std::string> ExpeditedRegisterMap;
tid_collection m_thread_ids; // Thread IDs for all threads. This list gets updated after stopping
StructuredData::ObjectSP m_jstopinfo_sp; // Stop info only for any threads that have valid stop infos
StructuredData::ObjectSP m_jthreadsinfo_sp; // Full stop info, expedited registers and memory for all threads if "jThreadsInfo" packet is supported
tid_collection m_continue_c_tids; // 'c' for continue
tid_sig_collection m_continue_C_tids; // 'C' for continue with signal
tid_collection m_continue_s_tids; // 's' for step
tid_sig_collection m_continue_S_tids; // 'S' for step with signal
uint64_t m_max_memory_size; // The maximum number of bytes to read/write when reading and writing memory
uint64_t m_remote_stub_max_memory_size; // The maximum memory size the remote gdb stub can handle
MMapMap m_addr_to_mmap_size;
lldb::BreakpointSP m_thread_create_bp_sp;
bool m_waiting_for_attach;
bool m_destroy_tried_resuming;
lldb::CommandObjectSP m_command_sp;
int64_t m_breakpoint_pc_offset;
lldb::tid_t m_initial_tid; // The initial thread ID, given by stub on attach
bool
HandleNotifyPacket(StringExtractorGDBRemote &packet);
@ -469,10 +465,9 @@ private:
lldb::user_id_t break_loc_id);
DISALLOW_COPY_AND_ASSIGN (ProcessGDBRemote);
};
} // namespace process_gdb_remote
} // namespace lldb_private
#endif // liblldb_ProcessGDBRemote_h_
#endif // liblldb_ProcessGDBRemote_h_

View File

@ -10,8 +10,12 @@
#ifndef liblldb_ThreadGDBRemote_h_
#define liblldb_ThreadGDBRemote_h_
// C Includes
// C++ Includes
#include <string>
// Other libraries and framework includes
// Project includes
#include "lldb/Core/StructuredData.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/Thread.h"
@ -28,8 +32,7 @@ class ThreadGDBRemote : public Thread
public:
ThreadGDBRemote (Process &process, lldb::tid_t tid);
virtual
~ThreadGDBRemote ();
~ThreadGDBRemote() override;
void
WillResume (lldb::StateType resume_state) override;
@ -101,9 +104,14 @@ public:
FetchThreadExtendedInfo () override;
protected:
friend class ProcessGDBRemote;
std::string m_thread_name;
std::string m_dispatch_queue_name;
lldb::addr_t m_thread_dispatch_qaddr;
lldb::QueueKind m_queue_kind; // Queue info from stop reply/stop info for thread
uint64_t m_queue_serial; // Queue info from stop reply/stop info for thread
bool
PrivateSetRegisterValue (uint32_t reg,
StringExtractor &response);
@ -113,18 +121,6 @@ protected:
{
return m_queue_kind != lldb::eQueueKindUnknown;
}
//------------------------------------------------------------------
// Member variables.
//------------------------------------------------------------------
std::string m_thread_name;
std::string m_dispatch_queue_name;
lldb::addr_t m_thread_dispatch_qaddr;
lldb::QueueKind m_queue_kind; // Queue info from stop reply/stop info for thread
uint64_t m_queue_serial; // Queue info from stop reply/stop info for thread
//------------------------------------------------------------------
// Member variables.
//------------------------------------------------------------------
void
SetStopInfoFromPacket (StringExtractor &stop_packet, uint32_t stop_id);
@ -135,4 +131,4 @@ protected:
} // namespace process_gdb_remote
} // namespace lldb_private
#endif // liblldb_ThreadGDBRemote_h_
#endif // liblldb_ThreadGDBRemote_h_

View File

@ -1,4 +1,4 @@
//===-- PythonDataObjects.h----------------------------------------*- C++ -*-===//
//===-- PythonDataObjects.h--------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@ -12,7 +12,6 @@
// C Includes
// C++ Includes
// Other libraries and framework includes
// Project includes
#include "lldb/lldb-defines.h"
@ -23,6 +22,7 @@
#include "lldb/Interpreter/OptionValue.h"
namespace lldb_private {
class PythonString;
class PythonList;
class PythonDictionary;
@ -30,7 +30,7 @@ class PythonInteger;
class StructuredPythonObject : public StructuredData::Generic
{
public:
public:
StructuredPythonObject()
: StructuredData::Generic()
{
@ -42,7 +42,7 @@ class StructuredPythonObject : public StructuredData::Generic
Py_XINCREF(GetValue());
}
virtual ~StructuredPythonObject()
~StructuredPythonObject() override
{
if (Py_IsInitialized())
Py_XDECREF(GetValue());
@ -57,7 +57,7 @@ class StructuredPythonObject : public StructuredData::Generic
void Dump(Stream &s) const override;
private:
private:
DISALLOW_COPY_AND_ASSIGN(StructuredPythonObject);
};
@ -106,7 +106,10 @@ public:
Reset(rhs);
}
virtual ~PythonObject() { Reset(); }
virtual ~PythonObject()
{
Reset();
}
void
Reset()
@ -235,6 +238,7 @@ public:
explicit PythonString(const char *string);
PythonString(PyRefType type, PyObject *o);
PythonString(const PythonString &object);
~PythonString() override;
static bool Check(PyObject *py_obj);
@ -262,6 +266,7 @@ public:
explicit PythonInteger(int64_t value);
PythonInteger(PyRefType type, PyObject *o);
PythonInteger(const PythonInteger &object);
~PythonInteger() override;
static bool Check(PyObject *py_obj);
@ -286,6 +291,7 @@ public:
explicit PythonList(int list_size);
PythonList(PyRefType type, PyObject *o);
PythonList(const PythonList &list);
~PythonList() override;
static bool Check(PyObject *py_obj);
@ -312,6 +318,7 @@ public:
explicit PythonDictionary(PyInitialValue value);
PythonDictionary(PyRefType type, PyObject *o);
PythonDictionary(const PythonDictionary &dict);
~PythonDictionary() override;
static bool Check(PyObject *py_obj);
@ -338,6 +345,7 @@ class PythonFile : public PythonObject
PythonFile(File &file, const char *mode);
PythonFile(const char *path, const char *mode);
PythonFile(PyRefType type, PyObject *o);
~PythonFile() override;
static bool Check(PyObject *py_obj);
@ -352,4 +360,4 @@ class PythonFile : public PythonObject
} // namespace lldb_private
#endif // LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_PYTHONDATAOBJECTS_H
#endif // LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_PYTHONDATAOBJECTS_H

View File

@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
#ifndef LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_SCRIPTINTERPRETERPYTHON_H
#define LLDB_PLUGINS_SCRIPTINTERPRETER_PYTHON_SCRIPTINTERPRETERPYTHON_H
@ -17,6 +16,14 @@
#else
// C Includes
// C++ Includes
#include <memory>
#include <string>
#include <vector>
// Other libraries and framework includes
// Project includes
#include "lldb/lldb-private.h"
#include "PythonDataObjects.h"
#include "lldb/Core/IOHandler.h"
@ -74,12 +81,19 @@ public:
const lldb::ProcessSP& process_sp);
typedef size_t (*SWIGPythonCalculateNumChildren) (void *implementor, uint32_t max);
typedef void* (*SWIGPythonGetChildAtIndex) (void *implementor, uint32_t idx);
typedef int (*SWIGPythonGetIndexOfChildWithName) (void *implementor, const char* child_name);
typedef void* (*SWIGPythonCastPyObjectToSBValue) (void* data);
typedef lldb::ValueObjectSP (*SWIGPythonGetValueObjectSPFromSBValue) (void* data);
typedef bool (*SWIGPythonUpdateSynthProviderInstance) (void* data);
typedef bool (*SWIGPythonMightHaveChildrenSynthProviderInstance) (void* data);
typedef void* (*SWIGPythonGetValueSynthProviderInstance) (void *implementor);
typedef bool (*SWIGPythonCallCommand) (const char *python_function_name,
@ -95,7 +109,6 @@ public:
lldb_private::CommandReturnObject& cmd_retobj,
lldb::ExecutionContextRefSP exe_ctx_ref_sp);
typedef bool (*SWIGPythonCallModuleInit) (const char *python_module_name,
const char *session_dictionary_name,
lldb::DebuggerSP& debugger);
@ -104,6 +117,7 @@ public:
const char* session_dictionary_name,
lldb::ProcessSP& process,
std::string& output);
typedef bool (*SWIGPythonScriptKeyword_Thread) (const char* python_function_name,
const char* session_dictionary_name,
lldb::ThreadSP& thread,
@ -159,17 +173,17 @@ public:
ExportFunctionDefinitionToInterpreter (StringList &function_def) override;
bool
GenerateTypeScriptFunction (StringList &input, std::string& output, const void* name_token = NULL) override;
GenerateTypeScriptFunction(StringList &input, std::string& output, const void* name_token = nullptr) override;
bool
GenerateTypeSynthClass (StringList &input, std::string& output, const void* name_token = NULL) override;
GenerateTypeSynthClass(StringList &input, std::string& output, const void* name_token = nullptr) override;
bool
GenerateTypeSynthClass (const char* oneliner, std::string& output, const void* name_token = NULL) override;
GenerateTypeSynthClass(const char* oneliner, std::string& output, const void* name_token = nullptr) override;
// use this if the function code is just a one-liner script
bool
GenerateTypeScriptFunction (const char* oneliner, std::string& output, const void* name_token = NULL) override;
GenerateTypeScriptFunction(const char* oneliner, std::string& output, const void* name_token = nullptr) override;
bool
GenerateScriptAliasFunction (StringList &input, std::string& output) override;
@ -181,7 +195,9 @@ public:
StructuredData::ObjectSP CreateScriptedThreadPlan(const char *class_name, lldb::ThreadPlanSP thread_plan) override;
bool ScriptedThreadPlanExplainsStop(StructuredData::ObjectSP implementor_sp, Event *event, bool &script_error) override;
bool ScriptedThreadPlanShouldStop(StructuredData::ObjectSP implementor_sp, Event *event, bool &script_error) override;
lldb::StateType ScriptedThreadPlanGetRunState(StructuredData::ObjectSP implementor_sp, bool &script_error) override;
StructuredData::GenericSP OSPlugin_CreatePluginObject(const char *class_name, lldb::ProcessSP process_sp) override;
@ -392,7 +408,6 @@ public:
return m_dictionary_name.c_str();
}
PyThreadState *
GetThreadState()
{
@ -415,7 +430,6 @@ public:
void
IOHandlerInputComplete (IOHandler &io_handler, std::string &data) override;
//------------------------------------------------------------------
// Static Functions
//------------------------------------------------------------------
@ -437,46 +451,15 @@ public:
//------------------------------------------------------------------
// PluginInterface protocol
//------------------------------------------------------------------
virtual lldb_private::ConstString
lldb_private::ConstString
GetPluginName() override;
virtual uint32_t
uint32_t
GetPluginVersion() override;
protected:
bool
EnterSession (uint16_t on_entry_flags,
FILE *in,
FILE *out,
FILE *err);
void
LeaveSession ();
void
SaveTerminalState (int fd);
void
RestoreTerminalState ();
class SynchronicityHandler
class Locker : public ScriptInterpreterLocker
{
private:
lldb::DebuggerSP m_debugger_sp;
ScriptedCommandSynchronicity m_synch_wanted;
bool m_old_asynch;
public:
SynchronicityHandler(lldb::DebuggerSP,
ScriptedCommandSynchronicity);
~SynchronicityHandler();
};
public:
class Locker : public ScriptInterpreterLocker
{
public:
enum OnEntry
{
AcquireLock = 0x0001,
@ -492,17 +475,16 @@ public:
TearDownSession = 0x0004
};
Locker (ScriptInterpreterPython *py_interpreter = NULL,
uint16_t on_entry = AcquireLock | InitSession,
uint16_t on_leave = FreeLock | TearDownSession,
FILE *in = NULL,
FILE *out = NULL,
FILE *err = NULL);
Locker(ScriptInterpreterPython *py_interpreter = nullptr,
uint16_t on_entry = AcquireLock | InitSession,
uint16_t on_leave = FreeLock | TearDownSession,
FILE *in = nullptr,
FILE *out = nullptr,
FILE *err = nullptr);
~Locker () override;
private:
private:
bool
DoAcquireLock ();
@ -522,9 +504,23 @@ public:
ScriptInterpreterPython *m_python_interpreter;
// FILE* m_tmp_fh;
PyGILState_STATE m_GILState;
};
protected:
};
protected:
class SynchronicityHandler
{
private:
lldb::DebuggerSP m_debugger_sp;
ScriptedCommandSynchronicity m_synch_wanted;
bool m_old_asynch;
public:
SynchronicityHandler(lldb::DebuggerSP,
ScriptedCommandSynchronicity);
~SynchronicityHandler();
};
enum class AddLocation
{
Beginning,
@ -533,6 +529,21 @@ protected:
static void AddToSysPath(AddLocation location, std::string path);
bool
EnterSession(uint16_t on_entry_flags,
FILE *in,
FILE *out,
FILE *err);
void
LeaveSession();
void
SaveTerminalState(int fd);
void
RestoreTerminalState();
uint32_t
IsExecutingPython () const
{
@ -588,6 +599,7 @@ protected:
uint32_t m_lock_count;
PyThreadState *m_command_thread_state;
};
} // namespace lldb_private
#endif // LLDB_DISABLE_PYTHON