Import LLDB as of upstream SVN 228549 (git 39760838)

This commit is contained in:
Ed Maste 2015-02-09 01:44:09 +00:00
parent 205afe6798
commit 12bd4897ff
285 changed files with 8928 additions and 4853 deletions

View File

@ -0,0 +1,186 @@
//===-- 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 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);
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 ();
ProcessLaunchInfoSP m_opaque_sp;
};
} // namespace lldb
#endif // LLDB_SBLaunchInfo_h_

View File

@ -12,11 +12,15 @@
#include "lldb/API/SBDefines.h"
#include <functional>
struct PlatformConnectOptions;
struct PlatformShellCommand;
namespace lldb {
class SBLaunchInfo;
class SBPlatformConnectOptions
{
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

@ -15,6 +15,7 @@
#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,166 +25,6 @@ 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:

View File

@ -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

@ -714,6 +714,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.
@ -733,7 +746,10 @@ class Breakpoint:
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

@ -390,6 +390,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 +418,9 @@ class BreakpointLocation :
void
BumpHitCount();
void
UndoBumpHitCount();
//------------------------------------------------------------------
// Constructors and Destructors

View File

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

View File

@ -276,6 +276,21 @@ class ArchSpec
return !m_triple.getOSName().empty();
}
//------------------------------------------------------------------
/// Merges fields from another ArchSpec into this ArchSpec.
///
/// 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.
///
//------------------------------------------------------------------
void
MergeFrom(const ArchSpec &other);
//------------------------------------------------------------------
/// Sets this ArchSpec according to the given architecture name.
///

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

@ -12,6 +12,7 @@
// C Includes
// C++ Includes
#include <string>
// Other libraries and framework includes
// Project includes
#include "lldb/lldb-private.h"
@ -133,13 +134,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 +151,18 @@ 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;
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

@ -19,6 +19,7 @@
#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"
@ -158,8 +159,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 ()
@ -224,6 +223,12 @@ friend class SourceManager; // For GetSourceFileCache.
ConstString
GetTopIOHandlerControlSequence(char ch);
const char *
GetIOHandlerCommandPrefix();
const char *
GetIOHandlerHelpPrologue();
bool
HideTopIOHandler();
@ -243,15 +248,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,
@ -296,13 +293,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 +349,6 @@ friend class SourceManager; // For GetSourceFileCache.
bool
GetNotifyVoid () const;
const ConstString &
GetInstanceName()

View File

@ -117,7 +117,7 @@ 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.
//------------------------------------------------------------------
@ -130,7 +130,7 @@ 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);
virtual bool
DoesBranch () = 0;
@ -457,7 +457,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,260 @@
//===-- 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,
FrameIndex,
FrameRegisterPC,
FrameRegisterSP,
FrameRegisterFP,
FrameRegisterFlags,
FrameRegisterByName,
ScriptFrame,
FunctionID,
FunctionDidChange,
FunctionInitialFunction,
FunctionName,
FunctionNameWithArgs,
FunctionNameNoArgs,
FunctionAddrOffset,
FunctionAddrOffsetConcrete,
FunctionLineOffset,
FunctionPCOffset,
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

@ -290,6 +290,25 @@ class Mangled
void
SetValue (const ConstString &name);
//----------------------------------------------------------------------
/// Get the language only if it is definitive what the language is from
/// the mangling.
///
/// For a mangled name to have a language it must have both a mangled
/// and a demangled name and it must be definitive from the mangling
/// what the language is.
///
/// 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
GetLanguage ();
private:
//----------------------------------------------------------------------
/// Mangled member variables.

View File

@ -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 ();
@ -1124,8 +1115,7 @@ class Module :
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

@ -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

@ -527,9 +527,14 @@ class ValueObject : public UserID
virtual lldb::ModuleSP
GetModule();
virtual ValueObject*
ValueObject*
GetRoot ();
// Given a ValueObject, loop over itself and its parent, and its parent's parent, ..
// until either the given callback returns false, or you end up at a null pointer
ValueObject*
FollowParentChain (std::function<bool(ValueObject*)>);
virtual bool
GetDeclaration (Declaration &decl);
@ -875,6 +880,9 @@ class ValueObject : public UserID
virtual lldb::LanguageType
GetPreferredDisplayLanguage ();
void
SetPreferredDisplayLanguage (lldb::LanguageType);
lldb::TypeSummaryImplSP
GetSummaryFormat()
{
@ -1106,6 +1114,8 @@ class ValueObject : public UserID
llvm::SmallVector<uint8_t, 16> m_value_checksum;
lldb::LanguageType m_preferred_display_language;
bool m_value_is_valid:1,
m_value_did_change:1,
m_children_count_valid:1,

View File

@ -140,6 +140,9 @@ class ValueObjectSynthetic : public ValueObject
return (UpdateValueIfNeeded(), m_provides_value == eLazyBoolYes);
}
virtual bool
SetValueFromCString (const char *value_str, Error& error);
protected:
virtual bool
UpdateValue ();

View File

@ -23,6 +23,8 @@
#include "lldb/lldb-public.h"
#include "lldb/lldb-enumerations.h"
#include "lldb/Core/Error.h"
#include "lldb/Core/FormatEntity.h"
#include "lldb/Core/ValueObject.h"
#include "lldb/Interpreter/ScriptInterpreterPython.h"
#include "lldb/Symbol/Type.h"
@ -372,31 +374,27 @@ namespace lldb_private {
// simple string-based summaries, using ${var to show data
struct StringSummaryFormat : public TypeSummaryImpl
{
std::string m_format;
std::string m_format_str;
FormatEntity::Entry m_format;
Error m_error;
StringSummaryFormat(const TypeSummaryImpl::Flags& flags,
const char* f);
const char*
GetSummaryString () const
{
return m_format.c_str();
}
void
SetSummaryString (const char* data)
{
if (data)
m_format.assign(data);
else
m_format.clear();
}
virtual
~StringSummaryFormat()
{
}
const char*
GetSummaryString () const
{
return m_format_str.c_str();
}
void
SetSummaryString (const char* f);
virtual bool
FormatObject(ValueObject *valobj,
std::string& dest,

View File

@ -91,7 +91,7 @@ class ASTResultSynthesizer : public clang::SemaConsumer
//----------------------------------------------------------------------
/// Passthrough stub
//----------------------------------------------------------------------
void HandleVTable(clang::CXXRecordDecl *RD, bool DefinitionRequired);
void HandleVTable(clang::CXXRecordDecl *RD);
//----------------------------------------------------------------------
/// Passthrough stub

View File

@ -99,7 +99,7 @@ class ASTStructExtractor : public clang::SemaConsumer
//----------------------------------------------------------------------
/// Passthrough stub
//----------------------------------------------------------------------
void HandleVTable(clang::CXXRecordDecl *RD, bool DefinitionRequired);
void HandleVTable(clang::CXXRecordDecl *RD);
//----------------------------------------------------------------------
/// Passthrough stub

View File

@ -207,6 +207,9 @@ class IRExecutionUnit :
DisassembleFunction (Stream &stream,
lldb::ProcessSP &process_sp);
void
ReportSymbolLookupError(const ConstString &name);
class MemoryManager : public llvm::SectionMemoryManager
{
public:
@ -282,10 +285,10 @@ class IRExecutionUnit :
//------------------------------------------------------------------
/// Passthrough interface stub
//------------------------------------------------------------------
virtual uint64_t getSymbolAddress(const std::string &Name);
virtual void *getPointerToNamedFunction(const std::string &Name,
bool AbortOnFailure = true) {
return m_default_mm_ap->getPointerToNamedFunction(Name, AbortOnFailure);
}
bool AbortOnFailure = true);
private:
std::unique_ptr<SectionMemoryManager> m_default_mm_ap; ///< The memory allocator to use in actually creating space. All calls are passed through to it.
IRExecutionUnit &m_parent; ///< The execution unit this is a proxy for.
@ -390,6 +393,7 @@ class IRExecutionUnit :
std::vector<std::string> m_cpu_features;
llvm::SmallVector<JittedFunction, 1> m_jitted_functions; ///< A vector of all functions that have been JITted into machine code
const ConstString m_name;
std::vector<ConstString> m_failed_lookups;
std::atomic<bool> m_did_jit;

View File

@ -42,7 +42,8 @@ class File : public IOObject
eOpenOptionNonBlocking = (1u << 4), // File reads
eOpenOptionCanCreate = (1u << 5), // Create file if doesn't already exist
eOpenOptionCanCreateNewOnly = (1u << 6), // Can create file only if it doesn't already exist
eOpenoptionDontFollowSymlinks = (1u << 7)
eOpenoptionDontFollowSymlinks = (1u << 7),
eOpenOptionCloseOnExec = (1u << 8) // Close the file when executing a new process
};
static mode_t

View File

@ -246,9 +246,6 @@ class Host
static const lldb_private::UnixSignalsSP&
GetUnixSignals ();
static lldb::pid_t
LaunchApplication (const FileSpec &app_file_spec);
static Error
LaunchProcess (ProcessLaunchInfo &launch_info);

View File

@ -14,6 +14,7 @@
#include <string>
#include "lldb/Core/Error.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
namespace lldb_private
@ -25,6 +26,7 @@ class PipeBase
virtual Error CreateNew(bool child_process_inherit) = 0;
virtual Error CreateNew(llvm::StringRef name, bool child_process_inherit) = 0;
virtual Error CreateWithUniqueName(llvm::StringRef prefix, bool child_process_inherit, llvm::SmallVectorImpl<char>& name) = 0;
virtual Error OpenAsReader(llvm::StringRef name, bool child_process_inherit) = 0;

View File

@ -70,22 +70,35 @@ class Socket : public IOObject
int GetOption (int level, int option_name, int &option_value);
int SetOption (int level, int option_name, int option_value);
static uint16_t GetPortNumber(const NativeSocket& socket);
uint16_t GetPortNumber () const;
// returns port number or 0 if error
static uint16_t GetLocalPortNumber (const NativeSocket& socket);
// returns port number or 0 if error
uint16_t GetLocalPortNumber () const;
// returns ip address string or empty string if error
std::string GetLocalIPAddress () const;
// must be connected
// returns port number or 0 if error
uint16_t GetRemotePortNumber () const;
// must be connected
// returns ip address string or empty string if error
std::string GetRemoteIPAddress () const;
NativeSocket GetNativeSocket () const { return m_socket; }
SocketProtocol GetSocketProtocol() const { return m_protocol; }
SocketProtocol GetSocketProtocol () const { return m_protocol; }
virtual Error Read (void *buf, size_t &num_bytes);
virtual Error Write (const void *buf, size_t &num_bytes);
virtual Error PreDisconnect();
virtual Error Close();
virtual Error PreDisconnect ();
virtual Error Close ();
virtual bool IsValid() const { return m_socket != kInvalidSocketValue; }
virtual WaitableHandle GetWaitableHandle();
virtual bool IsValid () const { return m_socket != kInvalidSocketValue; }
virtual WaitableHandle GetWaitableHandle ();
protected:
static bool
DecodeHostAndPort (llvm::StringRef host_and_port,
std::string &host_str,
@ -93,7 +106,7 @@ class Socket : public IOObject
int32_t& port,
Error *error_ptr);
protected:
SocketProtocol m_protocol;
NativeSocket m_socket;
SocketAddress m_udp_send_sockaddr; // Send address used for UDP connections.

View File

@ -31,6 +31,7 @@ typedef ADDRESS_FAMILY sa_family_t;
// C++ Includes
// Other libraries and framework includes
// Project includes
#include <string>
namespace lldb_private {
@ -99,6 +100,12 @@ class SocketAddress
void
SetFamily (sa_family_t family);
//------------------------------------------------------------------
// Get the address
//------------------------------------------------------------------
std::string
GetIPAddress () const;
//------------------------------------------------------------------
// Get the port if the socket address for the family has a port
//------------------------------------------------------------------

View File

@ -0,0 +1,45 @@
//===-- StringConvert.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_StringConvert_h_
#define liblldb_StringConvert_h_
// C Includes
#include <stdint.h>
// C++ Includes
// Other libraries and framework includes
// Project includes
namespace lldb_private {
namespace StringConvert {
//----------------------------------------------------------------------
/// @namespace StringConvert StringConvert.h "lldb/Host/StringConvert.h"
/// @brief Utility classes for converting strings into Integers
//----------------------------------------------------------------------
int32_t
ToSInt32 (const char *s, int32_t fail_value = 0, int base = 0, bool *success_ptr = nullptr);
uint32_t
ToUInt32 (const char *s, uint32_t fail_value = 0, int base = 0, bool *success_ptr = nullptr);
int64_t
ToSInt64 (const char *s, int64_t fail_value = 0, int base = 0, bool *success_ptr = nullptr);
uint64_t
ToUInt64 (const char *s, uint64_t fail_value = 0, int base = 0, bool *success_ptr = nullptr);
} // namespace StringConvert
} // namespace lldb_private
#endif

View File

@ -18,6 +18,7 @@
#include "lldb/Host/Mutex.h"
#include "NativeBreakpointList.h"
#include "NativeWatchpointList.h"
namespace lldb_private
{
@ -130,6 +131,9 @@ namespace lldb_private
//----------------------------------------------------------------------
// Watchpoint functions
//----------------------------------------------------------------------
virtual const NativeWatchpointList::WatchpointMap&
GetWatchpointMap () const;
virtual uint32_t
GetMaxWatchpoints () const;
@ -295,6 +299,7 @@ namespace lldb_private
Mutex m_delegates_mutex;
std::vector<NativeDelegate*> m_delegates;
NativeBreakpointList m_breakpoint_list;
NativeWatchpointList m_watchpoint_list;
int m_terminal_fd;
uint32_t m_stop_id;

View File

@ -15,6 +15,7 @@
// Other libraries and framework includes
// Project includes
#include "lldb/lldb-private.h"
#include "lldb/Host/common/NativeWatchpointList.h"
namespace lldb_private {
@ -44,6 +45,9 @@ class NativeRegisterContext:
virtual uint32_t
GetRegisterCount () const = 0;
virtual uint32_t
GetUserRegisterCount () const = 0;
virtual const RegisterInfo *
GetRegisterInfoAtIndex (uint32_t reg) const = 0;
@ -92,6 +96,9 @@ class NativeRegisterContext:
virtual bool
ClearHardwareWatchpoint (uint32_t hw_index);
virtual Error
ClearAllHardwareWatchpoints ();
virtual bool
HardwareSingleStep (bool enable);

View File

@ -31,6 +31,9 @@ namespace lldb_private
uint32_t
GetRegisterCount () const override;
uint32_t
GetUserRegisterCount () const override;
const RegisterInfo *
GetRegisterInfoAtIndex (uint32_t reg_index) const override;

View File

@ -53,10 +53,7 @@ namespace lldb_private
RestoreAllRegisters (lldb::DataBufferSP &data_sp);
virtual bool
GetStopReason (ThreadStopInfo &stop_info) = 0;
virtual uint32_t
TranslateStopInfoToGdbSignal (const ThreadStopInfo &stop_info) const;
GetStopReason (ThreadStopInfo &stop_info, std::string& description) = 0;
lldb::tid_t
GetID() const

View File

@ -0,0 +1,47 @@
//===-- NativeWatchpointList.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_NativeWatchpointList_h_
#define liblldb_NativeWatchpointList_h_
#include "lldb/lldb-private-forward.h"
#include "lldb/Core/Error.h"
#include <map>
namespace lldb_private
{
struct NativeWatchpoint
{
lldb::addr_t m_addr;
size_t m_size;
uint32_t m_watch_flags;
bool m_hardware;
};
class NativeWatchpointList
{
public:
Error
Add (lldb::addr_t addr, size_t size, uint32_t watch_flags, bool hardware);
Error
Remove (lldb::addr_t addr);
using WatchpointMap = std::map<lldb::addr_t, NativeWatchpoint>;
const WatchpointMap&
GetWatchpointMap () const;
private:
WatchpointMap m_watchpoints;
};
}
#endif // ifndef liblldb_NativeWatchpointList_h_

View File

@ -50,6 +50,8 @@ class ConnectionFileDescriptor : public Connection
virtual size_t Write(const void *src, size_t src_len, lldb::ConnectionStatus &status, Error *error_ptr);
virtual std::string GetURI();
lldb::ConnectionStatus BytesAvailable(uint32_t timeout_usec, Error *error_ptr);
bool InterruptRead();
@ -75,7 +77,7 @@ class ConnectionFileDescriptor : public Connection
void CloseCommandPipe();
lldb::ConnectionStatus SocketListen(const char *host_and_port, Error *error_ptr);
lldb::ConnectionStatus SocketListenAndAccept(const char *host_and_port, Error *error_ptr);
lldb::ConnectionStatus ConnectTCP(const char *host_and_port, Error *error_ptr);
@ -99,6 +101,8 @@ class ConnectionFileDescriptor : public Connection
bool m_waiting_for_accept;
bool m_child_processes_inherit;
std::string m_uri;
private:
DISALLOW_COPY_AND_ASSIGN(ConnectionFileDescriptor);
};

View File

@ -36,6 +36,8 @@ class PipePosix : public PipeBase
Error
CreateNew(llvm::StringRef name, bool child_process_inherit) override;
Error
CreateWithUniqueName(llvm::StringRef prefix, bool child_process_inherit, llvm::SmallVectorImpl<char>& name) override;
Error
OpenAsReader(llvm::StringRef name, bool child_process_inherit) override;
Error
OpenAsWriterWithTimeout(llvm::StringRef name, bool child_process_inherit, const std::chrono::microseconds &timeout) override;

View File

@ -347,18 +347,6 @@ class Args
bool trailing = true,
bool return_null_if_empty = true);
static int32_t
StringToSInt32 (const char *s, int32_t fail_value = 0, int base = 0, bool *success_ptr = NULL);
static uint32_t
StringToUInt32 (const char *s, uint32_t fail_value = 0, int base = 0, bool *success_ptr = NULL);
static int64_t
StringToSInt64 (const char *s, int64_t fail_value = 0, int base = 0, bool *success_ptr = NULL);
static uint64_t
StringToUInt64 (const char *s, uint64_t fail_value = 0, int base = 0, bool *success_ptr = NULL);
static bool
UInt64ValueIsValidForByteSize (uint64_t uval64, size_t total_byte_size)
{

View File

@ -224,6 +224,7 @@ class CommandInterpreter :
eCommandTypesBuiltin = 0x0001, // native commands such as "frame"
eCommandTypesUserDef = 0x0002, // scripted commands
eCommandTypesAliases = 0x0004, // aliases such as "po"
eCommandTypesHidden = 0x0008, // commands prefixed with an underscore
eCommandTypesAllThem = 0xFFFF // all commands
};
@ -430,6 +431,11 @@ class CommandInterpreter :
const char *command_name,
StreamString &help_string);
void
OutputFormattedHelpText (Stream &strm,
const char *prefix,
const char *help_text);
void
OutputFormattedHelpText (Stream &stream,
const char *command_word,
@ -607,6 +613,9 @@ class CommandInterpreter :
bool asynchronously,
void *baton);
const char *
GetCommandPrefix ();
//------------------------------------------------------------------
// Properties
//------------------------------------------------------------------

View File

@ -102,8 +102,10 @@ class OptionGroupPlatform : public OptionGroup
SetSDKBuild (const ConstString &sdk_build)
{
m_sdk_build = sdk_build;
}
}
bool
PlatformMatches(const lldb::PlatformSP &platform_sp) const;
protected:
std::string m_platform_name;

View File

@ -17,6 +17,7 @@
#include "lldb/lldb-defines.h"
#include "lldb/Core/ConstString.h"
#include "lldb/Core/Error.h"
#include "lldb/Core/FormatEntity.h"
namespace lldb_private {
@ -45,7 +46,8 @@ namespace lldb_private {
eTypeSInt64,
eTypeString,
eTypeUInt64,
eTypeUUID
eTypeUUID,
eTypeFormatEntity
} Type;
enum {
@ -309,7 +311,13 @@ namespace lldb_private {
const OptionValueUUID *
GetAsUUID () const;
OptionValueFormatEntity *
GetAsFormatEntity ();
const OptionValueFormatEntity *
GetAsFormatEntity () const;
bool
GetBooleanValue (bool fail_value = false) const;
@ -341,6 +349,9 @@ namespace lldb_private {
bool
SetFormatValue (lldb::Format new_value);
const FormatEntity::Entry *
GetFormatEntity () const;
const RegularExpression *
GetRegexValue () const;

View File

@ -0,0 +1,107 @@
//===-- OptionValueFormatEntity.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_OptionValueFormatEntity_h_
#define liblldb_OptionValueFormatEntity_h_
// C Includes
// C++ Includes
// Other libraries and framework includes
// Project includes
#include "lldb/Core/FormatEntity.h"
#include "lldb/Interpreter/OptionValue.h"
namespace lldb_private {
class OptionValueFormatEntity : public OptionValue
{
public:
OptionValueFormatEntity (const char *default_format);
virtual
~OptionValueFormatEntity()
{
}
//---------------------------------------------------------------------
// Virtual subclass pure virtual overrides
//---------------------------------------------------------------------
OptionValue::Type
GetType () const override
{
return eTypeFormatEntity;
}
void
DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override;
Error
SetValueFromCString (const char *value,
VarSetOperationType op = eVarSetOperationAssign) override;
bool
Clear () override;
lldb::OptionValueSP
DeepCopy () const override;
size_t
AutoComplete (CommandInterpreter &interpreter,
const char *s,
int match_start_point,
int max_return_elements,
bool &word_complete,
StringList &matches) override;
//---------------------------------------------------------------------
// Subclass specific functions
//---------------------------------------------------------------------
FormatEntity::Entry &
GetCurrentValue()
{
return m_current_entry;
}
const FormatEntity::Entry &
GetCurrentValue() const
{
return m_current_entry;
}
void
SetCurrentValue (const FormatEntity::Entry &value)
{
m_current_entry = value;
}
FormatEntity::Entry &
GetDefaultValue()
{
return m_default_entry;
}
const FormatEntity::Entry &
GetDefaultValue() const
{
return m_default_entry;
}
protected:
std::string m_current_format;
std::string m_default_format;
FormatEntity::Entry m_current_entry;
FormatEntity::Entry m_default_entry;
};
} // namespace lldb_private
#endif // liblldb_OptionValueFormatEntity_h_

View File

@ -15,6 +15,7 @@
// Other libraries and framework includes
// Project includes
#include "lldb/Core/ConstString.h"
#include "lldb/Core/FormatEntity.h"
#include "lldb/Core/UniqueCStringMap.h"
#include "lldb/Interpreter/OptionValue.h"
#include "lldb/Interpreter/Property.h"
@ -191,6 +192,9 @@ class OptionValueProperties :
bool
SetPropertyAtIndexAsEnumeration (const ExecutionContext *exe_ctx, uint32_t idx, int64_t new_value);
const FormatEntity::Entry *
GetPropertyAtIndexAsFormatEntity (const ExecutionContext *exe_ctx, uint32_t idx);
const RegularExpression *
GetPropertyAtIndexAsOptionValueRegex (const ExecutionContext *exe_ctx, uint32_t idx) const;

View File

@ -24,9 +24,9 @@ namespace lldb_private {
class OptionValueRegex : public OptionValue
{
public:
OptionValueRegex (const char *value = NULL, uint32_t regex_flags = 0) :
OptionValueRegex (const char *value = NULL) :
OptionValue(),
m_regex (value, regex_flags)
m_regex (value)
{
}
@ -75,10 +75,10 @@ class OptionValueRegex : public OptionValue
}
void
SetCurrentValue (const char *value, uint32_t regex_flags)
SetCurrentValue (const char *value)
{
if (value && value[0])
m_regex.Compile (value, regex_flags);
m_regex.Compile (value);
else
m_regex.Clear();
}

View File

@ -21,6 +21,7 @@
#include "lldb/Interpreter/OptionValueFileSpec.h"
#include "lldb/Interpreter/OptionValueFileSpecList.h"
#include "lldb/Interpreter/OptionValueFormat.h"
#include "lldb/Interpreter/OptionValueFormatEntity.h"
#include "lldb/Interpreter/OptionValuePathMappings.h"
#include "lldb/Interpreter/OptionValueProperties.h"
#include "lldb/Interpreter/OptionValueRegex.h"

View File

@ -240,7 +240,13 @@ class ScriptInterpreter
bool m_set_lldb_globals;
bool m_maskout_errors;
};
virtual bool
Interrupt()
{
return false;
}
virtual bool
ExecuteOneLine (const char *command,
CommandReturnObject *result,
@ -290,13 +296,13 @@ class ScriptInterpreter
}
virtual bool
GenerateTypeScriptFunction (const char* oneliner, std::string& output, void* name_token = NULL)
GenerateTypeScriptFunction (const char* oneliner, std::string& output, const void* name_token = NULL)
{
return false;
}
virtual bool
GenerateTypeScriptFunction (StringList &input, std::string& output, void* name_token = NULL)
GenerateTypeScriptFunction (StringList &input, std::string& output, const void* name_token = NULL)
{
return false;
}
@ -308,13 +314,13 @@ class ScriptInterpreter
}
virtual bool
GenerateTypeSynthClass (StringList &input, std::string& output, void* name_token = NULL)
GenerateTypeSynthClass (StringList &input, std::string& output, const void* name_token = NULL)
{
return false;
}
virtual bool
GenerateTypeSynthClass (const char* oneliner, std::string& output, void* name_token = NULL)
GenerateTypeSynthClass (const char* oneliner, std::string& output, const void* name_token = NULL)
{
return false;
}

View File

@ -40,126 +40,129 @@ class ScriptInterpreterPython :
~ScriptInterpreterPython ();
bool
Interrupt() override;
bool
ExecuteOneLine (const char *command,
CommandReturnObject *result,
const ExecuteScriptOptions &options = ExecuteScriptOptions());
const ExecuteScriptOptions &options = ExecuteScriptOptions()) override;
void
ExecuteInterpreterLoop ();
ExecuteInterpreterLoop () override;
bool
ExecuteOneLineWithReturn (const char *in_string,
ScriptInterpreter::ScriptReturnType return_type,
void *ret_value,
const ExecuteScriptOptions &options = ExecuteScriptOptions());
const ExecuteScriptOptions &options = ExecuteScriptOptions()) override;
lldb_private::Error
ExecuteMultipleLines (const char *in_string,
const ExecuteScriptOptions &options = ExecuteScriptOptions());
const ExecuteScriptOptions &options = ExecuteScriptOptions()) override;
Error
ExportFunctionDefinitionToInterpreter (StringList &function_def);
ExportFunctionDefinitionToInterpreter (StringList &function_def) override;
bool
GenerateTypeScriptFunction (StringList &input, std::string& output, void* name_token = NULL);
GenerateTypeScriptFunction (StringList &input, std::string& output, const void* name_token = NULL) override;
bool
GenerateTypeSynthClass (StringList &input, std::string& output, void* name_token = NULL);
GenerateTypeSynthClass (StringList &input, std::string& output, const void* name_token = NULL) override;
bool
GenerateTypeSynthClass (const char* oneliner, std::string& output, void* name_token = NULL);
GenerateTypeSynthClass (const char* oneliner, std::string& output, const void* name_token = NULL) override;
// use this if the function code is just a one-liner script
bool
GenerateTypeScriptFunction (const char* oneliner, std::string& output, void* name_token = NULL);
GenerateTypeScriptFunction (const char* oneliner, std::string& output, const void* name_token = NULL) override;
virtual bool
GenerateScriptAliasFunction (StringList &input, std::string& output);
bool
GenerateScriptAliasFunction (StringList &input, std::string& output) override;
lldb::ScriptInterpreterObjectSP
CreateSyntheticScriptedProvider (const char *class_name,
lldb::ValueObjectSP valobj);
lldb::ValueObjectSP valobj) override;
lldb::ScriptInterpreterObjectSP
virtual CreateScriptedThreadPlan (const char *class_name,
lldb::ThreadPlanSP thread_plan);
CreateScriptedThreadPlan (const char *class_name,
lldb::ThreadPlanSP thread_plan) override;
virtual bool
bool
ScriptedThreadPlanExplainsStop (lldb::ScriptInterpreterObjectSP implementor_sp,
Event *event,
bool &script_error);
virtual bool
bool &script_error) override;
bool
ScriptedThreadPlanShouldStop (lldb::ScriptInterpreterObjectSP implementor_sp,
Event *event,
bool &script_error);
virtual lldb::StateType
bool &script_error) override;
lldb::StateType
ScriptedThreadPlanGetRunState (lldb::ScriptInterpreterObjectSP implementor_sp,
bool &script_error);
bool &script_error) override;
virtual lldb::ScriptInterpreterObjectSP
lldb::ScriptInterpreterObjectSP
OSPlugin_CreatePluginObject (const char *class_name,
lldb::ProcessSP process_sp);
lldb::ProcessSP process_sp) override;
virtual lldb::ScriptInterpreterObjectSP
OSPlugin_RegisterInfo (lldb::ScriptInterpreterObjectSP os_plugin_object_sp);
lldb::ScriptInterpreterObjectSP
OSPlugin_RegisterInfo (lldb::ScriptInterpreterObjectSP os_plugin_object_sp) override;
virtual lldb::ScriptInterpreterObjectSP
OSPlugin_ThreadsInfo (lldb::ScriptInterpreterObjectSP os_plugin_object_sp);
lldb::ScriptInterpreterObjectSP
OSPlugin_ThreadsInfo (lldb::ScriptInterpreterObjectSP os_plugin_object_sp) override;
virtual lldb::ScriptInterpreterObjectSP
lldb::ScriptInterpreterObjectSP
OSPlugin_RegisterContextData (lldb::ScriptInterpreterObjectSP os_plugin_object_sp,
lldb::tid_t thread_id);
lldb::tid_t thread_id) override;
virtual lldb::ScriptInterpreterObjectSP
lldb::ScriptInterpreterObjectSP
OSPlugin_CreateThread (lldb::ScriptInterpreterObjectSP os_plugin_object_sp,
lldb::tid_t tid,
lldb::addr_t context);
lldb::addr_t context) override;
virtual lldb::ScriptInterpreterObjectSP
lldb::ScriptInterpreterObjectSP
LoadPluginModule (const FileSpec& file_spec,
lldb_private::Error& error);
lldb_private::Error& error) override;
virtual lldb::ScriptInterpreterObjectSP
lldb::ScriptInterpreterObjectSP
GetDynamicSettings (lldb::ScriptInterpreterObjectSP plugin_module_sp,
Target* target,
const char* setting_name,
lldb_private::Error& error);
lldb_private::Error& error) override;
virtual size_t
CalculateNumChildren (const lldb::ScriptInterpreterObjectSP& implementor);
size_t
CalculateNumChildren (const lldb::ScriptInterpreterObjectSP& implementor) override;
virtual lldb::ValueObjectSP
GetChildAtIndex (const lldb::ScriptInterpreterObjectSP& implementor, uint32_t idx);
lldb::ValueObjectSP
GetChildAtIndex (const lldb::ScriptInterpreterObjectSP& implementor, uint32_t idx) override;
virtual int
GetIndexOfChildWithName (const lldb::ScriptInterpreterObjectSP& implementor, const char* child_name);
int
GetIndexOfChildWithName (const lldb::ScriptInterpreterObjectSP& implementor, const char* child_name) override;
virtual bool
UpdateSynthProviderInstance (const lldb::ScriptInterpreterObjectSP& implementor);
bool
UpdateSynthProviderInstance (const lldb::ScriptInterpreterObjectSP& implementor) override;
virtual bool
MightHaveChildrenSynthProviderInstance (const lldb::ScriptInterpreterObjectSP& implementor);
bool
MightHaveChildrenSynthProviderInstance (const lldb::ScriptInterpreterObjectSP& implementor) override;
virtual lldb::ValueObjectSP
GetSyntheticValue (const lldb::ScriptInterpreterObjectSP& implementor);
lldb::ValueObjectSP
GetSyntheticValue (const lldb::ScriptInterpreterObjectSP& implementor) override;
virtual bool
bool
RunScriptBasedCommand(const char* impl_function,
const char* args,
ScriptedCommandSynchronicity synchronicity,
lldb_private::CommandReturnObject& cmd_retobj,
Error& error,
const lldb_private::ExecutionContext& exe_ctx);
const lldb_private::ExecutionContext& exe_ctx) override;
Error
GenerateFunction(const char *signature, const StringList &input);
GenerateFunction(const char *signature, const StringList &input) override;
Error
GenerateBreakpointCommandCallbackData (StringList &input, std::string& output);
GenerateBreakpointCommandCallbackData (StringList &input, std::string& output) override;
bool
GenerateWatchpointCommandCallbackData (StringList &input, std::string& output);
GenerateWatchpointCommandCallbackData (StringList &input, std::string& output) override;
// static size_t
// GenerateBreakpointOptionsCommandCallback (void *baton,
@ -186,21 +189,21 @@ class ScriptInterpreterPython :
StoppointCallbackContext *context,
lldb::user_id_t watch_id);
virtual bool
bool
GetScriptedSummary (const char *function_name,
lldb::ValueObjectSP valobj,
lldb::ScriptInterpreterObjectSP& callee_wrapper_sp,
const TypeSummaryOptions& options,
std::string& retval);
std::string& retval) override;
virtual void
Clear ();
void
Clear () override;
virtual bool
GetDocumentationForItem (const char* item, std::string& dest);
bool
GetDocumentationForItem (const char* item, std::string& dest) override;
virtual bool
CheckObjectExists (const char* name)
bool
CheckObjectExists (const char* name) override
{
if (!name || !name[0])
return false;
@ -208,76 +211,76 @@ class ScriptInterpreterPython :
return GetDocumentationForItem (name,temp);
}
virtual bool
bool
RunScriptFormatKeyword (const char* impl_function,
Process* process,
std::string& output,
Error& error);
Error& error) override;
virtual bool
bool
RunScriptFormatKeyword (const char* impl_function,
Thread* thread,
std::string& output,
Error& error);
Error& error) override;
virtual bool
bool
RunScriptFormatKeyword (const char* impl_function,
Target* target,
std::string& output,
Error& error);
Error& error) override;
virtual bool
bool
RunScriptFormatKeyword (const char* impl_function,
StackFrame* frame,
std::string& output,
Error& error);
Error& error) override;
virtual bool
bool
RunScriptFormatKeyword (const char* impl_function,
ValueObject* value,
std::string& output,
Error& error);
Error& error) override;
virtual bool
bool
LoadScriptingModule (const char* filename,
bool can_reload,
bool init_session,
lldb_private::Error& error,
lldb::ScriptInterpreterObjectSP* module_sp = nullptr);
lldb::ScriptInterpreterObjectSP* module_sp = nullptr) override;
virtual lldb::ScriptInterpreterObjectSP
MakeScriptObject (void* object);
lldb::ScriptInterpreterObjectSP
MakeScriptObject (void* object) override;
virtual std::unique_ptr<ScriptInterpreterLocker>
AcquireInterpreterLock ();
std::unique_ptr<ScriptInterpreterLocker>
AcquireInterpreterLock () override;
void
CollectDataForBreakpointCommandCallback (std::vector<BreakpointOptions *> &bp_options_vec,
CommandReturnObject &result);
CommandReturnObject &result) override;
void
CollectDataForWatchpointCommandCallback (WatchpointOptions *wp_options,
CommandReturnObject &result);
CommandReturnObject &result) override;
/// Set the callback body text into the callback for the breakpoint.
Error
SetBreakpointCommandCallback (BreakpointOptions *bp_options,
const char *callback_body);
const char *callback_body) override;
void
SetBreakpointCommandCallbackFunction (BreakpointOptions *bp_options,
const char *function_name);
const char *function_name) override;
/// Set a one-liner as the callback for the watchpoint.
void
SetWatchpointCommandCallback (WatchpointOptions *wp_options,
const char *oneliner);
const char *oneliner) override;
StringList
ReadCommandInputFromUser (FILE *in_file);
virtual void
ResetOutputFileHandle (FILE *new_fh);
ResetOutputFileHandle (FILE *new_fh) override;
static void
InitializePrivate ();
@ -331,11 +334,11 @@ class ScriptInterpreterPython :
//----------------------------------------------------------------------
// IOHandlerDelegate
//----------------------------------------------------------------------
virtual void
IOHandlerActivated (IOHandler &io_handler);
void
IOHandlerActivated (IOHandler &io_handler) override;
virtual void
IOHandlerInputComplete (IOHandler &io_handler, std::string &data);
void
IOHandlerInputComplete (IOHandler &io_handler, std::string &data) override;
protected:
@ -448,6 +451,26 @@ class ScriptInterpreterPython :
};
protected:
uint32_t
IsExecutingPython () const
{
return m_lock_count > 0;
}
uint32_t
IncrementLockCount()
{
return ++m_lock_count;
}
uint32_t
DecrementLockCount()
{
if (m_lock_count > 0)
--m_lock_count;
return m_lock_count;
}
enum ActiveIOHandler {
eIOHandlerNone,
eIOHandlerBreakpoint,
@ -480,6 +503,7 @@ class ScriptInterpreterPython :
bool m_session_is_active;
bool m_pty_slave_is_open;
bool m_valid_session;
uint32_t m_lock_count;
PyThreadState *m_command_thread_state;
};
} // namespace lldb_private

View File

@ -96,6 +96,10 @@ class ClangASTType
uint64_t *size,
bool *is_incomplete) const;
bool
IsVectorType (ClangASTType *element_type,
uint64_t *size) const;
bool
IsArrayOfScalarType () const;
@ -347,10 +351,10 @@ class ClangASTType
//----------------------------------------------------------------------
uint64_t
GetByteSize () const;
GetByteSize (ExecutionContext *exe_ctx) const;
uint64_t
GetBitSize () const;
GetBitSize (ExecutionContext *exe_ctx) const;
lldb::Encoding
GetEncoding (uint64_t &count) const;

View File

@ -767,6 +767,23 @@ friend class lldb_private::Module;
return 0;
}
//------------------------------------------------------------------
/// Return true if this file is a dynamic link editor (dyld)
///
/// Often times dyld has symbols that mirror symbols in libc and
/// other shared libraries (like "malloc" and "free") and the user
/// does _not_ want to stop in these shared libraries by default.
/// We can ask the ObjectFile if it is such a file and should be
/// avoided for things like settings breakpoints and doing function
/// lookups for expressions.
//------------------------------------------------------------------
virtual bool
GetIsDynamicLinkEditor()
{
return false;
}
//------------------------------------------------------------------
// Member Functions
//------------------------------------------------------------------

View File

@ -347,6 +347,7 @@ class SymbolContext
Block * block; ///< The Block for a given query
LineEntry line_entry; ///< The LineEntry for a given query
Symbol * symbol; ///< The Symbol for a given query
Variable * variable; ///< The global variable matching the given query
};

View File

@ -1,4 +1,4 @@
//===-- ProcessLaunchInfo.h -------------------------------------*- C++ -*-===//
//===-- FileAction.h --------------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//

View File

@ -102,6 +102,13 @@ class LanguageRuntime :
virtual lldb::SearchFilterSP
CreateExceptionSearchFilter ();
virtual bool
GetTypeBitSize (const ClangASTType& clang_type,
uint64_t &size)
{
return false;
}
protected:
//------------------------------------------------------------------

View File

@ -20,6 +20,7 @@
// Project includes
#include "lldb/lldb-private.h"
#include "lldb/Core/PluginInterface.h"
#include "lldb/Core/ThreadSafeDenseMap.h"
#include "lldb/Symbol/ClangASTType.h"
#include "lldb/Symbol/DeclVendor.h"
#include "lldb/Symbol/Type.h"
@ -514,6 +515,10 @@ class ObjCLanguageRuntime :
m_negative_complete_class_cache.clear();
}
virtual bool
GetTypeBitSize (const ClangASTType& clang_type,
uint64_t &size);
protected:
//------------------------------------------------------------------
// Classes that inherit from ObjCLanguageRuntime can see and modify these
@ -610,11 +615,13 @@ class ObjCLanguageRuntime :
typedef std::multimap<uint32_t, ObjCISA> HashToISAMap;
typedef ISAToDescriptorMap::iterator ISAToDescriptorIterator;
typedef HashToISAMap::iterator HashToISAIterator;
typedef ThreadSafeDenseMap<void*, uint64_t> TypeSizeCache;
MsgImplMap m_impl_cache;
LazyBool m_has_new_literals_and_indexing;
ISAToDescriptorMap m_isa_to_descriptor;
HashToISAMap m_hash_to_isa_map;
TypeSizeCache m_type_size_cache;
protected:
uint32_t m_isa_to_descriptor_stop_id;

View File

@ -28,7 +28,7 @@
// TODO pull NativeDelegate class out of NativeProcessProtocol so we
// can just forward ref the NativeDelegate rather than include it here.
#include "../../../source/Host/common/NativeProcessProtocol.h"
#include "lldb/Host/common/NativeProcessProtocol.h"
namespace lldb_private {
@ -379,6 +379,12 @@ namespace lldb_private {
virtual Error
LaunchProcess (ProcessLaunchInfo &launch_info);
//------------------------------------------------------------------
/// Kill process on a platform.
//------------------------------------------------------------------
virtual Error
KillProcess (const lldb::pid_t pid);
//------------------------------------------------------------------
/// Lets a platform answer if it is compatible with a given
/// architecture and the target triple contained within.
@ -569,7 +575,7 @@ namespace lldb_private {
// Appends the platform-specific options required to find the modules for the current platform.
virtual void
AddClangModuleCompilationOptions (std::vector<std::string> &options);
AddClangModuleCompilationOptions (Target *target, std::vector<std::string> &options);
ConstString
GetWorkingDirectory ();
@ -952,8 +958,7 @@ namespace lldb_private {
uint32_t m_update_os_version;
ArchSpec m_system_arch; // The architecture of the kernel or the remote platform
typedef std::map<uint32_t, ConstString> IDToNameMap;
Mutex m_uid_map_mutex;
Mutex m_gid_map_mutex;
Mutex m_mutex; // Mutex for modifying Platform data structures that should only be used for non-reentrant code
IDToNameMap m_uid_map;
IDToNameMap m_gid_map;
size_t m_max_uid_name_len;
@ -967,7 +972,6 @@ namespace lldb_private {
std::string m_local_cache_directory;
std::vector<ConstString> m_trap_handlers;
bool m_calculated_trap_handlers;
Mutex m_trap_handler_mutex;
//------------------------------------------------------------------
/// Ask the Platform subclass to fill in the list of trap handler names
@ -988,7 +992,7 @@ namespace lldb_private {
const char *
GetCachedUserName (uint32_t uid)
{
Mutex::Locker locker (m_uid_map_mutex);
Mutex::Locker locker (m_mutex);
IDToNameMap::iterator pos = m_uid_map.find (uid);
if (pos != m_uid_map.end())
{
@ -1004,7 +1008,7 @@ namespace lldb_private {
const char *
SetCachedUserName (uint32_t uid, const char *name, size_t name_len)
{
Mutex::Locker locker (m_uid_map_mutex);
Mutex::Locker locker (m_mutex);
ConstString const_name (name);
m_uid_map[uid] = const_name;
if (m_max_uid_name_len < name_len)
@ -1016,7 +1020,7 @@ namespace lldb_private {
void
SetUserNameNotFound (uint32_t uid)
{
Mutex::Locker locker (m_uid_map_mutex);
Mutex::Locker locker (m_mutex);
m_uid_map[uid] = ConstString();
}
@ -1024,14 +1028,14 @@ namespace lldb_private {
void
ClearCachedUserNames ()
{
Mutex::Locker locker (m_uid_map_mutex);
Mutex::Locker locker (m_mutex);
m_uid_map.clear();
}
const char *
GetCachedGroupName (uint32_t gid)
{
Mutex::Locker locker (m_gid_map_mutex);
Mutex::Locker locker (m_mutex);
IDToNameMap::iterator pos = m_gid_map.find (gid);
if (pos != m_gid_map.end())
{
@ -1047,7 +1051,7 @@ namespace lldb_private {
const char *
SetCachedGroupName (uint32_t gid, const char *name, size_t name_len)
{
Mutex::Locker locker (m_gid_map_mutex);
Mutex::Locker locker (m_mutex);
ConstString const_name (name);
m_gid_map[gid] = const_name;
if (m_max_gid_name_len < name_len)
@ -1059,14 +1063,14 @@ namespace lldb_private {
void
SetGroupNameNotFound (uint32_t gid)
{
Mutex::Locker locker (m_gid_map_mutex);
Mutex::Locker locker (m_mutex);
m_gid_map[gid] = ConstString();
}
void
ClearCachedGroupNames ()
{
Mutex::Locker locker (m_gid_map_mutex);
Mutex::Locker locker (m_mutex);
m_gid_map.clear();
}

View File

@ -678,13 +678,16 @@ friend bool operator== (const ProcessModID &lhs, const ProcessModID &rhs);
bool
IsLastResumeForUserExpression () const
{
// If we haven't yet resumed the target, then it can't be for a user expression...
if (m_resume_id == 0)
return false;
return m_resume_id == m_last_user_expression_resume;
}
void
SetRunningUserExpression (bool on)
{
// REMOVEME printf ("Setting running user expression %s at resume id %d - value: %d.\n", on ? "on" : "off", m_resume_id, m_running_user_expression);
if (on)
m_running_user_expression++;
else
@ -3177,6 +3180,7 @@ class Process :
lldb::IOHandlerSP m_process_input_reader;
Communication m_stdio_communication;
Mutex m_stdio_communication_mutex;
bool m_stdio_disable; /// Remember process launch setting
std::string m_stdout_data;
std::string m_stderr_data;
Mutex m_profile_data_comm_mutex;

View File

@ -50,37 +50,6 @@
namespace lldb_utility {
namespace ansi {
const char *k_escape_start = "\033[";
const char *k_escape_end = "m";
const char *k_fg_black = "30";
const char *k_fg_red = "31";
const char *k_fg_green = "32";
const char *k_fg_yellow = "33";
const char *k_fg_blue = "34";
const char *k_fg_purple = "35";
const char *k_fg_cyan = "36";
const char *k_fg_white = "37";
const char *k_bg_black = "40";
const char *k_bg_red = "41";
const char *k_bg_green = "42";
const char *k_bg_yellow = "43";
const char *k_bg_blue = "44";
const char *k_bg_purple = "45";
const char *k_bg_cyan = "46";
const char *k_bg_white = "47";
const char *k_ctrl_normal = "0";
const char *k_ctrl_bold = "1";
const char *k_ctrl_faint = "2";
const char *k_ctrl_italic = "3";
const char *k_ctrl_underline = "4";
const char *k_ctrl_slow_blink = "5";
const char *k_ctrl_fast_blink = "6";
const char *k_ctrl_negative = "7";
const char *k_ctrl_conceal = "8";
const char *k_ctrl_crossed_out = "9";
inline std::string
FormatAnsiTerminalCodes(const char *format, bool do_color = true)

View File

@ -59,7 +59,7 @@ namespace lldb_private {
// no support for bitfields in here (yet)
if (is_bitfield)
return;
auto size = field_type.GetByteSize();
auto size = field_type.GetByteSize(nullptr);
// no support for things larger than a uint64_t (yet)
if (size > 8)
return;
@ -67,7 +67,7 @@ namespace lldb_private {
size_t byte_index = static_cast<size_t>(bit_offset / 8);
m_fields[const_name] = FieldImpl{field_type, byte_index, static_cast<size_t>(size)};
}
size_t total_size = struct_type.GetByteSize();
size_t total_size = struct_type.GetByteSize(nullptr);
lldb::DataBufferSP buffer_sp(new DataBufferHeap(total_size,0));
Error error;
process->ReadMemoryFromInferior(base_addr,

View File

@ -290,7 +290,11 @@ namespace lldb {
eSymbolContextBlock = (1u << 4), ///< Set when the deepest \a block is requested from a query, or was located in query results
eSymbolContextLineEntry = (1u << 5), ///< Set when \a line_entry is requested from a query, or was located in query results
eSymbolContextSymbol = (1u << 6), ///< Set when \a symbol is requested from a query, or was located in query results
eSymbolContextEverything = ((eSymbolContextSymbol << 1) - 1u) ///< Indicates to try and lookup everything up during a query.
eSymbolContextEverything = ((eSymbolContextSymbol << 1) - 1u), ///< Indicates to try and lookup everything up during a routine symbol context query.
eSymbolContextVariable = (1u << 7) ///< Set when \a global or static variable is requested from a query, or was located in query results.
///< eSymbolContextVariable is potentially expensive to lookup so it isn't included in
///< eSymbolContextEverything which stops it from being used during frame PC lookups and
///< many other potential address to symbol context lookups.
} SymbolContextItem;
typedef enum Permissions
@ -374,6 +378,8 @@ namespace lldb {
eLanguageTypeUPC = 0x0012, ///< Unified Parallel C.
eLanguageTypeD = 0x0013, ///< D.
eLanguageTypePython = 0x0014, ///< Python.
// NOTE: The below are DWARF5 constants, subject to change upon
// completion of the DWARF5 specification
eLanguageTypeOpenCL = 0x0015, ///< OpenCL.
eLanguageTypeGo = 0x0016, ///< Go.
eLanguageTypeModula3 = 0x0017, ///< Modula 3.
@ -386,6 +392,9 @@ namespace lldb {
eLanguageTypeSwift = 0x001e, ///< Swift.
eLanguageTypeJulia = 0x001f, ///< Julia.
eLanguageTypeDylan = 0x0020, ///< Dylan.
eLanguageTypeC_plus_plus_14 = 0x0021, ///< ISO C++:2014.
eLanguageTypeFortran03 = 0x0022, ///< ISO Fortran 2003.
eLanguageTypeFortran08 = 0x0023, ///< ISO Fortran 2008.
eNumLanguageTypes
} LanguageType;

View File

@ -146,6 +146,7 @@ class OptionValueEnumeration;
class OptionValueFileSpec;
class OptionValueFileSpecList;
class OptionValueFormat;
class OptionValueFormatEntity;
class OptionValuePathMappings;
class OptionValueProperties;
class OptionValueRegex;

View File

@ -178,8 +178,9 @@ SBInstruction::GetDescription (lldb::SBStream &s)
module_sp->ResolveSymbolContextForAddress(addr, eSymbolContextEverything, sc);
// Use the "ref()" instead of the "get()" accessor in case the SBStream
// didn't have a stream already created, one will get created...
const char *disassemble_format = "${addr-file-or-load}: ";
m_opaque_sp->Dump (&s.ref(), 0, true, false, NULL, &sc, NULL, disassemble_format);
FormatEntity::Entry format;
FormatEntity::Parse("${addr}: ", format);
m_opaque_sp->Dump (&s.ref(), 0, true, false, NULL, &sc, NULL, &format);
return true;
}
return false;
@ -199,8 +200,9 @@ SBInstruction::Print (FILE *out)
if (module_sp)
module_sp->ResolveSymbolContextForAddress(addr, eSymbolContextEverything, sc);
StreamFile out_stream (out, false);
const char *disassemble_format = "${addr-file-or-load}: ";
m_opaque_sp->Dump (&out_stream, 0, true, false, NULL, &sc, NULL, disassemble_format);
FormatEntity::Entry format;
FormatEntity::Parse("${addr}: ", format);
m_opaque_sp->Dump (&out_stream, 0, true, false, NULL, &sc, NULL, &format);
}
}

View File

@ -102,7 +102,8 @@ SBInstructionList::GetDescription (lldb::SBStream &description)
// exist already inside description...
Stream &sref = description.ref();
const uint32_t max_opcode_byte_size = m_opaque_sp->GetInstructionList().GetMaxOpcocdeByteSize();
const char *disassemble_format = "${addr-file-or-load}: ";
FormatEntity::Entry format;
FormatEntity::Parse("${addr}: ", format);
SymbolContext sc;
SymbolContext prev_sc;
for (size_t i=0; i<num_instructions; ++i)
@ -119,7 +120,7 @@ SBInstructionList::GetDescription (lldb::SBStream &description)
module_sp->ResolveSymbolContextForAddress(addr, eSymbolContextEverything, sc);
}
inst->Dump (&sref, max_opcode_byte_size, true, false, NULL, &sc, &prev_sc, disassemble_format);
inst->Dump (&sref, max_opcode_byte_size, true, false, NULL, &sc, &prev_sc, &format);
sref.EOL();
}
return true;

278
source/API/SBLaunchInfo.cpp Normal file
View File

@ -0,0 +1,278 @@
//===-- SBLaunchInfo.cpp ----------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include "lldb/lldb-python.h"
#include "lldb/API/SBLaunchInfo.h"
#include "lldb/API/SBFileSpec.h"
#include "lldb/API/SBListener.h"
#include "lldb/Target/ProcessLaunchInfo.h"
using namespace lldb;
using namespace lldb_private;
SBLaunchInfo::SBLaunchInfo (const char **argv) :
m_opaque_sp(new ProcessLaunchInfo())
{
m_opaque_sp->GetFlags().Reset (eLaunchFlagDebug | eLaunchFlagDisableASLR);
if (argv && argv[0])
m_opaque_sp->GetArguments().SetArguments(argv);
}
SBLaunchInfo::~SBLaunchInfo()
{
}
lldb_private::ProcessLaunchInfo &
SBLaunchInfo::ref ()
{
return *m_opaque_sp;
}
lldb::pid_t
SBLaunchInfo::GetProcessID()
{
return m_opaque_sp->GetProcessID();
}
uint32_t
SBLaunchInfo::GetUserID()
{
return m_opaque_sp->GetUserID();
}
uint32_t
SBLaunchInfo::GetGroupID()
{
return m_opaque_sp->GetGroupID();
}
bool
SBLaunchInfo::UserIDIsValid ()
{
return m_opaque_sp->UserIDIsValid();
}
bool
SBLaunchInfo::GroupIDIsValid ()
{
return m_opaque_sp->GroupIDIsValid();
}
void
SBLaunchInfo::SetUserID (uint32_t uid)
{
m_opaque_sp->SetUserID (uid);
}
void
SBLaunchInfo::SetGroupID (uint32_t gid)
{
m_opaque_sp->SetGroupID (gid);
}
SBFileSpec
SBLaunchInfo::GetExecutableFile ()
{
return SBFileSpec (m_opaque_sp->GetExecutableFile());
}
void
SBLaunchInfo::SetExecutableFile (SBFileSpec exe_file, bool add_as_first_arg)
{
m_opaque_sp->SetExecutableFile(exe_file.ref(), add_as_first_arg);
}
SBListener
SBLaunchInfo::GetListener ()
{
return SBListener(m_opaque_sp->GetListener());
}
void
SBLaunchInfo::SetListener (SBListener &listener)
{
m_opaque_sp->SetListener(listener.GetSP());
}
uint32_t
SBLaunchInfo::GetNumArguments ()
{
return m_opaque_sp->GetArguments().GetArgumentCount();
}
const char *
SBLaunchInfo::GetArgumentAtIndex (uint32_t idx)
{
return m_opaque_sp->GetArguments().GetArgumentAtIndex(idx);
}
void
SBLaunchInfo::SetArguments (const char **argv, bool append)
{
if (append)
{
if (argv)
m_opaque_sp->GetArguments().AppendArguments(argv);
}
else
{
if (argv)
m_opaque_sp->GetArguments().SetArguments(argv);
else
m_opaque_sp->GetArguments().Clear();
}
}
uint32_t
SBLaunchInfo::GetNumEnvironmentEntries ()
{
return m_opaque_sp->GetEnvironmentEntries().GetArgumentCount();
}
const char *
SBLaunchInfo::GetEnvironmentEntryAtIndex (uint32_t idx)
{
return m_opaque_sp->GetEnvironmentEntries().GetArgumentAtIndex(idx);
}
void
SBLaunchInfo::SetEnvironmentEntries (const char **envp, bool append)
{
if (append)
{
if (envp)
m_opaque_sp->GetEnvironmentEntries().AppendArguments(envp);
}
else
{
if (envp)
m_opaque_sp->GetEnvironmentEntries().SetArguments(envp);
else
m_opaque_sp->GetEnvironmentEntries().Clear();
}
}
void
SBLaunchInfo::Clear ()
{
m_opaque_sp->Clear();
}
const char *
SBLaunchInfo::GetWorkingDirectory () const
{
return m_opaque_sp->GetWorkingDirectory();
}
void
SBLaunchInfo::SetWorkingDirectory (const char *working_dir)
{
m_opaque_sp->SetWorkingDirectory(working_dir);
}
uint32_t
SBLaunchInfo::GetLaunchFlags ()
{
return m_opaque_sp->GetFlags().Get();
}
void
SBLaunchInfo::SetLaunchFlags (uint32_t flags)
{
m_opaque_sp->GetFlags().Reset(flags);
}
const char *
SBLaunchInfo::GetProcessPluginName ()
{
return m_opaque_sp->GetProcessPluginName();
}
void
SBLaunchInfo::SetProcessPluginName (const char *plugin_name)
{
return m_opaque_sp->SetProcessPluginName (plugin_name);
}
const char *
SBLaunchInfo::GetShell ()
{
// Constify this string so that it is saved in the string pool. Otherwise
// it would be freed when this function goes out of scope.
ConstString shell(m_opaque_sp->GetShell().GetPath().c_str());
return shell.AsCString();
}
void
SBLaunchInfo::SetShell (const char * path)
{
m_opaque_sp->SetShell (FileSpec(path, false));
}
uint32_t
SBLaunchInfo::GetResumeCount ()
{
return m_opaque_sp->GetResumeCount();
}
void
SBLaunchInfo::SetResumeCount (uint32_t c)
{
m_opaque_sp->SetResumeCount (c);
}
bool
SBLaunchInfo::AddCloseFileAction (int fd)
{
return m_opaque_sp->AppendCloseFileAction(fd);
}
bool
SBLaunchInfo::AddDuplicateFileAction (int fd, int dup_fd)
{
return m_opaque_sp->AppendDuplicateFileAction(fd, dup_fd);
}
bool
SBLaunchInfo::AddOpenFileAction (int fd, const char *path, bool read, bool write)
{
return m_opaque_sp->AppendOpenFileAction(fd, path, read, write);
}
bool
SBLaunchInfo::AddSuppressFileAction (int fd, bool read, bool write)
{
return m_opaque_sp->AppendSuppressFileAction(fd, read, write);
}
void
SBLaunchInfo::SetLaunchEventData (const char *data)
{
m_opaque_sp->SetLaunchEventData (data);
}
const char *
SBLaunchInfo::GetLaunchEventData () const
{
return m_opaque_sp->GetLaunchEventData ();
}
void
SBLaunchInfo::SetDetachOnError (bool enable)
{
m_opaque_sp->SetDetachOnError (enable);
}
bool
SBLaunchInfo::GetDetachOnError () const
{
return m_opaque_sp->GetDetachOnError ();
}

View File

@ -10,6 +10,7 @@
#include "lldb/API/SBPlatform.h"
#include "lldb/API/SBError.h"
#include "lldb/API/SBFileSpec.h"
#include "lldb/API/SBLaunchInfo.h"
#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/Error.h"
#include "lldb/Host/File.h"
@ -17,6 +18,8 @@
#include "lldb/Target/Target.h"
#include "lldb/Target/Platform.h"
#include <functional>
using namespace lldb;
using namespace lldb_private;
@ -484,104 +487,108 @@ SBError
SBPlatform::Put (SBFileSpec &src,
SBFileSpec &dst)
{
SBError sb_error;
PlatformSP platform_sp(GetSP());
if (platform_sp)
{
if (src.Exists())
{
uint32_t permissions = src.ref().GetPermissions();
if (permissions == 0)
{
if (src.ref().GetFileType() == FileSpec::eFileTypeDirectory)
permissions = eFilePermissionsDirectoryDefault;
else
permissions = eFilePermissionsFileDefault;
}
return ExecuteConnected(
[&](const lldb::PlatformSP& platform_sp)
{
if (src.Exists())
{
uint32_t permissions = src.ref().GetPermissions();
if (permissions == 0)
{
if (src.ref().GetFileType() == FileSpec::eFileTypeDirectory)
permissions = eFilePermissionsDirectoryDefault;
else
permissions = eFilePermissionsFileDefault;
}
sb_error.ref() = platform_sp->PutFile(src.ref(),
dst.ref(),
permissions);
}
else
{
sb_error.ref().SetErrorStringWithFormat("'src' argument doesn't exist: '%s'", src.ref().GetPath().c_str());
}
}
else
{
sb_error.SetErrorString("invalid platform");
}
return sb_error;
return platform_sp->PutFile(src.ref(), dst.ref(), permissions);
}
Error error;
error.SetErrorStringWithFormat("'src' argument doesn't exist: '%s'", src.ref().GetPath().c_str());
return error;
});
}
SBError
SBPlatform::Install (SBFileSpec &src,
SBFileSpec &dst)
{
SBError sb_error;
PlatformSP platform_sp(GetSP());
if (platform_sp)
{
if (src.Exists())
{
sb_error.ref() = platform_sp->Install(src.ref(), dst.ref());
}
else
{
sb_error.ref().SetErrorStringWithFormat("'src' argument doesn't exist: '%s'", src.ref().GetPath().c_str());
}
}
else
{
sb_error.SetErrorString("invalid platform");
}
return sb_error;
return ExecuteConnected(
[&](const lldb::PlatformSP& platform_sp)
{
if (src.Exists())
return platform_sp->Install(src.ref(), dst.ref());
Error error;
error.SetErrorStringWithFormat("'src' argument doesn't exist: '%s'", src.ref().GetPath().c_str());
return error;
});
}
SBError
SBPlatform::Run (SBPlatformShellCommand &shell_command)
{
return ExecuteConnected(
[&](const lldb::PlatformSP& platform_sp)
{
const char *command = shell_command.GetCommand();
if (!command)
return Error("invalid shell command (empty)");
const char *working_dir = shell_command.GetWorkingDirectory();
if (working_dir == NULL)
{
working_dir = platform_sp->GetWorkingDirectory().GetCString();
if (working_dir)
shell_command.SetWorkingDirectory(working_dir);
}
return platform_sp->RunShellCommand(command,
working_dir,
&shell_command.m_opaque_ptr->m_status,
&shell_command.m_opaque_ptr->m_signo,
&shell_command.m_opaque_ptr->m_output,
shell_command.m_opaque_ptr->m_timeout_sec);
});
}
SBError
SBPlatform::Launch (SBLaunchInfo &launch_info)
{
return ExecuteConnected(
[&](const lldb::PlatformSP& platform_sp)
{
return platform_sp->LaunchProcess(launch_info.ref());
});
}
SBError
SBPlatform::Kill (const lldb::pid_t pid)
{
return ExecuteConnected(
[&](const lldb::PlatformSP& platform_sp)
{
return platform_sp->KillProcess(pid);
});
}
SBError
SBPlatform::ExecuteConnected (const std::function<Error(const lldb::PlatformSP&)>& func)
{
SBError sb_error;
PlatformSP platform_sp(GetSP());
const auto platform_sp(GetSP());
if (platform_sp)
{
if (platform_sp->IsConnected())
{
const char *command = shell_command.GetCommand();
if (command)
{
const char *working_dir = shell_command.GetWorkingDirectory();
if (working_dir == NULL)
{
working_dir = platform_sp->GetWorkingDirectory().GetCString();
if (working_dir)
shell_command.SetWorkingDirectory(working_dir);
}
sb_error.ref() = platform_sp->RunShellCommand(command,
working_dir,
&shell_command.m_opaque_ptr->m_status,
&shell_command.m_opaque_ptr->m_signo,
&shell_command.m_opaque_ptr->m_output,
shell_command.m_opaque_ptr->m_timeout_sec);
}
else
{
sb_error.SetErrorString("invalid shell command (empty)");
}
}
sb_error.ref() = func(platform_sp);
else
{
sb_error.SetErrorString("not connected");
}
}
else
{
sb_error.SetErrorString("invalid platform");
}
return sb_error;
return sb_error;
}
SBError

View File

@ -70,6 +70,9 @@ SBStream::Printf (const char *format, ...)
void
SBStream::RedirectToFile (const char *path, bool append)
{
if (path == nullptr)
return;
std::string local_data;
if (m_opaque_ap.get())
{
@ -104,6 +107,9 @@ SBStream::RedirectToFile (const char *path, bool append)
void
SBStream::RedirectToFileHandle (FILE *fh, bool transfer_fh_ownership)
{
if (fh == nullptr)
return;
std::string local_data;
if (m_opaque_ap.get())
{

View File

@ -66,259 +66,6 @@ using namespace lldb_private;
#define DEFAULT_DISASM_BYTE_SIZE 32
SBLaunchInfo::SBLaunchInfo (const char **argv) :
m_opaque_sp(new ProcessLaunchInfo())
{
m_opaque_sp->GetFlags().Reset (eLaunchFlagDebug | eLaunchFlagDisableASLR);
if (argv && argv[0])
m_opaque_sp->GetArguments().SetArguments(argv);
}
SBLaunchInfo::~SBLaunchInfo()
{
}
lldb_private::ProcessLaunchInfo &
SBLaunchInfo::ref ()
{
return *m_opaque_sp;
}
uint32_t
SBLaunchInfo::GetUserID()
{
return m_opaque_sp->GetUserID();
}
uint32_t
SBLaunchInfo::GetGroupID()
{
return m_opaque_sp->GetGroupID();
}
bool
SBLaunchInfo::UserIDIsValid ()
{
return m_opaque_sp->UserIDIsValid();
}
bool
SBLaunchInfo::GroupIDIsValid ()
{
return m_opaque_sp->GroupIDIsValid();
}
void
SBLaunchInfo::SetUserID (uint32_t uid)
{
m_opaque_sp->SetUserID (uid);
}
void
SBLaunchInfo::SetGroupID (uint32_t gid)
{
m_opaque_sp->SetGroupID (gid);
}
SBFileSpec
SBLaunchInfo::GetExecutableFile ()
{
return SBFileSpec (m_opaque_sp->GetExecutableFile());
}
void
SBLaunchInfo::SetExecutableFile (SBFileSpec exe_file, bool add_as_first_arg)
{
m_opaque_sp->SetExecutableFile(exe_file.ref(), add_as_first_arg);
}
SBListener
SBLaunchInfo::GetListener ()
{
return SBListener(m_opaque_sp->GetListener());
}
void
SBLaunchInfo::SetListener (SBListener &listener)
{
m_opaque_sp->SetListener(listener.GetSP());
}
uint32_t
SBLaunchInfo::GetNumArguments ()
{
return m_opaque_sp->GetArguments().GetArgumentCount();
}
const char *
SBLaunchInfo::GetArgumentAtIndex (uint32_t idx)
{
return m_opaque_sp->GetArguments().GetArgumentAtIndex(idx);
}
void
SBLaunchInfo::SetArguments (const char **argv, bool append)
{
if (append)
{
if (argv)
m_opaque_sp->GetArguments().AppendArguments(argv);
}
else
{
if (argv)
m_opaque_sp->GetArguments().SetArguments(argv);
else
m_opaque_sp->GetArguments().Clear();
}
}
uint32_t
SBLaunchInfo::GetNumEnvironmentEntries ()
{
return m_opaque_sp->GetEnvironmentEntries().GetArgumentCount();
}
const char *
SBLaunchInfo::GetEnvironmentEntryAtIndex (uint32_t idx)
{
return m_opaque_sp->GetEnvironmentEntries().GetArgumentAtIndex(idx);
}
void
SBLaunchInfo::SetEnvironmentEntries (const char **envp, bool append)
{
if (append)
{
if (envp)
m_opaque_sp->GetEnvironmentEntries().AppendArguments(envp);
}
else
{
if (envp)
m_opaque_sp->GetEnvironmentEntries().SetArguments(envp);
else
m_opaque_sp->GetEnvironmentEntries().Clear();
}
}
void
SBLaunchInfo::Clear ()
{
m_opaque_sp->Clear();
}
const char *
SBLaunchInfo::GetWorkingDirectory () const
{
return m_opaque_sp->GetWorkingDirectory();
}
void
SBLaunchInfo::SetWorkingDirectory (const char *working_dir)
{
m_opaque_sp->SetWorkingDirectory(working_dir);
}
uint32_t
SBLaunchInfo::GetLaunchFlags ()
{
return m_opaque_sp->GetFlags().Get();
}
void
SBLaunchInfo::SetLaunchFlags (uint32_t flags)
{
m_opaque_sp->GetFlags().Reset(flags);
}
const char *
SBLaunchInfo::GetProcessPluginName ()
{
return m_opaque_sp->GetProcessPluginName();
}
void
SBLaunchInfo::SetProcessPluginName (const char *plugin_name)
{
return m_opaque_sp->SetProcessPluginName (plugin_name);
}
const char *
SBLaunchInfo::GetShell ()
{
// Constify this string so that it is saved in the string pool. Otherwise
// it would be freed when this function goes out of scope.
ConstString shell(m_opaque_sp->GetShell().GetPath().c_str());
return shell.AsCString();
}
void
SBLaunchInfo::SetShell (const char * path)
{
m_opaque_sp->SetShell (FileSpec(path, false));
}
uint32_t
SBLaunchInfo::GetResumeCount ()
{
return m_opaque_sp->GetResumeCount();
}
void
SBLaunchInfo::SetResumeCount (uint32_t c)
{
m_opaque_sp->SetResumeCount (c);
}
bool
SBLaunchInfo::AddCloseFileAction (int fd)
{
return m_opaque_sp->AppendCloseFileAction(fd);
}
bool
SBLaunchInfo::AddDuplicateFileAction (int fd, int dup_fd)
{
return m_opaque_sp->AppendDuplicateFileAction(fd, dup_fd);
}
bool
SBLaunchInfo::AddOpenFileAction (int fd, const char *path, bool read, bool write)
{
return m_opaque_sp->AppendOpenFileAction(fd, path, read, write);
}
bool
SBLaunchInfo::AddSuppressFileAction (int fd, bool read, bool write)
{
return m_opaque_sp->AppendSuppressFileAction(fd, read, write);
}
void
SBLaunchInfo::SetLaunchEventData (const char *data)
{
m_opaque_sp->SetLaunchEventData (data);
}
const char *
SBLaunchInfo::GetLaunchEventData () const
{
return m_opaque_sp->GetLaunchEventData ();
}
void
SBLaunchInfo::SetDetachOnError (bool enable)
{
m_opaque_sp->SetDetachOnError (enable);
}
bool
SBLaunchInfo::GetDetachOnError () const
{
return m_opaque_sp->GetDetachOnError ();
}
SBAttachInfo::SBAttachInfo () :
m_opaque_sp (new ProcessAttachInfo())
@ -729,6 +476,9 @@ SBTarget::Launch
{
Mutex::Locker api_locker (target_sp->GetAPIMutex());
if (stop_at_entry)
launch_flags |= eLaunchFlagStopAtEntry;
if (getenv("LLDB_LAUNCH_FLAG_DISABLE_ASLR"))
launch_flags |= eLaunchFlagDisableASLR;

View File

@ -1491,7 +1491,8 @@ SBThread::GetDescription (SBStream &description) const
ExecutionContext exe_ctx (m_opaque_sp.get());
if (exe_ctx.HasThreadScope())
{
strm.Printf("SBThread: tid = 0x%4.4" PRIx64, exe_ctx.GetThreadPtr()->GetID());
exe_ctx.GetThreadPtr()->DumpUsingSettingsFormat(strm, LLDB_INVALID_THREAD_ID);
//strm.Printf("SBThread: tid = 0x%4.4" PRIx64, exe_ctx.GetThreadPtr()->GetID());
}
else
strm.PutCString ("No value");

View File

@ -143,7 +143,7 @@ SBType::GetByteSize()
if (!IsValid())
return 0;
return m_opaque_sp->GetClangASTType(false).GetByteSize();
return m_opaque_sp->GetClangASTType(false).GetByteSize(nullptr);
}
@ -163,6 +163,14 @@ SBType::IsArrayType()
return m_opaque_sp->GetClangASTType(true).IsArrayType(nullptr, nullptr, nullptr);
}
bool
SBType::IsVectorType()
{
if (!IsValid())
return false;
return m_opaque_sp->GetClangASTType(true).IsVectorType(nullptr, nullptr);
}
bool
SBType::IsReferenceType()
{
@ -220,7 +228,20 @@ SBType::GetArrayElementType()
return SBType(TypeImplSP(new TypeImpl(m_opaque_sp->GetClangASTType(true).GetArrayElementType())));
}
bool
SBType
SBType::GetVectorElementType ()
{
SBType type_sb;
if (IsValid())
{
ClangASTType vector_element_type;
if (m_opaque_sp->GetClangASTType(true).IsVectorType(&vector_element_type, nullptr))
type_sb.SetSP(TypeImplSP(new TypeImpl(vector_element_type)));
}
return type_sb;
}
bool
SBType::IsFunctionType ()
{
if (!IsValid())

View File

@ -353,7 +353,7 @@ SBTypeCategory::AddTypeSummary (SBTypeNameSpecifier type_name,
// this should eventually be fixed by deciding a final location in the LLDB object space for formatters
if (summary.IsFunctionCode())
{
void *name_token = (void*)ConstString(type_name.GetName()).GetCString();
const void *name_token = (const void*)ConstString(type_name.GetName()).GetCString();
const char* script = summary.GetData();
StringList input; input.SplitIntoLines(script, strlen(script));
uint32_t num_debuggers = lldb_private::Debugger::GetNumDebuggers();
@ -461,7 +461,7 @@ SBTypeCategory::AddTypeSynthetic (SBTypeNameSpecifier type_name,
// this should eventually be fixed by deciding a final location in the LLDB object space for formatters
if (synth.IsClassCode())
{
void *name_token = (void*)ConstString(type_name.GetName()).GetCString();
const void *name_token = (const void*)ConstString(type_name.GetName()).GetCString();
const char* script = synth.GetData();
StringList input; input.SplitIntoLines(script, strlen(script));
uint32_t num_debuggers = lldb_private::Debugger::GetNumDebuggers();

View File

@ -608,7 +608,8 @@ SBValue::GetValueDidChange ()
lldb::ValueObjectSP value_sp(GetSP(locker));
if (value_sp)
{
result = value_sp->GetValueDidChange ();
if (value_sp->UpdateValueIfNeeded(false))
result = value_sp->GetValueDidChange ();
}
if (log)
log->Printf ("SBValue(%p)::GetValueDidChange() => %i",

View File

@ -60,7 +60,8 @@ Breakpoint::Breakpoint(Target &target,
m_resolver_sp (resolver_sp),
m_options (),
m_locations (*this),
m_resolve_indirect_symbols(resolve_indirect_symbols)
m_resolve_indirect_symbols(resolve_indirect_symbols),
m_hit_count(0)
{
m_being_created = false;
}
@ -72,7 +73,8 @@ Breakpoint::Breakpoint (Target &new_target, Breakpoint &source_bp) :
m_name_list (source_bp.m_name_list),
m_options (source_bp.m_options),
m_locations(*this),
m_resolve_indirect_symbols(source_bp.m_resolve_indirect_symbols)
m_resolve_indirect_symbols(source_bp.m_resolve_indirect_symbols),
m_hit_count(0)
{
// Now go through and copy the filter & resolver:
m_resolver_sp = source_bp.m_resolver_sp->CopyForBreakpoint(*this);
@ -207,7 +209,7 @@ Breakpoint::IgnoreCountShouldStop ()
uint32_t
Breakpoint::GetHitCount () const
{
return m_locations.GetHitCount();
return m_hit_count;
}
bool

View File

@ -477,7 +477,22 @@ void
BreakpointLocation::BumpHitCount()
{
if (IsEnabled())
{
// Step our hit count, and also step the hit count of the owner.
IncrementHitCount();
m_owner.IncrementHitCount();
}
}
void
BreakpointLocation::UndoBumpHitCount()
{
if (IsEnabled())
{
// Step our hit count, and also step the hit count of the owner.
DecrementHitCount();
m_owner.DecrementHitCount();
}
}
bool

View File

@ -46,3 +46,10 @@ StoppointLocation::StoppointLocation (break_id_t bid, addr_t addr, uint32_t byte
StoppointLocation::~StoppointLocation()
{
}
void
StoppointLocation::DecrementHitCount ()
{
assert (m_hit_count > 0);
--m_hit_count;
}

View File

@ -19,6 +19,7 @@
#include "lldb/Breakpoint/Breakpoint.h"
#include "lldb/Breakpoint/BreakpointIDList.h"
#include "lldb/Breakpoint/BreakpointLocation.h"
#include "lldb/Host/StringConvert.h"
#include "lldb/Interpreter/Options.h"
#include "lldb/Interpreter/OptionValueString.h"
#include "lldb/Interpreter/OptionValueUInt64.h"
@ -140,7 +141,7 @@ class CommandObjectBreakpointSet : public CommandObjectParsed
break;
case 'C':
m_column = Args::StringToUInt32 (option_arg, 0);
m_column = StringConvert::ToUInt32 (option_arg, 0);
break;
case 'c':
@ -166,6 +167,7 @@ class CommandObjectBreakpointSet : public CommandObjectParsed
case eLanguageTypeC_plus_plus:
case eLanguageTypeC_plus_plus_03:
case eLanguageTypeC_plus_plus_11:
case eLanguageTypeC_plus_plus_14:
m_language = eLanguageTypeC_plus_plus;
break;
case eLanguageTypeObjC:
@ -207,7 +209,7 @@ class CommandObjectBreakpointSet : public CommandObjectParsed
case 'i':
{
m_ignore_count = Args::StringToUInt32(option_arg, UINT32_MAX, 0);
m_ignore_count = StringConvert::ToUInt32(option_arg, UINT32_MAX, 0);
if (m_ignore_count == UINT32_MAX)
error.SetErrorStringWithFormat ("invalid ignore count '%s'", option_arg);
break;
@ -229,7 +231,7 @@ class CommandObjectBreakpointSet : public CommandObjectParsed
break;
case 'l':
m_line_num = Args::StringToUInt32 (option_arg, 0);
m_line_num = StringConvert::ToUInt32 (option_arg, 0);
break;
case 'M':
@ -276,7 +278,7 @@ class CommandObjectBreakpointSet : public CommandObjectParsed
case 't' :
{
m_thread_id = Args::StringToUInt64(option_arg, LLDB_INVALID_THREAD_ID, 0);
m_thread_id = StringConvert::ToUInt64(option_arg, LLDB_INVALID_THREAD_ID, 0);
if (m_thread_id == LLDB_INVALID_THREAD_ID)
error.SetErrorStringWithFormat ("invalid thread id string '%s'", option_arg);
}
@ -297,7 +299,7 @@ class CommandObjectBreakpointSet : public CommandObjectParsed
case 'x':
{
m_thread_index = Args::StringToUInt32(option_arg, UINT32_MAX, 0);
m_thread_index = StringConvert::ToUInt32(option_arg, UINT32_MAX, 0);
if (m_thread_id == UINT32_MAX)
error.SetErrorStringWithFormat ("invalid thread index string '%s'", option_arg);
@ -838,7 +840,7 @@ class CommandObjectBreakpointModify : public CommandObjectParsed
break;
case 'i':
{
m_ignore_count = Args::StringToUInt32(option_arg, UINT32_MAX, 0);
m_ignore_count = StringConvert::ToUInt32(option_arg, UINT32_MAX, 0);
if (m_ignore_count == UINT32_MAX)
error.SetErrorStringWithFormat ("invalid ignore count '%s'", option_arg);
}
@ -865,7 +867,7 @@ class CommandObjectBreakpointModify : public CommandObjectParsed
}
else
{
m_thread_id = Args::StringToUInt64(option_arg, LLDB_INVALID_THREAD_ID, 0);
m_thread_id = StringConvert::ToUInt64(option_arg, LLDB_INVALID_THREAD_ID, 0);
if (m_thread_id == LLDB_INVALID_THREAD_ID)
error.SetErrorStringWithFormat ("invalid thread id string '%s'", option_arg);
else
@ -896,7 +898,7 @@ class CommandObjectBreakpointModify : public CommandObjectParsed
}
else
{
m_thread_index = Args::StringToUInt32 (option_arg, UINT32_MAX, 0);
m_thread_index = StringConvert::ToUInt32 (option_arg, UINT32_MAX, 0);
if (m_thread_id == UINT32_MAX)
error.SetErrorStringWithFormat ("invalid thread index string '%s'", option_arg);
else
@ -1555,7 +1557,7 @@ class CommandObjectBreakpointClear : public CommandObjectParsed
break;
case 'l':
m_line_num = Args::StringToUInt32 (option_arg, 0);
m_line_num = StringConvert::ToUInt32 (option_arg, 0);
break;
default:

View File

@ -19,7 +19,7 @@
#include "lldb/Core/Disassembler.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/SourceManager.h"
#include "lldb/Interpreter/Args.h"
#include "lldb/Host/StringConvert.h"
#include "lldb/Interpreter/CommandCompletions.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Interpreter/CommandReturnObject.h"
@ -76,13 +76,13 @@ CommandObjectDisassemble::CommandOptions::SetOptionValue (uint32_t option_idx, c
break;
case 'C':
num_lines_context = Args::StringToUInt32(option_arg, 0, 0, &success);
num_lines_context = StringConvert::ToUInt32(option_arg, 0, 0, &success);
if (!success)
error.SetErrorStringWithFormat ("invalid num context lines string: \"%s\"", option_arg);
break;
case 'c':
num_instructions = Args::StringToUInt32(option_arg, 0, 0, &success);
num_instructions = StringConvert::ToUInt32(option_arg, 0, 0, &success);
if (!success)
error.SetErrorStringWithFormat ("invalid num of instructions string: \"%s\"", option_arg);
break;

View File

@ -15,7 +15,6 @@
// C++ Includes
// Other libraries and framework includes
// Project includes
#include "lldb/Interpreter/Args.h"
#include "lldb/Core/Value.h"
#include "lldb/Core/ValueObjectVariable.h"
#include "lldb/DataFormatters/ValueObjectPrinter.h"
@ -24,6 +23,7 @@
#include "lldb/Expression/ClangFunction.h"
#include "lldb/Expression/DWARFExpression.h"
#include "lldb/Host/Host.h"
#include "lldb/Host/StringConvert.h"
#include "lldb/Core/Debugger.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Interpreter/CommandReturnObject.h"
@ -119,7 +119,7 @@ CommandObjectExpression::CommandOptions::SetOptionValue (CommandInterpreter &int
{
bool success;
uint32_t result;
result = Args::StringToUInt32(option_arg, 0, 0, &success);
result = StringConvert::ToUInt32(option_arg, 0, 0, &success);
if (success)
timeout = result;
else

View File

@ -27,6 +27,7 @@
#include "lldb/DataFormatters/DataVisualization.h"
#include "lldb/DataFormatters/ValueObjectPrinter.h"
#include "lldb/Host/Host.h"
#include "lldb/Host/StringConvert.h"
#include "lldb/Interpreter/Args.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Interpreter/CommandReturnObject.h"
@ -119,7 +120,7 @@ class CommandObjectFrameSelect : public CommandObjectParsed
switch (short_option)
{
case 'r':
relative_frame_offset = Args::StringToSInt32 (option_arg, INT32_MIN, 0, &success);
relative_frame_offset = StringConvert::ToSInt32 (option_arg, INT32_MIN, 0, &success);
if (!success)
error.SetErrorStringWithFormat ("invalid frame offset argument '%s'", option_arg);
break;
@ -246,7 +247,7 @@ class CommandObjectFrameSelect : public CommandObjectParsed
{
const char *frame_idx_cstr = command.GetArgumentAtIndex(0);
bool success = false;
frame_idx = Args::StringToUInt32 (frame_idx_cstr, UINT32_MAX, 0, &success);
frame_idx = StringConvert::ToUInt32 (frame_idx_cstr, UINT32_MAX, 0, &success);
if (!success)
{
result.AppendErrorWithFormat ("invalid frame index argument '%s'", frame_idx_cstr);

View File

@ -42,10 +42,22 @@ CommandObjectGUI::DoExecute (Args& args, CommandReturnObject &result)
if (args.GetArgumentCount() == 0)
{
Debugger &debugger = m_interpreter.GetDebugger();
IOHandlerSP io_handler_sp (new IOHandlerCursesGUI (debugger));
if (io_handler_sp)
debugger.PushIOHandler(io_handler_sp);
result.SetStatus (eReturnStatusSuccessFinishResult);
lldb::StreamFileSP input_sp = debugger.GetInputFile();
if (input_sp &&
input_sp->GetFile().GetIsRealTerminal() &&
input_sp->GetFile().GetIsInteractive())
{
IOHandlerSP io_handler_sp (new IOHandlerCursesGUI (debugger));
if (io_handler_sp)
debugger.PushIOHandler(io_handler_sp);
result.SetStatus (eReturnStatusSuccessFinishResult);
}
else
{
result.AppendError("the gui command requires an interactive terminal.");
result.SetStatus (eReturnStatusFailed);
}
}
else
{

View File

@ -54,9 +54,10 @@ CommandObjectHelp::~CommandObjectHelp()
OptionDefinition
CommandObjectHelp::CommandOptions::g_option_table[] =
{
{ LLDB_OPT_SET_ALL, false, "show-aliases", 'a', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone, "Show aliases in the command list."},
{ LLDB_OPT_SET_ALL, false, "hide-aliases", 'a', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone, "Hide aliases in the command list."},
{ LLDB_OPT_SET_ALL, false, "hide-user-commands", 'u', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone, "Hide user-defined commands from the list."},
{ 0, false, NULL, 0, 0, NULL, NULL, 0, eArgTypeNone, NULL }
{ LLDB_OPT_SET_ALL, false, "show-hidden-commands", 'h', OptionParser::eNoArgument, NULL, NULL, 0, eArgTypeNone, "Include commands prefixed with an underscore."},
{ 0, false, NULL, 0, 0, 0, NULL, 0, eArgTypeNone, NULL }
};
bool
@ -75,6 +76,8 @@ CommandObjectHelp::DoExecute (Args& command, CommandReturnObject &result)
cmd_types |= CommandInterpreter::eCommandTypesAliases;
if (m_options.m_show_user_defined)
cmd_types |= CommandInterpreter::eCommandTypesUserDef;
if (m_options.m_show_hidden)
cmd_types |= CommandInterpreter::eCommandTypesHidden;
result.SetStatus (eReturnStatusSuccessFinishNoResult);
m_interpreter.GetHelp (result, cmd_types); // General help
@ -136,17 +139,19 @@ CommandObjectHelp::DoExecute (Args& command, CommandReturnObject &result)
else if (!sub_cmd_obj)
{
result.AppendErrorWithFormat("'%s' is not a known command.\n"
"Try 'help' to see a current list of commands.\n",
cmd_string.c_str());
"Try '%shelp' to see a current list of commands.\n",
cmd_string.c_str(),
m_interpreter.GetCommandPrefix());
result.SetStatus (eReturnStatusFailed);
return false;
}
else
{
result.GetOutputStream().Printf("'%s' is not a known command.\n"
"Try 'help' to see a current list of commands.\n"
"Try '%shelp' to see a current list of commands.\n"
"The closest match is '%s'. Help on it follows.\n\n",
cmd_string.c_str(),
m_interpreter.GetCommandPrefix(),
sub_cmd_obj->GetCommandName());
}
}
@ -183,8 +188,9 @@ CommandObjectHelp::DoExecute (Args& command, CommandReturnObject &result)
else
{
result.AppendErrorWithFormat
("'%s' is not a known command.\nTry 'help' to see a current list of commands.\n",
command.GetArgumentAtIndex(0));
("'%s' is not a known command.\nTry '%shelp' to see a current list of commands.\n",
command.GetArgumentAtIndex(0),
m_interpreter.GetCommandPrefix());
result.SetStatus (eReturnStatusFailed);
}
}

View File

@ -62,11 +62,14 @@ class CommandObjectHelp : public CommandObjectParsed
switch (short_option)
{
case 'a':
m_show_aliases = true;
m_show_aliases = false;
break;
case 'u':
m_show_user_defined = false;
break;
case 'h':
m_show_hidden = true;
break;
default:
error.SetErrorStringWithFormat ("unrecognized option '%c'", short_option);
break;
@ -78,8 +81,9 @@ class CommandObjectHelp : public CommandObjectParsed
void
OptionParsingStarting ()
{
m_show_aliases = false;
m_show_aliases = true;
m_show_user_defined = true;
m_show_hidden = false;
}
const OptionDefinition*
@ -95,7 +99,8 @@ class CommandObjectHelp : public CommandObjectParsed
// Instance variables to hold the values for command options.
bool m_show_aliases;
bool m_show_user_defined;
bool m_show_user_defined;
bool m_show_hidden;
};
virtual Options *

View File

@ -29,6 +29,7 @@
#include "lldb/Core/Timer.h"
#include "lldb/Core/Debugger.h"
#include "lldb/Host/StringConvert.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Interpreter/CommandReturnObject.h"
@ -444,7 +445,7 @@ class CommandObjectLogTimer : public CommandObjectParsed
if (strcasecmp(sub_command, "enable") == 0)
{
bool success;
uint32_t depth = Args::StringToUInt32(args.GetArgumentAtIndex(1), 0, 0, &success);
uint32_t depth = StringConvert::ToUInt32(args.GetArgumentAtIndex(1), 0, 0, &success);
if (success)
{
Timer::SetDisplayDepth (depth);

View File

@ -24,6 +24,7 @@
#include "lldb/Core/StreamString.h"
#include "lldb/Core/ValueObjectMemory.h"
#include "lldb/DataFormatters/ValueObjectPrinter.h"
#include "lldb/Host/StringConvert.h"
#include "lldb/Interpreter/Args.h"
#include "lldb/Interpreter/CommandReturnObject.h"
#include "lldb/Interpreter/CommandInterpreter.h"
@ -566,7 +567,7 @@ class CommandObjectMemoryRead : public CommandObjectParsed
--pointer_count;
}
m_format_options.GetByteSizeValue() = clang_ast_type.GetByteSize();
m_format_options.GetByteSizeValue() = clang_ast_type.GetByteSize(nullptr);
if (m_format_options.GetByteSizeValue() == 0)
{
@ -689,7 +690,7 @@ class CommandObjectMemoryRead : public CommandObjectParsed
if (m_format_options.GetFormatValue().OptionWasSet() == false)
m_format_options.GetFormatValue().SetCurrentValue(eFormatDefault);
bytes_read = clang_ast_type.GetByteSize() * m_format_options.GetCountValue().GetCurrentValue();
bytes_read = clang_ast_type.GetByteSize(nullptr) * m_format_options.GetCountValue().GetCurrentValue();
}
else if (m_format_options.GetFormatValue().GetCurrentValue() != eFormatCString)
{
@ -1113,7 +1114,7 @@ class CommandObjectMemoryFind : public CommandObjectParsed
if (process->GetTarget().EvaluateExpression(m_memory_options.m_expr.GetStringValue(), frame, result_sp) && result_sp.get())
{
uint64_t value = result_sp->GetValueAsUnsigned(0);
switch (result_sp->GetClangType().GetByteSize())
switch (result_sp->GetClangType().GetByteSize(nullptr))
{
case 1: {
uint8_t byte = (uint8_t)value;
@ -1293,7 +1294,7 @@ class CommandObjectMemoryWrite : public CommandObjectParsed
case 'o':
{
bool success;
m_infile_offset = Args::StringToUInt64(option_arg, 0, 0, &success);
m_infile_offset = StringConvert::ToUInt64(option_arg, 0, 0, &success);
if (!success)
{
error.SetErrorStringWithFormat("invalid offset string '%s'", option_arg);
@ -1446,7 +1447,7 @@ class CommandObjectMemoryWrite : public CommandObjectParsed
if (m_memory_options.m_infile)
{
size_t length = SIZE_MAX;
if (item_byte_size > 0)
if (item_byte_size > 1)
length = item_byte_size;
lldb::DataBufferSP data_sp (m_memory_options.m_infile.ReadFileContents (m_memory_options.m_infile_offset, length));
if (data_sp)
@ -1539,7 +1540,7 @@ class CommandObjectMemoryWrite : public CommandObjectParsed
case eFormatPointer:
// Decode hex bytes
uval64 = Args::StringToUInt64(value_str, UINT64_MAX, 16, &success);
uval64 = StringConvert::ToUInt64(value_str, UINT64_MAX, 16, &success);
if (!success)
{
result.AppendErrorWithFormat ("'%s' is not a valid hex string value.\n", value_str);
@ -1567,7 +1568,7 @@ class CommandObjectMemoryWrite : public CommandObjectParsed
break;
case eFormatBinary:
uval64 = Args::StringToUInt64(value_str, UINT64_MAX, 2, &success);
uval64 = StringConvert::ToUInt64(value_str, UINT64_MAX, 2, &success);
if (!success)
{
result.AppendErrorWithFormat ("'%s' is not a valid binary string value.\n", value_str);
@ -1607,7 +1608,7 @@ class CommandObjectMemoryWrite : public CommandObjectParsed
break;
case eFormatDecimal:
sval64 = Args::StringToSInt64(value_str, INT64_MAX, 0, &success);
sval64 = StringConvert::ToSInt64(value_str, INT64_MAX, 0, &success);
if (!success)
{
result.AppendErrorWithFormat ("'%s' is not a valid signed decimal value.\n", value_str);
@ -1624,7 +1625,7 @@ class CommandObjectMemoryWrite : public CommandObjectParsed
break;
case eFormatUnsigned:
uval64 = Args::StringToUInt64(value_str, UINT64_MAX, 0, &success);
uval64 = StringConvert::ToUInt64(value_str, UINT64_MAX, 0, &success);
if (!success)
{
result.AppendErrorWithFormat ("'%s' is not a valid unsigned decimal string value.\n", value_str);
@ -1641,7 +1642,7 @@ class CommandObjectMemoryWrite : public CommandObjectParsed
break;
case eFormatOctal:
uval64 = Args::StringToUInt64(value_str, UINT64_MAX, 8, &success);
uval64 = StringConvert::ToUInt64(value_str, UINT64_MAX, 8, &success);
if (!success)
{
result.AppendErrorWithFormat ("'%s' is not a valid octal string value.\n", value_str);

View File

@ -19,6 +19,7 @@
#include "lldb/Core/Debugger.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Host/StringConvert.h"
#include "lldb/Interpreter/Args.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Interpreter/CommandOptionValidators.h"
@ -104,7 +105,7 @@ class OptionPermissions : public lldb_private::OptionGroup
case 'v':
{
bool ok;
uint32_t perms = Args::StringToUInt32(option_arg, 777, 8, &ok);
uint32_t perms = StringConvert::ToUInt32(option_arg, 777, 8, &ok);
if (!ok)
error.SetErrorStringWithFormat("invalid value for permissions: %s", option_arg);
else
@ -248,6 +249,8 @@ class CommandObjectPlatformSelect : public CommandObjectParsed
PlatformSP platform_sp (m_platform_options.CreatePlatformWithOptions (m_interpreter, ArchSpec(), select, error, platform_arch));
if (platform_sp)
{
m_interpreter.GetDebugger().GetPlatformList().SetSelectedPlatform(platform_sp);
platform_sp->GetStatus (result.GetOutputStream());
result.SetStatus (eReturnStatusSuccessFinishResult);
}
@ -613,7 +616,7 @@ class CommandObjectPlatformMkDir : public CommandObjectParsed
std::string cmd_line;
args.GetCommandString(cmd_line);
uint32_t mode;
const OptionPermissions* options_permissions = (OptionPermissions*)m_options.GetGroupWithOption('r');
const OptionPermissions* options_permissions = (const OptionPermissions*)m_options.GetGroupWithOption('r');
if (options_permissions)
mode = options_permissions->m_permissions;
else
@ -682,7 +685,7 @@ class CommandObjectPlatformFOpen : public CommandObjectParsed
std::string cmd_line;
args.GetCommandString(cmd_line);
mode_t perms;
const OptionPermissions* options_permissions = (OptionPermissions*)m_options.GetGroupWithOption('r');
const OptionPermissions* options_permissions = (const OptionPermissions*)m_options.GetGroupWithOption('r');
if (options_permissions)
perms = options_permissions->m_permissions;
else
@ -751,7 +754,7 @@ class CommandObjectPlatformFClose : public CommandObjectParsed
{
std::string cmd_line;
args.GetCommandString(cmd_line);
const lldb::user_id_t fd = Args::StringToUInt64(cmd_line.c_str(), UINT64_MAX);
const lldb::user_id_t fd = StringConvert::ToUInt64(cmd_line.c_str(), UINT64_MAX);
Error error;
bool success = platform_sp->CloseFile(fd, error);
if (success)
@ -803,7 +806,7 @@ class CommandObjectPlatformFRead : public CommandObjectParsed
{
std::string cmd_line;
args.GetCommandString(cmd_line);
const lldb::user_id_t fd = Args::StringToUInt64(cmd_line.c_str(), UINT64_MAX);
const lldb::user_id_t fd = StringConvert::ToUInt64(cmd_line.c_str(), UINT64_MAX);
std::string buffer(m_options.m_count,0);
Error error;
uint32_t retcode = platform_sp->ReadFile(fd, m_options.m_offset, &buffer[0], m_options.m_count, error);
@ -849,12 +852,12 @@ class CommandObjectPlatformFRead : public CommandObjectParsed
switch (short_option)
{
case 'o':
m_offset = Args::StringToUInt32(option_arg, 0, 0, &success);
m_offset = StringConvert::ToUInt32(option_arg, 0, 0, &success);
if (!success)
error.SetErrorStringWithFormat("invalid offset: '%s'", option_arg);
break;
case 'c':
m_count = Args::StringToUInt32(option_arg, 0, 0, &success);
m_count = StringConvert::ToUInt32(option_arg, 0, 0, &success);
if (!success)
error.SetErrorStringWithFormat("invalid offset: '%s'", option_arg);
break;
@ -930,7 +933,7 @@ class CommandObjectPlatformFWrite : public CommandObjectParsed
std::string cmd_line;
args.GetCommandString(cmd_line);
Error error;
const lldb::user_id_t fd = Args::StringToUInt64(cmd_line.c_str(), UINT64_MAX);
const lldb::user_id_t fd = StringConvert::ToUInt64(cmd_line.c_str(), UINT64_MAX);
uint32_t retcode = platform_sp->WriteFile (fd,
m_options.m_offset,
&m_options.m_data[0],
@ -977,7 +980,7 @@ class CommandObjectPlatformFWrite : public CommandObjectParsed
switch (short_option)
{
case 'o':
m_offset = Args::StringToUInt32(option_arg, 0, 0, &success);
m_offset = StringConvert::ToUInt32(option_arg, 0, 0, &success);
if (!success)
error.SetErrorStringWithFormat("invalid offset: '%s'", option_arg);
break;
@ -1537,37 +1540,37 @@ class CommandObjectPlatformProcessList : public CommandObjectParsed
switch (short_option)
{
case 'p':
match_info.GetProcessInfo().SetProcessID (Args::StringToUInt32 (option_arg, LLDB_INVALID_PROCESS_ID, 0, &success));
match_info.GetProcessInfo().SetProcessID (StringConvert::ToUInt32 (option_arg, LLDB_INVALID_PROCESS_ID, 0, &success));
if (!success)
error.SetErrorStringWithFormat("invalid process ID string: '%s'", option_arg);
break;
case 'P':
match_info.GetProcessInfo().SetParentProcessID (Args::StringToUInt32 (option_arg, LLDB_INVALID_PROCESS_ID, 0, &success));
match_info.GetProcessInfo().SetParentProcessID (StringConvert::ToUInt32 (option_arg, LLDB_INVALID_PROCESS_ID, 0, &success));
if (!success)
error.SetErrorStringWithFormat("invalid parent process ID string: '%s'", option_arg);
break;
case 'u':
match_info.GetProcessInfo().SetUserID (Args::StringToUInt32 (option_arg, UINT32_MAX, 0, &success));
match_info.GetProcessInfo().SetUserID (StringConvert::ToUInt32 (option_arg, UINT32_MAX, 0, &success));
if (!success)
error.SetErrorStringWithFormat("invalid user ID string: '%s'", option_arg);
break;
case 'U':
match_info.GetProcessInfo().SetEffectiveUserID (Args::StringToUInt32 (option_arg, UINT32_MAX, 0, &success));
match_info.GetProcessInfo().SetEffectiveUserID (StringConvert::ToUInt32 (option_arg, UINT32_MAX, 0, &success));
if (!success)
error.SetErrorStringWithFormat("invalid effective user ID string: '%s'", option_arg);
break;
case 'g':
match_info.GetProcessInfo().SetGroupID (Args::StringToUInt32 (option_arg, UINT32_MAX, 0, &success));
match_info.GetProcessInfo().SetGroupID (StringConvert::ToUInt32 (option_arg, UINT32_MAX, 0, &success));
if (!success)
error.SetErrorStringWithFormat("invalid group ID string: '%s'", option_arg);
break;
case 'G':
match_info.GetProcessInfo().SetEffectiveGroupID (Args::StringToUInt32 (option_arg, UINT32_MAX, 0, &success));
match_info.GetProcessInfo().SetEffectiveGroupID (StringConvert::ToUInt32 (option_arg, UINT32_MAX, 0, &success));
if (!success)
error.SetErrorStringWithFormat("invalid effective group ID string: '%s'", option_arg);
break;
@ -1730,7 +1733,7 @@ class CommandObjectPlatformProcessInfo : public CommandObjectParsed
for (size_t i=0; i<argc; ++ i)
{
const char *arg = args.GetArgumentAtIndex(i);
lldb::pid_t pid = Args::StringToUInt32 (arg, LLDB_INVALID_PROCESS_ID, 0, &success);
lldb::pid_t pid = StringConvert::ToUInt32 (arg, LLDB_INVALID_PROCESS_ID, 0, &success);
if (success)
{
ProcessInstanceInfo proc_info;
@ -1805,7 +1808,7 @@ class CommandObjectPlatformProcessAttach : public CommandObjectParsed
{
case 'p':
{
lldb::pid_t pid = Args::StringToUInt32 (option_arg, LLDB_INVALID_PROCESS_ID, 0, &success);
lldb::pid_t pid = StringConvert::ToUInt32 (option_arg, LLDB_INVALID_PROCESS_ID, 0, &success);
if (!success || pid == LLDB_INVALID_PROCESS_ID)
{
error.SetErrorStringWithFormat("invalid process ID '%s'", option_arg);
@ -2055,7 +2058,7 @@ class CommandObjectPlatformShell : public CommandObjectRaw
case 't':
{
bool success;
timeout = Args::StringToUInt32(option_value, 10, 10, &success);
timeout = StringConvert::ToUInt32(option_value, 10, 10, &success);
if (!success)
error.SetErrorStringWithFormat("could not convert \"%s\" to a numeric value.", option_value);
break;
@ -2278,19 +2281,16 @@ CommandObjectPlatform::CommandObjectPlatform(CommandInterpreter &interpreter) :
LoadSubCommand ("connect", CommandObjectSP (new CommandObjectPlatformConnect (interpreter)));
LoadSubCommand ("disconnect", CommandObjectSP (new CommandObjectPlatformDisconnect (interpreter)));
LoadSubCommand ("settings", CommandObjectSP (new CommandObjectPlatformSettings (interpreter)));
#ifdef LLDB_CONFIGURATION_DEBUG
LoadSubCommand ("mkdir", CommandObjectSP (new CommandObjectPlatformMkDir (interpreter)));
LoadSubCommand ("file", CommandObjectSP (new CommandObjectPlatformFile (interpreter)));
LoadSubCommand ("get-file", CommandObjectSP (new CommandObjectPlatformGetFile (interpreter)));
LoadSubCommand ("get-size", CommandObjectSP (new CommandObjectPlatformGetSize (interpreter)));
LoadSubCommand ("put-file", CommandObjectSP (new CommandObjectPlatformPutFile (interpreter)));
#endif
LoadSubCommand ("process", CommandObjectSP (new CommandObjectPlatformProcess (interpreter)));
LoadSubCommand ("shell", CommandObjectSP (new CommandObjectPlatformShell (interpreter)));
LoadSubCommand ("target-install", CommandObjectSP (new CommandObjectPlatformInstall (interpreter)));
}
//----------------------------------------------------------------------
// Destructor
//----------------------------------------------------------------------

View File

@ -22,6 +22,7 @@
#include "lldb/Core/Module.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Host/Host.h"
#include "lldb/Host/StringConvert.h"
#include "lldb/Interpreter/Args.h"
#include "lldb/Interpreter/Options.h"
#include "lldb/Interpreter/CommandInterpreter.h"
@ -353,7 +354,7 @@ class CommandObjectProcessAttach : public CommandObjectProcessLaunchOrAttach
case 'p':
{
lldb::pid_t pid = Args::StringToUInt32 (option_arg, LLDB_INVALID_PROCESS_ID, 0, &success);
lldb::pid_t pid = StringConvert::ToUInt32 (option_arg, LLDB_INVALID_PROCESS_ID, 0, &success);
if (!success || pid == LLDB_INVALID_PROCESS_ID)
{
error.SetErrorStringWithFormat("invalid process ID '%s'", option_arg);
@ -488,6 +489,8 @@ class CommandObjectProcessAttach : public CommandObjectProcessLaunchOrAttach
DoExecute (Args& command,
CommandReturnObject &result)
{
PlatformSP platform_sp (m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform());
Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
// N.B. The attach should be synchronous. It doesn't help much to get the prompt back between initiating the attach
// and the target actually stopping. So even if the interpreter is set to be asynchronous, we wait for the stop
@ -526,122 +529,130 @@ class CommandObjectProcessAttach : public CommandObjectProcessLaunchOrAttach
ModuleSP old_exec_module_sp = target->GetExecutableModule();
ArchSpec old_arch_spec = target->GetArchitecture();
ProcessSP process_sp;
Error error;
if (command.GetArgumentCount())
{
result.AppendErrorWithFormat("Invalid arguments for '%s'.\nUsage: %s\n", m_cmd_name.c_str(), m_cmd_syntax.c_str());
result.SetStatus (eReturnStatusFailed);
return false;
}
m_interpreter.UpdateExecutionContext(nullptr);
ListenerSP listener_sp (new Listener("lldb.CommandObjectProcessAttach.DoExecute.attach.hijack"));
m_options.attach_info.SetHijackListener(listener_sp);
// If no process info was specified, then use the target executable
// name as the process to attach to by default
if (!m_options.attach_info.ProcessInfoSpecified ())
{
if (old_exec_module_sp)
m_options.attach_info.GetExecutableFile().GetFilename() = old_exec_module_sp->GetPlatformFileSpec().GetFilename();
if (!m_options.attach_info.ProcessInfoSpecified ())
{
error.SetErrorString ("no process specified, create a target with a file, or specify the --pid or --name command option");
}
}
if (error.Success())
{
if (state != eStateConnected && platform_sp != nullptr && platform_sp->CanDebugProcess())
{
target->SetPlatform(platform_sp);
process = platform_sp->Attach(m_options.attach_info, m_interpreter.GetDebugger(), target, error).get();
}
else
{
if (state != eStateConnected)
{
const char *plugin_name = m_options.attach_info.GetProcessPluginName();
process = target->CreateProcess (m_interpreter.GetDebugger().GetListener(), plugin_name, nullptr).get();
if (process == nullptr)
error.SetErrorStringWithFormat("failed to create process using plugin %s", plugin_name);
}
if (process)
{
process->HijackProcessEvents(listener_sp.get());
error = process->Attach(m_options.attach_info);
}
}
}
if (error.Success() && process != nullptr)
{
result.SetStatus (eReturnStatusSuccessContinuingNoResult);
StreamString stream;
StateType state = process->WaitForProcessToStop (nullptr, nullptr, false, listener_sp.get(), &stream);
process->RestoreProcessEvents();
result.SetDidChangeProcessState (true);
if (stream.GetData())
result.AppendMessage(stream.GetData());
if (state == eStateStopped)
{
result.SetStatus (eReturnStatusSuccessFinishNoResult);
}
else
{
const char *exit_desc = process->GetExitDescription();
if (exit_desc)
result.AppendErrorWithFormat ("attach failed: %s", exit_desc);
else
result.AppendError ("attach failed: process did not stop (no such process or permission problem?)");
process->Destroy();
result.SetStatus (eReturnStatusFailed);
}
}
else
{
if (state != eStateConnected)
{
const char *plugin_name = m_options.attach_info.GetProcessPluginName();
process = target->CreateProcess (m_interpreter.GetDebugger().GetListener(), plugin_name, NULL).get();
}
if (process)
{
Error error;
// If no process info was specified, then use the target executable
// name as the process to attach to by default
if (!m_options.attach_info.ProcessInfoSpecified ())
{
if (old_exec_module_sp)
m_options.attach_info.GetExecutableFile().GetFilename() = old_exec_module_sp->GetPlatformFileSpec().GetFilename();
if (!m_options.attach_info.ProcessInfoSpecified ())
{
error.SetErrorString ("no process specified, create a target with a file, or specify the --pid or --name command option");
}
}
if (error.Success())
{
// Update the execution context so the current target and process are now selected
// in case we interrupt
m_interpreter.UpdateExecutionContext(NULL);
ListenerSP listener_sp (new Listener("lldb.CommandObjectProcessAttach.DoExecute.attach.hijack"));
m_options.attach_info.SetHijackListener(listener_sp);
process->HijackProcessEvents(listener_sp.get());
error = process->Attach (m_options.attach_info);
if (error.Success())
{
result.SetStatus (eReturnStatusSuccessContinuingNoResult);
StreamString stream;
StateType state = process->WaitForProcessToStop (NULL, NULL, false, listener_sp.get(), &stream);
process->RestoreProcessEvents();
result.SetDidChangeProcessState (true);
if (stream.GetData())
result.AppendMessage(stream.GetData());
if (state == eStateStopped)
{
result.SetStatus (eReturnStatusSuccessFinishNoResult);
}
else
{
const char *exit_desc = process->GetExitDescription();
if (exit_desc)
result.AppendErrorWithFormat ("attach failed: %s", exit_desc);
else
result.AppendError ("attach failed: process did not stop (no such process or permission problem?)");
process->Destroy();
result.SetStatus (eReturnStatusFailed);
}
}
else
{
result.AppendErrorWithFormat ("attach failed: %s\n", error.AsCString());
result.SetStatus (eReturnStatusFailed);
}
}
}
result.AppendErrorWithFormat ("attach failed: %s\n", error.AsCString());
result.SetStatus (eReturnStatusFailed);
}
if (result.Succeeded())
if (!result.Succeeded())
return false;
// Okay, we're done. Last step is to warn if the executable module has changed:
char new_path[PATH_MAX];
ModuleSP new_exec_module_sp (target->GetExecutableModule());
if (!old_exec_module_sp)
{
// Okay, we're done. Last step is to warn if the executable module has changed:
char new_path[PATH_MAX];
ModuleSP new_exec_module_sp (target->GetExecutableModule());
if (!old_exec_module_sp)
// We might not have a module if we attached to a raw pid...
if (new_exec_module_sp)
{
// We might not have a module if we attached to a raw pid...
if (new_exec_module_sp)
{
new_exec_module_sp->GetFileSpec().GetPath(new_path, PATH_MAX);
result.AppendMessageWithFormat("Executable module set to \"%s\".\n", new_path);
}
new_exec_module_sp->GetFileSpec().GetPath(new_path, PATH_MAX);
result.AppendMessageWithFormat("Executable module set to \"%s\".\n", new_path);
}
else if (old_exec_module_sp->GetFileSpec() != new_exec_module_sp->GetFileSpec())
{
char old_path[PATH_MAX];
old_exec_module_sp->GetFileSpec().GetPath (old_path, PATH_MAX);
new_exec_module_sp->GetFileSpec().GetPath (new_path, PATH_MAX);
result.AppendWarningWithFormat("Executable module changed from \"%s\" to \"%s\".\n",
old_path, new_path);
}
if (!old_arch_spec.IsValid())
{
result.AppendMessageWithFormat ("Architecture set to: %s.\n", target->GetArchitecture().GetTriple().getTriple().c_str());
}
else if (!old_arch_spec.IsExactMatch(target->GetArchitecture()))
{
result.AppendWarningWithFormat("Architecture changed from %s to %s.\n",
old_arch_spec.GetTriple().getTriple().c_str(),
target->GetArchitecture().GetTriple().getTriple().c_str());
}
// This supports the use-case scenario of immediately continuing the process once attached.
if (m_options.attach_info.GetContinueOnceAttached())
m_interpreter.HandleCommand("process continue", eLazyBoolNo, result);
}
else if (old_exec_module_sp->GetFileSpec() != new_exec_module_sp->GetFileSpec())
{
char old_path[PATH_MAX];
old_exec_module_sp->GetFileSpec().GetPath (old_path, PATH_MAX);
new_exec_module_sp->GetFileSpec().GetPath (new_path, PATH_MAX);
result.AppendWarningWithFormat("Executable module changed from \"%s\" to \"%s\".\n",
old_path, new_path);
}
if (!old_arch_spec.IsValid())
{
result.AppendMessageWithFormat ("Architecture set to: %s.\n", target->GetArchitecture().GetTriple().getTriple().c_str());
}
else if (!old_arch_spec.IsExactMatch(target->GetArchitecture()))
{
result.AppendWarningWithFormat("Architecture changed from %s to %s.\n",
old_arch_spec.GetTriple().getTriple().c_str(),
target->GetArchitecture().GetTriple().getTriple().c_str());
}
// This supports the use-case scenario of immediately continuing the process once attached.
if (m_options.attach_info.GetContinueOnceAttached())
m_interpreter.HandleCommand("process continue", eLazyBoolNo, result);
return result.Succeeded();
}
@ -714,7 +725,7 @@ class CommandObjectProcessContinue : public CommandObjectParsed
switch (short_option)
{
case 'i':
m_ignore = Args::StringToUInt32 (option_arg, 0, 0, &success);
m_ignore = StringConvert::ToUInt32 (option_arg, 0, 0, &success);
if (!success)
error.SetErrorStringWithFormat ("invalid value for ignore option: \"%s\", should be a number.", option_arg);
break;
@ -1297,7 +1308,7 @@ class CommandObjectProcessUnload : public CommandObjectParsed
for (uint32_t i=0; i<argc; ++i)
{
const char *image_token_cstr = command.GetArgumentAtIndex(i);
uint32_t image_token = Args::StringToUInt32(image_token_cstr, LLDB_INVALID_IMAGE_TOKEN, 0);
uint32_t image_token = StringConvert::ToUInt32(image_token_cstr, LLDB_INVALID_IMAGE_TOKEN, 0);
if (image_token == LLDB_INVALID_IMAGE_TOKEN)
{
result.AppendErrorWithFormat ("invalid image index argument '%s'", image_token_cstr);
@ -1371,7 +1382,7 @@ class CommandObjectProcessSignal : public CommandObjectParsed
const char *signal_name = command.GetArgumentAtIndex(0);
if (::isxdigit (signal_name[0]))
signo = Args::StringToSInt32(signal_name, LLDB_INVALID_SIGNAL_NUMBER, 0);
signo = StringConvert::ToSInt32(signal_name, LLDB_INVALID_SIGNAL_NUMBER, 0);
else
signo = process->GetUnixSignals().GetSignalNumberFromName (signal_name);
@ -1754,7 +1765,7 @@ class CommandObjectProcessHandle : public CommandObjectParsed
else
{
// If the value isn't 'true' or 'false', it had better be 0 or 1.
real_value = Args::StringToUInt32 (option.c_str(), 3);
real_value = StringConvert::ToUInt32 (option.c_str(), 3);
if (real_value != 0 && real_value != 1)
okay = false;
}

View File

@ -15,7 +15,6 @@
// C++ Includes
// Other libraries and framework includes
// Project includes
#include "lldb/Interpreter/Args.h"
#include "lldb/Core/Debugger.h"
#include "lldb/Core/FileLineResolver.h"
#include "lldb/Core/Module.h"
@ -24,6 +23,7 @@
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Interpreter/CommandReturnObject.h"
#include "lldb/Host/FileSpec.h"
#include "lldb/Host/StringConvert.h"
#include "lldb/Symbol/CompileUnit.h"
#include "lldb/Symbol/Function.h"
#include "lldb/Symbol/Symbol.h"
@ -63,7 +63,7 @@ class CommandObjectSourceInfo : public CommandObjectParsed
switch (short_option)
{
case 'l':
start_line = Args::StringToUInt32 (option_arg, 0);
start_line = StringConvert::ToUInt32 (option_arg, 0);
if (start_line == 0)
error.SetErrorStringWithFormat("invalid line number: '%s'", option_arg);
break;
@ -171,13 +171,13 @@ class CommandObjectSourceList : public CommandObjectParsed
switch (short_option)
{
case 'l':
start_line = Args::StringToUInt32 (option_arg, 0);
start_line = StringConvert::ToUInt32 (option_arg, 0);
if (start_line == 0)
error.SetErrorStringWithFormat("invalid line number: '%s'", option_arg);
break;
case 'c':
num_lines = Args::StringToUInt32 (option_arg, 0);
num_lines = StringConvert::ToUInt32 (option_arg, 0);
if (num_lines == 0)
error.SetErrorStringWithFormat("invalid line count: '%s'", option_arg);
break;

View File

@ -27,6 +27,7 @@
#include "lldb/Core/Timer.h"
#include "lldb/Core/ValueObjectVariable.h"
#include "lldb/DataFormatters/ValueObjectPrinter.h"
#include "lldb/Host/StringConvert.h"
#include "lldb/Host/Symbols.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Interpreter/CommandReturnObject.h"
@ -159,7 +160,6 @@ class CommandObjectTargetCreate : public CommandObjectParsed
NULL),
m_option_group (interpreter),
m_arch_option (),
m_platform_options(true), // Do include the "--platform" option in the platform settings by passing true
m_core_file (LLDB_OPT_SET_1, false, "core", 'c', 0, eArgTypeFilename, "Fullpath to a core file to use for this target."),
m_platform_path (LLDB_OPT_SET_1, false, "platform-path", 'P', 0, eArgTypePath, "Path to the remote file to use for this target."),
m_symbol_file (LLDB_OPT_SET_1, false, "symfile", 's', 0, eArgTypeFilename, "Fullpath to a stand alone debug symbols file for when debug symbols are not in the executable."),
@ -180,7 +180,6 @@ class CommandObjectTargetCreate : public CommandObjectParsed
m_arguments.push_back (arg);
m_option_group.Append (&m_arch_option, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1);
m_option_group.Append (&m_platform_options, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1);
m_option_group.Append (&m_core_file, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1);
m_option_group.Append (&m_platform_path, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1);
m_option_group.Append (&m_symbol_file, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1);
@ -282,70 +281,83 @@ class CommandObjectTargetCreate : public CommandObjectParsed
bool must_set_platform_path = false;
Debugger &debugger = m_interpreter.GetDebugger();
PlatformSP platform_sp(debugger.GetPlatformList().GetSelectedPlatform ());
if (remote_file)
{
// I have a remote file.. two possible cases
if (file_spec && file_spec.Exists())
{
// if the remote file does not exist, push it there
if (!platform_sp->GetFileExists (remote_file))
{
Error err = platform_sp->PutFile(file_spec, remote_file);
if (err.Fail())
{
result.AppendError(err.AsCString());
result.SetStatus (eReturnStatusFailed);
return false;
}
}
}
else
{
// there is no local file and we need one
// in order to make the remote ---> local transfer we need a platform
// TODO: if the user has passed in a --platform argument, use it to fetch the right platform
if (!platform_sp)
{
result.AppendError("unable to perform remote debugging without a platform");
result.SetStatus (eReturnStatusFailed);
return false;
}
if (file_path)
{
// copy the remote file to the local file
Error err = platform_sp->GetFile(remote_file, file_spec);
if (err.Fail())
{
result.AppendError(err.AsCString());
result.SetStatus (eReturnStatusFailed);
return false;
}
}
else
{
// make up a local file
result.AppendError("remote --> local transfer without local path is not implemented yet");
result.SetStatus (eReturnStatusFailed);
return false;
}
}
}
TargetSP target_sp;
const char *arch_cstr = m_arch_option.GetArchitectureName();
const bool get_dependent_files = m_add_dependents.GetOptionValue().GetCurrentValue();
Error error (debugger.GetTargetList().CreateTarget (debugger,
// remote_file ? remote_file : file_spec,
file_path,
arch_cstr,
get_dependent_files,
&m_platform_options,
NULL,
target_sp));
if (target_sp)
{
// Only get the platform after we create the target because we might have
// switched platforms depending on what the arguments were to CreateTarget()
// we can't rely on the selected platform.
PlatformSP platform_sp = target_sp->GetPlatform();
if (remote_file)
{
if (platform_sp)
{
// I have a remote file.. two possible cases
if (file_spec && file_spec.Exists())
{
// if the remote file does not exist, push it there
if (!platform_sp->GetFileExists (remote_file))
{
Error err = platform_sp->PutFile(file_spec, remote_file);
if (err.Fail())
{
result.AppendError(err.AsCString());
result.SetStatus (eReturnStatusFailed);
return false;
}
}
}
else
{
// there is no local file and we need one
// in order to make the remote ---> local transfer we need a platform
// TODO: if the user has passed in a --platform argument, use it to fetch the right platform
if (!platform_sp)
{
result.AppendError("unable to perform remote debugging without a platform");
result.SetStatus (eReturnStatusFailed);
return false;
}
if (file_path)
{
// copy the remote file to the local file
Error err = platform_sp->GetFile(remote_file, file_spec);
if (err.Fail())
{
result.AppendError(err.AsCString());
result.SetStatus (eReturnStatusFailed);
return false;
}
}
else
{
// make up a local file
result.AppendError("remote --> local transfer without local path is not implemented yet");
result.SetStatus (eReturnStatusFailed);
return false;
}
}
}
else
{
result.AppendError("no platform found for target");
result.SetStatus (eReturnStatusFailed);
return false;
}
}
if (symfile || remote_file)
{
ModuleSP module_sp (target_sp->GetExecutableModule());
@ -426,7 +438,7 @@ class CommandObjectTargetCreate : public CommandObjectParsed
}
else
{
result.AppendErrorWithFormat("'%s' takes exactly one executable path argument, or use the --core-file option.\n", m_cmd_name.c_str());
result.AppendErrorWithFormat("'%s' takes exactly one executable path argument, or use the --core option.\n", m_cmd_name.c_str());
result.SetStatus (eReturnStatusFailed);
}
return result.Succeeded();
@ -435,7 +447,6 @@ class CommandObjectTargetCreate : public CommandObjectParsed
private:
OptionGroupOptions m_option_group;
OptionGroupArchitecture m_arch_option;
OptionGroupPlatform m_platform_options;
OptionGroupFile m_core_file;
OptionGroupFile m_platform_path;
OptionGroupFile m_symbol_file;
@ -522,7 +533,7 @@ class CommandObjectTargetSelect : public CommandObjectParsed
{
bool success = false;
const char *target_idx_arg = args.GetArgumentAtIndex(0);
uint32_t target_idx = Args::StringToUInt32 (target_idx_arg, UINT32_MAX, 0, &success);
uint32_t target_idx = StringConvert::ToUInt32 (target_idx_arg, UINT32_MAX, 0, &success);
if (success)
{
TargetList &target_list = m_interpreter.GetDebugger().GetTargetList();
@ -629,7 +640,7 @@ class CommandObjectTargetDelete : public CommandObjectParsed
for (uint32_t arg_idx = 0; success && arg_idx < argc; ++arg_idx)
{
const char *target_idx_arg = args.GetArgumentAtIndex(arg_idx);
uint32_t target_idx = Args::StringToUInt32 (target_idx_arg, UINT32_MAX, 0, &success);
uint32_t target_idx = StringConvert::ToUInt32 (target_idx_arg, UINT32_MAX, 0, &success);
if (success)
{
if (target_idx < num_targets)
@ -1260,7 +1271,7 @@ class CommandObjectTargetModulesSearchPathsInsert : public CommandObjectParsed
{
bool success = false;
uint32_t insert_idx = Args::StringToUInt32(command.GetArgumentAtIndex(0), UINT32_MAX, 0, &success);
uint32_t insert_idx = StringConvert::ToUInt32(command.GetArgumentAtIndex(0), UINT32_MAX, 0, &success);
if (!success)
{
@ -2963,7 +2974,7 @@ class CommandObjectTargetModulesLoad : public CommandObjectTargetModulesModuleAu
{
ConstString const_sect_name(sect_name);
bool success = false;
addr_t load_addr = Args::StringToUInt64(load_addr_cstr, LLDB_INVALID_ADDRESS, 0, &success);
addr_t load_addr = StringConvert::ToUInt64(load_addr_cstr, LLDB_INVALID_ADDRESS, 0, &success);
if (success)
{
SectionSP section_sp (section_list->FindSectionByName(const_sect_name));
@ -3890,7 +3901,7 @@ class CommandObjectTargetModulesLookup : public CommandObjectParsed
break;
case 'o':
m_offset = Args::StringToUInt64(option_arg, LLDB_INVALID_ADDRESS);
m_offset = StringConvert::ToUInt64(option_arg, LLDB_INVALID_ADDRESS);
if (m_offset == LLDB_INVALID_ADDRESS)
error.SetErrorStringWithFormat ("invalid offset string '%s'", option_arg);
break;
@ -3910,7 +3921,7 @@ class CommandObjectTargetModulesLookup : public CommandObjectParsed
break;
case 'l':
m_line_number = Args::StringToUInt32(option_arg, UINT32_MAX);
m_line_number = StringConvert::ToUInt32(option_arg, UINT32_MAX);
if (m_line_number == UINT32_MAX)
error.SetErrorStringWithFormat ("invalid line number string '%s'", option_arg);
else if (m_line_number == 0)
@ -4078,7 +4089,7 @@ class CommandObjectTargetModulesLookup : public CommandObjectParsed
if (LookupAddressInModule (m_interpreter,
result.GetOutputStream(),
module,
eSymbolContextEverything,
eSymbolContextEverything | (m_options.m_verbose ? eSymbolContextVariable : 0),
m_options.m_addr,
m_options.m_offset,
m_options.m_verbose))
@ -4873,7 +4884,7 @@ class CommandObjectTargetStopHookAdd :
break;
case 'e':
m_line_end = Args::StringToUInt32 (option_arg, UINT_MAX, 0, &success);
m_line_end = StringConvert::ToUInt32 (option_arg, UINT_MAX, 0, &success);
if (!success)
{
error.SetErrorStringWithFormat ("invalid end line number: \"%s\"", option_arg);
@ -4883,7 +4894,7 @@ class CommandObjectTargetStopHookAdd :
break;
case 'l':
m_line_start = Args::StringToUInt32 (option_arg, 0, 0, &success);
m_line_start = StringConvert::ToUInt32 (option_arg, 0, 0, &success);
if (!success)
{
error.SetErrorStringWithFormat ("invalid start line number: \"%s\"", option_arg);
@ -4912,7 +4923,7 @@ class CommandObjectTargetStopHookAdd :
break;
case 't' :
{
m_thread_id = Args::StringToUInt64(option_arg, LLDB_INVALID_THREAD_ID, 0);
m_thread_id = StringConvert::ToUInt64(option_arg, LLDB_INVALID_THREAD_ID, 0);
if (m_thread_id == LLDB_INVALID_THREAD_ID)
error.SetErrorStringWithFormat ("invalid thread id string '%s'", option_arg);
m_thread_specified = true;
@ -4928,7 +4939,7 @@ class CommandObjectTargetStopHookAdd :
break;
case 'x':
{
m_thread_index = Args::StringToUInt32(option_arg, UINT32_MAX, 0);
m_thread_index = StringConvert::ToUInt32(option_arg, UINT32_MAX, 0);
if (m_thread_id == UINT32_MAX)
error.SetErrorStringWithFormat ("invalid thread index string '%s'", option_arg);
m_thread_specified = true;
@ -5233,7 +5244,7 @@ class CommandObjectTargetStopHookDelete : public CommandObjectParsed
bool success;
for (size_t i = 0; i < num_args; i++)
{
lldb::user_id_t user_id = Args::StringToUInt32 (command.GetArgumentAtIndex(i), 0, 0, &success);
lldb::user_id_t user_id = StringConvert::ToUInt32 (command.GetArgumentAtIndex(i), 0, 0, &success);
if (!success)
{
result.AppendErrorWithFormat ("invalid stop hook id: \"%s\".\n", command.GetArgumentAtIndex(i));
@ -5302,7 +5313,7 @@ class CommandObjectTargetStopHookEnableDisable : public CommandObjectParsed
{
for (size_t i = 0; i < num_args; i++)
{
lldb::user_id_t user_id = Args::StringToUInt32 (command.GetArgumentAtIndex(i), 0, 0, &success);
lldb::user_id_t user_id = StringConvert::ToUInt32 (command.GetArgumentAtIndex(i), 0, 0, &success);
if (!success)
{
result.AppendErrorWithFormat ("invalid stop hook id: \"%s\".\n", command.GetArgumentAtIndex(i));

View File

@ -19,6 +19,7 @@
#include "lldb/Core/State.h"
#include "lldb/Core/SourceManager.h"
#include "lldb/Host/Host.h"
#include "lldb/Host/StringConvert.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Interpreter/CommandReturnObject.h"
#include "lldb/Interpreter/Options.h"
@ -95,7 +96,7 @@ class CommandObjectIterateOverThreads : public CommandObjectParsed
{
bool success;
uint32_t thread_idx = Args::StringToUInt32(command.GetArgumentAtIndex(i), 0, 0, &success);
uint32_t thread_idx = StringConvert::ToUInt32(command.GetArgumentAtIndex(i), 0, 0, &success);
if (!success)
{
result.AppendErrorWithFormat ("invalid thread specification: \"%s\"\n", command.GetArgumentAtIndex(i));
@ -178,7 +179,7 @@ class CommandObjectThreadBacktrace : public CommandObjectIterateOverThreads
case 'c':
{
bool success;
int32_t input_count = Args::StringToSInt32 (option_arg, -1, 0, &success);
int32_t input_count = StringConvert::ToSInt32 (option_arg, -1, 0, &success);
if (!success)
error.SetErrorStringWithFormat("invalid integer value for option '%c'", short_option);
if (input_count < -1)
@ -190,7 +191,7 @@ class CommandObjectThreadBacktrace : public CommandObjectIterateOverThreads
case 's':
{
bool success;
m_start = Args::StringToUInt32 (option_arg, 0, 0, &success);
m_start = StringConvert::ToUInt32 (option_arg, 0, 0, &success);
if (!success)
error.SetErrorStringWithFormat("invalid integer value for option '%c'", short_option);
}
@ -384,7 +385,7 @@ class CommandObjectThreadStepWithTypeAndScope : public CommandObjectParsed
case 'c':
{
m_step_count = Args::StringToUInt32(option_arg, UINT32_MAX, 0);
m_step_count = StringConvert::ToUInt32(option_arg, UINT32_MAX, 0);
if (m_step_count == UINT32_MAX)
error.SetErrorStringWithFormat ("invalid ignore count '%s'", option_arg);
break;
@ -522,7 +523,7 @@ class CommandObjectThreadStepWithTypeAndScope : public CommandObjectParsed
else
{
const char *thread_idx_cstr = command.GetArgumentAtIndex(0);
uint32_t step_thread_idx = Args::StringToUInt32 (thread_idx_cstr, LLDB_INVALID_INDEX32);
uint32_t step_thread_idx = StringConvert::ToUInt32 (thread_idx_cstr, LLDB_INVALID_INDEX32);
if (step_thread_idx == LLDB_INVALID_INDEX32)
{
result.AppendErrorWithFormat ("invalid thread index '%s'.\n", thread_idx_cstr);
@ -812,7 +813,7 @@ class CommandObjectThreadContinue : public CommandObjectParsed
{
bool success;
const int base = 0;
uint32_t thread_idx = Args::StringToUInt32 (command.GetArgumentAtIndex(i), LLDB_INVALID_INDEX32, base, &success);
uint32_t thread_idx = StringConvert::ToUInt32 (command.GetArgumentAtIndex(i), LLDB_INVALID_INDEX32, base, &success);
if (success)
{
Thread *thread = process->GetThreadList().FindThreadByIndexID(thread_idx).get();
@ -984,9 +985,17 @@ class CommandObjectThreadUntil : public CommandObjectParsed
switch (short_option)
{
case 'a':
{
ExecutionContext exe_ctx (m_interpreter.GetExecutionContext());
lldb::addr_t tmp_addr = Args::StringToAddress(&exe_ctx, option_arg, LLDB_INVALID_ADDRESS, &error);
if (error.Success())
m_until_addrs.push_back(tmp_addr);
}
break;
case 't':
{
m_thread_idx = Args::StringToUInt32 (option_arg, LLDB_INVALID_INDEX32);
m_thread_idx = StringConvert::ToUInt32 (option_arg, LLDB_INVALID_INDEX32);
if (m_thread_idx == LLDB_INVALID_INDEX32)
{
error.SetErrorStringWithFormat ("invalid thread index '%s'", option_arg);
@ -995,7 +1004,7 @@ class CommandObjectThreadUntil : public CommandObjectParsed
break;
case 'f':
{
m_frame_idx = Args::StringToUInt32 (option_arg, LLDB_INVALID_FRAME_ID);
m_frame_idx = StringConvert::ToUInt32 (option_arg, LLDB_INVALID_FRAME_ID);
if (m_frame_idx == LLDB_INVALID_FRAME_ID)
{
error.SetErrorStringWithFormat ("invalid frame index '%s'", option_arg);
@ -1030,6 +1039,7 @@ class CommandObjectThreadUntil : public CommandObjectParsed
m_thread_idx = LLDB_INVALID_THREAD_ID;
m_frame_idx = 0;
m_stop_others = false;
m_until_addrs.clear();
}
const OptionDefinition*
@ -1040,6 +1050,7 @@ class CommandObjectThreadUntil : public CommandObjectParsed
uint32_t m_step_thread_idx;
bool m_stop_others;
std::vector<lldb::addr_t> m_until_addrs;
// Options table: Required for subclasses of Options.
@ -1051,7 +1062,7 @@ class CommandObjectThreadUntil : public CommandObjectParsed
CommandObjectThreadUntil (CommandInterpreter &interpreter) :
CommandObjectParsed (interpreter,
"thread until",
"Run the current or specified thread until it reaches a given line number or leaves the current function.",
"Run the current or specified thread until it reaches a given line number or address or leaves the current function.",
NULL,
eFlagRequiresThread |
eFlagTryTargetAPILock |
@ -1110,22 +1121,32 @@ class CommandObjectThreadUntil : public CommandObjectParsed
else
{
Thread *thread = NULL;
uint32_t line_number;
std::vector<uint32_t> line_numbers;
if (command.GetArgumentCount() != 1)
if (command.GetArgumentCount() >= 1)
{
result.AppendErrorWithFormat ("No line number provided:\n%s", GetSyntax());
size_t num_args = command.GetArgumentCount();
for (size_t i = 0; i < num_args; i++)
{
uint32_t line_number;
line_number = StringConvert::ToUInt32 (command.GetArgumentAtIndex(0), UINT32_MAX);
if (line_number == UINT32_MAX)
{
result.AppendErrorWithFormat ("invalid line number: '%s'.\n", command.GetArgumentAtIndex(0));
result.SetStatus (eReturnStatusFailed);
return false;
}
else
line_numbers.push_back(line_number);
}
}
else if (m_options.m_until_addrs.empty())
{
result.AppendErrorWithFormat ("No line number or address provided:\n%s", GetSyntax());
result.SetStatus (eReturnStatusFailed);
return false;
}
line_number = Args::StringToUInt32 (command.GetArgumentAtIndex(0), UINT32_MAX);
if (line_number == UINT32_MAX)
{
result.AppendErrorWithFormat ("invalid line number: '%s'.\n", command.GetArgumentAtIndex(0));
result.SetStatus (eReturnStatusFailed);
return false;
}
if (m_options.m_thread_idx == LLDB_INVALID_THREAD_ID)
{
@ -1188,27 +1209,40 @@ class CommandObjectThreadUntil : public CommandObjectParsed
Address fun_end_addr(fun_start_addr.GetSection(),
fun_start_addr.GetOffset() + fun_addr_range.GetByteSize());
line_table->FindLineEntryByAddress (fun_end_addr, function_start, &end_ptr);
bool all_in_function = true;
while (index_ptr <= end_ptr)
{
LineEntry line_entry;
const bool exact = false;
index_ptr = sc.comp_unit->FindLineEntry(index_ptr, line_number, sc.comp_unit, exact, &line_entry);
if (index_ptr == UINT32_MAX)
break;
addr_t address = line_entry.range.GetBaseAddress().GetLoadAddress(target);
if (address != LLDB_INVALID_ADDRESS)
line_table->FindLineEntryByAddress (fun_end_addr, function_start, &end_ptr);
for (uint32_t line_number : line_numbers)
{
uint32_t start_idx_ptr = index_ptr;
while (start_idx_ptr <= end_ptr)
{
if (fun_addr_range.ContainsLoadAddress (address, target))
address_list.push_back (address);
else
all_in_function = false;
LineEntry line_entry;
const bool exact = false;
start_idx_ptr = sc.comp_unit->FindLineEntry(start_idx_ptr, line_number, sc.comp_unit, exact, &line_entry);
if (start_idx_ptr == UINT32_MAX)
break;
addr_t address = line_entry.range.GetBaseAddress().GetLoadAddress(target);
if (address != LLDB_INVALID_ADDRESS)
{
if (fun_addr_range.ContainsLoadAddress (address, target))
address_list.push_back (address);
else
all_in_function = false;
}
start_idx_ptr++;
}
index_ptr++;
}
for (lldb::addr_t address : m_options.m_until_addrs)
{
if (fun_addr_range.ContainsLoadAddress (address, target))
address_list.push_back (address);
else
all_in_function = false;
}
if (address_list.size() == 0)
@ -1290,7 +1324,8 @@ CommandObjectThreadUntil::CommandOptions::g_option_table[] =
{
{ LLDB_OPT_SET_1, false, "frame", 'f', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeFrameIndex, "Frame index for until operation - defaults to 0"},
{ LLDB_OPT_SET_1, false, "thread", 't', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeThreadIndex, "Thread index for the thread for until operation"},
{ LLDB_OPT_SET_1, false, "run-mode",'m', OptionParser::eRequiredArgument, NULL, g_duo_running_mode, 0, eArgTypeRunMode,"Determine how to run other threads while stepping this one"},
{ LLDB_OPT_SET_1, false, "run-mode",'m', OptionParser::eRequiredArgument, NULL, g_duo_running_mode, 0, eArgTypeRunMode, "Determine how to run other threads while stepping this one"},
{ LLDB_OPT_SET_1, false, "address", 'a', OptionParser::eRequiredArgument, NULL, NULL, 0, eArgTypeAddressOrExpression, "Run until we reach the specified address, or leave the function - can be specified multiple times."},
{ 0, false, NULL, 0, 0, NULL, NULL, 0, eArgTypeNone, NULL }
};
@ -1351,7 +1386,7 @@ class CommandObjectThreadSelect : public CommandObjectParsed
return false;
}
uint32_t index_id = Args::StringToUInt32(command.GetArgumentAtIndex(0), 0, 0);
uint32_t index_id = StringConvert::ToUInt32(command.GetArgumentAtIndex(0), 0, 0);
Thread *new_thread = process->GetThreadList().FindThreadByIndexID(index_id).get();
if (new_thread == NULL)
@ -1796,12 +1831,12 @@ class CommandObjectThreadJump : public CommandObjectParsed
return Error("only one source file expected.");
break;
case 'l':
m_line_num = Args::StringToUInt32 (option_arg, 0, 0, &success);
m_line_num = StringConvert::ToUInt32 (option_arg, 0, 0, &success);
if (!success || m_line_num == 0)
return Error("invalid line number: '%s'.", option_arg);
break;
case 'b':
m_line_offset = Args::StringToSInt32 (option_arg, 0, 0, &success);
m_line_offset = StringConvert::ToSInt32 (option_arg, 0, 0, &success);
if (!success)
return Error("invalid line offset: '%s'.", option_arg);
break;
@ -2120,7 +2155,7 @@ class CommandObjectThreadPlanDiscard : public CommandObjectParsed
}
bool success;
uint32_t thread_plan_idx = Args::StringToUInt32(args.GetArgumentAtIndex(0), 0, 0, &success);
uint32_t thread_plan_idx = StringConvert::ToUInt32(args.GetArgumentAtIndex(0), 0, 0, &success);
if (!success)
{
result.AppendErrorWithFormat("Invalid thread index: \"%s\" - should be unsigned int.",

View File

@ -21,6 +21,7 @@
#include "lldb/Core/StreamString.h"
#include "lldb/Core/ValueObject.h"
#include "lldb/Core/ValueObjectVariable.h"
#include "lldb/Host/StringConvert.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Interpreter/CommandReturnObject.h"
#include "lldb/Interpreter/CommandCompletions.h"
@ -639,7 +640,7 @@ class CommandObjectWatchpointIgnore : public CommandObjectParsed
{
case 'i':
{
m_ignore_count = Args::StringToUInt32(option_arg, UINT32_MAX, 0);
m_ignore_count = StringConvert::ToUInt32(option_arg, UINT32_MAX, 0);
if (m_ignore_count == UINT32_MAX)
error.SetErrorStringWithFormat ("invalid ignore count '%s'", option_arg);
}

View File

@ -654,7 +654,7 @@ Address::Dump (Stream *s, ExecutionContextScope *exe_scope, DumpStyle style, Dum
if (module_sp)
{
SymbolContext sc;
module_sp->ResolveSymbolContextForAddress(*this, eSymbolContextEverything, sc);
module_sp->ResolveSymbolContextForAddress(*this, eSymbolContextEverything | eSymbolContextVariable, sc);
if (sc.function || sc.symbol)
{
bool show_stop_context = true;
@ -712,7 +712,7 @@ Address::Dump (Stream *s, ExecutionContextScope *exe_scope, DumpStyle style, Dum
if (module_sp)
{
SymbolContext sc;
module_sp->ResolveSymbolContextForAddress(*this, eSymbolContextEverything, sc);
module_sp->ResolveSymbolContextForAddress(*this, eSymbolContextEverything | eSymbolContextVariable, sc);
if (sc.symbol)
{
// If we have just a symbol make sure it is in the same section

View File

@ -765,6 +765,19 @@ ArchSpec::SetTriple (const char *triple_cstr, Platform *platform)
return IsValid();
}
void
ArchSpec::MergeFrom(const ArchSpec &other)
{
if (GetTriple().getVendor() == llvm::Triple::UnknownVendor && !TripleVendorWasSpecified())
GetTriple().setVendor(other.GetTriple().getVendor());
if (GetTriple().getOS() == llvm::Triple::UnknownOS && !TripleOSWasSpecified())
GetTriple().setOS(other.GetTriple().getOS());
if (GetTriple().getArch() == llvm::Triple::UnknownArch)
GetTriple().setArch(other.GetTriple().getArch());
if (GetTriple().getEnvironment() == llvm::Triple::UnknownEnvironment)
GetTriple().setEnvironment(other.GetTriple().getEnvironment());
}
bool
ArchSpec::SetArchitecture (ArchitectureType arch_type, uint32_t cpu, uint32_t sub)
{

View File

@ -303,6 +303,16 @@ Broadcaster::HijackBroadcaster (Listener *listener, uint32_t event_mask)
return true;
}
bool
Broadcaster::IsHijackedForEvent (uint32_t event_mask)
{
Mutex::Locker event_types_locker(m_listeners_mutex);
if (!m_hijacking_listeners.empty())
return (event_mask & m_hijacking_masks.back()) != 0;
return false;
}
void
Broadcaster::RestoreBroadcaster ()
{

View File

@ -107,6 +107,7 @@ ConnectionMachPort::Connect (const char *s, Error *error_ptr)
{
if (error_ptr)
error_ptr->Clear();
m_uri.assign(s);
}
else
{
@ -209,6 +210,7 @@ ConnectionMachPort::Disconnect (Error *error_ptr)
error_ptr->SetError (kret, eErrorTypeMachKernel);
m_port = MACH_PORT_TYPE_NONE;
}
m_uri.clear();
return eConnectionStatusSuccess;
}
@ -256,6 +258,12 @@ ConnectionMachPort::Write (const void *src, size_t src_len, ConnectionStatus &st
return 0;
}
std::string
ConnectionMachPort::GetURI()
{
return m_uri;
}
ConnectionStatus
ConnectionMachPort::BytesAvailable (uint32_t timeout_usec, Error *error_ptr)
{

View File

@ -107,6 +107,13 @@ ConnectionSharedMemory::Write (const void *src, size_t src_len, ConnectionStatus
return 0;
}
std::string
ConnectionSharedMemory::GetURI()
{
// TODO: fix when Connect is fixed?
return "";
}
ConnectionStatus
ConnectionSharedMemory::BytesAvailable (uint32_t timeout_usec, Error *error_ptr)
{

View File

@ -11,7 +11,7 @@
#include "lldb/Host/Mutex.h"
#include "llvm/ADT/StringMap.h"
#include <mutex>
#include <mutex> // std::once
using namespace lldb_private;

File diff suppressed because it is too large Load Diff

View File

@ -471,12 +471,7 @@ Disassembler::PrintInstructions
}
const bool show_bytes = (options & eOptionShowBytes) != 0;
const char *disassembly_format = "${addr-file-or-load}: ";
if (exe_ctx.HasTargetScope())
{
disassembly_format = exe_ctx.GetTargetRef().GetDebugger().GetDisassemblyFormat ();
}
inst->Dump (&strm, max_opcode_byte_size, true, show_bytes, &exe_ctx, &sc, &prev_sc, disassembly_format);
inst->Dump (&strm, max_opcode_byte_size, true, show_bytes, &exe_ctx, &sc, &prev_sc, NULL);
strm.EOL();
}
else
@ -566,7 +561,7 @@ Instruction::Dump (lldb_private::Stream *s,
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 opcode_column_width = 7;
const size_t operand_column_width = 25;
@ -577,7 +572,7 @@ Instruction::Dump (lldb_private::Stream *s,
if (show_address)
{
Debugger::FormatDisassemblerAddress (disassembly_addr_format_spec, sym_ctx, prev_sym_ctx, exe_ctx, &m_address, ss);
Debugger::FormatDisassemblerAddress (disassembly_addr_format, sym_ctx, prev_sym_ctx, exe_ctx, &m_address, ss);
}
if (show_bytes)
@ -985,18 +980,26 @@ InstructionList::Dump (Stream *s,
{
const uint32_t max_opcode_byte_size = GetMaxOpcocdeByteSize();
collection::const_iterator pos, begin, end;
const char *disassemble_format = "${addr-file-or-load}: ";
if (exe_ctx)
const FormatEntity::Entry *disassembly_format = NULL;
FormatEntity::Entry format;
if (exe_ctx && exe_ctx->HasTargetScope())
{
disassemble_format = exe_ctx->GetTargetRef().GetDebugger().GetDisassemblyFormat ();
disassembly_format = exe_ctx->GetTargetRef().GetDebugger().GetDisassemblyFormat ();
}
else
{
FormatEntity::Parse("${addr}: ", format);
disassembly_format = &format;
}
for (begin = m_instructions.begin(), end = m_instructions.end(), pos = begin;
pos != end;
++pos)
{
if (pos != begin)
s->EOL();
(*pos)->Dump(s, max_opcode_byte_size, show_address, show_bytes, exe_ctx, NULL, NULL, disassemble_format);
(*pos)->Dump(s, max_opcode_byte_size, show_address, show_bytes, exe_ctx, NULL, NULL, disassembly_format);
}
}
@ -1169,6 +1172,24 @@ Disassembler::Disassembler(const ArchSpec& arch, const char *flavor) :
m_flavor.assign("default");
else
m_flavor.assign(flavor);
// If this is an arm variant that can only include thumb (T16, T32)
// instructions, force the arch triple to be "thumbv.." instead of
// "armv..."
if (arch.GetTriple().getArch() == llvm::Triple::arm
&& (arch.GetCore() == ArchSpec::Core::eCore_arm_armv7m
|| arch.GetCore() == ArchSpec::Core::eCore_arm_armv7em
|| arch.GetCore() == ArchSpec::Core::eCore_arm_armv6m))
{
std::string thumb_arch_name (arch.GetTriple().getArchName().str());
// Replace "arm" with "thumb" so we get all thumb variants correct
if (thumb_arch_name.size() > 3)
{
thumb_arch_name.erase(0, 3);
thumb_arch_name.insert(0, "thumb");
}
m_arch.SetTriple (thumb_arch_name.c_str());
}
}
//----------------------------------------------------------------------

View File

@ -146,7 +146,7 @@ void
Error::Clear ()
{
m_code = 0;
m_type = eErrorTypeGeneric;
m_type = eErrorTypeInvalid;
m_string.clear();
}

2511
source/Core/FormatEntity.cpp Normal file

File diff suppressed because it is too large Load Diff

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