Update LLDB snapshot to upstream r241361

Notable upstream commits (upstream revision in parens):

- Add a JSON producer to LLDB (228636)
- Don't crash on bad DWARF expression (228729)
- Add support of DWARFv3 DW_OP_form_tls_address (231342)
- Assembly profiler for MIPS64 (232619)
- Handle FreeBSD/arm64 core files (233273)
- Read/Write register for MIPS64 (233685)
- Rework LLDB system initialization (233758)
- SysV ABI for aarch64 (236098)
- MIPS software single stepping (236696)
- FreeBSD/arm live debugging support (237303)
- Assembly profiler for mips32 (237420)
- Parse function name from DWARF DW_AT_abstract_origin (238307)
- Improve LLDB prompt handling (238313)
- Add real time signals support to FreeBSDSignals (238316)
- Fix race in IOHandlerProcessSTDIO (238423)
- MIPS64 Branch instruction emulation for SW single stepping (238820)
- Improve OSType initialization in elf object file's arch_spec (239148)
- Emulation of MIPS64 floating-point branch instructions (239996)
- ABI Plugin for MIPS32 (239997)
- ABI Plugin for MIPS64 (240123)
- MIPS32 branch emulation and single stepping (240373)
- Improve instruction emulation based stack unwinding on ARM (240533)
- Add branch emulation to aarch64 instruction emulator (240769)
This commit is contained in:
Ed Maste 2015-07-04 01:02:43 +00:00
commit 1c3bbb013d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/projects/clang-trunk/; revision=285116
911 changed files with 67760 additions and 32607 deletions

View File

@ -52,5 +52,6 @@
#include "lldb/API/SBType.h"
#include "lldb/API/SBValue.h"
#include "lldb/API/SBValueList.h"
#include "lldb/API/SBVariablesOptions.h"
#endif // LLDB_LLDB_h_

View File

@ -15,7 +15,7 @@
namespace lldb {
class SBAddress
class LLDB_API SBAddress
{
public:

View File

@ -0,0 +1,149 @@
//===-- SBAttachInfo.h ------------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef LLDB_SBAttachInfo_h_
#define LLDB_SBAttachInfo_h_
#include "lldb/API/SBDefines.h"
namespace lldb {
class SBTarget;
class LLDB_API SBAttachInfo
{
public:
SBAttachInfo ();
SBAttachInfo (lldb::pid_t pid);
SBAttachInfo (const char *path, bool wait_for);
SBAttachInfo (const SBAttachInfo &rhs);
~SBAttachInfo();
SBAttachInfo &
operator = (const SBAttachInfo &rhs);
lldb::pid_t
GetProcessID ();
void
SetProcessID (lldb::pid_t pid);
void
SetExecutable (const char *path);
void
SetExecutable (lldb::SBFileSpec exe_file);
bool
GetWaitForLaunch ();
void
SetWaitForLaunch (bool b);
bool
GetIgnoreExisting ();
void
SetIgnoreExisting (bool b);
uint32_t
GetResumeCount ();
void
SetResumeCount (uint32_t c);
const char *
GetProcessPluginName ();
void
SetProcessPluginName (const char *plugin_name);
uint32_t
GetUserID();
uint32_t
GetGroupID();
bool
UserIDIsValid ();
bool
GroupIDIsValid ();
void
SetUserID (uint32_t uid);
void
SetGroupID (uint32_t gid);
uint32_t
GetEffectiveUserID();
uint32_t
GetEffectiveGroupID();
bool
EffectiveUserIDIsValid ();
bool
EffectiveGroupIDIsValid ();
void
SetEffectiveUserID (uint32_t uid);
void
SetEffectiveGroupID (uint32_t gid);
lldb::pid_t
GetParentProcessID ();
void
SetParentProcessID (lldb::pid_t pid);
bool
ParentProcessIDIsValid();
//----------------------------------------------------------------------
/// Get the listener that will be used to receive process events.
///
/// If no listener has been set via a call to
/// SBLaunchInfo::SetListener(), then an invalid SBListener will be
/// returned (SBListener::IsValid() will return false). If a listener
/// has been set, then the valid listener object will be returned.
//----------------------------------------------------------------------
SBListener
GetListener ();
//----------------------------------------------------------------------
/// Set the listener that will be used to receive process events.
///
/// By default the SBDebugger, which has a listener, that the SBTarget
/// belongs to will listen for the process events. Calling this function
/// allows a different listener to be used to listen for process events.
//----------------------------------------------------------------------
void
SetListener (SBListener &listener);
protected:
friend class SBTarget;
lldb_private::ProcessAttachInfo &
ref ();
ProcessAttachInfoSP m_opaque_sp;
};
} // namespace lldb
#endif // LLDB_SBAttachInfo_h_

View File

@ -17,7 +17,7 @@
namespace lldb {
class SBBlock
class LLDB_API SBBlock
{
public:

View File

@ -14,7 +14,7 @@
namespace lldb {
class SBBreakpoint
class LLDB_API SBBreakpoint
{
public:

View File

@ -15,7 +15,7 @@
namespace lldb {
class SBBreakpointLocation
class LLDB_API SBBreakpointLocation
{
public:
@ -101,9 +101,7 @@ class SBBreakpointLocation
private:
friend class SBBreakpoint;
#ifndef LLDB_DISABLE_PYTHON
friend class lldb_private::ScriptInterpreterPython;
#endif
void
SetLocation (const lldb::BreakpointLocationSP &break_loc_sp);

View File

@ -14,7 +14,7 @@
namespace lldb {
class SBBroadcaster
class LLDB_API SBBroadcaster
{
public:
SBBroadcaster ();

View File

@ -15,7 +15,7 @@
namespace lldb {
class SBCommandInterpreterRunOptions
class LLDB_API SBCommandInterpreterRunOptions
{
friend class SBDebugger;
friend class SBCommandInterpreter;
@ -94,6 +94,9 @@ class SBCommandInterpreter
static const char *
GetArgumentDescriptionAsCString (const lldb::CommandArgumentType arg_type);
static bool
EventIsCommandInterpreterEvent (const lldb::SBEvent &event);
bool
IsValid() const;
@ -216,6 +219,19 @@ class SBCommandInterpreter
const char *
GetIOHandlerControlSequence(char ch);
bool
GetPromptOnQuit();
void
SetPromptOnQuit(bool b);
//----------------------------------------------------------------------
/// Resolve the command just as HandleCommand would, expanding abbreviations
/// and aliases. If successful, result->GetOutput has the full expansion.
//----------------------------------------------------------------------
void
ResolveCommand(const char *command_line, SBCommandReturnObject &result);
protected:
lldb_private::CommandInterpreter &
@ -266,6 +282,21 @@ class SBCommand
const char*
GetHelp ();
const char*
GetHelpLong ();
void
SetHelp (const char*);
void
SetHelpLong (const char*);
uint32_t
GetFlags ();
void
SetFlags (uint32_t flags);
lldb::SBCommand
AddMultiwordCommand (const char* name, const char* help = NULL);

View File

@ -16,7 +16,7 @@
namespace lldb {
class SBCommandReturnObject
class LLDB_API SBCommandReturnObject
{
public:

View File

@ -15,10 +15,11 @@
namespace lldb {
class SBCommunication
class LLDB_API SBCommunication
{
public:
enum {
FLAGS_ANONYMOUS_ENUM()
{
eBroadcastBitDisconnected = (1 << 0), ///< Sent when the communications connection is lost.
eBroadcastBitReadThreadGotBytes = (1 << 1), ///< Sent by the read thread when bytes become available.
eBroadcastBitReadThreadDidExit = (1 << 2), ///< Sent by the read thread when it exits to inform clients.

View File

@ -15,7 +15,7 @@
namespace lldb {
class SBCompileUnit
class LLDB_API SBCompileUnit
{
public:

View File

@ -14,7 +14,7 @@
namespace lldb {
class SBData
class LLDB_API SBData
{
public:

View File

@ -18,7 +18,7 @@
namespace lldb {
class SBInputReader
class LLDB_API SBInputReader
{
public:
SBInputReader();
@ -28,7 +28,7 @@ class SBInputReader
bool IsActive() const;
};
class SBDebugger
class LLDB_API SBDebugger
{
public:

View File

@ -15,7 +15,7 @@
namespace lldb {
class SBDeclaration
class LLDB_API SBDeclaration
{
public:

View File

@ -55,6 +55,8 @@ class LLDB_API SBFunction;
class LLDB_API SBHostOS;
class LLDB_API SBInstruction;
class LLDB_API SBInstructionList;
class LLDB_API SBLanguageRuntime;
class LLDB_API SBLaunchInfo;
class LLDB_API SBLineEntry;
class LLDB_API SBListener;
class LLDB_API SBModule;
@ -90,6 +92,7 @@ class LLDB_API SBTypeSynthetic;
class LLDB_API SBTypeList;
class LLDB_API SBValue;
class LLDB_API SBValueList;
class LLDB_API SBVariablesOptions;
class LLDB_API SBWatchpoint;
class LLDB_API SBUnixSignals;

View File

@ -14,7 +14,7 @@
namespace lldb {
class SBError {
class LLDB_API SBError {
public:
SBError ();

View File

@ -20,7 +20,7 @@ namespace lldb {
class SBBroadcaster;
class SBEvent
class LLDB_API SBEvent
{
public:
SBEvent();
@ -78,6 +78,7 @@ class SBEvent
friend class SBBreakpoint;
friend class SBDebugger;
friend class SBProcess;
friend class SBTarget;
friend class SBThread;
friend class SBWatchpoint;

View File

@ -18,7 +18,7 @@
namespace lldb {
class SBExecutionContext
class LLDB_API SBExecutionContext
{
friend class SBCommandInterpreter;

View File

@ -17,7 +17,7 @@
namespace lldb {
class SBExpressionOptions
class LLDB_API SBExpressionOptions
{
public:
SBExpressionOptions();
@ -105,6 +105,12 @@ class SBExpressionOptions
void
SetSuppressPersistentResult (bool b = false);
const char *
GetPrefix () const;
void
SetPrefix (const char *prefix);
protected:
SBExpressionOptions (lldb_private::EvaluateExpressionOptions &expression_options);

View File

@ -14,7 +14,7 @@
namespace lldb {
class SBFileSpec
class LLDB_API SBFileSpec
{
public:
SBFileSpec ();

View File

@ -14,7 +14,7 @@
namespace lldb {
class SBFileSpecList
class LLDB_API SBFileSpecList
{
public:
SBFileSpecList ();

View File

@ -15,7 +15,7 @@
namespace lldb {
class SBFrame
class LLDB_API SBFrame
{
public:
SBFrame ();
@ -25,7 +25,7 @@ class SBFrame
const lldb::SBFrame &
operator =(const lldb::SBFrame &rhs);
~SBFrame();
~SBFrame();
bool
IsEqual (const lldb::SBFrame &that) const;
@ -36,6 +36,9 @@ class SBFrame
uint32_t
GetFrameID () const;
lldb::addr_t
GetCFA () const;
lldb::addr_t
GetPC () const;
@ -88,12 +91,18 @@ class SBFrame
const char *
GetFunctionName();
const char *
GetFunctionName() const;
/// Return true if this frame represents an inlined function.
///
/// See also GetFunctionName().
bool
IsInlined();
bool
IsInlined() const;
/// The version that doesn't supply a 'use_dynamic' value will use the
/// target's default.
lldb::SBValue
@ -156,6 +165,9 @@ class SBFrame
bool in_scope_only,
lldb::DynamicValueType use_dynamic);
lldb::SBValueList
GetVariables (const lldb::SBVariablesOptions& options);
lldb::SBValueList
GetRegisters ();
@ -210,9 +222,6 @@ class SBFrame
friend class SBInstruction;
friend class SBThread;
friend class SBValue;
#ifndef LLDB_DISABLE_PYTHON
friend class lldb_private::ScriptInterpreterPython;
#endif
lldb::StackFrameSP
GetFrameSP() const;

View File

@ -16,7 +16,7 @@
namespace lldb {
class SBFunction
class LLDB_API SBFunction
{
public:

View File

@ -15,7 +15,7 @@
namespace lldb {
class SBHostOS
class LLDB_API SBHostOS
{
public:

View File

@ -20,7 +20,7 @@
namespace lldb {
class SBInstruction
class LLDB_API SBInstruction
{
public:

View File

@ -16,7 +16,7 @@
namespace lldb {
class SBInstructionList
class LLDB_API SBInstructionList
{
public:

View File

@ -0,0 +1,29 @@
//===-- SBLanguageRuntime.h -------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef LLDB_SBLanguageRuntime_h_
#define LLDB_SBLanguageRuntime_h_
#include "lldb/API/SBDefines.h"
namespace lldb {
class SBLanguageRuntime
{
public:
static lldb::LanguageType
GetLanguageTypeFromString (const char *string);
static const char *
GetNameForLanguageType (lldb::LanguageType language);
};
} // namespace lldb
#endif // LLDB_SBLanguageRuntime_h_

View File

@ -0,0 +1,195 @@
//===-- SBLaunchInfo.h ------------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef LLDB_SBLaunchInfo_h_
#define LLDB_SBLaunchInfo_h_
#include "lldb/API/SBDefines.h"
namespace lldb {
class SBPlatform;
class SBTarget;
class LLDB_API SBLaunchInfo
{
public:
SBLaunchInfo (const char **argv);
~SBLaunchInfo();
lldb::pid_t
GetProcessID();
uint32_t
GetUserID();
uint32_t
GetGroupID();
bool
UserIDIsValid ();
bool
GroupIDIsValid ();
void
SetUserID (uint32_t uid);
void
SetGroupID (uint32_t gid);
SBFileSpec
GetExecutableFile ();
//----------------------------------------------------------------------
/// Set the executable file that will be used to launch the process and
/// optionally set it as the first argument in the argument vector.
///
/// This only needs to be specified if clients wish to carefully control
/// the exact path will be used to launch a binary. If you create a
/// target with a symlink, that symlink will get resolved in the target
/// and the resolved path will get used to launch the process. Calling
/// this function can help you still launch your process using the
/// path of your choice.
///
/// If this function is not called prior to launching with
/// SBTarget::Launch(...), the target will use the resolved executable
/// path that was used to create the target.
///
/// @param[in] exe_file
/// The override path to use when launching the executable.
///
/// @param[in] add_as_first_arg
/// If true, then the path will be inserted into the argument vector
/// prior to launching. Otherwise the argument vector will be left
/// alone.
//----------------------------------------------------------------------
void
SetExecutableFile (SBFileSpec exe_file, bool add_as_first_arg);
//----------------------------------------------------------------------
/// Get the listener that will be used to receive process events.
///
/// If no listener has been set via a call to
/// SBLaunchInfo::SetListener(), then an invalid SBListener will be
/// returned (SBListener::IsValid() will return false). If a listener
/// has been set, then the valid listener object will be returned.
//----------------------------------------------------------------------
SBListener
GetListener ();
//----------------------------------------------------------------------
/// Set the listener that will be used to receive process events.
///
/// By default the SBDebugger, which has a listener, that the SBTarget
/// belongs to will listen for the process events. Calling this function
/// allows a different listener to be used to listen for process events.
//----------------------------------------------------------------------
void
SetListener (SBListener &listener);
uint32_t
GetNumArguments ();
const char *
GetArgumentAtIndex (uint32_t idx);
void
SetArguments (const char **argv, bool append);
uint32_t
GetNumEnvironmentEntries ();
const char *
GetEnvironmentEntryAtIndex (uint32_t idx);
void
SetEnvironmentEntries (const char **envp, bool append);
void
Clear ();
const char *
GetWorkingDirectory () const;
void
SetWorkingDirectory (const char *working_dir);
uint32_t
GetLaunchFlags ();
void
SetLaunchFlags (uint32_t flags);
const char *
GetProcessPluginName ();
void
SetProcessPluginName (const char *plugin_name);
const char *
GetShell ();
void
SetShell (const char * path);
bool
GetShellExpandArguments ();
void
SetShellExpandArguments (bool glob);
uint32_t
GetResumeCount ();
void
SetResumeCount (uint32_t c);
bool
AddCloseFileAction (int fd);
bool
AddDuplicateFileAction (int fd, int dup_fd);
bool
AddOpenFileAction (int fd, const char *path, bool read, bool write);
bool
AddSuppressFileAction (int fd, bool read, bool write);
void
SetLaunchEventData (const char *data);
const char *
GetLaunchEventData () const;
bool
GetDetachOnError() const;
void
SetDetachOnError(bool enable);
protected:
friend class SBPlatform;
friend class SBTarget;
lldb_private::ProcessLaunchInfo &
ref ();
const lldb_private::ProcessLaunchInfo &
ref () const;
ProcessLaunchInfoSP m_opaque_sp;
};
} // namespace lldb
#endif // LLDB_SBLaunchInfo_h_

View File

@ -16,7 +16,7 @@
namespace lldb {
class SBLineEntry
class LLDB_API SBLineEntry
{
public:

View File

@ -14,7 +14,7 @@
namespace lldb {
class SBListener
class LLDB_API SBListener
{
public:
SBListener ();

View File

@ -18,7 +18,7 @@
namespace lldb {
class SBModule
class LLDB_API SBModule
{
public:
@ -106,7 +106,7 @@ class SBModule
/// or "./usr/lib", then the install path will be resolved using
/// the platform's current working directory as the base path.
///
/// @param[in]
/// @param[in] file
/// A file specification object.
//------------------------------------------------------------------
bool
@ -318,6 +318,23 @@ class SBModule
GetVersion (uint32_t *versions,
uint32_t num_versions);
//------------------------------------------------------------------
/// Get accessor for the symbol file specification.
///
/// When debugging an object file an additional debug information can
/// be provided in separate file. Therefore if you debugging something
/// like '/usr/lib/liba.dylib' then debug information can be located
/// in folder like '/usr/lib/liba.dylib.dSYM/'.
///
/// @return
/// A const reference to the file specification object.
//------------------------------------------------------------------
lldb::SBFileSpec
GetSymbolFileSpec() const;
lldb::SBAddress
GetObjectFileHeaderAddress() const;
private:
friend class SBAddress;
friend class SBFrame;

View File

@ -15,7 +15,7 @@
namespace lldb {
class SBModuleSpec
class LLDB_API SBModuleSpec
{
public:

View File

@ -12,12 +12,16 @@
#include "lldb/API/SBDefines.h"
#include <functional>
struct PlatformConnectOptions;
struct PlatformShellCommand;
namespace lldb {
class SBPlatformConnectOptions
class SBLaunchInfo;
class LLDB_API SBPlatformConnectOptions
{
public:
SBPlatformConnectOptions (const char *url);
@ -55,7 +59,7 @@ namespace lldb {
PlatformConnectOptions *m_opaque_ptr;
};
class SBPlatformShellCommand
class LLDB_API SBPlatformShellCommand
{
public:
SBPlatformShellCommand (const char *shell_command);
@ -100,7 +104,7 @@ namespace lldb {
PlatformShellCommand *m_opaque_ptr;
};
class SBPlatform
class LLDB_API SBPlatform
{
public:
@ -170,6 +174,12 @@ namespace lldb {
SBError
Run (SBPlatformShellCommand &shell_command);
SBError
Launch (SBLaunchInfo &launch_info);
SBError
Kill (const lldb::pid_t pid);
SBError
MakeDirectory (const char *path, uint32_t file_permissions = eFilePermissionsDirectoryDefault);
@ -190,6 +200,9 @@ namespace lldb {
void
SetSP (const lldb::PlatformSP& platform_sp);
SBError
ExecuteConnected (const std::function<lldb_private::Error(const lldb::PlatformSP&)>& func);
lldb::PlatformSP m_opaque_sp;
};

View File

@ -20,13 +20,13 @@ namespace lldb {
class SBEvent;
class SBProcess
class LLDB_API SBProcess
{
public:
//------------------------------------------------------------------
/// Broadcaster event bits definitions.
//------------------------------------------------------------------
enum
FLAGS_ANONYMOUS_ENUM()
{
eBroadcastBitStateChanged = (1 << 0),
eBroadcastBitInterrupt = (1 << 1),
@ -229,7 +229,22 @@ class SBProcess
uint32_t
GetStopID(bool include_expression_stops = false);
//------------------------------------------------------------------
/// Gets the stop event corresponding to stop ID.
//
/// Note that it wasn't fully implemented and tracks only the stop
/// event for the last natural stop ID.
///
/// @param [in] stop_id
/// The ID of the stop event to return.
///
/// @return
/// The stop event corresponding to stop ID.
//------------------------------------------------------------------
lldb::SBEvent
GetStopEventForStopID(uint32_t stop_id);
size_t
ReadMemory (addr_t addr, void *buf, size_t size, lldb::SBError &error);
@ -260,6 +275,9 @@ class SBProcess
static lldb::SBProcess
GetProcessFromEvent (const lldb::SBEvent &event);
static bool
GetInterruptedFromEvent (const lldb::SBEvent &event);
static bool
EventIsProcessEvent (const lldb::SBEvent &event);

View File

@ -17,7 +17,7 @@
namespace lldb {
class SBQueue
class LLDB_API SBQueue
{
public:
SBQueue ();

View File

@ -15,7 +15,7 @@
namespace lldb {
class SBQueueItem
class LLDB_API SBQueueItem
{
public:
SBQueueItem ();

View File

@ -15,7 +15,7 @@
namespace lldb {
class SBSection
class LLDB_API SBSection
{
public:

View File

@ -16,7 +16,7 @@
namespace lldb {
class SBSourceManager
class LLDB_API SBSourceManager
{
public:
SBSourceManager (const SBDebugger &debugger);

View File

@ -16,7 +16,7 @@
namespace lldb {
class SBStream
class LLDB_API SBStream
{
public:

View File

@ -14,7 +14,7 @@
namespace lldb {
class SBStringList
class LLDB_API SBStringList
{
public:

View File

@ -17,7 +17,7 @@
namespace lldb {
class SBSymbol
class LLDB_API SBSymbol
{
public:

View File

@ -20,7 +20,7 @@
namespace lldb {
class SBSymbolContext
class LLDB_API SBSymbolContext
{
public:
SBSymbolContext ();

View File

@ -15,7 +15,7 @@
namespace lldb {
class SBSymbolContextList
class LLDB_API SBSymbolContextList
{
public:
SBSymbolContextList ();

View File

@ -12,9 +12,11 @@
#include "lldb/API/SBDefines.h"
#include "lldb/API/SBAddress.h"
#include "lldb/API/SBAttachInfo.h"
#include "lldb/API/SBBroadcaster.h"
#include "lldb/API/SBFileSpec.h"
#include "lldb/API/SBFileSpecList.h"
#include "lldb/API/SBLaunchInfo.h"
#include "lldb/API/SBSymbolContextList.h"
#include "lldb/API/SBType.h"
#include "lldb/API/SBValue.h"
@ -24,295 +26,7 @@ namespace lldb {
class SBPlatform;
class SBLaunchInfo
{
public:
SBLaunchInfo (const char **argv);
~SBLaunchInfo();
uint32_t
GetUserID();
uint32_t
GetGroupID();
bool
UserIDIsValid ();
bool
GroupIDIsValid ();
void
SetUserID (uint32_t uid);
void
SetGroupID (uint32_t gid);
SBFileSpec
GetExecutableFile ();
//----------------------------------------------------------------------
/// Set the executable file that will be used to launch the process and
/// optionally set it as the first argument in the argument vector.
///
/// This only needs to be specified if clients wish to carefully control
/// the exact path will be used to launch a binary. If you create a
/// target with a symlink, that symlink will get resolved in the target
/// and the resolved path will get used to launch the process. Calling
/// this function can help you still launch your process using the
/// path of your choice.
///
/// If this function is not called prior to launching with
/// SBTarget::Launch(...), the target will use the resolved executable
/// path that was used to create the target.
///
/// @param[in] exe_file
/// The override path to use when launching the executable.
///
/// @param[in] add_as_first_arg
/// If true, then the path will be inserted into the argument vector
/// prior to launching. Otherwise the argument vector will be left
/// alone.
//----------------------------------------------------------------------
void
SetExecutableFile (SBFileSpec exe_file, bool add_as_first_arg);
//----------------------------------------------------------------------
/// Get the listener that will be used to receive process events.
///
/// If no listener has been set via a call to
/// SBLaunchInfo::SetListener(), then an invalid SBListener will be
/// returned (SBListener::IsValid() will return false). If a listener
/// has been set, then the valid listener object will be returned.
//----------------------------------------------------------------------
SBListener
GetListener ();
//----------------------------------------------------------------------
/// Set the listener that will be used to receive process events.
///
/// By default the SBDebugger, which has a listener, that the SBTarget
/// belongs to will listen for the process events. Calling this function
/// allows a different listener to be used to listen for process events.
//----------------------------------------------------------------------
void
SetListener (SBListener &listener);
uint32_t
GetNumArguments ();
const char *
GetArgumentAtIndex (uint32_t idx);
void
SetArguments (const char **argv, bool append);
uint32_t
GetNumEnvironmentEntries ();
const char *
GetEnvironmentEntryAtIndex (uint32_t idx);
void
SetEnvironmentEntries (const char **envp, bool append);
void
Clear ();
const char *
GetWorkingDirectory () const;
void
SetWorkingDirectory (const char *working_dir);
uint32_t
GetLaunchFlags ();
void
SetLaunchFlags (uint32_t flags);
const char *
GetProcessPluginName ();
void
SetProcessPluginName (const char *plugin_name);
const char *
GetShell ();
void
SetShell (const char * path);
uint32_t
GetResumeCount ();
void
SetResumeCount (uint32_t c);
bool
AddCloseFileAction (int fd);
bool
AddDuplicateFileAction (int fd, int dup_fd);
bool
AddOpenFileAction (int fd, const char *path, bool read, bool write);
bool
AddSuppressFileAction (int fd, bool read, bool write);
void
SetLaunchEventData (const char *data);
const char *
GetLaunchEventData () const;
bool
GetDetachOnError() const;
void
SetDetachOnError(bool enable);
protected:
friend class SBTarget;
lldb_private::ProcessLaunchInfo &
ref ();
ProcessLaunchInfoSP m_opaque_sp;
};
class SBAttachInfo
{
public:
SBAttachInfo ();
SBAttachInfo (lldb::pid_t pid);
SBAttachInfo (const char *path, bool wait_for);
SBAttachInfo (const SBAttachInfo &rhs);
~SBAttachInfo();
SBAttachInfo &
operator = (const SBAttachInfo &rhs);
lldb::pid_t
GetProcessID ();
void
SetProcessID (lldb::pid_t pid);
void
SetExecutable (const char *path);
void
SetExecutable (lldb::SBFileSpec exe_file);
bool
GetWaitForLaunch ();
void
SetWaitForLaunch (bool b);
bool
GetIgnoreExisting ();
void
SetIgnoreExisting (bool b);
uint32_t
GetResumeCount ();
void
SetResumeCount (uint32_t c);
const char *
GetProcessPluginName ();
void
SetProcessPluginName (const char *plugin_name);
uint32_t
GetUserID();
uint32_t
GetGroupID();
bool
UserIDIsValid ();
bool
GroupIDIsValid ();
void
SetUserID (uint32_t uid);
void
SetGroupID (uint32_t gid);
uint32_t
GetEffectiveUserID();
uint32_t
GetEffectiveGroupID();
bool
EffectiveUserIDIsValid ();
bool
EffectiveGroupIDIsValid ();
void
SetEffectiveUserID (uint32_t uid);
void
SetEffectiveGroupID (uint32_t gid);
lldb::pid_t
GetParentProcessID ();
void
SetParentProcessID (lldb::pid_t pid);
bool
ParentProcessIDIsValid();
//----------------------------------------------------------------------
/// Get the listener that will be used to receive process events.
///
/// If no listener has been set via a call to
/// SBLaunchInfo::SetListener(), then an invalid SBListener will be
/// returned (SBListener::IsValid() will return false). If a listener
/// has been set, then the valid listener object will be returned.
//----------------------------------------------------------------------
SBListener
GetListener ();
//----------------------------------------------------------------------
/// Set the listener that will be used to receive process events.
///
/// By default the SBDebugger, which has a listener, that the SBTarget
/// belongs to will listen for the process events. Calling this function
/// allows a different listener to be used to listen for process events.
//----------------------------------------------------------------------
void
SetListener (SBListener &listener);
protected:
friend class SBTarget;
lldb_private::ProcessAttachInfo &
ref ();
ProcessAttachInfoSP m_opaque_sp;
};
class SBTarget
class LLDB_API SBTarget
{
public:
//------------------------------------------------------------------
@ -346,7 +60,19 @@ class SBTarget
bool
IsValid() const;
static bool
EventIsTargetEvent (const lldb::SBEvent &event);
static lldb::SBTarget
GetTargetFromEvent (const lldb::SBEvent &event);
static uint32_t
GetNumModulesFromEvent (const lldb::SBEvent &event);
static lldb::SBModule
GetModuleAtIndexFromEvent (const uint32_t idx, const lldb::SBEvent &event);
static const char *
GetBroadcasterClassName ();
@ -432,7 +158,7 @@ class SBTarget
/// @param[in] stop_at_entry
/// If false do not stop the inferior at the entry point.
///
/// @param[out]
/// @param[out] error
/// An error object. Contains the reason if there is some failure.
///
/// @return
@ -503,7 +229,7 @@ class SBTarget
/// @param[in] pid
/// The process ID to attach to.
///
/// @param[out]
/// @param[out] error
/// An error explaining what went wrong if attach fails.
///
/// @return
@ -537,7 +263,7 @@ class SBTarget
/// @param[in] wait_for
/// If true wait for a new instance of 'name' to be launched.
///
/// @param[out]
/// @param[out] error
/// An error explaining what went wrong if attach fails.
///
/// @return
@ -564,7 +290,7 @@ class SBTarget
/// @param[in] plugin_name
/// The plugin name to be used; can be NULL.
///
/// @param[out]
/// @param[out] error
/// An error explaining what went wrong if the connect fails.
///
/// @return
@ -923,13 +649,13 @@ class SBTarget
lldb::SBBreakpoint
BreakpointCreateBySourceRegex (const char *source_regex,
const lldb::SBFileSpec &source_file,
const SBFileSpec &source_file,
const char *module_name = NULL);
lldb::SBBreakpoint
BreakpointCreateBySourceRegex (const char *source_regex,
const SBFileSpecList &module_list,
const lldb::SBFileSpecList &source_file);
BreakpointCreateBySourceRegex (const char *source_regex,
const SBFileSpecList &module_list,
const SBFileSpecList &source_file);
lldb::SBBreakpoint
BreakpointCreateForException (lldb::LanguageType language,
@ -1047,6 +773,12 @@ class SBTarget
lldb::addr_t
GetStackRedZoneSize();
lldb::SBLaunchInfo
GetLaunchInfo () const;
void
SetLaunchInfo (const lldb::SBLaunchInfo &launch_info);
protected:
friend class SBAddress;

View File

@ -18,7 +18,7 @@ namespace lldb {
class SBFrame;
class SBThread
class LLDB_API SBThread
{
public:
enum

View File

@ -14,7 +14,7 @@
namespace lldb {
class SBThreadCollection
class LLDB_API SBThreadCollection
{
public:

View File

@ -16,7 +16,7 @@
namespace lldb {
class SBThreadPlan
class LLDB_API SBThreadPlan
{
friend class lldb_private::ThreadPlan;

View File

@ -16,7 +16,7 @@ namespace lldb {
class SBTypeList;
class SBTypeMember
class LLDB_API SBTypeMember
{
public:
SBTypeMember ();
@ -152,6 +152,9 @@ class SBType
bool
IsArrayType ();
bool
IsVectorType ();
bool
IsTypedefType ();
@ -175,6 +178,9 @@ class SBType
lldb::SBType
GetArrayElementType ();
lldb::SBType
GetVectorElementType ();
lldb::SBType
GetCanonicalType();

View File

@ -14,7 +14,7 @@
namespace lldb {
class SBTypeCategory
class LLDB_API SBTypeCategory
{
public:

View File

@ -15,7 +15,7 @@
namespace lldb {
class SBTypeEnumMember
class LLDB_API SBTypeEnumMember
{
public:
SBTypeEnumMember ();

View File

@ -14,7 +14,7 @@
namespace lldb {
class SBTypeFilter
class LLDB_API SBTypeFilter
{
public:

View File

@ -14,7 +14,7 @@
namespace lldb {
class SBTypeFormat
class LLDB_API SBTypeFormat
{
public:

View File

@ -14,7 +14,7 @@
namespace lldb {
class SBTypeNameSpecifier
class LLDB_API SBTypeNameSpecifier
{
public:

View File

@ -15,7 +15,7 @@
#ifndef LLDB_DISABLE_PYTHON
namespace lldb {
class SBTypeSummaryOptions
class LLDB_API SBTypeSummaryOptions
{
public:
SBTypeSummaryOptions();

View File

@ -16,7 +16,7 @@
namespace lldb {
class SBTypeSynthetic
class LLDB_API SBTypeSynthetic
{
public:

View File

@ -14,7 +14,7 @@
namespace lldb {
class SBUnixSignals {
class LLDB_API SBUnixSignals {
public:
SBUnixSignals ();

View File

@ -19,10 +19,8 @@ class ValueLocker;
namespace lldb {
class SBValue
class LLDB_API SBValue
{
friend class ValueLocker;
public:
SBValue ();
@ -84,6 +82,7 @@ friend class ValueLocker;
ValueType
GetValueType ();
// If you call this on a newly created ValueObject, it will always return false.
bool
GetValueDidChange ();
@ -223,7 +222,7 @@ friend class ValueLocker;
/// and also if the target can be run to figure out the dynamic
/// type of the child value.
///
/// @param[in] synthetic_allowed
/// @param[in] can_create_synthetic
/// If \b true, then allow child values to be created by index
/// for pointers and arrays for indexes that normally wouldn't
/// be allowed.
@ -326,6 +325,9 @@ friend class ValueLocker;
//------------------------------------------------------------------
bool
MightHaveChildren ();
bool
IsRuntimeSupportValue ();
uint32_t
GetNumChildren ();
@ -386,7 +388,7 @@ friend class ValueLocker;
/// @param[in] write
/// Stop when this value is modified
///
/// @param[out]
/// @param[out] error
/// An error object. Contains the reason if there is some failure.
///
/// @return
@ -419,7 +421,7 @@ friend class ValueLocker;
/// @param[in] write
/// Stop when this value is modified
///
/// @param[out]
/// @param[out] error
/// An error object. Contains the reason if there is some failure.
///
/// @return

View File

@ -16,7 +16,7 @@ class ValueListImpl;
namespace lldb {
class SBValueList
class LLDB_API SBValueList
{
public:

View File

@ -0,0 +1,98 @@
//===-- SBVariablesOptions.h ------------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef LLDB_SBVariablesOptions_h_
#define LLDB_SBVariablesOptions_h_
#include "lldb/API/SBDefines.h"
class VariablesOptionsImpl;
namespace lldb {
class LLDB_API SBVariablesOptions
{
public:
SBVariablesOptions ();
SBVariablesOptions (const SBVariablesOptions& options);
SBVariablesOptions&
operator = (const SBVariablesOptions& options);
~SBVariablesOptions ();
bool
IsValid () const;
bool
GetIncludeArguments () const;
void
SetIncludeArguments (bool);
bool
GetIncludeLocals () const;
void
SetIncludeLocals (bool);
bool
GetIncludeStatics () const;
void
SetIncludeStatics (bool);
bool
GetInScopeOnly () const;
void
SetInScopeOnly (bool);
bool
GetIncludeRuntimeSupportValues () const;
void
SetIncludeRuntimeSupportValues (bool);
lldb::DynamicValueType
GetUseDynamic () const;
void
SetUseDynamic (lldb::DynamicValueType);
protected:
VariablesOptionsImpl *
operator->();
const VariablesOptionsImpl *
operator->() const;
VariablesOptionsImpl *
get ();
VariablesOptionsImpl &
ref();
const VariablesOptionsImpl &
ref() const;
SBVariablesOptions (VariablesOptionsImpl *lldb_object_ptr);
void
SetOptions (VariablesOptionsImpl *lldb_object_ptr);
private:
std::unique_ptr<VariablesOptionsImpl> m_opaque_ap;
};
} // namespace lldb
#endif // LLDB_SBValue_h_

View File

@ -14,7 +14,7 @@
namespace lldb {
class SBWatchpoint
class LLDB_API SBWatchpoint
{
public:

View File

@ -0,0 +1,40 @@
//===-- SystemInitializerFull.h ---------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef LLDB_API_SYSTEM_INITIALIZER_FULL_H
#define LLDB_API_SYSTEM_INITIALIZER_FULL_H
#include "lldb/Initialization/SystemInitializerCommon.h"
namespace lldb_private
{
//------------------------------------------------------------------
/// Initializes lldb.
///
/// This class is responsible for initializing all of lldb system
/// services needed to use the full LLDB application. This class is
/// not intended to be used externally, but is instead used
/// internally by SBDebugger to initialize the system.
//------------------------------------------------------------------
class SystemInitializerFull : public SystemInitializerCommon
{
public:
SystemInitializerFull();
virtual ~SystemInitializerFull();
void Initialize() override;
void Terminate() override;
private:
void InitializeSWIG();
void TerminateSWIG();
};
}
#endif

View File

@ -155,6 +155,23 @@ class Breakpoint:
};
class BreakpointPrecondition
{
public:
virtual ~BreakpointPrecondition() {}
virtual bool
EvaluatePrecondition(StoppointCallbackContext &context);
virtual Error
ConfigurePrecondition(Args &options);
virtual void
DescribePrecondition(Stream &stream, lldb::DescriptionLevel level);
};
typedef std::shared_ptr<BreakpointPrecondition> BreakpointPreconditionSP;
//------------------------------------------------------------------
/// Destructor.
///
@ -665,6 +682,31 @@ class Breakpoint:
}
}
//------------------------------------------------------------------
/// Set a pre-condition filter that overrides all user provided filters/callbacks etc.
///
/// Used to define fancy breakpoints that can do dynamic hit detection without taking up the condition slot -
/// which really belongs to the user anyway...
///
/// The Precondition should not continue the target, it should return true if the condition says to stop and
/// false otherwise.
///
//------------------------------------------------------------------
void
SetPrecondition(BreakpointPreconditionSP precondition_sp)
{
m_precondition_sp = precondition_sp;
}
bool
EvaluatePrecondition (StoppointCallbackContext &context);
BreakpointPreconditionSP
GetPrecondition()
{
return m_precondition_sp;
}
protected:
friend class Target;
//------------------------------------------------------------------
@ -714,6 +756,19 @@ class Breakpoint:
bool
IgnoreCountShouldStop ();
void
IncrementHitCount()
{
m_hit_count++;
}
void
DecrementHitCount()
{
assert (m_hit_count > 0);
m_hit_count--;
}
private:
// This one should only be used by Target to copy breakpoints from target to target - primarily from the dummy
// target to prime new targets.
@ -724,16 +779,23 @@ class Breakpoint:
// For Breakpoint only
//------------------------------------------------------------------
bool m_being_created;
bool m_hardware; // If this breakpoint is required to use a hardware breakpoint
Target &m_target; // The target that holds this breakpoint.
bool m_hardware; // If this breakpoint is required to use a hardware breakpoint
Target &m_target; // The target that holds this breakpoint.
std::unordered_set<std::string> m_name_list; // If not empty, this is the name of this breakpoint (many breakpoints can share the same name.)
lldb::SearchFilterSP m_filter_sp; // The filter that constrains the breakpoint's domain.
lldb::BreakpointResolverSP m_resolver_sp; // The resolver that defines this breakpoint.
BreakpointOptions m_options; // Settable breakpoint options
BreakpointLocationList m_locations; // The list of locations currently found for this breakpoint.
lldb::SearchFilterSP m_filter_sp; // The filter that constrains the breakpoint's domain.
lldb::BreakpointResolverSP m_resolver_sp; // The resolver that defines this breakpoint.
BreakpointPreconditionSP m_precondition_sp; // The precondition is a breakpoint-level hit filter that can be used
// to skip certain breakpoint hits. For instance, exception breakpoints
// use this to limit the stop to certain exception classes, while leaving
// the condition & callback free for user specification.
BreakpointOptions m_options; // Settable breakpoint options
BreakpointLocationList m_locations; // The list of locations currently found for this breakpoint.
std::string m_kind_description;
bool m_resolve_indirect_symbols;
uint32_t m_hit_count; // Number of times this breakpoint/watchpoint has been hit. This is kept
// separately from the locations hit counts, since locations can go away when
// their backing library gets unloaded, and we would lose hit counts.
void
SendBreakpointChangedEvent (lldb::BreakpointEventType eventKind);

View File

@ -21,11 +21,8 @@
#include "lldb/lldb-private.h"
#include "lldb/Breakpoint/StoppointLocation.h"
#include "lldb/Core/Address.h"
#include "lldb/Core/StringList.h"
#include "lldb/Core/UserID.h"
#include "lldb/Host/Mutex.h"
#include "lldb/Target/Process.h"
#include "lldb/Expression/ClangUserExpression.h"
namespace lldb_private {
@ -390,6 +387,7 @@ class BreakpointLocation :
friend class BreakpointSite;
friend class BreakpointLocationList;
friend class Process;
friend class StopInfoBreakpoint;
//------------------------------------------------------------------
/// Set the breakpoint site for this location to \a bp_site_sp.
@ -417,6 +415,9 @@ class BreakpointLocation :
void
BumpHitCount();
void
UndoBumpHitCount();
//------------------------------------------------------------------
// Constructors and Destructors
@ -460,7 +461,7 @@ class BreakpointLocation :
Breakpoint &m_owner; ///< The breakpoint that produced this object.
std::unique_ptr<BreakpointOptions> m_options_ap; ///< Breakpoint options pointer, NULL if we're using our breakpoint's options.
lldb::BreakpointSiteSP m_bp_site_sp; ///< Our breakpoint site (it may be shared by more than one location.)
ClangUserExpression::ClangUserExpressionSP m_user_expression_sp; ///< The compiled expression to use in testing our condition.
lldb::ClangUserExpressionSP m_user_expression_sp; ///< The compiled expression to use in testing our condition.
Mutex m_condition_mutex; ///< Guards parsing and evaluation of the condition, which could be evaluated by multiple processes.
size_t m_condition_hash; ///< For testing whether the condition source code changed.

View File

@ -89,6 +89,9 @@ class BreakpointOptions
// callback.
// Asynchronous callbacks get run as part of the "ShouldStop" logic in the thread plan. The logic there is:
// a) If the breakpoint is thread specific and not for this thread, continue w/o running the callback.
// NB. This is actually enforced underneath the breakpoint system, the Process plugin is expected to
// call BreakpointSite::IsValidForThread, and set the thread's StopInfo to "no reason". That way,
// thread displays won't show stops for breakpoints not for that thread...
// b) If the ignore count says we shouldn't stop, then ditto.
// c) If the condition says we shouldn't stop, then ditto.
// d) Otherwise, the callback will get run, and if it returns true we will stop, and if false we won't.

View File

@ -32,7 +32,8 @@ class BreakpointResolverFileLine :
const FileSpec &resolver,
uint32_t line_no,
bool check_inlines,
bool skip_prologue);
bool skip_prologue,
bool exact_match);
virtual
~BreakpointResolverFileLine ();
@ -67,6 +68,7 @@ class BreakpointResolverFileLine :
uint32_t m_line_number; // This is the line number that we are looking for.
bool m_inlines; // This determines whether the resolver looks for inlined functions or not.
bool m_skip_prologue;
bool m_exact_match;
private:
DISALLOW_COPY_AND_ASSIGN(BreakpointResolverFileLine);

View File

@ -29,7 +29,8 @@ class BreakpointResolverFileRegex :
{
public:
BreakpointResolverFileRegex (Breakpoint *bkpt,
RegularExpression &regex);
RegularExpression &regex,
bool exact_match);
virtual
~BreakpointResolverFileRegex ();
@ -61,6 +62,7 @@ class BreakpointResolverFileRegex :
protected:
friend class Breakpoint;
RegularExpression m_regex; // This is the line expression that we are looking for.
bool m_exact_match;
private:
DISALLOW_COPY_AND_ASSIGN(BreakpointResolverFileRegex);

View File

@ -18,7 +18,7 @@
// Other libraries and framework includes
// Project includes
#include "lldb/lldb-private.h"
#include "lldb/lldb-forward.h"
#include "lldb/Host/Mutex.h"
#include "lldb/Core/UserID.h"
#include "lldb/Breakpoint/StoppointLocation.h"

View File

@ -134,6 +134,9 @@ class StoppointLocation
++m_hit_count;
}
void
DecrementHitCount ();
private:
//------------------------------------------------------------------
// For StoppointLocation only

View File

@ -20,10 +20,11 @@
// Project includes
#include "lldb/lldb-private.h"
#include "lldb/Target/Target.h"
#include "lldb/Core/UserID.h"
#include "lldb/Breakpoint/WatchpointOptions.h"
#include "lldb/Breakpoint/StoppointLocation.h"
#include "lldb/Core/UserID.h"
#include "lldb/Symbol/ClangASTType.h"
#include "lldb/Target/Target.h"
namespace lldb_private {
@ -205,7 +206,18 @@ class Watchpoint :
friend class Target;
friend class WatchpointList;
void ResetHitCount() { m_hit_count = 0; }
void
ResetHitCount ()
{
m_hit_count = 0;
}
void
ResetHistoricValues ()
{
m_old_value_sp.reset(nullptr);
m_new_value_sp.reset(nullptr);
}
Target &m_target;
bool m_enabled; // Is this watchpoint enabled

View File

@ -88,6 +88,8 @@ class Address
///< if the address is in a section (section of pointers, c strings, etc).
DumpStyleResolvedDescriptionNoModule,
DumpStyleResolvedDescriptionNoFunctionArguments,
DumpStyleNoFunctionName, ///< Elide the function name; display an offset into the current function.
///< Used primarily in disassembly symbolication
DumpStyleDetailedSymbolContext, ///< Detailed symbol context information for an address for all symbol
///< context members.
DumpStyleResolvedPointerDescription ///< Dereference a pointer at the current address and then lookup the

View File

@ -12,9 +12,8 @@
#if defined(__cplusplus)
#include "lldb/lldb-private.h"
#include "lldb/lldb-forward.h"
#include "lldb/Core/ConstString.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Triple.h"
namespace lldb_private {
@ -33,6 +32,23 @@ struct CoreDefinition;
class ArchSpec
{
public:
enum MIPSSubType
{
eMIPSSubType_unknown,
eMIPSSubType_mips32,
eMIPSSubType_mips32r2,
eMIPSSubType_mips32r6,
eMIPSSubType_mips32el,
eMIPSSubType_mips32r2el,
eMIPSSubType_mips32r6el,
eMIPSSubType_mips64,
eMIPSSubType_mips64r2,
eMIPSSubType_mips64r6,
eMIPSSubType_mips64el,
eMIPSSubType_mips64r2el,
eMIPSSubType_mips64r6el,
};
enum Core
{
eCore_arm_generic,
@ -66,8 +82,27 @@ class ArchSpec
eCore_arm_arm64,
eCore_arm_armv8,
eCore_arm_aarch64,
eCore_mips32,
eCore_mips32r2,
eCore_mips32r3,
eCore_mips32r5,
eCore_mips32r6,
eCore_mips32el,
eCore_mips32r2el,
eCore_mips32r3el,
eCore_mips32r5el,
eCore_mips32r6el,
eCore_mips64,
eCore_mips64r2,
eCore_mips64r3,
eCore_mips64r5,
eCore_mips64r6,
eCore_mips64el,
eCore_mips64r2el,
eCore_mips64r3el,
eCore_mips64r5el,
eCore_mips64r6el,
eCore_ppc_generic,
eCore_ppc_ppc601,
@ -142,7 +177,19 @@ class ArchSpec
kCore_hexagon_last = eCore_hexagon_hexagonv5,
kCore_kalimba_first = eCore_kalimba3,
kCore_kalimba_last = eCore_kalimba5
kCore_kalimba_last = eCore_kalimba5,
kCore_mips32_first = eCore_mips32,
kCore_mips32_last = eCore_mips32r6,
kCore_mips32el_first = eCore_mips32el,
kCore_mips32el_last = eCore_mips32r6el,
kCore_mips64_first = eCore_mips64,
kCore_mips64_last = eCore_mips64r6,
kCore_mips64el_first = eCore_mips64el,
kCore_mips64el_last = eCore_mips64r6el
};
typedef void (* StopInfoOverrideCallbackType)(lldb_private::Thread &thread);
@ -277,56 +324,61 @@ class ArchSpec
}
//------------------------------------------------------------------
/// Sets this ArchSpec according to the given architecture name.
/// Merges fields from another ArchSpec into this ArchSpec.
///
/// The architecture name can be one of the generic system default
/// values:
/// This will use the supplied ArchSpec to fill in any fields of
/// the triple in this ArchSpec which were unspecified. This can
/// be used to refine a generic ArchSpec with a more specific one.
/// For example, if this ArchSpec's triple is something like
/// i386-unknown-unknown-unknown, and we have a triple which is
/// x64-pc-windows-msvc, then merging that triple into this one
/// will result in the triple i386-pc-windows-msvc.
///
/// @li \c LLDB_ARCH_DEFAULT - The arch the current system defaults
/// to when a program is launched without any extra
/// attributes or settings.
/// @li \c LLDB_ARCH_DEFAULT_32BIT - The default host architecture
/// for 32 bit (if any).
/// @li \c LLDB_ARCH_DEFAULT_64BIT - The default host architecture
/// for 64 bit (if any).
///
/// Alternatively, if the object type of this ArchSpec has been
/// configured, a concrete architecture can be specified to set
/// the CPU type ("x86_64" for example).
///
/// Finally, an encoded object and archetecture format is accepted.
/// The format contains an object type (like "macho" or "elf"),
/// followed by a platform dependent encoding of CPU type and
/// subtype. For example:
///
/// "macho" : Specifies an object type of MachO.
/// "macho-16-6" : MachO specific encoding for ARMv6.
/// "elf-43 : ELF specific encoding for Sparc V9.
///
/// @param[in] arch_name The name of an architecture.
///
/// @return True if @p arch_name was successfully translated, false
/// otherwise.
//------------------------------------------------------------------
// bool
// SetArchitecture (const llvm::StringRef& arch_name);
//
// bool
// SetArchitecture (const char *arch_name);
void
MergeFrom(const ArchSpec &other);
//------------------------------------------------------------------
/// Change the architecture object type and CPU type.
/// Change the architecture object type, CPU type and OS type.
///
/// @param[in] arch_type The object type of this ArchSpec.
///
/// @param[in] cpu The required CPU type.
///
/// @return True if the object and CPU type were successfully set.
/// @param[in] os The optional OS type
/// The default value of 0 was choosen to from the ELF spec value
/// ELFOSABI_NONE. ELF is the only one using this parameter. If another
/// format uses this parameter and 0 does not work, use a value over
/// 255 because in the ELF header this is value is only a byte.
///
/// @return True if the object, and CPU were successfully set.
///
/// As a side effect, the vendor value is usually set to unknown.
/// The exections are
/// aarch64-apple-ios
/// arm-apple-ios
/// thumb-apple-ios
/// x86-apple-
/// x86_64-apple-
///
/// As a side effect, the os value is usually set to unknown
/// The exceptions are
/// *-*-aix
/// aarch64-apple-ios
/// arm-apple-ios
/// thumb-apple-ios
/// powerpc-apple-darwin
/// *-*-freebsd
/// *-*-linux
/// *-*-netbsd
/// *-*-openbsd
/// *-*-solaris
//------------------------------------------------------------------
bool
SetArchitecture (ArchitectureType arch_type,
uint32_t cpu,
uint32_t sub);
uint32_t sub,
uint32_t os = 0);
//------------------------------------------------------------------
/// Returns the byte order for the architecture specification.
@ -441,8 +493,18 @@ class ArchSpec
GetDefaultEndian () const;
//------------------------------------------------------------------
/// Compare an ArchSpec to another ArchSpec, requiring an exact cpu
/// type match between them.
/// Returns true if 'char' is a signed type by defualt in the
/// architecture false otherwise
///
/// @return True if 'char' is a signed type by default on the
/// architecture and false otherwise.
//------------------------------------------------------------------
bool
CharIsSignedByDefault () const;
//------------------------------------------------------------------
/// Compare an ArchSpec to another ArchSpec, requiring an exact cpu
/// type match between them.
/// e.g. armv7s is not an exact match with armv7 - this would return false
///
/// @return true if the two ArchSpecs match.

View File

@ -419,12 +419,7 @@ class Broadcaster
HijackBroadcaster (Listener *listener, uint32_t event_mask = UINT32_MAX);
bool
IsHijackedForEvent (uint32_t event_mask)
{
if (m_hijacking_listeners.size() > 0)
return (event_mask & m_hijacking_masks.back()) != 0;
return false;
}
IsHijackedForEvent (uint32_t event_mask);
//------------------------------------------------------------------
/// Restore the state of the Broadcaster from a previous hijack attempt.

View File

@ -72,11 +72,14 @@ namespace clang
class FunctionTemplateSpecializationInfo;
class GotoStmt;
class HeaderSearchOptions;
class IdentifierInfo;
class IdentifierTable;
class IntegerLiteral;
class LabelStmt;
class LangOptions;
class MacroDirective;
class MemberExpr;
class Module;
class NamedDecl;
class NamespaceDecl;
class NonTypeTemplateParmDecl;

View File

@ -85,14 +85,16 @@ namespace lldb_private {
class Communication : public Broadcaster
{
public:
enum {
eBroadcastBitDisconnected = (1 << 0), ///< Sent when the communications connection is lost.
eBroadcastBitReadThreadGotBytes = (1 << 1), ///< Sent by the read thread when bytes become available.
eBroadcastBitReadThreadDidExit = (1 << 2), ///< Sent by the read thread when it exits to inform clients.
eBroadcastBitReadThreadShouldExit = (1 << 3), ///< Sent by clients that need to cancel the read thread.
eBroadcastBitPacketAvailable = (1 << 4), ///< Sent when data received makes a complete packet.
kLoUserBroadcastBit = (1 << 16),///< Subclasses can used bits 31:16 for any needed events.
kHiUserBroadcastBit = (1 << 31),
FLAGS_ANONYMOUS_ENUM()
{
eBroadcastBitDisconnected = (1u << 0), ///< Sent when the communications connection is lost.
eBroadcastBitReadThreadGotBytes = (1u << 1), ///< Sent by the read thread when bytes become available.
eBroadcastBitReadThreadDidExit = (1u << 2), ///< Sent by the read thread when it exits to inform clients.
eBroadcastBitReadThreadShouldExit = (1u << 3), ///< Sent by clients that need to cancel the read thread.
eBroadcastBitPacketAvailable = (1u << 4), ///< Sent when data received makes a complete packet.
eBroadcastBitNoMorePendingInput = (1u << 5), ///< Sent by the read thread to indicate all pending input has been processed.
kLoUserBroadcastBit = (1u << 16),///< Subclasses can used bits 31:16 for any needed events.
kHiUserBroadcastBit = (1u << 31),
eAllEventBits = 0xffffffff
};
@ -321,6 +323,16 @@ class Communication : public Broadcaster
SetReadThreadBytesReceivedCallback (ReadThreadBytesReceived callback,
void *callback_baton);
//------------------------------------------------------------------
/// Wait for the read thread to process all outstanding data.
///
/// After this function returns, the read thread has processed all data that
/// has been waiting in the Connection queue.
///
//------------------------------------------------------------------
void SynchronizeWithReadThread ();
static const char *
ConnectionStatusAsCString (lldb::ConnectionStatus status);
@ -354,9 +366,11 @@ class Communication : public Broadcaster
lldb::ConnectionSP m_connection_sp; ///< The connection that is current in use by this communications class.
HostThread m_read_thread; ///< The read thread handle in case we need to cancel the thread.
std::atomic<bool> m_read_thread_enabled;
std::atomic<bool> m_read_thread_did_exit;
std::string m_bytes; ///< A buffer to cache bytes read in the ReadThread function.
Mutex m_bytes_mutex; ///< A mutex to protect multi-threaded access to the cached bytes.
Mutex m_write_mutex; ///< Don't let multiple threads write at the same time...
Mutex m_synchronize_mutex;
ReadThreadBytesReceived m_callback;
void *m_callback_baton;
bool m_close_on_eof;

View File

@ -12,6 +12,7 @@
// C Includes
// C++ Includes
#include <string>
// Other libraries and framework includes
// Project includes
#include "lldb/lldb-private.h"
@ -110,6 +111,13 @@ class Connection
/// The number of bytes to attempt to read, and also the max
/// number of bytes that can be placed into \a dst.
///
/// @param[in] timeout_usec
/// The number of microseconds to wait for the data.
///
/// @param[out] status
/// On return, indicates whether the call was sucessful or terminated
/// due to some error condition.
///
/// @param[out] error_ptr
/// A pointer to an error object that should be given an
/// approriate error value if this method returns zero. This
@ -133,13 +141,13 @@ class Connection
///
/// Subclasses must override this function.
///
/// @param[in] src
/// A source buffer that must be at least \a src_len bytes
/// @param[in] dst
/// A desination buffer that must be at least \a dst_len bytes
/// long.
///
/// @param[in] src_len
/// @param[in] dst_len
/// The number of bytes to attempt to write, and also the
/// number of bytes are currently available in \a src.
/// number of bytes are currently available in \a dst.
///
/// @param[out] error_ptr
/// A pointer to an error object that should be given an
@ -150,7 +158,34 @@ class Connection
/// The number of bytes actually Written.
//------------------------------------------------------------------
virtual size_t
Write (const void *buffer, size_t length, lldb::ConnectionStatus &status, Error *error_ptr) = 0;
Write (const void *dst, size_t dst_len, lldb::ConnectionStatus &status, Error *error_ptr) = 0;
//------------------------------------------------------------------
/// Returns a URI that describes this connection object
///
/// Subclasses may override this function.
///
/// @return
/// Returns URI or an empty string if disconnecteds
//------------------------------------------------------------------
virtual std::string
GetURI() = 0;
//------------------------------------------------------------------
/// Interrupts an ongoing Read() operation.
///
/// If there is an ongoing read operation in another thread, this operation
/// return with status == eConnectionStatusInterrupted. Note that if there
/// data waiting to be read and an interrupt request is issued, the Read()
/// function will return the data immediately without processing the
/// interrupt request (which will remain queued for the next Read()
/// operation).
///
/// @return
/// Returns true is the interrupt request was sucessful.
//------------------------------------------------------------------
virtual bool
InterruptRead() = 0;
private:
//------------------------------------------------------------------

View File

@ -56,6 +56,9 @@ class ConnectionMachPort :
lldb::ConnectionStatus &status,
lldb_private::Error *error_ptr);
virtual std::string
GetURI();
lldb::ConnectionStatus
BootstrapCheckIn (const char *port_name,
lldb_private::Error *error_ptr);
@ -83,6 +86,7 @@ class ConnectionMachPort :
mach_port_t m_port;
private:
std::string m_uri;
DISALLOW_COPY_AND_ASSIGN (ConnectionMachPort);

View File

@ -53,6 +53,9 @@ class ConnectionSharedMemory :
virtual size_t
Write (const void *src, size_t src_len, lldb::ConnectionStatus &status, Error *error_ptr);
virtual std::string
GetURI();
lldb::ConnectionStatus
Open (bool create, const char *name, size_t size, Error *error_ptr);

View File

@ -233,7 +233,7 @@ class ConstString
const char *
AsCString(const char *value_if_empty = NULL) const
{
if (m_string == NULL)
if (IsEmpty())
return value_if_empty;
return m_string;
}

View File

@ -0,0 +1,21 @@
//===-- CxaDemangle.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_CxaDemangle_h_
#define liblldb_CxaDemangle_h_
namespace lldb_private
{
char*
__cxa_demangle(const char* mangled_name, char* buf, size_t* n, int* status);
}
#endif

View File

@ -357,7 +357,7 @@ class DataEncoder
/// The number of bytes that this object now contains.
//------------------------------------------------------------------
uint32_t
SetData (const void *bytes, uint32_t length, lldb::ByteOrder byte_order);
SetData (void *bytes, uint32_t length, lldb::ByteOrder byte_order);
//------------------------------------------------------------------
/// Adopt a subset of shared data in \a data_sp.
@ -446,7 +446,7 @@ class DataEncoder
uint8_t *m_end; ///< A pointer to the byte that is past the end of the data.
lldb::ByteOrder m_byte_order; ///< The byte order of the data we are extracting from.
uint8_t m_addr_size; ///< The address size to use when extracting pointers or addresses
mutable lldb::DataBufferSP m_data_sp; ///< The shared pointer to data that can be shared among multilple instances
mutable lldb::DataBufferSP m_data_sp; ///< The shared pointer to data that can be shared among multiple instances
private:
DISALLOW_COPY_AND_ASSIGN (DataEncoder);

View File

@ -234,7 +234,7 @@ class DataExtractor
/// bytes into the contained data, into the stream \a s. \a
/// num_per_line objects will be dumped on each line before a new
/// line will be output. If \a base_addr is a valid address, then
/// each new line of output will be prededed by the address value
/// each new line of output will be preceded by the address value
/// plus appropriate offset, and a colon and space. Bitfield values
/// can be dumped by calling this function multiple times with the
/// same start offset, format and size, yet differing \a
@ -574,7 +574,7 @@ class DataExtractor
GetSharedDataOffset () const;
//------------------------------------------------------------------
/// Get a the data start pointer.
/// Get the data start pointer.
///
/// @return
/// Returns a pointer to the first byte contained in this
@ -908,7 +908,7 @@ class DataExtractor
///
/// @return
/// \a dst if all values were properly extracted and copied,
/// NULL otherise.
/// NULL otherwise.
//------------------------------------------------------------------
void *
GetU8 (lldb::offset_t *offset_ptr, void *dst, uint32_t count) const;
@ -955,7 +955,7 @@ class DataExtractor
///
/// @return
/// \a dst if all values were properly extracted and copied,
/// NULL otherise.
/// NULL otherwise.
//------------------------------------------------------------------
void *
GetU16 (lldb::offset_t *offset_ptr, void *dst, uint32_t count) const;
@ -1002,7 +1002,7 @@ class DataExtractor
///
/// @return
/// \a dst if all values were properly extracted and copied,
/// NULL otherise.
/// NULL otherwise.
//------------------------------------------------------------------
void *
GetU32 (lldb::offset_t *offset_ptr, void *dst, uint32_t count) const;
@ -1049,7 +1049,7 @@ class DataExtractor
///
/// @return
/// \a dst if all values were properly extracted and copied,
/// NULL otherise.
/// NULL otherwise.
//------------------------------------------------------------------
void *
GetU64 ( lldb::offset_t *offset_ptr, void *dst, uint32_t count) const;
@ -1328,7 +1328,7 @@ class DataExtractor
const uint8_t * m_end; ///< A pointer to the byte that is past the end of the data.
lldb::ByteOrder m_byte_order; ///< The byte order of the data we are extracting from.
uint32_t m_addr_size; ///< The address size to use when extracting pointers or addresses
mutable lldb::DataBufferSP m_data_sp; ///< The shared pointer to data that can be shared among multilple instances
mutable lldb::DataBufferSP m_data_sp; ///< The shared pointer to data that can be shared among multiple instances
const uint32_t m_target_byte_size;
};

View File

@ -14,21 +14,16 @@
#include <stdint.h>
#include <stack>
#include "lldb/lldb-public.h"
#include "lldb/Core/Broadcaster.h"
#include "lldb/Core/Communication.h"
#include "lldb/Core/FormatEntity.h"
#include "lldb/Core/IOHandler.h"
#include "lldb/Core/Listener.h"
#include "lldb/Core/SourceManager.h"
#include "lldb/Core/UserID.h"
#include "lldb/Core/UserSettingsController.h"
#include "lldb/DataFormatters/FormatManager.h"
#include "lldb/Host/HostThread.h"
#include "lldb/Host/Terminal.h"
#include "lldb/Interpreter/OptionValueProperties.h"
#include "lldb/Target/ExecutionContext.h"
#include "lldb/Target/Platform.h"
#include "lldb/Target/TargetList.h"
@ -60,10 +55,6 @@ friend class SourceManager; // For GetSourceFileCache.
public:
typedef llvm::sys::DynamicLibrary (*LoadPluginCallbackType) (const lldb::DebuggerSP &debugger_sp,
const FileSpec& spec,
Error& error);
static lldb::DebuggerSP
CreateInstance (lldb::LogOutputCallback log_callback = NULL, void *baton = NULL);
@ -74,10 +65,10 @@ friend class SourceManager; // For GetSourceFileCache.
FindTargetWithProcess (Process *process);
static void
Initialize (LoadPluginCallbackType load_plugin_callback);
Initialize(LoadPluginCallbackType load_plugin_callback);
static void
Terminate ();
static void
Terminate();
static void
SettingsInitialize ();
@ -158,8 +149,6 @@ friend class SourceManager; // For GetSourceFileCache.
// To get the target's source manager, call GetSourceManager on the target instead.
SourceManager &
GetSourceManager ();
public:
lldb::TargetSP
GetSelectedTarget ()
@ -221,14 +210,17 @@ friend class SourceManager; // For GetSourceFileCache.
bool
IsTopIOHandler (const lldb::IOHandlerSP& reader_sp);
void
PrintAsync (const char *s, size_t len, bool is_stdout);
ConstString
GetTopIOHandlerControlSequence(char ch);
bool
HideTopIOHandler();
const char *
GetIOHandlerCommandPrefix();
void
RefreshTopIOHandler();
const char *
GetIOHandlerHelpPrologue();
static lldb::DebuggerSP
FindDebuggerWithID (lldb::user_id_t id);
@ -243,15 +235,7 @@ friend class SourceManager; // For GetSourceFileCache.
GetDebuggerAtIndex (size_t index);
static bool
FormatPrompt (const char *format,
const SymbolContext *sc,
const ExecutionContext *exe_ctx,
const Address *addr,
Stream &s,
ValueObject* valobj = NULL);
static bool
FormatDisassemblerAddress (const char *format,
FormatDisassemblerAddress (const FormatEntity::Entry *format,
const SymbolContext *sc,
const SymbolContext *prev_sc,
const ExecutionContext *exe_ctx,
@ -261,9 +245,6 @@ friend class SourceManager; // For GetSourceFileCache.
void
ClearIOHandlers ();
static int
TestDebuggerRefCount ();
bool
GetCloseInputOnEOF () const;
@ -296,13 +277,13 @@ friend class SourceManager; // For GetSourceFileCache.
bool
GetAutoConfirm () const;
const char *
const FormatEntity::Entry *
GetDisassemblyFormat() const;
const char *
const FormatEntity::Entry *
GetFrameFormat() const;
const char *
const FormatEntity::Entry *
GetThreadFormat() const;
lldb::ScriptLanguage
@ -352,7 +333,6 @@ friend class SourceManager; // For GetSourceFileCache.
bool
GetNotifyVoid () const;
const ConstString &
GetInstanceName()
@ -364,7 +344,7 @@ friend class SourceManager; // For GetSourceFileCache.
LoadPlugin (const FileSpec& spec, Error& error);
void
ExecuteIOHanders();
ExecuteIOHandlers();
bool
IsForwardingEvents ();

View File

@ -117,9 +117,15 @@ class Instruction
/// the InstructionList.
/// Only needed if show_address is true.
///
/// @param[in] disassembly_addr_format_spec
/// @param[in] disassembly_addr_format
/// The format specification for how addresses are printed.
/// Only needed if show_address is true.
///
/// @param[in] max_address_text_size
/// The length of the longest address string at the start of the
/// disassembly line that will be printed (the Debugger::FormatDisassemblerAddress() string)
/// so this method can properly align the instruction opcodes.
/// May be 0 to indicate no indentation/alignment of the opcodes.
//------------------------------------------------------------------
virtual void
@ -130,7 +136,8 @@ class Instruction
const ExecutionContext* exe_ctx,
const SymbolContext *sym_ctx,
const SymbolContext *prev_sym_ctx,
const char *disassembly_addr_format_spec);
const FormatEntity::Entry *disassembly_addr_format,
size_t max_address_text_size);
virtual bool
DoesBranch () = 0;
@ -218,7 +225,7 @@ class InstructionList
GetInstructionAtIndex (size_t idx) const;
uint32_t
GetIndexOfNextBranchInstruction(uint32_t start) const;
GetIndexOfNextBranchInstruction(uint32_t start, Target &target) const;
uint32_t
GetIndexOfInstructionAtLoadAddress (lldb::addr_t load_addr, Target &target);
@ -457,7 +464,7 @@ class Disassembler :
//------------------------------------------------------------------
// Classes that inherit from Disassembler can see and modify these
//------------------------------------------------------------------
const ArchSpec m_arch;
ArchSpec m_arch;
InstructionList m_instruction_list;
lldb::addr_t m_base_addr;
std::string m_flavor;

View File

@ -0,0 +1,24 @@
//===-- FastDemangle.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_FastDemangle_h_
#define liblldb_FastDemangle_h_
namespace lldb_private
{
char *
FastDemangle(const char *mangled_name);
char *
FastDemangle(const char *mangled_name, long mangled_name_length);
}
#endif

View File

@ -0,0 +1,263 @@
//===-- FormatEntity.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_FormatEntity_h_
#define liblldb_FormatEntity_h_
#if defined(__cplusplus)
#include <string>
#include <vector>
#include "lldb/lldb-private.h"
#include "lldb/Core/Error.h"
namespace llvm
{
class StringRef;
}
namespace lldb_private
{
class FormatEntity
{
public:
struct Entry
{
enum class Type {
Invalid,
ParentNumber,
ParentString,
InsertString,
Root,
String,
Scope,
Variable,
VariableSynthetic,
ScriptVariable,
ScriptVariableSynthetic,
AddressLoad,
AddressFile,
AddressLoadOrFile,
ProcessID,
ProcessFile,
ScriptProcess,
ThreadID,
ThreadProtocolID,
ThreadIndexID,
ThreadName,
ThreadQueue,
ThreadStopReason,
ThreadReturnValue,
ThreadCompletedExpression,
ScriptThread,
ThreadInfo,
TargetArch,
ScriptTarget,
ModuleFile,
File,
Lang,
FrameIndex,
FrameRegisterPC,
FrameRegisterSP,
FrameRegisterFP,
FrameRegisterFlags,
FrameRegisterByName,
ScriptFrame,
FunctionID,
FunctionDidChange,
FunctionInitialFunction,
FunctionName,
FunctionNameWithArgs,
FunctionNameNoArgs,
FunctionAddrOffset,
FunctionAddrOffsetConcrete,
FunctionLineOffset,
FunctionPCOffset,
FunctionInitial,
FunctionChanged,
LineEntryFile,
LineEntryLineNumber,
LineEntryStartAddress,
LineEntryEndAddress,
CurrentPCArrow
};
enum FormatType
{
None,
UInt32,
UInt64,
CString
};
struct Definition
{
const char *name;
const char *string; // Insert this exact string into the output
Entry::Type type;
FormatType format_type; // uint32_t, uint64_t, cstr, or anything that can be formatted by printf or lldb::Format
uint64_t data;
uint32_t num_children;
Definition *children; // An array of "num_children" Definition entries,
bool keep_separator;
};
Entry (Type t = Type::Invalid,
const char *s = NULL,
const char *f = NULL) :
string (s ? s : ""),
printf_format (f ? f : ""),
children (),
definition (NULL),
type (t),
fmt (lldb::eFormatDefault),
number (0),
deref (false)
{
}
Entry (llvm::StringRef s);
Entry (char ch);
void
AppendChar (char ch);
void
AppendText (const llvm::StringRef &s);
void
AppendText (const char *cstr);
void
AppendEntry (const Entry &&entry)
{
children.push_back(entry);
}
void
Clear ()
{
string.clear();
printf_format.clear();
children.clear();
definition = NULL;
type = Type::Invalid;
fmt = lldb::eFormatDefault;
number = 0;
deref = false;
}
static const char *
TypeToCString (Type t);
void
Dump (Stream &s, int depth = 0) const;
bool
operator == (const Entry &rhs) const
{
if (string != rhs.string)
return false;
if (printf_format != rhs.printf_format)
return false;
const size_t n = children.size();
const size_t m = rhs.children.size();
for (size_t i=0; i < std::min<size_t>(n, m); ++i)
{
if (!(children[i] == rhs.children[i]))
return false;
}
if (children != rhs.children)
return false;
if (definition != rhs.definition)
return false;
if (type != rhs.type)
return false;
if (fmt != rhs.fmt)
return false;
if (deref != rhs.deref)
return false;
return true;
}
std::string string;
std::string printf_format;
std::vector<Entry> children;
Definition *definition;
Type type;
lldb::Format fmt;
lldb::addr_t number;
bool deref;
};
static bool
Format (const Entry &entry,
Stream &s,
const SymbolContext *sc,
const ExecutionContext *exe_ctx,
const Address *addr,
ValueObject* valobj,
bool function_changed,
bool initial_function);
static bool
FormatStringRef (const llvm::StringRef &format,
Stream &s,
const SymbolContext *sc,
const ExecutionContext *exe_ctx,
const Address *addr,
ValueObject* valobj,
bool function_changed,
bool initial_function);
static bool
FormatCString (const char *format,
Stream &s,
const SymbolContext *sc,
const ExecutionContext *exe_ctx,
const Address *addr,
ValueObject* valobj,
bool function_changed,
bool initial_function);
static Error
Parse (const llvm::StringRef &format, Entry &entry);
static Error
ExtractVariableInfo (llvm::StringRef &format_str,
llvm::StringRef &variable_name,
llvm::StringRef &variable_format);
static size_t
AutoComplete (const char *s,
int match_start_point,
int max_return_elements,
bool &word_complete,
StringList &matches);
//----------------------------------------------------------------------
// Format the current elements into the stream \a s.
//
// The root element will be stripped off and the format str passed in
// will be either an empty string (print a description of this object),
// or contain a . separated series like a domain name that identifies
// further sub elements to display.
//----------------------------------------------------------------------
static bool
FormatFileSpec (const FileSpec &file, Stream &s, llvm::StringRef elements, llvm::StringRef element_format);
protected:
static Error
ParseInternal (llvm::StringRef &format, Entry &parent_entry, uint32_t depth);
};
}
#endif // #if defined(__cplusplus)
#endif // liblldb_FormatEntity_h_

View File

@ -67,18 +67,6 @@ namespace lldb_private {
virtual void
Run () = 0;
// Hide any characters that have been displayed so far so async
// output can be displayed. Refresh() will be called after the
// output has been displayed.
virtual void
Hide () = 0;
// Called when the async output has been received in order to update
// the input reader (refresh the prompt and redisplay any current
// line(s) that are being edited
virtual void
Refresh () = 0;
// Called when an input reader should relinquish its control so another
// can be pushed onto the IO handler stack, or so the current IO
// handler can pop itself off the stack
@ -246,7 +234,14 @@ namespace lldb_private {
void
WaitForPop ();
virtual void
PrintAsync (Stream *stream, const char *s, size_t len)
{
stream->Write (s, len);
stream->Flush();
}
protected:
Debugger &m_debugger;
lldb::StreamFileSP m_input_sp;
@ -318,7 +313,7 @@ namespace lldb_private {
}
//------------------------------------------------------------------
/// Called when a new line is created or one of an identifed set of
/// Called when a new line is created or one of an identified set of
/// indentation characters is typed.
///
/// This function determines how much indentation should be added
@ -332,7 +327,7 @@ namespace lldb_private {
/// following the line containing the cursor are not included.
///
/// @param[in] cursor_position
/// The number of characters preceeding the cursor on the final
/// The number of characters preceding the cursor on the final
/// line at the time.
///
/// @return
@ -448,17 +443,17 @@ namespace lldb_private {
{
}
virtual ConstString
IOHandlerGetControlSequence (char ch)
ConstString
IOHandlerGetControlSequence (char ch) override
{
if (ch == 'd')
return ConstString (m_end_line + "\n");
return ConstString();
}
virtual bool
bool
IOHandlerIsInputComplete (IOHandler &io_handler,
StringList &lines)
StringList &lines) override
{
// Determine whether the end of input signal has been entered
const size_t num_lines = lines.GetSize();
@ -507,53 +502,47 @@ namespace lldb_private {
virtual
~IOHandlerEditline ();
virtual void
Run ();
void
Run () override;
virtual void
Hide ();
void
Cancel () override;
virtual void
Refresh ();
virtual void
Cancel ();
virtual bool
Interrupt ();
bool
Interrupt () override;
virtual void
GotEOF();
void
GotEOF() override;
virtual void
Activate ();
void
Activate () override;
virtual void
Deactivate ();
void
Deactivate () override;
virtual ConstString
GetControlSequence (char ch)
ConstString
GetControlSequence (char ch) override
{
return m_delegate.IOHandlerGetControlSequence (ch);
}
virtual const char *
GetCommandPrefix ()
const char *
GetCommandPrefix () override
{
return m_delegate.IOHandlerGetCommandPrefix ();
}
virtual const char *
GetHelpPrologue ()
const char *
GetHelpPrologue () override
{
return m_delegate.IOHandlerGetHelpPrologue ();
}
virtual const char *
GetPrompt ();
const char *
GetPrompt () override;
virtual bool
SetPrompt (const char *prompt);
bool
SetPrompt (const char *prompt) override;
const char *
GetContinuationPrompt ();
@ -591,6 +580,9 @@ namespace lldb_private {
uint32_t
GetCurrentLineIndex () const;
void
PrintAsync (Stream *stream, const char *s, size_t len) override;
private:
#ifndef LLDB_DISABLE_LIBEDIT
static bool
@ -626,6 +618,7 @@ namespace lldb_private {
bool m_multi_line;
bool m_color_prompts;
bool m_interrupt_exits;
bool m_editing; // Set to true when fetching a line manually (not using libedit)
};
// The order of base classes is important. Look at the constructor of IOHandlerConfirm
@ -648,17 +641,17 @@ namespace lldb_private {
return m_user_response;
}
virtual int
int
IOHandlerComplete (IOHandler &io_handler,
const char *current_line,
const char *cursor,
const char *last_char,
int skip_first_n_matches,
int max_matches,
StringList &matches);
StringList &matches) override;
virtual void
IOHandlerInputComplete (IOHandler &io_handler, std::string &data);
void
IOHandlerInputComplete (IOHandler &io_handler, std::string &data) override;
protected:
const bool m_default_response;
@ -671,32 +664,25 @@ namespace lldb_private {
public:
IOHandlerCursesGUI (Debugger &debugger);
virtual
~IOHandlerCursesGUI ();
~IOHandlerCursesGUI () override;
virtual void
Run ();
void
Run () override;
virtual void
Hide ();
virtual void
Refresh ();
void
Cancel () override;
virtual void
Cancel ();
virtual bool
Interrupt ();
bool
Interrupt () override;
virtual void
GotEOF();
void
GotEOF() override;
virtual void
Activate ();
void
Activate () override;
virtual void
Deactivate ();
void
Deactivate () override;
protected:
curses::ApplicationAP m_app_ap;
@ -711,20 +697,11 @@ namespace lldb_private {
virtual
~IOHandlerCursesValueObjectList ();
virtual void
Run ();
void
Run () override;
virtual void
Hide ();
virtual void
Refresh ();
virtual bool
HandleInterrupt ();
virtual void
GotEOF();
void
GotEOF() override;
protected:
ValueObjectList m_valobj_list;
};
@ -849,7 +826,10 @@ namespace lldb_private {
return NULL;
}
protected:
void
PrintAsync (Stream *stream, const char *s, size_t len);
protected:
typedef std::vector<lldb::IOHandlerSP> collection;
collection m_stack;

View File

@ -22,19 +22,9 @@
#include "lldb/lldb-private.h"
#include "lldb/Core/ConstString.h"
#include "lldb/Core/Flags.h"
#include "lldb/Core/Logging.h"
#include "lldb/Core/PluginInterface.h"
//----------------------------------------------------------------------
// Logging types
//----------------------------------------------------------------------
#define LLDB_LOG_FLAG_STDOUT (1u << 0)
#define LLDB_LOG_FLAG_STDERR (1u << 1)
#define LLDB_LOG_FLAG_FATAL (1u << 2)
#define LLDB_LOG_FLAG_ERROR (1u << 3)
#define LLDB_LOG_FLAG_WARNING (1u << 4)
#define LLDB_LOG_FLAG_DEBUG (1u << 5)
#define LLDB_LOG_FLAG_VERBOSE (1u << 6)
//----------------------------------------------------------------------
// Logging Options
//----------------------------------------------------------------------
@ -46,6 +36,7 @@
#define LLDB_LOG_OPTION_PREPEND_PROC_AND_THREAD (1u << 5)
#define LLDB_LOG_OPTION_PREPEND_THREAD_NAME (1U << 6)
#define LLDB_LOG_OPTION_BACKTRACE (1U << 7)
#define LLDB_LOG_OPTION_APPEND (1U << 8)
//----------------------------------------------------------------------
// Logging Functions
@ -59,12 +50,10 @@ class Log
//------------------------------------------------------------------
// Callback definitions for abstracted plug-in log access.
//------------------------------------------------------------------
typedef void (*DisableCallback) (const char **categories, Stream *feedback_strm);
typedef Log * (*EnableCallback) (lldb::StreamSP &log_stream_sp,
uint32_t log_options,
const char **categories,
Stream *feedback_strm);
typedef void (*ListCategoriesCallback) (Stream *strm);
typedef void (*DisableCallback)(const char **categories, Stream *feedback_strm);
typedef Log *(*EnableCallback)(lldb::StreamSP &log_stream_sp, uint32_t log_options, const char **categories,
Stream *feedback_strm);
typedef void (*ListCategoriesCallback)(Stream *strm);
struct Callbacks
{
@ -77,86 +66,85 @@ class Log
// Static accessors for logging channels
//------------------------------------------------------------------
static void
RegisterLogChannel (const ConstString &channel,
const Log::Callbacks &log_callbacks);
RegisterLogChannel(const ConstString &channel, const Log::Callbacks &log_callbacks);
static bool
UnregisterLogChannel (const ConstString &channel);
UnregisterLogChannel(const ConstString &channel);
static bool
GetLogChannelCallbacks (const ConstString &channel,
Log::Callbacks &log_callbacks);
GetLogChannelCallbacks(const ConstString &channel, Log::Callbacks &log_callbacks);
static bool
EnableLogChannel(lldb::StreamSP &log_stream_sp, uint32_t log_options, const char *channel,
const char **categories, Stream &error_stream);
static void
EnableAllLogChannels (lldb::StreamSP &log_stream_sp,
uint32_t log_options,
const char **categories,
Stream *feedback_strm);
EnableAllLogChannels(lldb::StreamSP &log_stream_sp, uint32_t log_options, const char **categories,
Stream *feedback_strm);
static void
DisableAllLogChannels (Stream *feedback_strm);
DisableAllLogChannels(Stream *feedback_strm);
static void
ListAllLogChannels (Stream *strm);
ListAllLogChannels(Stream *strm);
static void
Initialize ();
Initialize();
static void
Terminate ();
Terminate();
//------------------------------------------------------------------
// Auto completion
//------------------------------------------------------------------
static void
AutoCompleteChannelName (const char *channel_name,
StringList &matches);
AutoCompleteChannelName(const char *channel_name, StringList &matches);
//------------------------------------------------------------------
// Member functions
//------------------------------------------------------------------
Log ();
Log();
Log (const lldb::StreamSP &stream_sp);
Log(const lldb::StreamSP &stream_sp);
~Log ();
virtual
~Log();
void
PutCString (const char *cstr);
virtual void
PutCString(const char *cstr);
void
Printf (const char *format, ...) __attribute__ ((format (printf, 2, 3)));
virtual void
Printf(const char *format, ...) __attribute__((format(printf, 2, 3)));
void
VAPrintf (const char *format, va_list args);
virtual void
VAPrintf(const char *format, va_list args);
void
PrintfWithFlags( uint32_t flags, const char *format, ...) __attribute__ ((format (printf, 3, 4)));
virtual void
LogIf(uint32_t mask, const char *fmt, ...) __attribute__((format(printf, 3, 4)));
void
LogIf (uint32_t mask, const char *fmt, ...) __attribute__ ((format (printf, 3, 4)));
virtual void
Debug(const char *fmt, ...) __attribute__((format(printf, 2, 3)));
void
Debug (const char *fmt, ...) __attribute__ ((format (printf, 2, 3)));
virtual void
DebugVerbose(const char *fmt, ...) __attribute__((format(printf, 2, 3)));
void
DebugVerbose (const char *fmt, ...) __attribute__ ((format (printf, 2, 3)));
virtual void
Error(const char *fmt, ...) __attribute__((format(printf, 2, 3)));
void
Error (const char *fmt, ...) __attribute__ ((format (printf, 2, 3)));
virtual void
VAError(const char *format, va_list args);
void
FatalError (int err, const char *fmt, ...) __attribute__ ((format (printf, 3, 4)));
virtual void
FatalError(int err, const char *fmt, ...) __attribute__((format(printf, 3, 4)));
void
Verbose (const char *fmt, ...) __attribute__ ((format (printf, 2, 3)));
virtual void
Verbose(const char *fmt, ...) __attribute__((format(printf, 2, 3)));
void
Warning (const char *fmt, ...) __attribute__ ((format (printf, 2, 3)));
virtual void
Warning(const char *fmt, ...) __attribute__((format(printf, 2, 3)));
void
WarningVerbose (const char *fmt, ...) __attribute__ ((format (printf, 2, 3)));
virtual void
WarningVerbose(const char *fmt, ...) __attribute__((format(printf, 2, 3)));
Flags &
GetOptions();
@ -177,7 +165,7 @@ class Log
GetDebug() const;
void
SetStream (const lldb::StreamSP &stream_sp)
SetStream(const lldb::StreamSP &stream_sp)
{
m_stream_sp = stream_sp;
}
@ -190,43 +178,35 @@ class Log
Flags m_options;
Flags m_mask_bits;
void
PrintfWithFlagsVarArg (uint32_t flags, const char *format, va_list args);
private:
DISALLOW_COPY_AND_ASSIGN (Log);
DISALLOW_COPY_AND_ASSIGN(Log);
};
class LogChannel : public PluginInterface
{
public:
LogChannel ();
LogChannel();
virtual
~LogChannel ();
virtual ~LogChannel();
static lldb::LogChannelSP
FindPlugin (const char *plugin_name);
static lldb::LogChannelSP FindPlugin(const char *plugin_name);
// categories is a an array of chars that ends with a NULL element.
virtual void
Disable (const char **categories, Stream *feedback_strm) = 0;
virtual void Disable(const char **categories, Stream *feedback_strm) = 0;
virtual bool
Enable (lldb::StreamSP &log_stream_sp,
uint32_t log_options,
Stream *feedback_strm, // Feedback stream for argument errors etc
const char **categories) = 0;// The categories to enable within this logging stream, if empty, enable default set
virtual bool Enable(
lldb::StreamSP &log_stream_sp, uint32_t log_options,
Stream *feedback_strm, // Feedback stream for argument errors etc
const char **categories) = 0; // The categories to enable within this logging stream, if empty, enable default set
virtual void
ListCategories (Stream *strm) = 0;
virtual void ListCategories(Stream *strm) = 0;
protected:
std::unique_ptr<Log> m_log_ap;
private:
DISALLOW_COPY_AND_ASSIGN (LogChannel);
DISALLOW_COPY_AND_ASSIGN(LogChannel);
};

View File

@ -1,4 +1,4 @@
//===-- lldb-private-log.h --------------------------------------*- C++ -*-===//
//===-- Logging.h -----------------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
@ -7,8 +7,8 @@
//
//===----------------------------------------------------------------------===//
#ifndef liblldb_lldb_private_log_h_
#define liblldb_lldb_private_log_h_
#ifndef liblldb_Core_Logging_h_
#define liblldb_Core_Logging_h_
// C Includes
// C++ Includes
@ -47,6 +47,7 @@
#define LIBLLDB_LOG_PLATFORM (1u << 25)
#define LIBLLDB_LOG_SYSTEM_RUNTIME (1u << 26)
#define LIBLLDB_LOG_JIT_LOADER (1u << 27)
#define LIBLLDB_LOG_LANGUAGE (1u << 28)
#define LIBLLDB_LOG_ALL (UINT32_MAX)
#define LIBLLDB_LOG_DEFAULT (LIBLLDB_LOG_PROCESS |\
LIBLLDB_LOG_THREAD |\
@ -90,4 +91,4 @@ ListLogCategories (Stream *strm);
} // namespace lldb_private
#endif // liblldb_lldb_private_log_h_
#endif // liblldb_Core_Logging_h_

View File

@ -41,6 +41,13 @@ class Mangled
ePreferDemangledWithoutArguments
};
enum ManglingScheme
{
eManglingSchemeNone = 0,
eManglingSchemeMSVC,
eManglingSchemeItanium
};
//----------------------------------------------------------------------
/// Default constructor.
///
@ -290,6 +297,25 @@ class Mangled
void
SetValue (const ConstString &name);
//----------------------------------------------------------------------
/// Try to guess the language from the mangling.
///
/// For a mangled name to have a language it must have both a mangled
/// and a demangled name and it can be guessed from the mangling what
/// the language is. Note: this will return C++ for any language that
/// uses Itanium ABI mangling.
///
/// Standard C function names will return eLanguageTypeUnknown because
/// they aren't mangled and it isn't clear what language the name
/// represents (there will be no mangled name).
///
/// @return
/// The language for the mangled/demangled name, eLanguageTypeUnknown
/// if there is no mangled or demangled counterpart.
//----------------------------------------------------------------------
lldb::LanguageType
GuessLanguage () const;
private:
//----------------------------------------------------------------------
/// Mangled member variables.

View File

@ -10,12 +10,12 @@
#ifndef liblldb_Module_h_
#define liblldb_Module_h_
#include "lldb/lldb-forward.h"
#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/UUID.h"
#include "lldb/Host/FileSpec.h"
#include "lldb/Host/Mutex.h"
#include "lldb/Host/TimeValue.h"
#include "lldb/Symbol/ClangASTContext.h"
#include "lldb/Symbol/SymbolContextScope.h"
#include "lldb/Target/PathMappingList.h"
@ -941,17 +941,8 @@ class Module :
const ConstString &object_name);
bool
GetIsDynamicLinkEditor () const
{
return m_is_dynamic_loader_module;
}
void
SetIsDynamicLinkEditor (bool b)
{
m_is_dynamic_loader_module = b;
}
GetIsDynamicLinkEditor ();
ClangASTContext &
GetClangASTContext ();
@ -1107,7 +1098,7 @@ class Module :
mutable Mutex m_mutex; ///< A mutex to keep this object happy in multi-threaded environments.
TimeValue m_mod_time; ///< The modification time for this module when it was created.
ArchSpec m_arch; ///< The architecture for this module.
lldb_private::UUID m_uuid; ///< Each module is assumed to have a unique identifier to help match it up to debug symbols.
UUID m_uuid; ///< Each module is assumed to have a unique identifier to help match it up to debug symbols.
FileSpec m_file; ///< The file representation on disk for this module (if there is one).
FileSpec m_platform_file;///< The path to the module on the platform on which it is being debugged
FileSpec m_remote_install_file; ///< If set when debugging on remote platforms, this module will be installed at this location
@ -1116,16 +1107,17 @@ class Module :
uint64_t m_object_offset;
TimeValue m_object_mod_time;
lldb::ObjectFileSP m_objfile_sp; ///< A shared pointer to the object file parser for this module as it may or may not be shared with the SymbolFile
std::unique_ptr<SymbolVendor> m_symfile_ap; ///< A pointer to the symbol vendor for this module.
ClangASTContext m_ast; ///< The AST context for this module.
lldb::SymbolVendorUP m_symfile_ap; ///< A pointer to the symbol vendor for this module.
std::vector<lldb::SymbolVendorUP> m_old_symfiles; ///< If anyone calls Module::SetSymbolFileFileSpec() and changes the symbol file,
///< we need to keep all old symbol files around in case anyone has type references to them
lldb::ClangASTContextUP m_ast; ///< The AST context for this module.
PathMappingList m_source_mappings; ///< Module specific source remappings for when you have debug info for a module that doesn't match where the sources currently are
std::unique_ptr<lldb_private::SectionList> m_sections_ap; ///< Unified section list for module that is used by the ObjectFile and and ObjectFile instances for the debug info
lldb::SectionListUP m_sections_ap; ///< Unified section list for module that is used by the ObjectFile and and ObjectFile instances for the debug info
bool m_did_load_objfile:1,
m_did_load_symbol_vendor:1,
m_did_parse_uuid:1,
m_did_init_ast:1,
m_is_dynamic_loader_module:1;
m_did_init_ast:1;
mutable bool m_file_has_changed:1,
m_first_file_changed_log:1; /// See if the module was modified after it was initially opened.

View File

@ -12,6 +12,7 @@
#include <vector>
#include <list>
#include <functional>
#include "lldb/lldb-private.h"
#include "lldb/Host/Mutex.h"
@ -562,6 +563,9 @@ class ModuleList
static bool
RemoveSharedModuleIfOrphaned (const Module *module_ptr);
void
ForEach (std::function <bool (const lldb::ModuleSP &module_sp)> const &callback) const;
protected:
//------------------------------------------------------------------
// Class typedefs.

View File

@ -14,6 +14,7 @@
#include "lldb/Core/Stream.h"
#include "lldb/Core/UUID.h"
#include "lldb/Host/FileSpec.h"
#include "lldb/Host/Mutex.h"
#include "lldb/Target/PathMappingList.h"
namespace lldb_private {
@ -29,6 +30,7 @@ class ModuleSpec
m_uuid (),
m_object_name (),
m_object_offset (0),
m_object_size (0),
m_object_mod_time (),
m_source_mappings ()
{
@ -42,6 +44,7 @@ class ModuleSpec
m_uuid (),
m_object_name (),
m_object_offset (0),
m_object_size (file_spec.GetByteSize ()),
m_object_mod_time (),
m_source_mappings ()
{
@ -55,6 +58,7 @@ class ModuleSpec
m_uuid (),
m_object_name (),
m_object_offset (0),
m_object_size (file_spec.GetByteSize ()),
m_object_mod_time (),
m_source_mappings ()
{
@ -68,6 +72,7 @@ class ModuleSpec
m_uuid (rhs.m_uuid),
m_object_name (rhs.m_object_name),
m_object_offset (rhs.m_object_offset),
m_object_size (rhs.m_object_size),
m_object_mod_time (rhs.m_object_mod_time),
m_source_mappings (rhs.m_source_mappings)
{
@ -85,6 +90,7 @@ class ModuleSpec
m_uuid = rhs.m_uuid;
m_object_name = rhs.m_object_name;
m_object_offset = rhs.m_object_offset;
m_object_size = rhs.m_object_size;
m_object_mod_time = rhs.m_object_mod_time;
m_source_mappings = rhs.m_source_mappings;
}
@ -254,7 +260,19 @@ class ModuleSpec
{
m_object_offset = object_offset;
}
uint64_t
GetObjectSize () const
{
return m_object_size;
}
void
SetObjectSize (uint64_t object_size)
{
m_object_size = object_size;
}
TimeValue &
GetObjectModificationTime ()
{
@ -283,6 +301,7 @@ class ModuleSpec
m_uuid.Clear();
m_object_name.Clear();
m_object_offset = 0;
m_object_size = 0;
m_source_mappings.Clear(false);
m_object_mod_time.Clear();
}
@ -302,6 +321,8 @@ class ModuleSpec
return true;
if (m_object_name)
return true;
if (m_object_size)
return true;
if (m_object_mod_time.IsValid())
return true;
return false;
@ -362,7 +383,14 @@ class ModuleSpec
{
if (dumped_something)
strm.PutCString(", ");
strm.Printf("object_offset = 0x%" PRIx64, m_object_offset);
strm.Printf("object_offset = %" PRIu64, m_object_offset);
dumped_something = true;
}
if (m_object_size > 0)
{
if (dumped_something)
strm.PutCString(", ");
strm.Printf("object size = %" PRIu64, m_object_size);
dumped_something = true;
}
if (m_object_mod_time.IsValid())
@ -425,6 +453,7 @@ class ModuleSpec
UUID m_uuid;
ConstString m_object_name;
uint64_t m_object_offset;
uint64_t m_object_size;
TimeValue m_object_mod_time;
mutable PathMappingList m_source_mappings;
};

View File

@ -137,7 +137,8 @@ class PluginManager
static bool
RegisterPlugin (const ConstString &name,
const char *description,
LanguageRuntimeCreateInstance create_callback);
LanguageRuntimeCreateInstance create_callback,
LanguageRuntimeGetCommandObject command_callback = nullptr);
static bool
UnregisterPlugin (LanguageRuntimeCreateInstance create_callback);
@ -145,6 +146,9 @@ class PluginManager
static LanguageRuntimeCreateInstance
GetLanguageRuntimeCreateCallbackAtIndex (uint32_t idx);
static LanguageRuntimeGetCommandObject
GetLanguageRuntimeGetCommandObjectAtIndex (uint32_t idx);
static LanguageRuntimeCreateInstance
GetLanguageRuntimeCreateCallbackForPluginName (const ConstString &name);

View File

@ -128,9 +128,10 @@ namespace lldb_private {
{
return Contains(range.GetRangeBase()) && ContainsEndInclusive(range.GetRangeEnd());
}
// Returns true if the two ranges adjoing or intersect
bool
Overlap (const Range &rhs) const
DoesAdjoinOrIntersect (const Range &rhs) const
{
const BaseType lhs_base = this->GetRangeBase();
const BaseType rhs_base = rhs.GetRangeBase();
@ -139,7 +140,19 @@ namespace lldb_private {
bool result = (lhs_base <= rhs_end) && (lhs_end >= rhs_base);
return result;
}
// Returns true if the two ranges intersect
bool
DoesIntersect (const Range &rhs) const
{
const BaseType lhs_base = this->GetRangeBase();
const BaseType rhs_base = rhs.GetRangeBase();
const BaseType lhs_end = this->GetRangeEnd();
const BaseType rhs_end = rhs.GetRangeEnd();
bool result = (lhs_base < rhs_end) && (lhs_end > rhs_base);
return result;
}
bool
operator < (const Range &rhs) const
{
@ -241,7 +254,7 @@ namespace lldb_private {
// don't end up allocating and making a new collection for no reason
for (pos = m_entries.begin(), end = m_entries.end(), prev = end; pos != end; prev = pos++)
{
if (prev != end && prev->Overlap(*pos))
if (prev != end && prev->DoesAdjoinOrIntersect(*pos))
{
can_combine = true;
break;
@ -255,7 +268,7 @@ namespace lldb_private {
Collection minimal_ranges;
for (pos = m_entries.begin(), end = m_entries.end(), prev = end; pos != end; prev = pos++)
{
if (prev != end && prev->Overlap(*pos))
if (prev != end && prev->DoesAdjoinOrIntersect(*pos))
minimal_ranges.back().SetRangeEnd (std::max<BaseType>(prev->GetRangeEnd(), pos->GetRangeEnd()));
else
minimal_ranges.push_back (*pos);
@ -521,7 +534,7 @@ namespace lldb_private {
// don't end up allocating and making a new collection for no reason
for (pos = m_entries.begin(), end = m_entries.end(), prev = end; pos != end; prev = pos++)
{
if (prev != end && prev->Overlap(*pos))
if (prev != end && prev->DoesAdjoinOrIntersect(*pos))
{
can_combine = true;
break;
@ -535,7 +548,7 @@ namespace lldb_private {
Collection minimal_ranges;
for (pos = m_entries.begin(), end = m_entries.end(), prev = end; pos != end; prev = pos++)
{
if (prev != end && prev->Overlap(*pos))
if (prev != end && prev->DoesAdjoinOrIntersect(*pos))
minimal_ranges.back().SetRangeEnd (std::max<BaseType>(prev->GetRangeEnd(), pos->GetRangeEnd()));
else
minimal_ranges.push_back (*pos);

View File

@ -121,23 +121,6 @@ class RegularExpression
//------------------------------------------------------------------
RegularExpression ();
//------------------------------------------------------------------
/// Constructor that takes a regular expression with flags.
///
/// Constructor that compiles \a re using \a flags and stores the
/// resulting compiled regular expression into this object.
///
/// @param[in] re
/// A c string that represents the regular expression to
/// compile.
///
/// @param[in] flags
/// Flags that are passed to the \c regcomp() function.
//------------------------------------------------------------------
explicit
RegularExpression (const char* re, int flags);
// This one uses flags = REG_EXTENDED.
explicit
RegularExpression (const char* re);
@ -157,7 +140,7 @@ class RegularExpression
/// Compile a regular expression.
///
/// Compile a regular expression using the supplied regular
/// expression text and flags. The compiled regular expression lives
/// expression text. The compiled regular expression lives
/// in this object so that it can be readily used for regular
/// expression matches. Execute() can be called after the regular
/// expression is compiled. Any previously compiled regular
@ -167,9 +150,6 @@ class RegularExpression
/// A NULL terminated C string that represents the regular
/// expression to compile.
///
/// @param[in] flags
/// Flags that are passed to the \c regcomp() function.
///
/// @return
/// \b true if the regular expression compiles successfully,
/// \b false otherwise.
@ -177,9 +157,6 @@ class RegularExpression
bool
Compile (const char* re);
bool
Compile (const char* re, int flags);
//------------------------------------------------------------------
/// Executes a regular expression.
///
@ -187,8 +164,7 @@ class RegularExpression
/// expression that is already in this object against the match
/// string \a s. If any parens are used for regular expression
/// matches \a match_count should indicate the number of regmatch_t
/// values that are present in \a match_ptr. The regular expression
/// will be executed using the \a execute_flags
/// values that are present in \a match_ptr.
///
/// @param[in] string
/// The string to match against the compile regular expression.
@ -198,15 +174,12 @@ class RegularExpression
/// properly initialized with the desired number of maximum
/// matches, or NULL if no parenthesized matching is needed.
///
/// @param[in] execute_flags
/// Flags to pass to the \c regexec() function.
///
/// @return
/// \b true if \a string matches the compiled regular
/// expression, \b false otherwise.
//------------------------------------------------------------------
bool
Execute (const char* string, Match *match = NULL, int execute_flags = 0) const;
Execute (const char* string, Match *match = NULL) const;
size_t
GetErrorAsCString (char *err_str, size_t err_str_max_len) const;
@ -233,12 +206,6 @@ class RegularExpression
const char*
GetText () const;
int
GetCompileFlags () const
{
return m_compile_flags;
}
//------------------------------------------------------------------
/// Test if valid.
///
@ -256,7 +223,6 @@ class RegularExpression
{
Free();
m_re.clear();
m_compile_flags = 0;
m_comp_err = 1;
}
@ -276,7 +242,6 @@ class RegularExpression
std::string m_re; ///< A copy of the original regular expression text
int m_comp_err; ///< Error code for the regular expression compilation
regex_t m_preg; ///< The compiled regular expression
int m_compile_flags; ///< Stores the flags from the last compile.
};
} // namespace lldb_private

View File

@ -20,7 +20,7 @@ class StreamAsynchronousIO :
public Stream
{
public:
StreamAsynchronousIO (Broadcaster &broadcaster, uint32_t broadcast_event_type);
StreamAsynchronousIO (Debugger &debugger, bool for_stdout);
virtual ~StreamAsynchronousIO ();
@ -32,9 +32,9 @@ class StreamAsynchronousIO :
private:
Broadcaster &m_broadcaster;
uint32_t m_broadcast_event_type;
std::string m_accumulated_data;
Debugger &m_debugger;
std::string m_data;
bool m_for_stdout;
};
} // namespace lldb_private

View File

@ -37,6 +37,10 @@ class StreamFile : public Stream
StreamFile (const char *path);
StreamFile (const char *path,
uint32_t options,
uint32_t permissions = lldb::eFilePermissionsFileDefault);
StreamFile (FILE *fh, bool transfer_ownership);
virtual

View File

@ -14,6 +14,7 @@
#include "lldb/Core/STLUtils.h"
#include "lldb/lldb-forward.h"
#include "llvm/ADT/StringRef.h"
namespace lldb_private {
@ -42,6 +43,9 @@ class StringList
void
AppendString (const char *str, size_t str_len);
void
AppendString(llvm::StringRef str);
void
AppendList (const char ** strv, int strc);

View File

@ -13,10 +13,11 @@
// C Includes
// C++ Includes
#include <functional>
#include <map>
#include <string>
#include <utility>
#include <vector>
#include <string>
#include "llvm/ADT/StringRef.h"
@ -54,14 +55,22 @@ class StructuredData
class Boolean;
class String;
class Dictionary;
class Generic;
typedef std::shared_ptr<Object> ObjectSP;
typedef std::shared_ptr<Array> ArraySP;
typedef std::shared_ptr<Integer> IntegerSP;
typedef std::shared_ptr<Float> FloatSP;
typedef std::shared_ptr<Boolean> BooleanSP;
typedef std::shared_ptr<String> StringSP;
typedef std::shared_ptr<Dictionary> DictionarySP;
typedef std::shared_ptr<Generic> GenericSP;
enum class Type {
enum class Type
{
eTypeInvalid = -1,
eTypeNull = 0,
eTypeGeneric,
eTypeArray,
eTypeInteger,
eTypeFloat,
@ -84,6 +93,12 @@ class StructuredData
{
}
virtual bool
IsValid() const
{
return true;
}
virtual void
Clear ()
{
@ -126,6 +141,15 @@ class StructuredData
return NULL;
}
uint64_t
GetIntegerValue (uint64_t fail_value = 0)
{
Integer *integer = GetAsInteger ();
if (integer)
return integer->GetValue();
return fail_value;
}
Float *
GetAsFloat ()
{
@ -134,6 +158,15 @@ class StructuredData
return NULL;
}
double
GetFloatValue (double fail_value = 0.0)
{
Float *f = GetAsFloat ();
if (f)
return f->GetValue();
return fail_value;
}
Boolean *
GetAsBoolean ()
{
@ -142,6 +175,15 @@ class StructuredData
return NULL;
}
bool
GetBooleanValue (bool fail_value = false)
{
Boolean *b = GetAsBoolean ();
if (b)
return b->GetValue();
return fail_value;
}
String *
GetAsString ()
{
@ -150,9 +192,32 @@ class StructuredData
return NULL;
}
std::string
GetStringValue(const char *fail_value = NULL)
{
String *s = GetAsString ();
if (s)
return s->GetValue();
if (fail_value && fail_value[0])
return std::string(fail_value);
return std::string();
}
Generic *
GetAsGeneric()
{
if (m_type == Type::eTypeGeneric)
return (Generic *)this;
return NULL;
}
ObjectSP
GetObjectForDotSeparatedPath (llvm::StringRef path);
void DumpToStdout() const;
virtual void
Dump (Stream &s) const = 0;
@ -173,8 +238,19 @@ class StructuredData
{
}
void
ForEach (std::function <bool(Object* object)> const &foreach_callback) const
{
for (const auto &object_sp : m_items)
{
if (foreach_callback(object_sp.get()) == false)
break;
}
}
size_t
GetSize()
GetSize() const
{
return m_items.size();
}
@ -188,13 +264,97 @@ class StructuredData
}
ObjectSP
GetItemAtIndex (size_t idx)
GetItemAtIndex(size_t idx) const
{
assert(idx < GetSize());
if (idx < m_items.size())
return m_items[idx];
return ObjectSP();
}
template <class IntType>
bool
GetItemAtIndexAsInteger(size_t idx, IntType &result) const
{
ObjectSP value = GetItemAtIndex(idx);
if (auto int_value = value->GetAsInteger())
{
result = static_cast<IntType>(int_value->GetValue());
return true;
}
return false;
}
template <class IntType>
bool
GetItemAtIndexAsInteger(size_t idx, IntType &result, IntType default_val) const
{
bool success = GetItemAtIndexAsInteger(idx, result);
if (!success)
result = default_val;
return success;
}
bool
GetItemAtIndexAsString(size_t idx, std::string &result) const
{
ObjectSP value = GetItemAtIndex(idx);
if (auto string_value = value->GetAsString())
{
result = string_value->GetValue();
return true;
}
return false;
}
bool
GetItemAtIndexAsString(size_t idx, std::string &result, const std::string &default_val) const
{
bool success = GetItemAtIndexAsString(idx, result);
if (!success)
result = default_val;
return success;
}
bool
GetItemAtIndexAsString(size_t idx, ConstString &result) const
{
ObjectSP value = GetItemAtIndex(idx);
if (!value)
return false;
if (auto string_value = value->GetAsString())
{
result = ConstString(string_value->GetValue());
return true;
}
return false;
}
bool
GetItemAtIndexAsString(size_t idx, ConstString &result, const char *default_val) const
{
bool success = GetItemAtIndexAsString(idx, result);
if (!success)
result.SetCString(default_val);
return success;
}
bool
GetItemAtIndexAsDictionary(size_t idx, Dictionary *&result) const
{
ObjectSP value = GetItemAtIndex(idx);
result = value->GetAsDictionary();
return (result != nullptr);
}
bool
GetItemAtIndexAsArray(size_t idx, Array *&result) const
{
ObjectSP value = GetItemAtIndex(idx);
result = value->GetAsArray();
return (result != nullptr);
}
void
Push(ObjectSP item)
{
@ -207,8 +367,7 @@ class StructuredData
m_items.push_back(item);
}
virtual void
Dump (Stream &s) const;
void Dump(Stream &s) const override;
protected:
typedef std::vector<ObjectSP> collection;
@ -219,9 +378,9 @@ class StructuredData
class Integer : public Object
{
public:
Integer () :
Integer (uint64_t i = 0) :
Object (Type::eTypeInteger),
m_value ()
m_value (i)
{
}
@ -241,8 +400,7 @@ class StructuredData
return m_value;
}
virtual void
Dump (Stream &s) const;
void Dump(Stream &s) const override;
protected:
uint64_t m_value;
@ -251,9 +409,9 @@ class StructuredData
class Float : public Object
{
public:
Float () :
Float (double d = 0.0) :
Object (Type::eTypeFloat),
m_value ()
m_value (d)
{
}
@ -273,8 +431,7 @@ class StructuredData
return m_value;
}
virtual void
Dump (Stream &s) const;
void Dump(Stream &s) const override;
protected:
double m_value;
@ -283,9 +440,9 @@ class StructuredData
class Boolean : public Object
{
public:
Boolean () :
Boolean (bool b = false) :
Object (Type::eTypeBoolean),
m_value ()
m_value (b)
{
}
@ -305,8 +462,7 @@ class StructuredData
return m_value;
}
virtual void
Dump (Stream &s) const;
void Dump(Stream &s) const override;
protected:
bool m_value;
@ -317,26 +473,39 @@ class StructuredData
class String : public Object
{
public:
String () :
String (const char *cstr = NULL) :
Object (Type::eTypeString),
m_value ()
{
if (cstr)
m_value = cstr;
}
String (const std::string &s) :
Object (Type::eTypeString),
m_value (s)
{
}
String (const std::string &&s) :
Object (Type::eTypeString),
m_value (s)
{
}
void
SetValue (std::string string)
SetValue (const std::string &string)
{
m_value = string;
}
std::string
const std::string &
GetValue ()
{
return m_value;
}
virtual void
Dump (Stream &s) const;
void Dump(Stream &s) const override;
protected:
std::string m_value;
@ -345,6 +514,7 @@ class StructuredData
class Dictionary : public Object
{
public:
Dictionary () :
Object (Type::eTypeDictionary),
m_dict ()
@ -354,14 +524,25 @@ class StructuredData
virtual ~Dictionary()
{
}
size_t
GetSize()
GetSize() const
{
return m_dict.size();
}
void
ForEach (std::function <bool(ConstString key, Object* object)> const &callback) const
{
for (const auto &pair : m_dict)
{
if (callback (pair.first, pair.second.get()) == false)
break;
}
}
ObjectSP
GetKeys()
GetKeys() const
{
ObjectSP object_sp(new Array ());
Array *array = object_sp->GetAsArray();
@ -376,10 +557,10 @@ class StructuredData
}
ObjectSP
GetValueForKey (const char *key)
GetValueForKey(llvm::StringRef key) const
{
ObjectSP value_sp;
if (key)
if (!key.empty())
{
ConstString key_cs(key);
for (collection::const_iterator iter = m_dict.begin(); iter != m_dict.end(); ++iter)
@ -394,62 +575,144 @@ class StructuredData
return value_sp;
}
template <class IntType>
bool
HasKey (const char *key)
GetValueForKeyAsInteger(llvm::StringRef key, IntType &result) const
{
ConstString key_cs (key);
collection::const_iterator search = m_dict.find(key_cs);
if (search != m_dict.end())
ObjectSP value = GetValueForKey(key);
if (!value)
return false;
if (auto int_value = value->GetAsInteger())
{
result = static_cast<IntType>(int_value->GetValue());
return true;
}
else
{
return false;
}
template <class IntType>
bool
GetValueForKeyAsInteger(llvm::StringRef key, IntType &result, IntType default_val) const
{
bool success = GetValueForKeyAsInteger<IntType>(key, result);
if (!success)
result = default_val;
return success;
}
bool
GetValueForKeyAsString(llvm::StringRef key, std::string &result) const
{
ObjectSP value = GetValueForKey(key);
if (!value)
return false;
if (auto string_value = value->GetAsString())
{
result = string_value->GetValue();
return true;
}
return false;
}
bool
GetValueForKeyAsString(llvm::StringRef key, std::string &result, const char *default_val) const
{
bool success = GetValueForKeyAsString(key, result);
if (!success)
{
if (default_val)
result = default_val;
else
result.clear();
}
return success;
}
bool
GetValueForKeyAsString(llvm::StringRef key, ConstString &result) const
{
ObjectSP value = GetValueForKey(key);
if (!value)
return false;
if (auto string_value = value->GetAsString())
{
result = ConstString(string_value->GetValue());
return true;
}
return false;
}
bool
GetValueForKeyAsString(llvm::StringRef key, ConstString &result, const char *default_val) const
{
bool success = GetValueForKeyAsString(key, result);
if (!success)
result.SetCString(default_val);
return success;
}
bool
GetValueForKeyAsDictionary(llvm::StringRef key, Dictionary *&result) const
{
result = nullptr;
ObjectSP value = GetValueForKey(key);
if (!value)
return false;
result = value->GetAsDictionary();
return true;
}
bool
GetValueForKeyAsArray(llvm::StringRef key, Array *&result) const
{
result = nullptr;
ObjectSP value = GetValueForKey(key);
if (!value)
return false;
result = value->GetAsArray();
return true;
}
bool
HasKey(llvm::StringRef key) const
{
ConstString key_cs(key);
collection::const_iterator search = m_dict.find(key_cs);
return search != m_dict.end();
}
void
AddItem (const char *key, ObjectSP value)
AddItem (llvm::StringRef key, ObjectSP value)
{
ConstString key_cs(key);
m_dict[key_cs] = value;
}
void
AddIntegerItem (const char *key, uint64_t value)
AddIntegerItem (llvm::StringRef key, uint64_t value)
{
ObjectSP val_obj (new Integer());
val_obj->GetAsInteger()->SetValue (value);
AddItem (key, val_obj);
AddItem (key, ObjectSP (new Integer(value)));
}
void
AddFloatItem (const char *key, double value)
AddFloatItem (llvm::StringRef key, double value)
{
ObjectSP val_obj (new Float());
val_obj->GetAsFloat()->SetValue (value);
AddItem (key, val_obj);
AddItem (key, ObjectSP (new Float(value)));
}
void
AddStringItem (const char *key, std::string value)
AddStringItem (llvm::StringRef key, std::string value)
{
ObjectSP val_obj (new String());
val_obj->GetAsString()->SetValue (value);
AddItem (key, val_obj);
AddItem (key, ObjectSP (new String(std::move(value))));
}
void
AddBooleanItem (const char *key, bool value)
AddBooleanItem (llvm::StringRef key, bool value)
{
ObjectSP val_obj (new Boolean());
val_obj->GetAsBoolean()->SetValue (value);
AddItem (key, val_obj);
AddItem (key, ObjectSP (new Boolean(value)));
}
virtual void
Dump (Stream &s) const;
void Dump(Stream &s) const override;
protected:
typedef std::map<ConstString, ObjectSP> collection;
@ -468,12 +731,49 @@ class StructuredData
{
}
virtual void
Dump (Stream &s) const;
bool
IsValid() const override
{
return false;
}
void Dump(Stream &s) const override;
protected:
};
class Generic : public Object
{
public:
explicit Generic(void *object = nullptr) :
Object (Type::eTypeGeneric),
m_object (object)
{
}
void
SetValue(void *value)
{
m_object = value;
}
void *
GetValue() const
{
return m_object;
}
bool
IsValid() const override
{
return m_object != nullptr;
}
void Dump(Stream &s) const override;
private:
void *m_object;
};
static ObjectSP
ParseJSON (std::string json_text);

View File

@ -0,0 +1,65 @@
//===-- ThreadSafeDenseSet.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_ThreadSafeDenseSet_h_
#define liblldb_ThreadSafeDenseSet_h_
// C Includes
// C++ Includes
// Other libraries and framework includes
#include "llvm/ADT/DenseSet.h"
// Project includes
#include "lldb/Host/Mutex.h"
namespace lldb_private {
template <typename _ElementType>
class ThreadSafeDenseSet
{
public:
typedef llvm::DenseSet<_ElementType> LLVMSetType;
ThreadSafeDenseSet(unsigned set_initial_capacity = 0,
Mutex::Type mutex_type = Mutex::eMutexTypeNormal) :
m_set(set_initial_capacity),
m_mutex(mutex_type)
{
}
void
Insert (_ElementType e)
{
Mutex::Locker locker(m_mutex);
m_set.insert(e);
}
void
Erase (_ElementType e)
{
Mutex::Locker locker(m_mutex);
m_set.erase(e);
}
bool
Lookup (_ElementType e)
{
Mutex::Locker locker(m_mutex);
return (m_set.count(e) > 0);
}
protected:
LLVMSetType m_set;
Mutex m_mutex;
};
} // namespace lldb_private
#endif // liblldb_ThreadSafeDenseSet_h_

Some files were not shown because too many files have changed in this diff Show More