[NFC] Remove ASCII lines from comments

A lot of comments in LLDB are surrounded by an ASCII line to delimit the
begging and end of the comment.

Its use is not really consistent across the code base, sometimes the
lines are longer, sometimes they are shorter and sometimes they are
omitted. Furthermore, it looks kind of weird with the 80 column limit,
where the comment actually extends past the line, but not by much.
Furthermore, when /// is used for Doxygen comments, it looks
particularly odd. And when // is used, it incorrectly gives the
impression that it's actually a Doxygen comment.

I assume these lines were added to improve distinguishing between
comments and code. However, given that todays editors and IDEs do a
great job at highlighting comments, I think it's worth to drop this for
the sake of consistency. The alternative is fixing all the
inconsistencies, which would create a lot more churn.

Differential revision: https://reviews.llvm.org/D60508

llvm-svn: 358135
This commit is contained in:
Jonas Devlieghere 2019-04-10 20:48:55 +00:00
parent 66b6bb1766
commit 8b3af63b89
889 changed files with 0 additions and 10287 deletions

View File

@ -79,9 +79,7 @@
// C++ includes
#include <vector>
//----------------------------------------------------------------------
// Redefine private types from "/usr/local/include/stack_logging.h"
//----------------------------------------------------------------------
typedef struct {
uint32_t type_flags;
uint64_t stack_identifier;
@ -89,9 +87,7 @@ typedef struct {
mach_vm_address_t address;
} mach_stack_logging_record_t;
//----------------------------------------------------------------------
// Redefine private defines from "/usr/local/include/stack_logging.h"
//----------------------------------------------------------------------
#define stack_logging_type_free 0
#define stack_logging_type_generic 1
#define stack_logging_type_alloc 2
@ -99,10 +95,8 @@ typedef struct {
// This bit is made up by this code
#define stack_logging_type_vm_region 8
//----------------------------------------------------------------------
// Redefine private function prototypes from
// "/usr/local/include/stack_logging.h"
//----------------------------------------------------------------------
extern "C" kern_return_t __mach_stack_logging_set_file_path(task_t task,
char *file_path);
@ -125,21 +119,15 @@ extern "C" void *gdb_class_getClass(void *objc_class);
static void range_info_callback(task_t task, void *baton, unsigned type,
uint64_t ptr_addr, uint64_t ptr_size);
//----------------------------------------------------------------------
// Redefine private global variables prototypes from
// "/usr/local/include/stack_logging.h"
//----------------------------------------------------------------------
extern "C" int stack_logging_enable_logging;
//----------------------------------------------------------------------
// Local defines
//----------------------------------------------------------------------
#define MAX_FRAMES 1024
//----------------------------------------------------------------------
// Local Typedefs and Types
//----------------------------------------------------------------------
typedef void range_callback_t(task_t task, void *baton, unsigned type,
uint64_t ptr_addr, uint64_t ptr_size);
typedef void zone_callback_t(void *info, const malloc_zone_t *zone);
@ -294,10 +282,8 @@ protected:
uint32_t m_size;
};
//----------------------------------------------------------------------
// A safe way to allocate memory and keep it from interfering with the
// malloc enumerators.
//----------------------------------------------------------------------
void *safe_malloc(size_t n_bytes) {
if (n_bytes > 0) {
const int k_page_size = getpagesize();
@ -311,9 +297,7 @@ void *safe_malloc(size_t n_bytes) {
return NULL;
}
//----------------------------------------------------------------------
// ObjCClasses
//----------------------------------------------------------------------
class ObjCClasses {
public:
ObjCClasses() : m_objc_class_ptrs(NULL), m_size(0) {}
@ -356,16 +340,12 @@ private:
uint32_t m_size;
};
//----------------------------------------------------------------------
// Local global variables
//----------------------------------------------------------------------
MatchResults g_matches;
MallocStackLoggingEntries g_malloc_stack_history;
ObjCClasses g_objc_classes;
//----------------------------------------------------------------------
// ObjCClassInfo
//----------------------------------------------------------------------
enum HeapInfoSortType { eSortTypeNone, eSortTypeBytes, eSortTypeCount };
@ -469,13 +449,11 @@ private:
ObjCClassInfo g_objc_class_snapshot;
//----------------------------------------------------------------------
// task_peek
//
// Reads memory from this tasks address space. This callback is needed
// by the code that iterates through all of the malloc blocks to read
// the memory in this process.
//----------------------------------------------------------------------
static kern_return_t task_peek(task_t task, vm_address_t remote_address,
vm_size_t size, void **local_memory) {
*local_memory = (void *)remote_address;
@ -534,12 +512,10 @@ static const void foreach_zone_in_this_process(range_callback_info_t *info) {
}
}
//----------------------------------------------------------------------
// dump_malloc_block_callback
//
// A simple callback that will dump each malloc block and all available
// info from the enumeration callback perspective.
//----------------------------------------------------------------------
static void dump_malloc_block_callback(task_t task, void *baton, unsigned type,
uint64_t ptr_addr, uint64_t ptr_size) {
printf("task = 0x%4.4x: baton = %p, type = %u, ptr_addr = 0x%llx + 0x%llu\n",
@ -739,12 +715,10 @@ malloc_stack_entry *get_stack_history_for_address(const void *addr,
return g_malloc_stack_history.data();
}
//----------------------------------------------------------------------
// find_pointer_in_heap
//
// Finds a pointer value inside one or more currently valid malloc
// blocks.
//----------------------------------------------------------------------
malloc_match *find_pointer_in_heap(const void *addr, int check_vm_regions) {
g_matches.clear();
// Setup "info" to look for a malloc block that contains data
@ -767,12 +741,10 @@ malloc_match *find_pointer_in_heap(const void *addr, int check_vm_regions) {
return g_matches.data();
}
//----------------------------------------------------------------------
// find_pointer_in_memory
//
// Finds a pointer value inside one or more currently valid malloc
// blocks.
//----------------------------------------------------------------------
malloc_match *find_pointer_in_memory(uint64_t memory_addr, uint64_t memory_size,
const void *addr) {
g_matches.clear();
@ -793,13 +765,11 @@ malloc_match *find_pointer_in_memory(uint64_t memory_addr, uint64_t memory_size,
return g_matches.data();
}
//----------------------------------------------------------------------
// find_objc_objects_in_memory
//
// Find all instances of ObjC classes 'c', or all ObjC classes if 'c' is
// NULL. If 'c' is non NULL, then also check objects to see if they
// inherit from 'c'
//----------------------------------------------------------------------
malloc_match *find_objc_objects_in_memory(void *isa, int check_vm_regions) {
g_matches.clear();
if (g_objc_classes.Update()) {
@ -819,12 +789,10 @@ malloc_match *find_objc_objects_in_memory(void *isa, int check_vm_regions) {
return g_matches.data();
}
//----------------------------------------------------------------------
// get_heap_info
//
// Gather information for all allocations on the heap and report
// statistics.
//----------------------------------------------------------------------
void get_heap_info(int sort_type) {
if (g_objc_classes.Update()) {
@ -859,11 +827,9 @@ void get_heap_info(int sort_type) {
}
}
//----------------------------------------------------------------------
// find_cstring_in_heap
//
// Finds a C string inside one or more currently valid malloc blocks.
//----------------------------------------------------------------------
malloc_match *find_cstring_in_heap(const char *s, int check_vm_regions) {
g_matches.clear();
if (s == NULL || s[0] == '\0') {
@ -887,11 +853,9 @@ malloc_match *find_cstring_in_heap(const char *s, int check_vm_regions) {
return g_matches.data();
}
//----------------------------------------------------------------------
// find_block_for_address
//
// Find the malloc block that whose address range contains "addr".
//----------------------------------------------------------------------
malloc_match *find_block_for_address(const void *addr, int check_vm_regions) {
g_matches.clear();
// Setup "info" to look for a malloc block that contains data

View File

@ -29,7 +29,6 @@
using namespace lldb;
//----------------------------------------------------------------------
// This quick sample code shows how to create a debugger instance and
// create an executable target without adding dependent shared
// libraries. It will then set a regular expression breakpoint to get
@ -47,7 +46,6 @@ using namespace lldb;
//
// $ DYLD_FRAMEWORK_PATH=/Volumes/data/lldb/tot/build/Debug ./a.out
// executable_path1 [executable_path2 ...]
//----------------------------------------------------------------------
class LLDBSentry {
public:
LLDBSentry() {

View File

@ -68,11 +68,9 @@
#include <unistd.h>
#include <vector>
//----------------------------------------------------------------------
/// \def DISALLOW_COPY_AND_ASSIGN(TypeName)
/// Macro definition for easily disallowing copy constructor and
/// assignment operators in C++ classes.
//----------------------------------------------------------------------
#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
TypeName(const TypeName &); \
const TypeName &operator=(const TypeName &)
@ -87,10 +85,8 @@ int __open_extended(const char *, int, uid_t, gid_t, int,
namespace fd_interposing {
//----------------------------------------------------------------------
// String class so we can get formatted strings without having to worry
// about the memory storage since it will allocate the memory it needs.
//----------------------------------------------------------------------
class String {
public:
String() : m_str(NULL) {}
@ -142,23 +138,19 @@ private:
DISALLOW_COPY_AND_ASSIGN(String);
};
//----------------------------------------------------------------------
// Type definitions
//----------------------------------------------------------------------
typedef std::vector<void *> Frames;
class FDEvent;
typedef std::vector<void *> Frames;
typedef std::tr1::shared_ptr<FDEvent> FDEventSP;
typedef std::tr1::shared_ptr<String> StringSP;
//----------------------------------------------------------------------
// FDEvent
//
// A class that describes a file desciptor event.
//
// File descriptor events fall into one of two categories: create events
// and delete events.
//----------------------------------------------------------------------
class FDEvent {
public:
FDEvent(int fd, int err, const StringSP &string_sp, bool is_create,
@ -204,11 +196,9 @@ private:
bool m_is_create;
};
//----------------------------------------------------------------------
// Templatized class that will save errno only if the "value" it is
// constructed with is equal to INVALID. When the class goes out of
// scope, it will restore errno if it was saved.
//----------------------------------------------------------------------
template <int INVALID> class Errno {
public:
// Save errno only if we are supposed to
@ -235,9 +225,7 @@ typedef Errno<-1> NegativeErrorErrno;
typedef std::vector<FDEventSP> FDEventArray;
typedef std::map<int, FDEventArray> FDEventMap;
//----------------------------------------------------------------------
// Globals
//----------------------------------------------------------------------
// Global event map that contains all file descriptor events. As file
// descriptor create and close events come in, they will get filled
// into this map (protected by g_mutex). When a file descriptor close
@ -264,10 +252,8 @@ static int g_compact = 1;
// The current process ID
static int g_pid = -1;
static bool g_enabled = true;
//----------------------------------------------------------------------
// Mutex class that will lock a mutex when it is constructed, and unlock
// it when is goes out of scope
//----------------------------------------------------------------------
class Locker {
public:
Locker(pthread_mutex_t *mutex_ptr) : m_mutex_ptr(mutex_ptr) {
@ -543,9 +529,7 @@ void save_backtrace(int fd, int err, const StringSP &string_sp,
}
}
//----------------------------------------------------------------------
// socket() interpose function
//----------------------------------------------------------------------
extern "C" int socket$__interposed__(int domain, int type, int protocol) {
const int pid = get_interposed_pid();
if (pid >= 0) {
@ -572,9 +556,7 @@ extern "C" int socket$__interposed__(int domain, int type, int protocol) {
}
}
//----------------------------------------------------------------------
// socketpair() interpose function
//----------------------------------------------------------------------
extern "C" int socketpair$__interposed__(int domain, int type, int protocol,
int fds[2]) {
const int pid = get_interposed_pid();
@ -600,9 +582,7 @@ extern "C" int socketpair$__interposed__(int domain, int type, int protocol,
}
}
//----------------------------------------------------------------------
// open() interpose function
//----------------------------------------------------------------------
extern "C" int open$__interposed__(const char *path, int oflag, int mode) {
const int pid = get_interposed_pid();
if (pid >= 0) {
@ -631,9 +611,7 @@ extern "C" int open$__interposed__(const char *path, int oflag, int mode) {
}
}
//----------------------------------------------------------------------
// open$NOCANCEL() interpose function
//----------------------------------------------------------------------
extern "C" int open$NOCANCEL$__interposed__(const char *path, int oflag,
int mode) {
const int pid = get_interposed_pid();
@ -654,9 +632,7 @@ extern "C" int open$NOCANCEL$__interposed__(const char *path, int oflag,
}
}
//----------------------------------------------------------------------
// __open_extended() interpose function
//----------------------------------------------------------------------
extern "C" int __open_extended$__interposed__(const char *path, int oflag,
uid_t uid, gid_t gid, int mode,
struct kauth_filesec *fsacl) {
@ -679,9 +655,7 @@ extern "C" int __open_extended$__interposed__(const char *path, int oflag,
}
}
//----------------------------------------------------------------------
// kqueue() interpose function
//----------------------------------------------------------------------
extern "C" int kqueue$__interposed__(void) {
const int pid = get_interposed_pid();
if (pid >= 0) {
@ -699,9 +673,7 @@ extern "C" int kqueue$__interposed__(void) {
}
}
//----------------------------------------------------------------------
// shm_open() interpose function
//----------------------------------------------------------------------
extern "C" int shm_open$__interposed__(const char *path, int oflag, int mode) {
const int pid = get_interposed_pid();
if (pid >= 0) {
@ -721,9 +693,7 @@ extern "C" int shm_open$__interposed__(const char *path, int oflag, int mode) {
}
}
//----------------------------------------------------------------------
// accept() interpose function
//----------------------------------------------------------------------
extern "C" int accept$__interposed__(int socket, struct sockaddr *address,
socklen_t *address_len) {
const int pid = get_interposed_pid();
@ -743,9 +713,7 @@ extern "C" int accept$__interposed__(int socket, struct sockaddr *address,
}
}
//----------------------------------------------------------------------
// accept$NOCANCEL() interpose function
//----------------------------------------------------------------------
extern "C" int accept$NOCANCEL$__interposed__(int socket,
struct sockaddr *address,
socklen_t *address_len) {
@ -766,9 +734,7 @@ extern "C" int accept$NOCANCEL$__interposed__(int socket,
}
}
//----------------------------------------------------------------------
// dup() interpose function
//----------------------------------------------------------------------
extern "C" int dup$__interposed__(int fd2) {
const int pid = get_interposed_pid();
if (pid >= 0) {
@ -787,9 +753,7 @@ extern "C" int dup$__interposed__(int fd2) {
}
}
//----------------------------------------------------------------------
// dup2() interpose function
//----------------------------------------------------------------------
extern "C" int dup2$__interposed__(int fd1, int fd2) {
const int pid = get_interposed_pid();
if (pid >= 0) {
@ -819,9 +783,7 @@ extern "C" int dup2$__interposed__(int fd1, int fd2) {
}
}
//----------------------------------------------------------------------
// close() interpose function
//----------------------------------------------------------------------
extern "C" int close$__interposed__(int fd) {
const int pid = get_interposed_pid();
if (pid >= 0) {
@ -859,9 +821,7 @@ extern "C" int close$__interposed__(int fd) {
}
}
//----------------------------------------------------------------------
// close$NOCANCEL() interpose function
//----------------------------------------------------------------------
extern "C" int close$NOCANCEL$__interposed__(int fd) {
const int pid = get_interposed_pid();
if (pid >= 0) {
@ -900,9 +860,7 @@ extern "C" int close$NOCANCEL$__interposed__(int fd) {
}
}
//----------------------------------------------------------------------
// pipe() interpose function
//----------------------------------------------------------------------
extern "C" int pipe$__interposed__(int fds[2]) {
const int pid = get_interposed_pid();
if (pid >= 0) {
@ -926,7 +884,6 @@ extern "C" int pipe$__interposed__(int fds[2]) {
}
}
//----------------------------------------------------------------------
// get_fd_history()
//
// This function allows runtime access to the file descriptor history.
@ -936,7 +893,6 @@ extern "C" int pipe$__interposed__(int fds[2]) {
//
// @param[in] fd
// The file descriptor whose history should be dumped
//----------------------------------------------------------------------
extern "C" void get_fd_history(int log_fd, int fd) {
// "create" below needs to be outside of the mutex locker scope
if (log_fd >= 0) {
@ -960,9 +916,7 @@ extern "C" void get_fd_history(int log_fd, int fd) {
}
}
//----------------------------------------------------------------------
// Interposing
//----------------------------------------------------------------------
// FD creation routines
DYLD_INTERPOSE(accept$__interposed__, accept);
DYLD_INTERPOSE(accept$NOCANCEL$__interposed__, accept$NOCANCEL);

View File

@ -29,7 +29,6 @@
using namespace lldb;
//----------------------------------------------------------------------
// This quick sample code shows how to create a debugger instance and
// create an "i386" executable target. Then we can lookup the executable
// module and resolve a file address into a section offset address,
@ -45,7 +44,6 @@ using namespace lldb;
//
// $ DYLD_FRAMEWORK_PATH=/Volumes/data/lldb/svn/ToT/build/Debug ./a.out
// executable_path file_address
//----------------------------------------------------------------------
class LLDBSentry {
public:
LLDBSentry() {

View File

@ -21,7 +21,6 @@ public:
SBAttachInfo(lldb::pid_t pid);
//------------------------------------------------------------------
/// Attach to a process by name.
///
/// This function implies that a future call to SBTarget::Attach(...)
@ -33,10 +32,8 @@ public:
/// \param[in] wait_for
/// If \b false, attach to an existing process whose name matches.
/// If \b true, then wait for the next process whose name matches.
//------------------------------------------------------------------
SBAttachInfo(const char *path, bool wait_for);
//------------------------------------------------------------------
/// Attach to a process by name.
///
/// Future calls to SBTarget::Attach(...) will be synchronous or
@ -59,7 +56,6 @@ public:
/// eventually found. If the client wants to cancel the event,
/// SBProcess::Stop() can be called and an eStateExited process
/// event will be delivered.
//------------------------------------------------------------------
SBAttachInfo(const char *path, bool wait_for, bool async);
SBAttachInfo(const SBAttachInfo &rhs);
@ -78,7 +74,6 @@ public:
bool GetWaitForLaunch();
//------------------------------------------------------------------
/// Set attach by process name settings.
///
/// Designed to be used after a call to SBAttachInfo::SetExecutable().
@ -88,10 +83,8 @@ public:
/// \param[in] b
/// If \b false, attach to an existing process whose name matches.
/// If \b true, then wait for the next process whose name matches.
//------------------------------------------------------------------
void SetWaitForLaunch(bool b);
//------------------------------------------------------------------
/// Set attach by process name settings.
///
/// Designed to be used after a call to SBAttachInfo::SetExecutable().
@ -112,7 +105,6 @@ public:
/// eventually found. If the client wants to cancel the event,
/// SBProcess::Stop() can be called and an eStateExited process
/// event will be delivered.
//------------------------------------------------------------------
void SetWaitForLaunch(bool b, bool async);
bool GetIgnoreExisting();
@ -157,23 +149,19 @@ public:
bool ParentProcessIDIsValid();
//----------------------------------------------------------------------
/// Get the listener that will be used to receive process events.
///
/// If no listener has been set via a call to
/// SBAttachInfo::SetListener(), then an invalid SBListener will be
/// returned (SBListener::IsValid() will return false). If a listener
/// has been set, then the valid listener object will be returned.
//----------------------------------------------------------------------
SBListener GetListener();
//----------------------------------------------------------------------
/// Set the listener that will be used to receive process events.
///
/// By default the SBDebugger, which has a listener, that the SBTarget
/// belongs to will listen for the process events. Calling this function
/// allows a different listener to be used to listen for process events.
//----------------------------------------------------------------------
void SetListener(SBListener &listener);
protected:

View File

@ -60,7 +60,6 @@ public:
lldb::SBValueList GetVariables(lldb::SBTarget &target, bool arguments,
bool locals, bool statics);
//------------------------------------------------------------------
/// Get the inlined block that contains this block.
///
/// \return
@ -69,7 +68,6 @@ public:
/// block and are themselves inlined. An invalid SBBlock will
/// be returned if this block nor any parent blocks are inlined
/// function blocks.
//------------------------------------------------------------------
lldb::SBBlock GetContainingInlinedBlock();
bool GetDescription(lldb::SBStream &description);

View File

@ -190,16 +190,13 @@ public:
lldb_private::CommandInterpreter *interpreter_ptr =
nullptr); // Access using SBDebugger::GetCommandInterpreter();
//----------------------------------------------------------------------
/// Return true if the command interpreter is the active IO handler.
///
/// This indicates that any input coming into the debugger handles will
/// go to the command interpreter and will result in LLDB command line
/// commands being executed.
//----------------------------------------------------------------------
bool IsActive();
//----------------------------------------------------------------------
/// Get the string that needs to be written to the debugger stdin file
/// handle when a control character is typed.
///
@ -215,36 +212,27 @@ public:
/// The string that should be written into the file handle that is
/// feeding the input stream for the debugger, or nullptr if there is
/// no string for this control key.
//----------------------------------------------------------------------
const char *GetIOHandlerControlSequence(char ch);
bool GetPromptOnQuit();
void SetPromptOnQuit(bool b);
//----------------------------------------------------------------------
/// Sets whether the command interpreter should allow custom exit codes
/// for the 'quit' command.
//----------------------------------------------------------------------
void AllowExitCodeOnQuit(bool allow);
//----------------------------------------------------------------------
/// Returns true if the user has called the 'quit' command with a custom exit
/// code.
//----------------------------------------------------------------------
bool HasCustomQuitExitCode();
//----------------------------------------------------------------------
/// Returns the exit code that the user has specified when running the
/// 'quit' command. Returns 0 if the user hasn't called 'quit' at all or
/// without a custom exit code.
//----------------------------------------------------------------------
int GetQuitStatus();
//----------------------------------------------------------------------
/// Resolve the command just as HandleCommand would, expanding abbreviations
/// and aliases. If successful, result->GetOutput has the full expansion.
//----------------------------------------------------------------------
void ResolveCommand(const char *command_line, SBCommandReturnObject &result);
protected:

View File

@ -48,7 +48,6 @@ public:
uint32_t FindSupportFileIndex(uint32_t start_idx, const SBFileSpec &sb_file,
bool full);
//------------------------------------------------------------------
/// Get all types matching \a type_mask from debug info in this
/// compile unit.
///
@ -62,7 +61,6 @@ public:
///
/// \return
/// A list of types in this compile unit that match \a type_mask
//------------------------------------------------------------------
lldb::SBTypeList GetTypes(uint32_t type_mask = lldb::eTypeClassAny);
lldb::LanguageType GetLanguage();

View File

@ -33,11 +33,9 @@ public:
lldb::SBInstruction GetInstructionAtIndex(uint32_t idx);
// ----------------------------------------------------------------------
// Returns the number of instructions between the start and end address. If
// canSetBreakpoint is true then the count will be the number of
// instructions on which a breakpoint can be set.
// ----------------------------------------------------------------------
size_t GetInstructionsCount(const SBAddress &start,
const SBAddress &end,
bool canSetBreakpoint = false);

View File

@ -42,7 +42,6 @@ public:
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.
///
@ -64,26 +63,21 @@ public:
/// 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();

View File

@ -27,56 +27,43 @@ public:
void Clear();
//------------------------------------------------------------------
/// Get the base address of this memory range.
///
/// \return
/// The base address of this memory range.
//------------------------------------------------------------------
lldb::addr_t GetRegionBase();
//------------------------------------------------------------------
/// Get the end address of this memory range.
///
/// \return
/// The base address of this memory range.
//------------------------------------------------------------------
lldb::addr_t GetRegionEnd();
//------------------------------------------------------------------
/// Check if this memory address is marked readable to the process.
///
/// \return
/// true if this memory address is marked readable
//------------------------------------------------------------------
bool IsReadable();
//------------------------------------------------------------------
/// Check if this memory address is marked writable to the process.
///
/// \return
/// true if this memory address is marked writable
//------------------------------------------------------------------
bool IsWritable();
//------------------------------------------------------------------
/// Check if this memory address is marked executable to the process.
///
/// \return
/// true if this memory address is marked executable
//------------------------------------------------------------------
bool IsExecutable();
//------------------------------------------------------------------
/// Check if this memory address is mapped into the process address
/// space.
///
/// \return
/// true if this memory address is in the process address space.
//------------------------------------------------------------------
bool IsMapped();
//------------------------------------------------------------------
/// Returns the name of the memory region mapped at the given
/// address.
///
@ -84,7 +71,6 @@ public:
/// In case of memory mapped files it is the absolute path of
/// the file otherwise it is a name associated with the memory
/// region. If no name can be determined the returns nullptr.
//------------------------------------------------------------------
const char *GetName();
bool operator==(const lldb::SBMemoryRegionInfo &rhs) const;

View File

@ -37,7 +37,6 @@ public:
void Clear();
//------------------------------------------------------------------
/// Get const accessor for the module file specification.
///
/// This function returns the file for the module on the host system
@ -46,10 +45,8 @@ public:
///
/// \return
/// A const reference to the file specification object.
//------------------------------------------------------------------
lldb::SBFileSpec GetFileSpec() const;
//------------------------------------------------------------------
/// Get accessor for the module platform file specification.
///
/// Platform file refers to the path of the module as it is known on
@ -63,12 +60,10 @@ public:
///
/// \return
/// A const reference to the file specification object.
//------------------------------------------------------------------
lldb::SBFileSpec GetPlatformFileSpec() const;
bool SetPlatformFileSpec(const lldb::SBFileSpec &platform_file);
//------------------------------------------------------------------
/// Get accessor for the remote install path for a module.
///
/// When debugging to a remote platform by connecting to a remote
@ -79,10 +74,8 @@ public:
///
/// \return
/// A file specification object.
//------------------------------------------------------------------
lldb::SBFileSpec GetRemoteInstallFileSpec();
//------------------------------------------------------------------
/// Set accessor for the remote install path for a module.
///
/// When debugging to a remote platform by connecting to a remote
@ -99,7 +92,6 @@ public:
///
/// \param[in] file
/// A file specification object.
//------------------------------------------------------------------
bool SetRemoteInstallFileSpec(lldb::SBFileSpec &file);
lldb::ByteOrder GetByteOrder();
@ -130,7 +122,6 @@ public:
lldb::SBCompileUnit GetCompileUnitAtIndex(uint32_t);
//------------------------------------------------------------------
/// Find compile units related to *this module and passed source
/// file.
///
@ -141,7 +132,6 @@ public:
/// \return
/// A lldb::SBSymbolContextList that gets filled in with all of
/// the symbol contexts for all the matches.
//------------------------------------------------------------------
lldb::SBSymbolContextList
FindCompileUnits(const lldb::SBFileSpec &sb_file_spec);
@ -158,7 +148,6 @@ public:
size_t GetNumSections();
lldb::SBSection GetSectionAtIndex(size_t idx);
//------------------------------------------------------------------
/// Find functions by name.
///
/// \param[in] name
@ -174,12 +163,10 @@ public:
/// \return
/// A lldb::SBSymbolContextList that gets filled in with all of
/// the symbol contexts for all the matches.
//------------------------------------------------------------------
lldb::SBSymbolContextList
FindFunctions(const char *name,
uint32_t name_type_mask = lldb::eFunctionNameTypeAny);
//------------------------------------------------------------------
/// Find global and static variables by name.
///
/// \param[in] target
@ -194,11 +181,9 @@ public:
///
/// \return
/// A list of matched variables in an SBValueList.
//------------------------------------------------------------------
lldb::SBValueList FindGlobalVariables(lldb::SBTarget &target,
const char *name, uint32_t max_matches);
//------------------------------------------------------------------
/// Find the first global (or static) variable by name.
///
/// \param[in] target
@ -210,7 +195,6 @@ public:
///
/// \return
/// An SBValue that gets filled in with the found variable (if any).
//------------------------------------------------------------------
lldb::SBValue FindFirstGlobalVariable(lldb::SBTarget &target,
const char *name);
@ -218,7 +202,6 @@ public:
lldb::SBTypeList FindTypes(const char *type);
//------------------------------------------------------------------
/// Get a type using its type ID.
///
/// Each symbol file reader will assign different user IDs to their
@ -233,12 +216,10 @@ public:
/// \return
/// An SBType for the given type ID, or an empty SBType if the
/// type was not found.
//------------------------------------------------------------------
lldb::SBType GetTypeByID(lldb::user_id_t uid);
lldb::SBType GetBasicType(lldb::BasicType type);
//------------------------------------------------------------------
/// Get all types matching \a type_mask from debug info in this
/// module.
///
@ -251,10 +232,8 @@ public:
///
/// \return
/// A list of types in this module that match \a type_mask
//------------------------------------------------------------------
lldb::SBTypeList GetTypes(uint32_t type_mask = lldb::eTypeClassAny);
//------------------------------------------------------------------
/// Get the module version numbers.
///
/// Many object files have a set of version numbers that describe
@ -293,10 +272,8 @@ public:
/// This function always returns the number of version numbers
/// that this object file has regardless of the number of
/// version numbers that were copied into \a versions.
//------------------------------------------------------------------
uint32_t GetVersion(uint32_t *versions, uint32_t num_versions);
//------------------------------------------------------------------
/// Get accessor for the symbol file specification.
///
/// When debugging an object file an additional debug information can
@ -306,7 +283,6 @@ public:
///
/// \return
/// A const reference to the file specification object.
//------------------------------------------------------------------
lldb::SBFileSpec GetSymbolFileSpec() const;
lldb::SBAddress GetObjectFileHeaderAddress() const;

View File

@ -30,7 +30,6 @@ public:
void Clear();
//------------------------------------------------------------------
/// Get const accessor for the module file.
///
/// This function returns the file for the module on the host system
@ -39,12 +38,10 @@ public:
///
/// \return
/// A const reference to the file specification object.
//------------------------------------------------------------------
lldb::SBFileSpec GetFileSpec();
void SetFileSpec(const lldb::SBFileSpec &fspec);
//------------------------------------------------------------------
/// Get accessor for the module platform file.
///
/// Platform file refers to the path of the module as it is known on
@ -58,7 +55,6 @@ public:
///
/// \return
/// A const reference to the file specification object.
//------------------------------------------------------------------
lldb::SBFileSpec GetPlatformFileSpec();
void SetPlatformFileSpec(const lldb::SBFileSpec &fspec);

View File

@ -109,9 +109,7 @@ public:
bool IsConnected();
//----------------------------------------------------------------------
// The following functions will work if the platform is connected
//----------------------------------------------------------------------
const char *GetTriple();
const char *GetHostname();

View File

@ -22,9 +22,7 @@ class SBEvent;
class LLDB_API SBProcess {
public:
//------------------------------------------------------------------
/// Broadcaster event bits definitions.
//------------------------------------------------------------------
FLAGS_ANONYMOUS_ENUM(){eBroadcastBitStateChanged = (1 << 0),
eBroadcastBitInterrupt = (1 << 1),
eBroadcastBitSTDOUT = (1 << 2),
@ -72,11 +70,9 @@ public:
void AppendEventStateReport(const lldb::SBEvent &event,
lldb::SBCommandReturnObject &result);
//------------------------------------------------------------------
/// Remote connection related functions. These will fail if the
/// process is not in eStateConnected. They are intended for use
/// when connecting to an externally managed debugserver instance.
//------------------------------------------------------------------
bool RemoteAttachToProcessWithID(lldb::pid_t pid, lldb::SBError &error);
bool RemoteLaunch(char const **argv, char const **envp,
@ -85,9 +81,7 @@ public:
uint32_t launch_flags, bool stop_at_entry,
lldb::SBError &error);
//------------------------------------------------------------------
// Thread related functions
//------------------------------------------------------------------
uint32_t GetNumThreads();
lldb::SBThread GetThreadAtIndex(size_t index);
@ -98,12 +92,10 @@ public:
lldb::SBThread GetSelectedThread() const;
//------------------------------------------------------------------
// Function for lazily creating a thread using the current OS plug-in. This
// function will be removed in the future when there are APIs to create
// SBThread objects through the interface and add them to the process through
// the SBProcess API.
//------------------------------------------------------------------
lldb::SBThread CreateOSPluginThread(lldb::tid_t tid, lldb::addr_t context);
bool SetSelectedThread(const lldb::SBThread &thread);
@ -112,16 +104,12 @@ public:
bool SetSelectedThreadByIndexID(uint32_t index_id);
//------------------------------------------------------------------
// Queue related functions
//------------------------------------------------------------------
uint32_t GetNumQueues();
lldb::SBQueue GetQueueAtIndex(size_t index);
//------------------------------------------------------------------
// Stepping related functions
//------------------------------------------------------------------
lldb::StateType GetState();
@ -129,7 +117,6 @@ public:
const char *GetExitDescription();
//------------------------------------------------------------------
/// Gets the process ID
///
/// Returns the process identifier for the process as it is known
@ -142,10 +129,8 @@ public:
/// contain a valid process object, or if the process has not
/// been launched. Returns a valid process ID if the process is
/// valid.
//------------------------------------------------------------------
lldb::pid_t GetProcessID();
//------------------------------------------------------------------
/// Gets the unique ID associated with this process object
///
/// Unique IDs start at 1 and increment up with each new process
@ -157,7 +142,6 @@ public:
/// Returns a non-zero integer ID if this object contains a
/// valid process object, zero if this object does not contain
/// a valid process object.
//------------------------------------------------------------------
uint32_t GetUniqueID();
uint32_t GetAddressByteSize() const;
@ -182,7 +166,6 @@ public:
uint32_t GetStopID(bool include_expression_stops = false);
//------------------------------------------------------------------
/// Gets the stop event corresponding to stop ID.
//
/// Note that it wasn't fully implemented and tracks only the stop
@ -193,7 +176,6 @@ public:
///
/// \return
/// The stop event corresponding to stop ID.
//------------------------------------------------------------------
lldb::SBEvent GetStopEventForStopID(uint32_t stop_id);
size_t ReadMemory(addr_t addr, void *buf, size_t size, lldb::SBError &error);
@ -236,7 +218,6 @@ public:
bool GetDescription(lldb::SBStream &description);
//------------------------------------------------------------------
/// Start Tracing with the given SBTraceOptions.
///
/// \param[in] options
@ -260,12 +241,10 @@ public:
/// \return
/// A SBTrace instance, which should be used
/// to get the trace data or other trace related operations.
//------------------------------------------------------------------
lldb::SBTrace StartTrace(SBTraceOptions &options, lldb::SBError &error);
uint32_t GetNumSupportedHardwareWatchpoints(lldb::SBError &error) const;
//------------------------------------------------------------------
/// Load a shared library into this process.
///
/// \param[in] remote_image_spec
@ -281,10 +260,8 @@ public:
/// later used to unload the shared library. A value of
/// LLDB_INVALID_IMAGE_TOKEN will be returned if the shared
/// library can't be opened.
//------------------------------------------------------------------
uint32_t LoadImage(lldb::SBFileSpec &remote_image_spec, lldb::SBError &error);
//------------------------------------------------------------------
/// Load a shared library into this process.
///
/// \param[in] local_image_spec
@ -309,12 +286,10 @@ public:
/// later used to unload the shared library. A value of
/// LLDB_INVALID_IMAGE_TOKEN will be returned if the shared
/// library can't be opened.
//------------------------------------------------------------------
uint32_t LoadImage(const lldb::SBFileSpec &local_image_spec,
const lldb::SBFileSpec &remote_image_spec,
lldb::SBError &error);
//------------------------------------------------------------------
/// Load a shared library into this process, starting with a
/// library name and a list of paths, searching along the list of
/// paths till you find a matching library.
@ -342,7 +317,6 @@ public:
/// later passed to UnloadImage. A value of
/// LLDB_INVALID_IMAGE_TOKEN will be returned if the shared
/// library can't be opened.
//------------------------------------------------------------------
uint32_t LoadImageUsingPaths(const lldb::SBFileSpec &image_spec,
SBStringList &paths,
lldb::SBFileSpec &loaded_path,
@ -352,7 +326,6 @@ public:
lldb::SBError SendEventData(const char *data);
//------------------------------------------------------------------
/// Return the number of different thread-origin extended backtraces
/// this process can support.
///
@ -364,10 +337,8 @@ public:
/// \return
/// The number of thread-origin extended backtrace types that may be
/// available.
//------------------------------------------------------------------
uint32_t GetNumExtendedBacktraceTypes();
//------------------------------------------------------------------
/// Return the name of one of the thread-origin extended backtrace
/// methods.
///
@ -379,7 +350,6 @@ public:
///
/// \return
/// The name at that index.
//------------------------------------------------------------------
const char *GetExtendedBacktraceTypeAtIndex(uint32_t idx);
lldb::SBThreadCollection GetHistoryThreads(addr_t addr);
@ -389,7 +359,6 @@ public:
/// Save the state of the process in a core file (or mini dump on Windows).
lldb::SBError SaveCore(const char *file_name);
//------------------------------------------------------------------
/// Query the address load_addr and store the details of the memory
/// region that contains it in the supplied SBMemoryRegionInfo object.
/// To iterate over all memory regions use GetMemoryRegionList.
@ -404,25 +373,20 @@ public:
/// \return
/// An error object describes any errors that occurred while
/// querying load_addr.
//------------------------------------------------------------------
lldb::SBError GetMemoryRegionInfo(lldb::addr_t load_addr,
lldb::SBMemoryRegionInfo &region_info);
//------------------------------------------------------------------
/// Return the list of memory regions within the process.
///
/// \return
/// A list of all witin the process memory regions.
//------------------------------------------------------------------
lldb::SBMemoryRegionInfoList GetMemoryRegions();
//------------------------------------------------------------------
/// Return information about the process.
///
/// Valid process info will only be returned when the process is
/// alive, use SBProcessInfo::IsValid() to check returned info is
/// valid.
//------------------------------------------------------------------
lldb::SBProcessInfo GetProcessInfo();
protected:

View File

@ -54,7 +54,6 @@ public:
SectionType GetSectionType();
//------------------------------------------------------------------
/// Gets the permissions (RWX) of the section of the object file
///
/// Returns a mask of bits of enum lldb::Permissions for this section.
@ -65,11 +64,9 @@ public:
///
/// \return
/// Returns an unsigned value for Permissions for the section.
//------------------------------------------------------------------
uint32_t
GetPermissions() const;
//------------------------------------------------------------------
/// Return the size of a target's byte represented by this section
/// in numbers of host bytes. Note that certain architectures have
/// varying minimum addressable unit (i.e. byte) size for their
@ -77,7 +74,6 @@ public:
///
/// \return
/// The number of host (8-bit) bytes needed to hold a target byte
//------------------------------------------------------------------
uint32_t GetTargetByteSize();
bool operator==(const lldb::SBSection &rhs);

View File

@ -40,53 +40,36 @@ public:
lldb::SBError GetDescription(lldb::SBStream &stream) const;
//------------------------------------------------------------------
/// Return the type of data in this data structure
//------------------------------------------------------------------
lldb::StructuredDataType GetType() const;
//------------------------------------------------------------------
/// Return the size (i.e. number of elements) in this data structure
/// if it is an array or dictionary type. For other types, 0 will be
// returned.
//------------------------------------------------------------------
size_t GetSize() const;
//------------------------------------------------------------------
/// Fill keys with the keys in this object and return true if this data
/// structure is a dictionary. Returns false otherwise.
//------------------------------------------------------------------
bool GetKeys(lldb::SBStringList &keys) const;
//------------------------------------------------------------------
/// Return the value corresponding to a key if this data structure
/// is a dictionary type.
//------------------------------------------------------------------
lldb::SBStructuredData GetValueForKey(const char *key) const;
//------------------------------------------------------------------
/// Return the value corresponding to an index if this data structure
/// is array.
//------------------------------------------------------------------
lldb::SBStructuredData GetItemAtIndex(size_t idx) const;
//------------------------------------------------------------------
/// Return the integer value if this data structure is an integer type.
//------------------------------------------------------------------
uint64_t GetIntegerValue(uint64_t fail_value = 0) const;
//------------------------------------------------------------------
/// Return the floating point value if this data structure is a floating
/// type.
//------------------------------------------------------------------
double GetFloatValue(double fail_value = 0.0) const;
//------------------------------------------------------------------
/// Return the boolean value if this data structure is a boolean type.
//------------------------------------------------------------------
bool GetBooleanValue(bool fail_value = false) const;
//------------------------------------------------------------------
/// Provides the string value if this data structure is a string type.
///
/// \param[out] dst
@ -102,7 +85,6 @@ public:
/// \return
/// Returns the byte size needed to completely write the string value at
/// \a dst in all cases.
//------------------------------------------------------------------
size_t GetStringValue(char *dst, size_t dst_len) const;
protected:

View File

@ -55,16 +55,12 @@ public:
bool GetDescription(lldb::SBStream &description);
//----------------------------------------------------------------------
// Returns true if the symbol is externally visible in the module that it is
// defined in
//----------------------------------------------------------------------
bool IsExternal();
//----------------------------------------------------------------------
// Returns true if the symbol was synthetically generated from something
// other than the actual symbol table itself in the object file.
//----------------------------------------------------------------------
bool IsSynthetic();
protected:

View File

@ -28,9 +28,7 @@ class SBPlatform;
class LLDB_API SBTarget {
public:
//------------------------------------------------------------------
// Broadcaster bits.
//------------------------------------------------------------------
enum {
eBroadcastBitBreakpointChanged = (1 << 0),
eBroadcastBitModulesLoaded = (1 << 1),
@ -39,18 +37,14 @@ public:
eBroadcastBitSymbolsLoaded = (1 << 4)
};
//------------------------------------------------------------------
// Constructors
//------------------------------------------------------------------
SBTarget();
SBTarget(const lldb::SBTarget &rhs);
SBTarget(const lldb::TargetSP &target_sp);
//------------------------------------------------------------------
// Destructor
//------------------------------------------------------------------
~SBTarget();
const lldb::SBTarget &operator=(const lldb::SBTarget &rhs);
@ -72,32 +66,25 @@ public:
lldb::SBProcess GetProcess();
//------------------------------------------------------------------
/// Sets whether we should collect statistics on lldb or not.
///
/// \param[in] v
/// A boolean to control the collection.
//------------------------------------------------------------------
void SetCollectingStats(bool v);
//------------------------------------------------------------------
/// Returns whether statistics collection are enabled.
///
/// \return
/// true if statistics are currently being collected, false
/// otherwise.
//------------------------------------------------------------------
bool GetCollectingStats();
//------------------------------------------------------------------
/// Returns a dump of the collected statistics.
///
/// \return
/// A SBStructuredData with the statistics collected.
//------------------------------------------------------------------
lldb::SBStructuredData GetStatistics();
//------------------------------------------------------------------
/// Return the platform object associated with the target.
///
/// After return, the platform object should be checked for
@ -105,10 +92,8 @@ public:
///
/// \return
/// A platform object.
//------------------------------------------------------------------
lldb::SBPlatform GetPlatform();
//------------------------------------------------------------------
/// Install any binaries that need to be installed.
///
/// This function does nothing when debugging on the host system.
@ -121,10 +106,8 @@ public:
/// \return
/// An error describing anything that went wrong during
/// installation.
//------------------------------------------------------------------
SBError Install();
//------------------------------------------------------------------
/// Launch a new process.
///
/// Launch a new process by spawning a new process using the
@ -176,7 +159,6 @@ public:
///
/// \return
/// A process object for the newly created process.
//------------------------------------------------------------------
lldb::SBProcess Launch(SBListener &listener, char const **argv,
char const **envp, const char *stdin_path,
const char *stdout_path, const char *stderr_path,
@ -187,7 +169,6 @@ public:
SBProcess LoadCore(const char *core_file);
SBProcess LoadCore(const char *core_file, lldb::SBError &error);
//------------------------------------------------------------------
/// Launch a new process with sensible defaults.
///
/// \param[in] argv
@ -212,7 +193,6 @@ public:
///
/// \return
/// A process object for the newly created process.
//------------------------------------------------------------------
SBProcess LaunchSimple(const char **argv, const char **envp,
const char *working_directory);
@ -220,7 +200,6 @@ public:
SBProcess Attach(SBAttachInfo &attach_info, SBError &error);
//------------------------------------------------------------------
/// Attach to process with pid.
///
/// \param[in] listener
@ -237,11 +216,9 @@ public:
///
/// \return
/// A process object for the attached process.
//------------------------------------------------------------------
lldb::SBProcess AttachToProcessWithID(SBListener &listener, lldb::pid_t pid,
lldb::SBError &error);
//------------------------------------------------------------------
/// Attach to process with name.
///
/// \param[in] listener
@ -261,12 +238,10 @@ public:
///
/// \return
/// A process object for the attached process.
//------------------------------------------------------------------
lldb::SBProcess AttachToProcessWithName(SBListener &listener,
const char *name, bool wait_for,
lldb::SBError &error);
//------------------------------------------------------------------
/// Connect to a remote debug server with url.
///
/// \param[in] listener
@ -286,7 +261,6 @@ public:
///
/// \return
/// A process object for the connected process.
//------------------------------------------------------------------
lldb::SBProcess ConnectRemote(SBListener &listener, const char *url,
const char *plugin_name, SBError &error);
@ -316,7 +290,6 @@ public:
lldb::SBModule FindModule(const lldb::SBFileSpec &file_spec);
//------------------------------------------------------------------
/// Find compile units related to *this target and passed source
/// file.
///
@ -327,7 +300,6 @@ public:
/// \return
/// A lldb::SBSymbolContextList that gets filled in with all of
/// the symbol contexts for all the matches.
//------------------------------------------------------------------
lldb::SBSymbolContextList
FindCompileUnits(const lldb::SBFileSpec &sb_file_spec);
@ -337,25 +309,20 @@ public:
const char *GetTriple();
//------------------------------------------------------------------
/// Architecture data byte width accessor
///
/// \return
/// The size in 8-bit (host) bytes of a minimum addressable
/// unit from the Architecture's data bus
//------------------------------------------------------------------
uint32_t GetDataByteSize();
//------------------------------------------------------------------
/// Architecture code byte width accessor
///
/// \return
/// The size in 8-bit (host) bytes of a minimum addressable
/// unit from the Architecture's code bus
//------------------------------------------------------------------
uint32_t GetCodeByteSize();
//------------------------------------------------------------------
/// Set the base load address for a module section.
///
/// \param[in] section
@ -368,11 +335,9 @@ public:
/// \return
/// An error to indicate success, fail, and any reason for
/// failure.
//------------------------------------------------------------------
lldb::SBError SetSectionLoadAddress(lldb::SBSection section,
lldb::addr_t section_base_addr);
//------------------------------------------------------------------
/// Clear the base load address for a module section.
///
/// \param[in] section
@ -382,10 +347,8 @@ public:
/// \return
/// An error to indicate success, fail, and any reason for
/// failure.
//------------------------------------------------------------------
lldb::SBError ClearSectionLoadAddress(lldb::SBSection section);
//------------------------------------------------------------------
/// Slide all file addresses for all module sections so that \a module
/// appears to loaded at these slide addresses.
///
@ -404,11 +367,9 @@ public:
/// \return
/// An error to indicate success, fail, and any reason for
/// failure.
//------------------------------------------------------------------
lldb::SBError SetModuleLoadAddress(lldb::SBModule module,
int64_t sections_offset);
//------------------------------------------------------------------
/// Clear the section base load addresses for all sections in a module.
///
/// \param[in] module
@ -417,10 +378,8 @@ public:
/// \return
/// An error to indicate success, fail, and any reason for
/// failure.
//------------------------------------------------------------------
lldb::SBError ClearModuleLoadAddress(lldb::SBModule module);
//------------------------------------------------------------------
/// Find functions by name.
///
/// \param[in] name
@ -436,12 +395,10 @@ public:
/// \return
/// A lldb::SBSymbolContextList that gets filled in with all of
/// the symbol contexts for all the matches.
//------------------------------------------------------------------
lldb::SBSymbolContextList
FindFunctions(const char *name,
uint32_t name_type_mask = lldb::eFunctionNameTypeAny);
//------------------------------------------------------------------
/// Find global and static variables by name.
///
/// \param[in] name
@ -453,10 +410,8 @@ public:
///
/// \return
/// A list of matched variables in an SBValueList.
//------------------------------------------------------------------
lldb::SBValueList FindGlobalVariables(const char *name, uint32_t max_matches);
//------------------------------------------------------------------
/// Find the first global (or static) variable by name.
///
/// \param[in] name
@ -465,10 +420,8 @@ public:
///
/// \return
/// An SBValue that gets filled in with the found variable (if any).
//------------------------------------------------------------------
lldb::SBValue FindFirstGlobalVariable(const char *name);
//------------------------------------------------------------------
/// Find global and static variables by pattern.
///
/// \param[in] name
@ -482,11 +435,9 @@ public:
///
/// \return
/// A list of matched variables in an SBValueList.
//------------------------------------------------------------------
lldb::SBValueList FindGlobalVariables(const char *name, uint32_t max_matches,
MatchType matchtype);
//------------------------------------------------------------------
/// Find global functions by their name with pattern matching.
///
/// \param[in] name
@ -500,14 +451,12 @@ public:
///
/// \return
/// A list of matched variables in an SBValueList.
//------------------------------------------------------------------
lldb::SBSymbolContextList FindGlobalFunctions(const char *name,
uint32_t max_matches,
MatchType matchtype);
void Clear();
//------------------------------------------------------------------
/// Resolve a current file address into a section offset address.
///
/// \param[in] file_addr
@ -515,10 +464,8 @@ public:
///
/// \return
/// An SBAddress which will be valid if...
//------------------------------------------------------------------
lldb::SBAddress ResolveFileAddress(lldb::addr_t file_addr);
//------------------------------------------------------------------
/// Resolve a current load address into a section offset address.
///
/// \param[in] vm_addr
@ -530,10 +477,8 @@ public:
/// successfully resolved into a section offset address, or an
/// invalid SBAddress if \a vm_addr doesn't resolve to a section
/// in a module.
//------------------------------------------------------------------
lldb::SBAddress ResolveLoadAddress(lldb::addr_t vm_addr);
//------------------------------------------------------------------
/// Resolve a current load address into a section offset address
/// using the process stop ID to identify a time in the past.
///
@ -554,14 +499,12 @@ public:
/// successfully resolved into a section offset address, or an
/// invalid SBAddress if \a vm_addr doesn't resolve to a section
/// in a module.
//------------------------------------------------------------------
lldb::SBAddress ResolvePastLoadAddress(uint32_t stop_id,
lldb::addr_t vm_addr);
SBSymbolContext ResolveSymbolContextForAddress(const SBAddress &addr,
uint32_t resolve_scope);
//------------------------------------------------------------------
/// Read target memory. If a target process is running then memory
/// is read from here. Otherwise the memory is read from the object
/// files. For a target whose bytes are sized as a multiple of host
@ -582,7 +525,6 @@ public:
///
/// \return
/// The amount of data read in host bytes.
//------------------------------------------------------------------
size_t ReadMemory(const SBAddress addr, void *buf, size_t size,
lldb::SBError &error);
@ -683,7 +625,6 @@ public:
lldb::SBBreakpoint BreakpointCreateBySBAddress(SBAddress &address);
//------------------------------------------------------------------
/// Create a breakpoint using a scripted resolver.
///
/// \param[in] class_name
@ -706,7 +647,6 @@ public:
/// \return
/// An SBBreakpoint that will set locations based on the logic in the
/// resolver's search callback.
//------------------------------------------------------------------
lldb::SBBreakpoint BreakpointCreateFromScript(
const char *class_name,
SBStructuredData &extra_args,
@ -714,7 +654,6 @@ public:
const SBFileSpecList &file_list,
bool request_hardware = false);
//------------------------------------------------------------------
/// Read breakpoints from source_file and return the newly created
/// breakpoints in bkpt_list.
///
@ -726,11 +665,9 @@ public:
///
/// \return
/// An SBError detailing any errors in reading in the breakpoints.
//------------------------------------------------------------------
lldb::SBError BreakpointsCreateFromFile(SBFileSpec &source_file,
SBBreakpointList &new_bps);
//------------------------------------------------------------------
/// Read breakpoints from source_file and return the newly created
/// breakpoints in bkpt_list.
///
@ -746,12 +683,10 @@ public:
///
/// \return
/// An SBError detailing any errors in reading in the breakpoints.
//------------------------------------------------------------------
lldb::SBError BreakpointsCreateFromFile(SBFileSpec &source_file,
SBStringList &matching_names,
SBBreakpointList &new_bps);
//------------------------------------------------------------------
/// Write breakpoints to dest_file.
///
/// \param[in] dest_file
@ -759,10 +694,8 @@ public:
///
/// \return
/// An SBError detailing any errors in writing in the breakpoints.
//------------------------------------------------------------------
lldb::SBError BreakpointsWriteToFile(SBFileSpec &dest_file);
//------------------------------------------------------------------
/// Write breakpoints listed in bkpt_list to dest_file.
///
/// \param[in] dest_file
@ -778,7 +711,6 @@ public:
///
/// \return
/// An SBError detailing any errors in writing in the breakpoints.
//------------------------------------------------------------------
lldb::SBError BreakpointsWriteToFile(SBFileSpec &dest_file,
SBBreakpointList &bkpt_list,
bool append = false);
@ -904,10 +836,8 @@ protected:
friend class SBValue;
friend class SBVariablesOptions;
//------------------------------------------------------------------
// Constructors are private, use static Target::Create function to create an
// instance of this class.
//------------------------------------------------------------------
lldb::TargetSP GetSP() const;

View File

@ -51,7 +51,6 @@ public:
/// See also GetStopReasonDataAtIndex().
size_t GetStopReasonDataCount();
//--------------------------------------------------------------------------
/// Get information associated with a stop reason.
///
/// Breakpoint stop reasons will have data that consists of pairs of
@ -68,7 +67,6 @@ public:
/// eStopReasonException N exception data
/// eStopReasonExec 0
/// eStopReasonPlanComplete 0
//--------------------------------------------------------------------------
uint64_t GetStopReasonDataAtIndex(uint32_t idx);
bool GetStopReasonExtendedInfoAsJSON(lldb::SBStream &stream);
@ -134,7 +132,6 @@ public:
SBError UnwindInnermostExpression();
//--------------------------------------------------------------------------
/// LLDB currently supports process centric debugging which means when any
/// thread in a process stops, all other threads are stopped. The Suspend()
/// call here tells our process to suspend a thread and not let it run when
@ -154,7 +151,6 @@ public:
/// Suspend() and Resume() functions are not currently reference counted, if
/// anyone has the need for them to be reference counted, please let us
/// know.
//--------------------------------------------------------------------------
bool Suspend();
bool Suspend(SBError &error);

View File

@ -42,7 +42,6 @@ public:
/// See also GetStopReasonDataAtIndex().
size_t GetStopReasonDataCount();
//--------------------------------------------------------------------------
/// Get information associated with a stop reason.
///
/// Breakpoint stop reasons will have data that consists of pairs of
@ -59,7 +58,6 @@ public:
/// eStopReasonException N exception data
/// eStopReasonExec 0
/// eStopReasonPlanComplete 0
//--------------------------------------------------------------------------
uint64_t GetStopReasonDataAtIndex(uint32_t idx);
SBThread GetThread() const;

View File

@ -19,7 +19,6 @@ namespace lldb {
class LLDB_API SBTrace {
public:
SBTrace();
//------------------------------------------------------------------
/// Obtain the trace data as raw bytes.
///
/// \param[out] error
@ -47,19 +46,15 @@ public:
///
/// \return
/// The size of the trace data effectively read by the API call.
//------------------------------------------------------------------
size_t GetTraceData(SBError &error, void *buf, size_t size, size_t offset = 0,
lldb::tid_t thread_id = LLDB_INVALID_THREAD_ID);
//------------------------------------------------------------------
/// Obtain any meta data as raw bytes for the tracing instance.
/// The input parameter definition is similar to the previous
/// function.
//------------------------------------------------------------------
size_t GetMetaData(SBError &error, void *buf, size_t size, size_t offset = 0,
lldb::tid_t thread_id = LLDB_INVALID_THREAD_ID);
//------------------------------------------------------------------
/// Stop the tracing instance. Stopping the trace will also
/// lead to deletion of any gathered trace data.
///
@ -80,11 +75,9 @@ public:
/// trace id of the process.
/// Now if the StopTrace API is called for the whole process,
/// thread A will not be stopped and must be stopped separately.
//------------------------------------------------------------------
void StopTrace(SBError &error,
lldb::tid_t thread_id = LLDB_INVALID_THREAD_ID);
//------------------------------------------------------------------
/// Get the trace configuration being used for the trace instance.
/// The threadid in the SBTraceOptions needs to be set when the
/// configuration used by a specific thread is being requested.
@ -95,7 +88,6 @@ public:
///
/// \param[out] error
/// An error explaining what went wrong.
//------------------------------------------------------------------
void GetTraceConfig(SBTraceOptions &options, SBError &error);
lldb::user_id_t GetTraceUID();

View File

@ -137,7 +137,6 @@ public:
lldb::SBValue CreateValueFromData(const char *name, lldb::SBData data,
lldb::SBType type);
//------------------------------------------------------------------
/// Get a child value by index from a value.
///
/// Structs, unions, classes, arrays and pointers have child
@ -190,7 +189,6 @@ public:
///
/// \return
/// A new SBValue object that represents the child member value.
//------------------------------------------------------------------
lldb::SBValue GetChildAtIndex(uint32_t idx,
lldb::DynamicValueType use_dynamic,
bool can_create_synthetic);
@ -217,7 +215,6 @@ public:
lldb::SBAddress GetAddress();
//------------------------------------------------------------------
/// Get an SBData wrapping what this SBValue points to.
///
/// This method will dereference the current SBValue, if its
@ -237,10 +234,8 @@ public:
/// \return
/// An SBData with the contents of the copied items, on success.
/// An empty SBData otherwise.
//------------------------------------------------------------------
lldb::SBData GetPointeeData(uint32_t item_idx = 0, uint32_t item_count = 1);
//------------------------------------------------------------------
/// Get an SBData wrapping the contents of this SBValue.
///
/// This method will read the contents of this object in memory
@ -249,14 +244,12 @@ public:
/// \return
/// An SBData with the contents of this SBValue, on success.
/// An empty SBData otherwise.
//------------------------------------------------------------------
lldb::SBData GetData();
bool SetData(lldb::SBData &data, lldb::SBError &error);
lldb::SBDeclaration GetDeclaration();
//------------------------------------------------------------------
/// Find out if a SBValue might have children.
///
/// This call is much more efficient than GetNumChildren() as it
@ -271,7 +264,6 @@ public:
/// \return
/// Returns \b true if the SBValue might have children, or \b
/// false otherwise.
//------------------------------------------------------------------
bool MightHaveChildren();
bool IsRuntimeSupportValue();
@ -315,7 +307,6 @@ public:
SBValue(const lldb::ValueObjectSP &value_sp);
//------------------------------------------------------------------
/// Watch this value if it resides in memory.
///
/// Sets a watchpoint on the value.
@ -340,14 +331,12 @@ public:
/// return due to a value not being contained in memory, too
/// large, or watchpoint resources are not available or all in
/// use.
//------------------------------------------------------------------
lldb::SBWatchpoint Watch(bool resolve_location, bool read, bool write,
SBError &error);
// Backward compatibility fix in the interim.
lldb::SBWatchpoint Watch(bool resolve_location, bool read, bool write);
//------------------------------------------------------------------
/// Watch this value that this value points to in memory
///
/// Sets a watchpoint on the value.
@ -372,11 +361,9 @@ public:
/// return due to a value not being contained in memory, too
/// large, or watchpoint resources are not available or all in
/// use.
//------------------------------------------------------------------
lldb::SBWatchpoint WatchPointee(bool resolve_location, bool read, bool write,
SBError &error);
//------------------------------------------------------------------
/// Same as the protected version of GetSP that takes a locker, except that we
/// make the
/// locker locally in the function. Since the Target API mutex is recursive,
@ -388,7 +375,6 @@ public:
/// \return
/// A ValueObjectSP of the best kind (static, dynamic or synthetic) we
/// can cons up, in accordance with the SBValue's settings.
//------------------------------------------------------------------
lldb::ValueObjectSP GetSP() const;
protected:
@ -398,7 +384,6 @@ protected:
friend class SBThread;
friend class SBValueList;
//------------------------------------------------------------------
/// Get the appropriate ValueObjectSP from this SBValue, consulting the
/// use_dynamic and use_synthetic options passed in to SetSP when the
/// SBValue's contents were set. Since this often requires examining memory,
@ -422,7 +407,6 @@ protected:
/// \return
/// A ValueObjectSP of the best kind (static, dynamic or synthetic) we
/// can cons up, in accordance with the SBValue's settings.
//------------------------------------------------------------------
lldb::ValueObjectSP GetSP(ValueLocker &value_locker) const;
// these calls do the right thing WRT adjusting their settings according to

View File

@ -27,12 +27,9 @@
namespace lldb_private {
//----------------------------------------------------------------------
/// \class Breakpoint Breakpoint.h "lldb/Breakpoint/Breakpoint.h" Class that
/// manages logical breakpoint setting.
//----------------------------------------------------------------------
//----------------------------------------------------------------------
/// General Outline:
/// A breakpoint has four main parts, a filter, a resolver, the list of
/// breakpoint
@ -78,16 +75,13 @@ namespace lldb_private {
/// subtle point worth observing here is that you don't actually stop at a
/// Breakpoint, you always stop at one of its locations. So the "should stop"
/// tests are done by the location, not by the breakpoint.
//----------------------------------------------------------------------
class Breakpoint : public std::enable_shared_from_this<Breakpoint>,
public Stoppoint {
public:
static ConstString GetEventIdentifier();
//------------------------------------------------------------------
/// An enum specifying the match style for breakpoint settings. At present
/// only used for function name style breakpoints.
//------------------------------------------------------------------
typedef enum { Exact, Regexp, Glob } MatchType;
private:
@ -170,48 +164,33 @@ public:
virtual StructuredData::ObjectSP SerializeToStructuredData();
static const char *GetSerializationKey() { return "Breakpoint"; }
//------------------------------------------------------------------
/// Destructor.
///
/// The destructor is not virtual since there should be no reason to
/// subclass breakpoints. The varieties of breakpoints are specified
/// instead by providing different resolvers & filters.
//------------------------------------------------------------------
~Breakpoint() override;
//------------------------------------------------------------------
// Methods
//------------------------------------------------------------------
//------------------------------------------------------------------
/// Tell whether this breakpoint is an "internal" breakpoint. \return
/// Returns \b true if this is an internal breakpoint, \b false otherwise.
//------------------------------------------------------------------
bool IsInternal() const;
//------------------------------------------------------------------
/// Standard "Dump" method. At present it does nothing.
//------------------------------------------------------------------
void Dump(Stream *s) override;
//------------------------------------------------------------------
// The next set of methods provide ways to tell the breakpoint to update it's
// location list - usually done when modules appear or disappear.
//------------------------------------------------------------------
//------------------------------------------------------------------
/// Tell this breakpoint to clear all its breakpoint sites. Done when the
/// process holding the breakpoint sites is destroyed.
//------------------------------------------------------------------
void ClearAllBreakpointSites();
//------------------------------------------------------------------
/// Tell this breakpoint to scan it's target's module list and resolve any
/// new locations that match the breakpoint's specifications.
//------------------------------------------------------------------
void ResolveBreakpoint();
//------------------------------------------------------------------
/// Tell this breakpoint to scan a given module list and resolve any new
/// locations that match the breakpoint's specifications.
///
@ -221,11 +200,9 @@ public:
/// \param[in] send_event
/// If \b true, send a breakpoint location added event for non-internal
/// breakpoints.
//------------------------------------------------------------------
void ResolveBreakpointInModules(ModuleList &module_list,
bool send_event = true);
//------------------------------------------------------------------
/// Tell this breakpoint to scan a given module list and resolve any new
/// locations that match the breakpoint's specifications.
///
@ -234,11 +211,9 @@ public:
///
/// \param[in] new_locations
/// Fills new_locations with the new locations that were made.
//------------------------------------------------------------------
void ResolveBreakpointInModules(ModuleList &module_list,
BreakpointLocationCollection &new_locations);
//------------------------------------------------------------------
/// Like ResolveBreakpointInModules, but allows for "unload" events, in
/// which case we will remove any locations that are in modules that got
/// unloaded.
@ -250,11 +225,9 @@ public:
/// \param[in] delete_locations
/// If \b true then the modules were unloaded delete any locations in the
/// changed modules.
//------------------------------------------------------------------
void ModulesChanged(ModuleList &changed_modules, bool load_event,
bool delete_locations = false);
//------------------------------------------------------------------
/// Tells the breakpoint the old module \a old_module_sp has been replaced
/// by new_module_sp (usually because the underlying file has been rebuilt,
/// and the old version is gone.)
@ -263,16 +236,12 @@ public:
/// The old module that is going away.
/// \param[in] new_module_sp
/// The new module that is replacing it.
//------------------------------------------------------------------
void ModuleReplaced(lldb::ModuleSP old_module_sp,
lldb::ModuleSP new_module_sp);
//------------------------------------------------------------------
// The next set of methods provide access to the breakpoint locations for
// this breakpoint.
//------------------------------------------------------------------
//------------------------------------------------------------------
/// Add a location to the breakpoint's location list. This is only meant to
/// be called by the breakpoint's resolver. FIXME: how do I ensure that?
///
@ -283,11 +252,9 @@ public:
/// already was a location at this Address.
/// \return
/// Returns a pointer to the new location.
//------------------------------------------------------------------
lldb::BreakpointLocationSP AddLocation(const Address &addr,
bool *new_location = nullptr);
//------------------------------------------------------------------
/// Find a breakpoint location by Address.
///
/// \param[in] addr
@ -296,10 +263,8 @@ public:
/// Returns a shared pointer to the location at \a addr. The pointer
/// in the shared pointer will be nullptr if there is no location at that
/// address.
//------------------------------------------------------------------
lldb::BreakpointLocationSP FindLocationByAddress(const Address &addr);
//------------------------------------------------------------------
/// Find a breakpoint location ID by Address.
///
/// \param[in] addr
@ -307,10 +272,8 @@ public:
/// \return
/// Returns the UID of the location at \a addr, or \b LLDB_INVALID_ID if
/// there is no breakpoint location at that address.
//------------------------------------------------------------------
lldb::break_id_t FindLocationIDByAddress(const Address &addr);
//------------------------------------------------------------------
/// Find a breakpoint location for a given breakpoint location ID.
///
/// \param[in] bp_loc_id
@ -320,10 +283,8 @@ public:
/// pointer
/// in the shared pointer will be nullptr if there is no location with that
/// ID.
//------------------------------------------------------------------
lldb::BreakpointLocationSP FindLocationByID(lldb::break_id_t bp_loc_id);
//------------------------------------------------------------------
/// Get breakpoint locations by index.
///
/// \param[in] index
@ -333,10 +294,8 @@ public:
/// Returns a shared pointer to the location with index \a
/// index. The shared pointer might contain nullptr if \a index is
/// greater than then number of actual locations.
//------------------------------------------------------------------
lldb::BreakpointLocationSP GetLocationAtIndex(size_t index);
//------------------------------------------------------------------
/// Removes all invalid breakpoint locations.
///
/// Removes all breakpoint locations with architectures that aren't
@ -350,83 +309,58 @@ public:
/// \param[in] arch
/// If valid, check the module in each breakpoint to make sure
/// they are compatible, otherwise, ignore architecture.
//------------------------------------------------------------------
void RemoveInvalidLocations(const ArchSpec &arch);
//------------------------------------------------------------------
// The next section deals with various breakpoint options.
//------------------------------------------------------------------
//------------------------------------------------------------------
/// If \a enable is \b true, enable the breakpoint, if \b false disable it.
//------------------------------------------------------------------
void SetEnabled(bool enable) override;
//------------------------------------------------------------------
/// Check the Enable/Disable state.
/// \return
/// \b true if the breakpoint is enabled, \b false if disabled.
//------------------------------------------------------------------
bool IsEnabled() override;
//------------------------------------------------------------------
/// Set the breakpoint to ignore the next \a count breakpoint hits.
/// \param[in] count
/// The number of breakpoint hits to ignore.
//------------------------------------------------------------------
void SetIgnoreCount(uint32_t count);
//------------------------------------------------------------------
/// Return the current ignore count/
/// \return
/// The number of breakpoint hits to be ignored.
//------------------------------------------------------------------
uint32_t GetIgnoreCount() const;
//------------------------------------------------------------------
/// Return the current hit count for all locations. \return
/// The current hit count for all locations.
//------------------------------------------------------------------
uint32_t GetHitCount() const;
//------------------------------------------------------------------
/// If \a one_shot is \b true, breakpoint will be deleted on first hit.
//------------------------------------------------------------------
void SetOneShot(bool one_shot);
//------------------------------------------------------------------
/// Check the OneShot state.
/// \return
/// \b true if the breakpoint is one shot, \b false otherwise.
//------------------------------------------------------------------
bool IsOneShot() const;
//------------------------------------------------------------------
/// If \a auto_continue is \b true, breakpoint will auto-continue when on
/// hit.
//------------------------------------------------------------------
void SetAutoContinue(bool auto_continue);
//------------------------------------------------------------------
/// Check the AutoContinue state.
/// \return
/// \b true if the breakpoint is set to auto-continue, \b false otherwise.
//------------------------------------------------------------------
bool IsAutoContinue() const;
//------------------------------------------------------------------
/// Set the valid thread to be checked when the breakpoint is hit.
/// \param[in] thread_id
/// If this thread hits the breakpoint, we stop, otherwise not.
//------------------------------------------------------------------
void SetThreadID(lldb::tid_t thread_id);
//------------------------------------------------------------------
/// Return the current stop thread value.
/// \return
/// The thread id for which the breakpoint hit will stop,
/// LLDB_INVALID_THREAD_ID for all threads.
//------------------------------------------------------------------
lldb::tid_t GetThreadID() const;
void SetThreadIndex(uint32_t index);
@ -441,7 +375,6 @@ public:
const char *GetQueueName() const;
//------------------------------------------------------------------
/// Set the callback action invoked when the breakpoint is hit.
///
/// \param[in] callback
@ -456,7 +389,6 @@ public:
/// \return
/// \b true if the process should stop when you hit the breakpoint.
/// \b false if it should continue.
//------------------------------------------------------------------
void SetCallback(BreakpointHitCallback callback, void *baton,
bool is_synchronous = false);
@ -466,54 +398,41 @@ public:
void ClearCallback();
//------------------------------------------------------------------
/// Set the breakpoint's condition.
///
/// \param[in] condition
/// The condition expression to evaluate when the breakpoint is hit.
/// Pass in nullptr to clear the condition.
//------------------------------------------------------------------
void SetCondition(const char *condition);
//------------------------------------------------------------------
/// Return a pointer to the text of the condition expression.
///
/// \return
/// A pointer to the condition expression text, or nullptr if no
// condition has been set.
//------------------------------------------------------------------
const char *GetConditionText() const;
//------------------------------------------------------------------
// The next section are various utility functions.
//------------------------------------------------------------------
//------------------------------------------------------------------
/// Return the number of breakpoint locations that have resolved to actual
/// breakpoint sites.
///
/// \return
/// The number locations resolved breakpoint sites.
//------------------------------------------------------------------
size_t GetNumResolvedLocations() const;
//------------------------------------------------------------------
/// Return whether this breakpoint has any resolved locations.
///
/// \return
/// True if GetNumResolvedLocations > 0
//------------------------------------------------------------------
bool HasResolvedLocations() const;
//------------------------------------------------------------------
/// Return the number of breakpoint locations.
///
/// \return
/// The number breakpoint locations.
//------------------------------------------------------------------
size_t GetNumLocations() const;
//------------------------------------------------------------------
/// Put a description of this breakpoint into the stream \a s.
///
/// \param[in] s
@ -524,11 +443,9 @@ public:
/// provide.
///
/// \see lldb::DescriptionLevel
//------------------------------------------------------------------
void GetDescription(Stream *s, lldb::DescriptionLevel level,
bool show_locations = false);
//------------------------------------------------------------------
/// Set the "kind" description for a breakpoint. If the breakpoint is hit
/// the stop info will show this "kind" description instead of the
/// breakpoint number. Mostly useful for internal breakpoints, where the
@ -536,22 +453,17 @@ public:
///
/// \param[in] kind
/// New "kind" description.
//------------------------------------------------------------------
void SetBreakpointKind(const char *kind) { m_kind_description.assign(kind); }
//------------------------------------------------------------------
/// Return the "kind" description for a breakpoint.
///
/// \return
/// The breakpoint kind, or nullptr if none is set.
//------------------------------------------------------------------
const char *GetBreakpointKind() const { return m_kind_description.c_str(); }
//------------------------------------------------------------------
/// Accessor for the breakpoint Target.
/// \return
/// This breakpoint's Target.
//------------------------------------------------------------------
Target &GetTarget() { return m_target; }
const Target &GetTarget() const { return m_target; }
@ -560,7 +472,6 @@ public:
void GetResolverDescription(Stream *s);
//------------------------------------------------------------------
/// Find breakpoint locations which match the (filename, line_number)
/// description. The breakpoint location collection is to be filled with the
/// matching locations. It should be initialized with 0 size by the API
@ -574,33 +485,27 @@ public:
/// size is 0 and true is returned, it means the breakpoint fully matches
/// the
/// description.
//------------------------------------------------------------------
bool GetMatchingFileLine(ConstString filename, uint32_t line_number,
BreakpointLocationCollection &loc_coll);
void GetFilterDescription(Stream *s);
//------------------------------------------------------------------
/// Returns the BreakpointOptions structure set at the breakpoint level.
///
/// Meant to be used by the BreakpointLocation class.
///
/// \return
/// A pointer to this breakpoint's BreakpointOptions.
//------------------------------------------------------------------
BreakpointOptions *GetOptions();
//------------------------------------------------------------------
/// Returns the BreakpointOptions structure set at the breakpoint level.
///
/// Meant to be used by the BreakpointLocation class.
///
/// \return
/// A pointer to this breakpoint's BreakpointOptions.
//------------------------------------------------------------------
const BreakpointOptions *GetOptions() const;
//------------------------------------------------------------------
/// Invoke the callback action when the breakpoint is hit.
///
/// Meant to be used by the BreakpointLocation class.
@ -613,7 +518,6 @@ public:
///
/// \return
/// \b true if the target should stop at this breakpoint and \b false not.
//------------------------------------------------------------------
bool InvokeCallback(StoppointCallbackContext *context,
lldb::break_id_t bp_loc_id);
@ -644,7 +548,6 @@ public:
}
}
//------------------------------------------------------------------
/// Set a pre-condition filter that overrides all user provided
/// filters/callbacks etc.
///
@ -655,7 +558,6 @@ public:
/// The Precondition should not continue the target, it should return true
/// if the condition says to stop and false otherwise.
///
//------------------------------------------------------------------
void SetPrecondition(BreakpointPreconditionSP precondition_sp) {
m_precondition_sp = precondition_sp;
}
@ -685,11 +587,8 @@ public:
protected:
friend class Target;
//------------------------------------------------------------------
// Protected Methods
//------------------------------------------------------------------
//------------------------------------------------------------------
/// Constructors and Destructors
/// Only the Target can make a breakpoint, and it owns the breakpoint
/// lifespans. The constructor takes a filter and a resolver. Up in Target
@ -717,7 +616,6 @@ protected:
/// indirect symbol (i.e. Symbol::IsIndirect returns true) then the actual
/// breakpoint site will
/// be set on the target of the indirect symbol.
//------------------------------------------------------------------
// This is the generic constructor
Breakpoint(Target &target, lldb::SearchFilterSP &filter_sp,
lldb::BreakpointResolverSP &resolver_sp, bool hardware,
@ -748,9 +646,7 @@ private:
// target - primarily from the dummy target to prime new targets.
Breakpoint(Target &new_target, Breakpoint &bp_to_copy_from);
//------------------------------------------------------------------
// For Breakpoint only
//------------------------------------------------------------------
bool m_being_created;
bool
m_hardware; // If this breakpoint is required to use a hardware breakpoint

View File

@ -18,9 +18,7 @@
namespace lldb_private {
//----------------------------------------------------------------------
// class BreakpointID
//----------------------------------------------------------------------
class BreakpointID {
public:
@ -50,7 +48,6 @@ public:
static bool IsValidIDExpression(llvm::StringRef str);
static llvm::ArrayRef<llvm::StringRef> GetRangeSpecifiers();
//------------------------------------------------------------------
/// Takes an input string containing the description of a breakpoint or
/// breakpoint and location and returns a BreakpointID filled out with
/// the proper id and location.
@ -61,11 +58,9 @@ public:
/// If \p input was not a valid breakpoint ID string, returns
/// \b llvm::None. Otherwise returns a BreakpointID with members filled
/// out accordingly.
//------------------------------------------------------------------
static llvm::Optional<BreakpointID>
ParseCanonicalReference(llvm::StringRef input);
//------------------------------------------------------------------
/// Takes an input string and checks to see whether it is a breakpoint name.
/// If it is a mal-formed breakpoint name, error will be set to an appropriate
/// error string.
@ -78,10 +73,8 @@ public:
/// \return
/// \b true if the name is a breakpoint name (as opposed to an ID or
/// range) false otherwise.
//------------------------------------------------------------------
static bool StringIsBreakpointName(llvm::StringRef str, Status &error);
//------------------------------------------------------------------
/// Takes a breakpoint ID and the breakpoint location id and returns
/// a string containing the canonical description for the breakpoint
/// or breakpoint location.
@ -92,7 +85,6 @@ public:
/// \param[out] break_loc_id
/// This is breakpoint location id, or LLDB_INVALID_BREAK_ID is no
/// location is to be specified.
//------------------------------------------------------------------
static void GetCanonicalReference(Stream *s, lldb::break_id_t break_id,
lldb::break_id_t break_loc_id);

View File

@ -20,9 +20,7 @@
namespace lldb_private {
//----------------------------------------------------------------------
// class BreakpointIDList
//----------------------------------------------------------------------
class BreakpointIDList {
public:

View File

@ -16,15 +16,11 @@
namespace lldb_private {
//----------------------------------------------------------------------
/// \class BreakpointList BreakpointList.h "lldb/Breakpoint/BreakpointList.h"
/// This class manages a list of breakpoints.
//----------------------------------------------------------------------
//----------------------------------------------------------------------
/// General Outline:
/// Allows adding and removing breakpoints and find by ID and index.
//----------------------------------------------------------------------
class BreakpointList {
public:
@ -32,7 +28,6 @@ public:
~BreakpointList();
//------------------------------------------------------------------
/// Add the breakpoint \a bp_sp to the list.
///
/// \param[in] bp_sp
@ -40,15 +35,11 @@ public:
///
/// \result
/// Returns breakpoint id.
//------------------------------------------------------------------
lldb::break_id_t Add(lldb::BreakpointSP &bp_sp, bool notify);
//------------------------------------------------------------------
/// Standard "Dump" method. At present it does nothing.
//------------------------------------------------------------------
void Dump(Stream *s) const;
//------------------------------------------------------------------
/// Returns a shared pointer to the breakpoint with id \a breakID. Const
/// version.
///
@ -58,10 +49,8 @@ public:
/// \result
/// A shared pointer to the breakpoint. May contain a NULL pointer if the
/// breakpoint doesn't exist.
//------------------------------------------------------------------
lldb::BreakpointSP FindBreakpointByID(lldb::break_id_t breakID) const;
//------------------------------------------------------------------
/// Returns a shared pointer to the breakpoint with index \a i.
///
/// \param[in] i
@ -70,10 +59,8 @@ public:
/// \result
/// A shared pointer to the breakpoint. May contain a NULL pointer if the
/// breakpoint doesn't exist.
//------------------------------------------------------------------
lldb::BreakpointSP GetBreakpointAtIndex(size_t i) const;
//------------------------------------------------------------------
/// Find all the breakpoints with a given name
///
/// \param[in] name
@ -81,21 +68,17 @@ public:
///
/// \result
/// \bfalse if the input name was not a legal breakpoint name.
//------------------------------------------------------------------
bool FindBreakpointsByName(const char *name, BreakpointList &matching_bps);
//------------------------------------------------------------------
/// Returns the number of elements in this breakpoint list.
///
/// \result
/// The number of elements.
//------------------------------------------------------------------
size_t GetSize() const {
std::lock_guard<std::recursive_mutex> guard(m_mutex);
return m_breakpoints.size();
}
//------------------------------------------------------------------
/// Removes the breakpoint given by \b breakID from this list.
///
/// \param[in] breakID
@ -103,10 +86,8 @@ public:
///
/// \result
/// \b true if the breakpoint \a breakID was in the list.
//------------------------------------------------------------------
bool Remove(lldb::break_id_t breakID, bool notify);
//------------------------------------------------------------------
/// Removes all invalid breakpoint locations.
///
/// Removes all breakpoint locations in the list with architectures that
@ -120,26 +101,20 @@ public:
/// \param[in] arch
/// If valid, check the module in each breakpoint to make sure
/// they are compatible, otherwise, ignore architecture.
//------------------------------------------------------------------
void RemoveInvalidLocations(const ArchSpec &arch);
void SetEnabledAll(bool enabled);
void SetEnabledAllowed(bool enabled);
//------------------------------------------------------------------
/// Removes all the breakpoints from this list.
//------------------------------------------------------------------
void RemoveAll(bool notify);
//------------------------------------------------------------------
/// Removes all the breakpoints from this list - first checking the
/// ePermDelete on the breakpoints. This call should be used unless you are
/// shutting down and need to actually clear them all.
//------------------------------------------------------------------
void RemoveAllowed(bool notify);
//------------------------------------------------------------------
/// Tell all the breakpoints to update themselves due to a change in the
/// modules in \a module_list. \a added says whether the module was loaded
/// or unloaded.
@ -153,7 +128,6 @@ public:
/// \param[in] delete_locations
/// If \a load is \b false, then delete breakpoint locations when
/// when updating breakpoints.
//------------------------------------------------------------------
void UpdateBreakpoints(ModuleList &module_list, bool load,
bool delete_locations);
@ -162,12 +136,10 @@ public:
void ClearAllBreakpointSites();
//------------------------------------------------------------------
/// Sets the passed in Locker to hold the Breakpoint List mutex.
///
/// \param[in] locker
/// The locker object that is set.
//------------------------------------------------------------------
void GetListMutex(std::unique_lock<std::recursive_mutex> &lock);
protected:

View File

@ -20,13 +20,10 @@
namespace lldb_private {
//----------------------------------------------------------------------
/// \class BreakpointLocation BreakpointLocation.h
/// "lldb/Breakpoint/BreakpointLocation.h" Class that manages one unique (by
/// address) instance of a logical breakpoint.
//----------------------------------------------------------------------
//----------------------------------------------------------------------
/// General Outline:
/// A breakpoint location is defined by the breakpoint that produces it,
/// and the address that resulted in this particular instantiation. Each
@ -36,7 +33,6 @@ namespace lldb_private {
/// FIXME: Should we also store some fingerprint for the location, so
/// we can map one location to the "equivalent location" on rerun? This would
/// be useful if you've set options on the locations.
//----------------------------------------------------------------------
class BreakpointLocation
: public std::enable_shared_from_this<BreakpointLocation>,
@ -44,27 +40,20 @@ class BreakpointLocation
public:
~BreakpointLocation() override;
//------------------------------------------------------------------
/// Gets the load address for this breakpoint location \return
/// Returns breakpoint location load address, \b
/// LLDB_INVALID_ADDRESS if not yet set.
//------------------------------------------------------------------
lldb::addr_t GetLoadAddress() const override;
//------------------------------------------------------------------
/// Gets the Address for this breakpoint location \return
/// Returns breakpoint location Address.
//------------------------------------------------------------------
Address &GetAddress();
//------------------------------------------------------------------
/// Gets the Breakpoint that created this breakpoint location \return
/// Returns the owning breakpoint.
//------------------------------------------------------------------
Breakpoint &GetBreakpoint();
Target &GetTarget();
//------------------------------------------------------------------
/// Determines whether we should stop due to a hit at this breakpoint
/// location.
///
@ -74,56 +63,40 @@ public:
/// \return
/// \b true if this breakpoint location thinks we should stop,
/// \b false otherwise.
//------------------------------------------------------------------
bool ShouldStop(StoppointCallbackContext *context) override;
//------------------------------------------------------------------
// The next section deals with various breakpoint options.
//------------------------------------------------------------------
//------------------------------------------------------------------
/// If \a enable is \b true, enable the breakpoint, if \b false disable it.
//------------------------------------------------------------------
void SetEnabled(bool enabled);
//------------------------------------------------------------------
/// Check the Enable/Disable state.
///
/// \return
/// \b true if the breakpoint is enabled, \b false if disabled.
//------------------------------------------------------------------
bool IsEnabled() const;
//------------------------------------------------------------------
/// If \a auto_continue is \b true, set the breakpoint to continue when hit.
//------------------------------------------------------------------
void SetAutoContinue(bool auto_continue);
//------------------------------------------------------------------
/// Check the AutoContinue state.
///
/// \return
/// \b true if the breakpoint is set to auto-continue, \b false if not.
//------------------------------------------------------------------
bool IsAutoContinue() const;
//------------------------------------------------------------------
/// Return the current Ignore Count.
///
/// \return
/// The number of breakpoint hits to be ignored.
//------------------------------------------------------------------
uint32_t GetIgnoreCount();
//------------------------------------------------------------------
/// Set the breakpoint to ignore the next \a count breakpoint hits.
///
/// \param[in] count
/// The number of breakpoint hits to ignore.
//------------------------------------------------------------------
void SetIgnoreCount(uint32_t n);
//------------------------------------------------------------------
/// Set the callback action invoked when the breakpoint is hit.
///
/// The callback will return a bool indicating whether the target should
@ -137,7 +110,6 @@ public:
/// for the callback.
///
/// \see lldb_private::Baton
//------------------------------------------------------------------
void SetCallback(BreakpointHitCallback callback,
const lldb::BatonSP &callback_baton_sp, bool is_synchronous);
@ -146,31 +118,25 @@ public:
void ClearCallback();
//------------------------------------------------------------------
/// Set the breakpoint location's condition.
///
/// \param[in] condition
/// The condition expression to evaluate when the breakpoint is hit.
//------------------------------------------------------------------
void SetCondition(const char *condition);
//------------------------------------------------------------------
/// Return a pointer to the text of the condition expression.
///
/// \return
/// A pointer to the condition expression text, or nullptr if no
// condition has been set.
//------------------------------------------------------------------
const char *GetConditionText(size_t *hash = nullptr) const;
bool ConditionSaysStop(ExecutionContext &exe_ctx, Status &error);
//------------------------------------------------------------------
/// Set the valid thread to be checked when the breakpoint is hit.
///
/// \param[in] thread_id
/// If this thread hits the breakpoint, we stop, otherwise not.
//------------------------------------------------------------------
void SetThreadID(lldb::tid_t thread_id);
lldb::tid_t GetThreadID();
@ -187,43 +153,32 @@ public:
const char *GetQueueName() const;
//------------------------------------------------------------------
// The next section deals with this location's breakpoint sites.
//------------------------------------------------------------------
//------------------------------------------------------------------
/// Try to resolve the breakpoint site for this location.
///
/// \return
/// \b true if we were successful at setting a breakpoint site,
/// \b false otherwise.
//------------------------------------------------------------------
bool ResolveBreakpointSite();
//------------------------------------------------------------------
/// Clear this breakpoint location's breakpoint site - for instance when
/// disabling the breakpoint.
///
/// \return
/// \b true if there was a breakpoint site to be cleared, \b false
/// otherwise.
//------------------------------------------------------------------
bool ClearBreakpointSite();
//------------------------------------------------------------------
/// Return whether this breakpoint location has a breakpoint site. \return
/// \b true if there was a breakpoint site for this breakpoint
/// location, \b false otherwise.
//------------------------------------------------------------------
bool IsResolved() const;
lldb::BreakpointSiteSP GetBreakpointSite() const;
//------------------------------------------------------------------
// The next section are generic report functions.
//------------------------------------------------------------------
//------------------------------------------------------------------
/// Print a description of this breakpoint location to the stream \a s.
///
/// \param[in] s
@ -234,15 +189,11 @@ public:
/// provide.
///
/// \see lldb::DescriptionLevel
//------------------------------------------------------------------
void GetDescription(Stream *s, lldb::DescriptionLevel level);
//------------------------------------------------------------------
/// Standard "Dump" method. At present it does nothing.
//------------------------------------------------------------------
void Dump(Stream *s) const override;
//------------------------------------------------------------------
/// Use this to set location specific breakpoint options.
///
/// It will create a copy of the containing breakpoint's options if that
@ -250,10 +201,8 @@ public:
///
/// \return
/// A pointer to the breakpoint options.
//------------------------------------------------------------------
BreakpointOptions *GetLocationOptions();
//------------------------------------------------------------------
/// Use this to access breakpoint options from this breakpoint location.
/// This will return the options that have a setting for the specified
/// BreakpointOptions kind.
@ -263,13 +212,11 @@ public:
/// \return
/// A pointer to the containing breakpoint's options if this
/// location doesn't have its own copy.
//------------------------------------------------------------------
const BreakpointOptions *GetOptionsSpecifyingKind(
BreakpointOptions::OptionKind kind) const;
bool ValidForThisThread(Thread *thread);
//------------------------------------------------------------------
/// Invoke the callback action when the breakpoint is hit.
///
/// Meant to be used by the BreakpointLocation class.
@ -283,44 +230,36 @@ public:
/// \return
/// \b true if the target should stop at this breakpoint and \b
/// false not.
//------------------------------------------------------------------
bool InvokeCallback(StoppointCallbackContext *context);
//------------------------------------------------------------------
/// Returns whether we should resolve Indirect functions in setting the
/// breakpoint site for this location.
///
/// \return
/// \b true if the breakpoint SITE for this location should be set on the
/// resolved location for Indirect functions.
//------------------------------------------------------------------
bool ShouldResolveIndirectFunctions() {
return m_should_resolve_indirect_functions;
}
//------------------------------------------------------------------
/// Returns whether the address set in the breakpoint site for this location
/// was found by resolving an indirect symbol.
///
/// \return
/// \b true or \b false as given in the description above.
//------------------------------------------------------------------
bool IsIndirect() { return m_is_indirect; }
void SetIsIndirect(bool is_indirect) { m_is_indirect = is_indirect; }
//------------------------------------------------------------------
/// Returns whether the address set in the breakpoint location was re-routed
/// to the target of a re-exported symbol.
///
/// \return
/// \b true or \b false as given in the description above.
//------------------------------------------------------------------
bool IsReExported() { return m_is_reexported; }
void SetIsReExported(bool is_reexported) { m_is_reexported = is_reexported; }
//------------------------------------------------------------------
/// Returns whether the two breakpoint locations might represent "equivalent
/// locations". This is used when modules changed to determine if a Location
/// in the old module might be the "same as" the input location.
@ -330,7 +269,6 @@ public:
///
/// \return
/// \b true or \b false as given in the description above.
//------------------------------------------------------------------
bool EquivalentToLocation(BreakpointLocation &location);
protected:
@ -339,7 +277,6 @@ protected:
friend class Process;
friend class StopInfoBreakpoint;
//------------------------------------------------------------------
/// Set the breakpoint site for this location to \a bp_site_sp.
///
/// \param[in] bp_site_sp
@ -348,7 +285,6 @@ protected:
/// \return
/// \b true if we were successful at setting the breakpoint site,
/// \b false otherwise.
//------------------------------------------------------------------
bool SetBreakpointSite(lldb::BreakpointSiteSP &bp_site_sp);
void DecrementIgnoreCount();
@ -362,13 +298,10 @@ private:
void UndoBumpHitCount();
//------------------------------------------------------------------
// Constructors and Destructors
//
// Only the Breakpoint can make breakpoint locations, and it owns them.
//------------------------------------------------------------------
//------------------------------------------------------------------
/// Constructor.
///
/// \param[in] owner
@ -383,15 +316,12 @@ private:
///
/// \param[in] hardware
/// \b true if a hardware breakpoint is requested.
//------------------------------------------------------------------
BreakpointLocation(lldb::break_id_t bid, Breakpoint &owner,
const Address &addr, lldb::tid_t tid, bool hardware,
bool check_for_resolver = true);
//------------------------------------------------------------------
// Data members:
//------------------------------------------------------------------
bool m_being_created;
bool m_should_resolve_indirect_functions;
bool m_is_reexported;

View File

@ -25,7 +25,6 @@ public:
BreakpointLocationCollection &operator=(const BreakpointLocationCollection &rhs);
//------------------------------------------------------------------
/// Add the breakpoint \a bp_loc_sp to the list.
///
/// \param[in] bp_sp
@ -34,10 +33,8 @@ public:
///
/// \result
/// Returns breakpoint location id.
//------------------------------------------------------------------
void Add(const lldb::BreakpointLocationSP &bp_loc_sp);
//------------------------------------------------------------------
/// Removes the breakpoint location given by \b breakID from this
/// list.
///
@ -49,10 +46,8 @@ public:
///
/// \result
/// \b true if the breakpoint was in the list.
//------------------------------------------------------------------
bool Remove(lldb::break_id_t break_id, lldb::break_id_t break_loc_id);
//------------------------------------------------------------------
/// Returns a shared pointer to the breakpoint location with id \a
/// breakID.
///
@ -65,11 +60,9 @@ public:
/// \result
/// A shared pointer to the breakpoint. May contain a NULL
/// pointer if the breakpoint doesn't exist.
//------------------------------------------------------------------
lldb::BreakpointLocationSP FindByIDPair(lldb::break_id_t break_id,
lldb::break_id_t break_loc_id);
//------------------------------------------------------------------
/// Returns a shared pointer to the breakpoint location with id \a
/// breakID, const version.
///
@ -82,11 +75,9 @@ public:
/// \result
/// A shared pointer to the breakpoint. May contain a NULL
/// pointer if the breakpoint doesn't exist.
//------------------------------------------------------------------
const lldb::BreakpointLocationSP
FindByIDPair(lldb::break_id_t break_id, lldb::break_id_t break_loc_id) const;
//------------------------------------------------------------------
/// Returns a shared pointer to the breakpoint location with index
/// \a i.
///
@ -96,10 +87,8 @@ public:
/// \result
/// A shared pointer to the breakpoint. May contain a NULL
/// pointer if the breakpoint doesn't exist.
//------------------------------------------------------------------
lldb::BreakpointLocationSP GetByIndex(size_t i);
//------------------------------------------------------------------
/// Returns a shared pointer to the breakpoint location with index
/// \a i, const version.
///
@ -109,18 +98,14 @@ public:
/// \result
/// A shared pointer to the breakpoint. May contain a NULL
/// pointer if the breakpoint doesn't exist.
//------------------------------------------------------------------
const lldb::BreakpointLocationSP GetByIndex(size_t i) const;
//------------------------------------------------------------------
/// Returns the number of elements in this breakpoint location list.
///
/// \result
/// The number of elements.
//------------------------------------------------------------------
size_t GetSize() const { return m_break_loc_collection.size(); }
//------------------------------------------------------------------
/// Enquires of all the breakpoint locations in this list whether
/// we should stop at a hit at \a breakID.
///
@ -132,10 +117,8 @@ public:
///
/// \return
/// \b true if we should stop, \b false otherwise.
//------------------------------------------------------------------
bool ShouldStop(StoppointCallbackContext *context);
//------------------------------------------------------------------
/// Print a description of the breakpoint locations in this list
/// to the stream \a s.
///
@ -147,10 +130,8 @@ public:
/// provide.
///
/// \see lldb::DescriptionLevel
//------------------------------------------------------------------
void GetDescription(Stream *s, lldb::DescriptionLevel level);
//------------------------------------------------------------------
/// Check whether this collection of breakpoint locations have any
/// thread specifiers, and if yes, is \a thread_id contained in any
/// of these specifiers.
@ -161,28 +142,21 @@ public:
/// return
/// \b true if the collection contains at least one location that
/// would be valid for this thread, false otherwise.
//------------------------------------------------------------------
bool ValidForThisThread(Thread *thread);
//------------------------------------------------------------------
/// Tell whether ALL the breakpoints in the location collection are internal.
///
/// \result
/// \b true if all breakpoint locations are owned by internal breakpoints,
/// \b false otherwise.
//------------------------------------------------------------------
bool IsInternal() const;
protected:
//------------------------------------------------------------------
// Classes that inherit from BreakpointLocationCollection can see and modify
// these
//------------------------------------------------------------------
private:
//------------------------------------------------------------------
// For BreakpointLocationCollection only
//------------------------------------------------------------------
typedef std::vector<lldb::BreakpointLocationSP> collection;

View File

@ -19,12 +19,10 @@
namespace lldb_private {
//----------------------------------------------------------------------
/// \class BreakpointLocationList BreakpointLocationList.h
/// "lldb/Breakpoint/BreakpointLocationList.h" This class is used by
/// Breakpoint to manage a list of breakpoint locations, each breakpoint
/// location in the list has a unique ID, and is unique by Address as well.
//----------------------------------------------------------------------
class BreakpointLocationList {
// Only Breakpoints can make the location list, or add elements to it. This
// is not just some random collection of locations. Rather, the act of
@ -36,12 +34,9 @@ class BreakpointLocationList {
public:
virtual ~BreakpointLocationList();
//------------------------------------------------------------------
/// Standard "Dump" method. At present it does nothing.
//------------------------------------------------------------------
void Dump(Stream *s) const;
//------------------------------------------------------------------
/// Returns a shared pointer to the breakpoint location at address \a addr -
/// const version.
///
@ -51,10 +46,8 @@ public:
/// \result
/// A shared pointer to the breakpoint. May contain a nullptr
/// pointer if the breakpoint doesn't exist.
//------------------------------------------------------------------
const lldb::BreakpointLocationSP FindByAddress(const Address &addr) const;
//------------------------------------------------------------------
/// Returns a shared pointer to the breakpoint location with id \a breakID,
/// const version.
///
@ -64,10 +57,8 @@ public:
/// \result
/// A shared pointer to the breakpoint. May contain a nullptr
/// pointer if the breakpoint doesn't exist.
//------------------------------------------------------------------
lldb::BreakpointLocationSP FindByID(lldb::break_id_t breakID) const;
//------------------------------------------------------------------
/// Returns the breakpoint location id to the breakpoint location at address
/// \a addr.
///
@ -76,10 +67,8 @@ public:
///
/// \result
/// The ID of the breakpoint location, or LLDB_INVALID_BREAK_ID.
//------------------------------------------------------------------
lldb::break_id_t FindIDByAddress(const Address &addr);
//------------------------------------------------------------------
/// Returns a breakpoint location list of the breakpoint locations in the
/// module \a module. This list is allocated, and owned by the caller.
///
@ -92,11 +81,9 @@ public:
///
/// \result
/// The number of matches
//------------------------------------------------------------------
size_t FindInModule(Module *module,
BreakpointLocationCollection &bp_loc_list);
//------------------------------------------------------------------
/// Returns a shared pointer to the breakpoint location with index \a i.
///
/// \param[in] i
@ -105,10 +92,8 @@ public:
/// \result
/// A shared pointer to the breakpoint. May contain a nullptr
/// pointer if the breakpoint doesn't exist.
//------------------------------------------------------------------
lldb::BreakpointLocationSP GetByIndex(size_t i);
//------------------------------------------------------------------
/// Returns a shared pointer to the breakpoint location with index \a i,
/// const version.
///
@ -118,39 +103,29 @@ public:
/// \result
/// A shared pointer to the breakpoint. May contain a nullptr
/// pointer if the breakpoint doesn't exist.
//------------------------------------------------------------------
const lldb::BreakpointLocationSP GetByIndex(size_t i) const;
//------------------------------------------------------------------
/// Removes all the locations in this list from their breakpoint site owners
/// list.
//------------------------------------------------------------------
void ClearAllBreakpointSites();
//------------------------------------------------------------------
/// Tells all the breakpoint locations in this list to attempt to resolve
/// any possible breakpoint sites.
//------------------------------------------------------------------
void ResolveAllBreakpointSites();
//------------------------------------------------------------------
/// Returns the number of breakpoint locations in this list with resolved
/// breakpoints.
///
/// \result
/// Number of qualifying breakpoint locations.
//------------------------------------------------------------------
size_t GetNumResolvedLocations() const;
//------------------------------------------------------------------
/// Returns the number hit count of all locations in this list.
///
/// \result
/// Hit count of all locations in this list.
//------------------------------------------------------------------
uint32_t GetHitCount() const;
//------------------------------------------------------------------
/// Enquires of the breakpoint location in this list with ID \a breakID
/// whether we should stop.
///
@ -162,18 +137,14 @@ public:
///
/// \return
/// \b true if we should stop, \b false otherwise.
//------------------------------------------------------------------
bool ShouldStop(StoppointCallbackContext *context, lldb::break_id_t breakID);
//------------------------------------------------------------------
/// Returns the number of elements in this breakpoint location list.
///
/// \result
/// The number of elements.
//------------------------------------------------------------------
size_t GetSize() const { return m_locations.size(); }
//------------------------------------------------------------------
/// Print a description of the breakpoint locations in this list to the
/// stream \a s.
///
@ -185,20 +156,16 @@ public:
/// provide.
///
/// \see lldb::DescriptionLevel
//------------------------------------------------------------------
void GetDescription(Stream *s, lldb::DescriptionLevel level);
protected:
//------------------------------------------------------------------
/// This is the standard constructor.
///
/// It creates an empty breakpoint location list. It is protected here
/// because only Breakpoints are allowed to create the breakpoint location
/// list.
//------------------------------------------------------------------
BreakpointLocationList(Breakpoint &owner);
//------------------------------------------------------------------
/// Add the breakpoint \a bp_loc_sp to the list.
///
/// \param[in] bp_sp
@ -207,7 +174,6 @@ protected:
///
/// \result
/// Returns breakpoint location id.
//------------------------------------------------------------------
lldb::BreakpointLocationSP Create(const Address &addr,
bool resolve_indirect_symbols);

View File

@ -20,11 +20,9 @@
namespace lldb_private {
//----------------------------------------------------------------------
/// \class BreakpointOptions BreakpointOptions.h
/// "lldb/Breakpoint/BreakpointOptions.h" Class that manages the options on a
/// breakpoint or breakpoint location.
//----------------------------------------------------------------------
class BreakpointOptions {
friend class BreakpointLocation;
@ -95,11 +93,8 @@ public:
typedef std::shared_ptr<CommandBaton> CommandBatonSP;
//------------------------------------------------------------------
// Constructors and Destructors
//------------------------------------------------------------------
//------------------------------------------------------------------
/// This constructor allows you to specify all the breakpoint options except
/// the callback. That one is more complicated, and better to do by hand.
///
@ -112,15 +107,12 @@ public:
/// \param[in] ignore
/// How many breakpoint hits we should ignore before stopping.
///
//------------------------------------------------------------------
BreakpointOptions(const char *condition, bool enabled = true,
int32_t ignore = 0, bool one_shot = false,
bool auto_continue = false);
//------------------------------------------------------------------
/// Breakpoints make options with all flags set. Locations and Names make
/// options with no flags set.
//------------------------------------------------------------------
BreakpointOptions(bool all_flags_set);
BreakpointOptions(const BreakpointOptions &rhs);
@ -135,17 +127,12 @@ public:
static const char *GetSerializationKey() { return "BKPTOptions"; }
//------------------------------------------------------------------
// Operators
//------------------------------------------------------------------
const BreakpointOptions &operator=(const BreakpointOptions &rhs);
//------------------------------------------------------------------
/// Copy over only the options set in the incoming BreakpointOptions.
//------------------------------------------------------------------
void CopyOverSetOptions(const BreakpointOptions &rhs);
//------------------------------------------------------------------
// Callbacks
//
// Breakpoint callbacks come in two forms, synchronous and asynchronous.
@ -177,9 +164,7 @@ public:
// should be the last action the callback does. We will relax this condition
// at some point, but it will take a bit of plumbing to get that to work.
//
//------------------------------------------------------------------
//------------------------------------------------------------------
/// Adds a callback to the breakpoint option set.
///
/// \param[in] callback
@ -191,7 +176,6 @@ public:
/// \param[in] synchronous
/// Whether this is a synchronous or asynchronous callback. See discussion
/// above.
//------------------------------------------------------------------
void SetCallback(BreakpointHitCallback callback,
const lldb::BatonSP &baton_sp, bool synchronous = false);
@ -199,7 +183,6 @@ public:
const BreakpointOptions::CommandBatonSP &command_baton_sp,
bool synchronous = false);
//------------------------------------------------------------------
/// Returns the command line commands for the callback on this breakpoint.
///
/// \param[out] command_list
@ -208,18 +191,14 @@ public:
/// \return
/// \btrue if the command callback is a command-line callback,
/// \bfalse otherwise.
//------------------------------------------------------------------
bool GetCommandLineCallbacks(StringList &command_list);
//------------------------------------------------------------------
/// Remove the callback from this option set.
//------------------------------------------------------------------
void ClearCallback();
// The rest of these functions are meant to be used only within the
// breakpoint handling mechanism.
//------------------------------------------------------------------
/// Use this function to invoke the callback for a specific stop.
///
/// \param[in] context
@ -238,161 +217,120 @@ public:
///
/// \return
/// The callback return value.
//------------------------------------------------------------------
bool InvokeCallback(StoppointCallbackContext *context,
lldb::user_id_t break_id, lldb::user_id_t break_loc_id);
//------------------------------------------------------------------
/// Used in InvokeCallback to tell whether it is the right time to run this
/// kind of callback.
///
/// \return
/// The synchronicity of our callback.
//------------------------------------------------------------------
bool IsCallbackSynchronous() const { return m_callback_is_synchronous; }
//------------------------------------------------------------------
/// Fetch the baton from the callback.
///
/// \return
/// The baton.
//------------------------------------------------------------------
Baton *GetBaton();
//------------------------------------------------------------------
/// Fetch a const version of the baton from the callback.
///
/// \return
/// The baton.
//------------------------------------------------------------------
const Baton *GetBaton() const;
//------------------------------------------------------------------
// Condition
//------------------------------------------------------------------
//------------------------------------------------------------------
/// Set the breakpoint option's condition.
///
/// \param[in] condition
/// The condition expression to evaluate when the breakpoint is hit.
//------------------------------------------------------------------
void SetCondition(const char *condition);
//------------------------------------------------------------------
/// Return a pointer to the text of the condition expression.
///
/// \return
/// A pointer to the condition expression text, or nullptr if no
// condition has been set.
//------------------------------------------------------------------
const char *GetConditionText(size_t *hash = nullptr) const;
//------------------------------------------------------------------
// Enabled/Ignore Count
//------------------------------------------------------------------
//------------------------------------------------------------------
/// Check the Enable/Disable state.
/// \return
/// \b true if the breakpoint is enabled, \b false if disabled.
//------------------------------------------------------------------
bool IsEnabled() const { return m_enabled; }
//------------------------------------------------------------------
/// If \a enable is \b true, enable the breakpoint, if \b false disable it.
//------------------------------------------------------------------
void SetEnabled(bool enabled) {
m_enabled = enabled;
m_set_flags.Set(eEnabled);
}
//------------------------------------------------------------------
/// Check the auto-continue state.
/// \return
/// \b true if the breakpoint is set to auto-continue, \b false otherwise.
//------------------------------------------------------------------
bool IsAutoContinue() const { return m_auto_continue; }
//------------------------------------------------------------------
/// Set the auto-continue state.
//------------------------------------------------------------------
void SetAutoContinue(bool auto_continue) {
m_auto_continue = auto_continue;
m_set_flags.Set(eAutoContinue);
}
//------------------------------------------------------------------
/// Check the One-shot state.
/// \return
/// \b true if the breakpoint is one-shot, \b false otherwise.
//------------------------------------------------------------------
bool IsOneShot() const { return m_one_shot; }
//------------------------------------------------------------------
/// If \a enable is \b true, enable the breakpoint, if \b false disable it.
//------------------------------------------------------------------
void SetOneShot(bool one_shot) {
m_one_shot = one_shot;
m_set_flags.Set(eOneShot);
}
//------------------------------------------------------------------
/// Set the breakpoint to ignore the next \a count breakpoint hits.
/// \param[in] count
/// The number of breakpoint hits to ignore.
//------------------------------------------------------------------
void SetIgnoreCount(uint32_t n) {
m_ignore_count = n;
m_set_flags.Set(eIgnoreCount);
}
//------------------------------------------------------------------
/// Return the current Ignore Count.
/// \return
/// The number of breakpoint hits to be ignored.
//------------------------------------------------------------------
uint32_t GetIgnoreCount() const { return m_ignore_count; }
//------------------------------------------------------------------
/// Return the current thread spec for this option. This will return nullptr
/// if the no thread specifications have been set for this Option yet.
/// \return
/// The thread specification pointer for this option, or nullptr if none
/// has
/// been set yet.
//------------------------------------------------------------------
const ThreadSpec *GetThreadSpecNoCreate() const;
//------------------------------------------------------------------
/// Returns a pointer to the ThreadSpec for this option, creating it. if it
/// hasn't been created already. This API is used for setting the
/// ThreadSpec items for this option.
//------------------------------------------------------------------
ThreadSpec *GetThreadSpec();
void SetThreadID(lldb::tid_t thread_id);
void GetDescription(Stream *s, lldb::DescriptionLevel level) const;
//------------------------------------------------------------------
/// Returns true if the breakpoint option has a callback set.
//------------------------------------------------------------------
bool HasCallback() const;
//------------------------------------------------------------------
/// This is the default empty callback.
//------------------------------------------------------------------
static bool NullCallback(void *baton, StoppointCallbackContext *context,
lldb::user_id_t break_id,
lldb::user_id_t break_loc_id);
//------------------------------------------------------------------
/// Set a callback based on BreakpointOptions::CommandData. \param[in]
/// cmd_data
/// A UP holding the new'ed CommandData object.
/// The breakpoint will take ownership of pointer held by this object.
//------------------------------------------------------------------
void SetCommandDataCallback(std::unique_ptr<CommandData> &cmd_data);
void Clear();
@ -402,9 +340,7 @@ public:
}
protected:
//------------------------------------------------------------------
// Classes that inherit from BreakpointOptions can see and modify these
//------------------------------------------------------------------
bool IsOptionSet(OptionKind kind)
{
return m_set_flags.Test(kind);
@ -431,9 +367,7 @@ protected:
void SetThreadSpec(std::unique_ptr<ThreadSpec> &thread_spec_up);
private:
//------------------------------------------------------------------
// For BreakpointOptions only
//------------------------------------------------------------------
BreakpointHitCallback m_callback; // This is the callback function pointer
lldb::BatonSP m_callback_baton_sp; // This is the client data for the callback
bool m_baton_is_command_baton;

View File

@ -19,13 +19,10 @@
namespace lldb_private {
//----------------------------------------------------------------------
/// \class BreakpointResolver BreakpointResolver.h
/// "lldb/Breakpoint/BreakpointResolver.h" This class works with SearchFilter
/// to resolve logical breakpoints to their of concrete breakpoint locations.
//----------------------------------------------------------------------
//----------------------------------------------------------------------
/// General Outline:
/// The BreakpointResolver is a Searcher. In that protocol, the SearchFilter
/// asks the question "At what depth of the symbol context descent do you want
@ -34,13 +31,11 @@ namespace lldb_private {
/// Each Breakpoint has a BreakpointResolver, and it calls either
/// ResolveBreakpoint or ResolveBreakpointInModules to tell it to look for new
/// breakpoint locations.
//----------------------------------------------------------------------
class BreakpointResolver : public Searcher {
friend class Breakpoint;
public:
//------------------------------------------------------------------
/// The breakpoint resolver need to have a breakpoint for "ResolveBreakpoint
/// to make sense. It can be constructed without a breakpoint, but you have
/// to call SetBreakpoint before ResolveBreakpoint.
@ -52,74 +47,57 @@ public:
///
/// \result
/// Returns breakpoint location id.
//------------------------------------------------------------------
BreakpointResolver(Breakpoint *bkpt, unsigned char resolverType,
lldb::addr_t offset = 0);
//------------------------------------------------------------------
/// The Destructor is virtual, all significant breakpoint resolvers derive
/// from this class.
//------------------------------------------------------------------
~BreakpointResolver() override;
//------------------------------------------------------------------
/// This sets the breakpoint for this resolver.
///
/// \param[in] bkpt
/// The breakpoint that owns this resolver.
//------------------------------------------------------------------
void SetBreakpoint(Breakpoint *bkpt);
//------------------------------------------------------------------
/// This updates the offset for this breakpoint. All the locations
/// currently set for this breakpoint will have their offset adjusted when
/// this is called.
///
/// \param[in] offset
/// The offset to add to all locations.
//------------------------------------------------------------------
void SetOffset(lldb::addr_t offset);
//------------------------------------------------------------------
/// This updates the offset for this breakpoint. All the locations
/// currently set for this breakpoint will have their offset adjusted when
/// this is called.
///
/// \param[in] offset
/// The offset to add to all locations.
//------------------------------------------------------------------
lldb::addr_t GetOffset() const { return m_offset; }
//------------------------------------------------------------------
/// In response to this method the resolver scans all the modules in the
/// breakpoint's target, and adds any new locations it finds.
///
/// \param[in] filter
/// The filter that will manage the search for this resolver.
//------------------------------------------------------------------
virtual void ResolveBreakpoint(SearchFilter &filter);
//------------------------------------------------------------------
/// In response to this method the resolver scans the modules in the module
/// list \a modules, and adds any new locations it finds.
///
/// \param[in] filter
/// The filter that will manage the search for this resolver.
//------------------------------------------------------------------
virtual void ResolveBreakpointInModules(SearchFilter &filter,
ModuleList &modules);
//------------------------------------------------------------------
/// Prints a canonical description for the breakpoint to the stream \a s.
///
/// \param[in] s
/// Stream to which the output is copied.
//------------------------------------------------------------------
void GetDescription(Stream *s) override = 0;
//------------------------------------------------------------------
/// Standard "Dump" method. At present it does nothing.
//------------------------------------------------------------------
virtual void Dump(Stream *s) const = 0;
/// This section handles serializing and deserializing from StructuredData
@ -142,8 +120,6 @@ public:
StructuredData::DictionarySP
WrapOptionsDict(StructuredData::DictionarySP options_dict_sp);
//------------------------------------------------------------------
//------------------------------------------------------------------
/// An enumeration for keeping track of the concrete subclass that is
/// actually instantiated. Values of this enumeration are kept in the
/// BreakpointResolver's SubclassID field. They are used for concrete type
@ -163,7 +139,6 @@ public:
// index, and one for UnknownResolver.
static const char *g_ty_to_name[LastKnownResolverType + 2];
//------------------------------------------------------------------
/// getResolverID - Return an ID for the concrete type of this object. This
/// is used to implement the LLVM classof checks. This should not be used
/// for any other purpose, as the values may change as LLDB evolves.
@ -220,7 +195,6 @@ public:
}
protected:
//------------------------------------------------------------------
/// Takes a symbol context list of matches which supposedly represent the
/// same file and line number in a CU, and find the nearest actual line
/// number that matches, and then filter down the matching addresses to

View File

@ -14,12 +14,10 @@
namespace lldb_private {
//----------------------------------------------------------------------
/// \class BreakpointResolverAddress BreakpointResolverAddress.h
/// "lldb/Breakpoint/BreakpointResolverAddress.h" This class sets breakpoints
/// on a given Address. This breakpoint only takes once, and then it won't
/// attempt to reset itself.
//----------------------------------------------------------------------
class BreakpointResolverAddress : public BreakpointResolver {
public:

View File

@ -13,12 +13,10 @@
namespace lldb_private {
//----------------------------------------------------------------------
/// \class BreakpointResolverFileLine BreakpointResolverFileLine.h
/// "lldb/Breakpoint/BreakpointResolverFileLine.h" This class sets breakpoints
/// by file and line. Optionally, it will look for inlined instances of the
/// file and line specification.
//----------------------------------------------------------------------
class BreakpointResolverFileLine : public BreakpointResolver {
public:

View File

@ -16,12 +16,10 @@
namespace lldb_private {
//----------------------------------------------------------------------
/// \class BreakpointResolverFileRegex BreakpointResolverFileRegex.h
/// "lldb/Breakpoint/BreakpointResolverFileRegex.h" This class sets
/// breakpoints by file and line. Optionally, it will look for inlined
/// instances of the file and line specification.
//----------------------------------------------------------------------
class BreakpointResolverFileRegex : public BreakpointResolver {
public:

View File

@ -17,11 +17,9 @@
namespace lldb_private {
//----------------------------------------------------------------------
/// \class BreakpointResolverName BreakpointResolverName.h
/// "lldb/Breakpoint/BreakpointResolverName.h" This class sets breakpoints on
/// a given function name, either by exact match or by regular expression.
//----------------------------------------------------------------------
class BreakpointResolverName : public BreakpointResolver {
public:

View File

@ -16,12 +16,10 @@
namespace lldb_private {
//----------------------------------------------------------------------
/// \class BreakpointResolverScripted BreakpointResolverScripted.h
/// "lldb/Breakpoint/BreakpointResolverScripted.h" This class sets breakpoints
/// on a given Address. This breakpoint only takes once, and then it won't
/// attempt to reset itself.
//----------------------------------------------------------------------
class BreakpointResolverScripted : public BreakpointResolver {
public:

View File

@ -21,7 +21,6 @@
namespace lldb_private {
//----------------------------------------------------------------------
/// \class BreakpointSite BreakpointSite.h "lldb/Breakpoint/BreakpointSite.h"
/// Class that manages the actual breakpoint that will be inserted into the
/// running program.
@ -32,7 +31,6 @@ namespace lldb_private {
/// that share this physical site. When the breakpoint is hit, all the
/// locations are informed by the breakpoint site. Breakpoint sites are owned
/// by the process.
//----------------------------------------------------------------------
class BreakpointSite : public std::enable_shared_from_this<BreakpointSite>,
public StoppointLocation {
@ -49,68 +47,47 @@ public:
~BreakpointSite() override;
//----------------------------------------------------------------------
// This section manages the breakpoint traps
//----------------------------------------------------------------------
//------------------------------------------------------------------
/// Returns the Opcode Bytes for this breakpoint
//------------------------------------------------------------------
uint8_t *GetTrapOpcodeBytes();
//------------------------------------------------------------------
/// Returns the Opcode Bytes for this breakpoint - const version
//------------------------------------------------------------------
const uint8_t *GetTrapOpcodeBytes() const;
//------------------------------------------------------------------
/// Get the size of the trap opcode for this address
//------------------------------------------------------------------
size_t GetTrapOpcodeMaxByteSize() const;
//------------------------------------------------------------------
/// Sets the trap opcode
//------------------------------------------------------------------
bool SetTrapOpcode(const uint8_t *trap_opcode, uint32_t trap_opcode_size);
//------------------------------------------------------------------
/// Gets the original instruction bytes that were overwritten by the trap
//------------------------------------------------------------------
uint8_t *GetSavedOpcodeBytes();
//------------------------------------------------------------------
/// Gets the original instruction bytes that were overwritten by the trap
/// const version
//------------------------------------------------------------------
const uint8_t *GetSavedOpcodeBytes() const;
//------------------------------------------------------------------
/// Says whether \a addr and size \a size intersects with the address \a
/// intersect_addr
//------------------------------------------------------------------
bool IntersectsRange(lldb::addr_t addr, size_t size,
lldb::addr_t *intersect_addr, size_t *intersect_size,
size_t *opcode_offset) const;
//------------------------------------------------------------------
/// Tells whether the current breakpoint site is enabled or not
///
/// This is a low-level enable bit for the breakpoint sites. If a
/// breakpoint site has no enabled owners, it should just get removed. This
/// enable/disable is for the low-level target code to enable and disable
/// breakpoint sites when single stepping, etc.
//------------------------------------------------------------------
bool IsEnabled() const;
//------------------------------------------------------------------
/// Sets whether the current breakpoint site is enabled or not
///
/// \param[in] enabled
/// \b true if the breakpoint is enabled, \b false otherwise.
//------------------------------------------------------------------
void SetEnabled(bool enabled);
//------------------------------------------------------------------
/// Enquires of the breakpoint locations that produced this breakpoint site
/// whether we should stop at this location.
///
@ -119,36 +96,28 @@ public:
///
/// \return
/// \b true if we should stop, \b false otherwise.
//------------------------------------------------------------------
bool ShouldStop(StoppointCallbackContext *context) override;
//------------------------------------------------------------------
/// Standard Dump method
///
/// \param[in] context
/// The stream to dump this output.
//------------------------------------------------------------------
void Dump(Stream *s) const override;
//------------------------------------------------------------------
/// The "Owners" are the breakpoint locations that share this breakpoint
/// site. The method adds the \a owner to this breakpoint site's owner list.
///
/// \param[in] context
/// \a owner is the Breakpoint Location to add.
//------------------------------------------------------------------
void AddOwner(const lldb::BreakpointLocationSP &owner);
//------------------------------------------------------------------
/// This method returns the number of breakpoint locations currently located
/// at this breakpoint site.
///
/// \return
/// The number of owners.
//------------------------------------------------------------------
size_t GetNumberOfOwners();
//------------------------------------------------------------------
/// This method returns the breakpoint location at index \a index located at
/// this breakpoint site. The owners are listed ordinally from 0 to
/// GetNumberOfOwners() - 1 so you can use this method to iterate over the
@ -158,10 +127,8 @@ public:
/// The index in the list of owners for which you wish the owner location.
/// \return
/// A shared pointer to the breakpoint location at that index.
//------------------------------------------------------------------
lldb::BreakpointLocationSP GetOwnerAtIndex(size_t idx);
//------------------------------------------------------------------
/// This method copies the breakpoint site's owners into a new collection.
/// It does this while the owners mutex is locked.
///
@ -171,10 +138,8 @@ public:
///
/// \return
/// The number of elements copied into out_collection.
//------------------------------------------------------------------
size_t CopyOwnersList(BreakpointLocationCollection &out_collection);
//------------------------------------------------------------------
/// Check whether the owners of this breakpoint site have any thread
/// specifiers, and if yes, is \a thread contained in any of these
/// specifiers.
@ -185,10 +150,8 @@ public:
/// return
/// \b true if the collection contains at least one location that
/// would be valid for this thread, false otherwise.
//------------------------------------------------------------------
bool ValidForThisThread(Thread *thread);
//------------------------------------------------------------------
/// Print a description of this breakpoint site to the stream \a s.
/// GetDescription tells you about the breakpoint site's owners. Use
/// BreakpointSite::Dump(Stream *) to get information about the breakpoint
@ -202,10 +165,8 @@ public:
/// provide.
///
/// \see lldb::DescriptionLevel
//------------------------------------------------------------------
void GetDescription(Stream *s, lldb::DescriptionLevel level);
//------------------------------------------------------------------
/// Tell whether a breakpoint has a location at this site.
///
/// \param[in] bp_id
@ -214,17 +175,14 @@ public:
/// \result
/// \b true if bp_id has a location that is at this site,
/// \b false otherwise.
//------------------------------------------------------------------
bool IsBreakpointAtThisSite(lldb::break_id_t bp_id);
//------------------------------------------------------------------
/// Tell whether ALL the breakpoints in the location collection are
/// internal.
///
/// \result
/// \b true if all breakpoint locations are owned by internal breakpoints,
/// \b false otherwise.
//------------------------------------------------------------------
bool IsInternal() const;
BreakpointSite::Type GetType() const { return m_type; }
@ -241,13 +199,11 @@ private:
void BumpHitCounts();
//------------------------------------------------------------------
/// The method removes the owner at \a break_loc_id from this breakpoint
/// list.
///
/// \param[in] context
/// \a break_loc_id is the Breakpoint Location to remove.
//------------------------------------------------------------------
size_t RemoveOwner(lldb::break_id_t break_id, lldb::break_id_t break_loc_id);
BreakpointSite::Type m_type; ///< The type of this breakpoint site.

View File

@ -17,11 +17,9 @@
namespace lldb_private {
//----------------------------------------------------------------------
/// \class BreakpointSiteList BreakpointSiteList.h
/// "lldb/Breakpoint/BreakpointSiteList.h" Class that manages lists of
/// BreakpointSite shared pointers.
//----------------------------------------------------------------------
class BreakpointSiteList {
// At present Process directly accesses the map of BreakpointSites so it can
// do quick lookups into the map (using GetMap).
@ -29,17 +27,12 @@ class BreakpointSiteList {
friend class Process;
public:
//------------------------------------------------------------------
/// Default constructor makes an empty list.
//------------------------------------------------------------------
BreakpointSiteList();
//------------------------------------------------------------------
/// Destructor, currently does nothing.
//------------------------------------------------------------------
~BreakpointSiteList();
//------------------------------------------------------------------
/// Add a BreakpointSite to the list.
///
/// \param[in] bp_site_sp
@ -47,16 +40,12 @@ public:
///
/// \return
/// The ID of the BreakpointSite in the list.
//------------------------------------------------------------------
lldb::break_id_t Add(const lldb::BreakpointSiteSP &bp_site_sp);
//------------------------------------------------------------------
/// Standard Dump routine, doesn't do anything at present. \param[in] s
/// Stream into which to dump the description.
//------------------------------------------------------------------
void Dump(Stream *s) const;
//------------------------------------------------------------------
/// Returns a shared pointer to the breakpoint site at address \a addr.
///
/// \param[in] addr
@ -65,10 +54,8 @@ public:
/// \result
/// A shared pointer to the breakpoint site. May contain a NULL
/// pointer if no breakpoint site exists with a matching address.
//------------------------------------------------------------------
lldb::BreakpointSiteSP FindByAddress(lldb::addr_t addr);
//------------------------------------------------------------------
/// Returns a shared pointer to the breakpoint site with id \a breakID.
///
/// \param[in] breakID
@ -78,10 +65,8 @@ public:
/// A shared pointer to the breakpoint site. May contain a NULL pointer if
/// the
/// breakpoint doesn't exist.
//------------------------------------------------------------------
lldb::BreakpointSiteSP FindByID(lldb::break_id_t breakID);
//------------------------------------------------------------------
/// Returns a shared pointer to the breakpoint site with id \a breakID -
/// const version.
///
@ -92,10 +77,8 @@ public:
/// A shared pointer to the breakpoint site. May contain a NULL pointer if
/// the
/// breakpoint doesn't exist.
//------------------------------------------------------------------
const lldb::BreakpointSiteSP FindByID(lldb::break_id_t breakID) const;
//------------------------------------------------------------------
/// Returns the breakpoint site id to the breakpoint site at address \a
/// addr.
///
@ -104,10 +87,8 @@ public:
///
/// \result
/// The ID of the breakpoint site, or LLDB_INVALID_BREAK_ID.
//------------------------------------------------------------------
lldb::break_id_t FindIDByAddress(lldb::addr_t addr);
//------------------------------------------------------------------
/// Returns whether the breakpoint site \a bp_site_id has \a bp_id
// as one of its owners.
///
@ -120,13 +101,11 @@ public:
/// \result
/// True if \a bp_site_id exists in the site list AND \a bp_id is one of the
/// owners of that site.
//------------------------------------------------------------------
bool BreakpointSiteContainsBreakpoint(lldb::break_id_t bp_site_id,
lldb::break_id_t bp_id);
void ForEach(std::function<void(BreakpointSite *)> const &callback);
//------------------------------------------------------------------
/// Removes the breakpoint site given by \b breakID from this list.
///
/// \param[in] breakID
@ -134,10 +113,8 @@ public:
///
/// \result
/// \b true if the breakpoint site \a breakID was in the list.
//------------------------------------------------------------------
bool Remove(lldb::break_id_t breakID);
//------------------------------------------------------------------
/// Removes the breakpoint site at address \a addr from this list.
///
/// \param[in] addr
@ -145,7 +122,6 @@ public:
///
/// \result
/// \b true if \a addr had a breakpoint site to remove from the list.
//------------------------------------------------------------------
bool RemoveByAddress(lldb::addr_t addr);
bool FindInRange(lldb::addr_t lower_bound, lldb::addr_t upper_bound,
@ -154,7 +130,6 @@ public:
typedef void (*BreakpointSiteSPMapFunc)(lldb::BreakpointSiteSP &bp,
void *baton);
//------------------------------------------------------------------
/// Enquires of the breakpoint site on in this list with ID \a breakID
/// whether we should stop for the breakpoint or not.
///
@ -166,15 +141,12 @@ public:
///
/// \return
/// \b true if we should stop, \b false otherwise.
//------------------------------------------------------------------
bool ShouldStop(StoppointCallbackContext *context, lldb::break_id_t breakID);
//------------------------------------------------------------------
/// Returns the number of elements in the list.
///
/// \result
/// The number of elements.
//------------------------------------------------------------------
size_t GetSize() const {
std::lock_guard<std::recursive_mutex> guard(m_mutex);
return m_bp_site_list.size();

View File

@ -16,16 +16,12 @@ namespace lldb_private {
class Stoppoint {
public:
//------------------------------------------------------------------
// Constructors and Destructors
//------------------------------------------------------------------
Stoppoint();
virtual ~Stoppoint();
//------------------------------------------------------------------
// Methods
//------------------------------------------------------------------
virtual void Dump(Stream *) = 0;
virtual bool IsEnabled() = 0;
@ -40,9 +36,7 @@ protected:
lldb::break_id_t m_bid;
private:
//------------------------------------------------------------------
// For Stoppoint only
//------------------------------------------------------------------
DISALLOW_COPY_AND_ASSIGN(Stoppoint);
};

View File

@ -14,18 +14,14 @@
namespace lldb_private {
//----------------------------------------------------------------------
/// \class StoppointCallbackContext StoppointCallbackContext.h
/// "lldb/Breakpoint/StoppointCallbackContext.h" Class holds the information
/// that a breakpoint callback needs to evaluate this stop.
//----------------------------------------------------------------------
//----------------------------------------------------------------------
/// General Outline:
/// When we hit a breakpoint we need to package up whatever information is
/// needed to evaluate breakpoint commands and conditions. This class is the
/// container of that information.
//----------------------------------------------------------------------
class StoppointCallbackContext {
public:
@ -34,17 +30,13 @@ public:
StoppointCallbackContext(Event *event, const ExecutionContext &exe_ctx,
bool synchronously = false);
//------------------------------------------------------------------
/// Clear the object's state.
///
/// Sets the event, process and thread to NULL, and the frame index to an
/// invalid value.
//------------------------------------------------------------------
void Clear();
//------------------------------------------------------------------
// Member variables
//------------------------------------------------------------------
Event *event; // This is the event, the callback can modify this to indicate
// the meaning of the breakpoint hit
ExecutionContextRef

View File

@ -17,9 +17,7 @@ namespace lldb_private {
class StoppointLocation {
public:
//------------------------------------------------------------------
// Constructors and Destructors
//------------------------------------------------------------------
StoppointLocation(lldb::break_id_t bid, lldb::addr_t m_addr, bool hardware);
StoppointLocation(lldb::break_id_t bid, lldb::addr_t m_addr,
@ -27,13 +25,9 @@ public:
virtual ~StoppointLocation();
//------------------------------------------------------------------
// Operators
//------------------------------------------------------------------
//------------------------------------------------------------------
// Methods
//------------------------------------------------------------------
virtual lldb::addr_t GetLoadAddress() const { return m_addr; }
virtual void SetLoadAddress(lldb::addr_t addr) { m_addr = addr; }
@ -59,9 +53,7 @@ public:
lldb::break_id_t GetID() const { return m_loc_id; }
protected:
//------------------------------------------------------------------
// Classes that inherit from StoppointLocation can see and modify these
//------------------------------------------------------------------
lldb::break_id_t m_loc_id; // Stoppoint location ID
lldb::addr_t
m_addr; // The load address of this stop point. The base Stoppoint doesn't
@ -84,9 +76,7 @@ protected:
void DecrementHitCount();
private:
//------------------------------------------------------------------
// For StoppointLocation only
//------------------------------------------------------------------
DISALLOW_COPY_AND_ASSIGN(StoppointLocation);
StoppointLocation(); // Disallow default constructor
};

View File

@ -97,15 +97,12 @@ public:
Target &GetTarget() { return m_target; }
const Status &GetError() { return m_error; }
//------------------------------------------------------------------
/// Returns the WatchpointOptions structure set for this watchpoint.
///
/// \return
/// A pointer to this watchpoint's WatchpointOptions.
//------------------------------------------------------------------
WatchpointOptions *GetOptions() { return &m_options; }
//------------------------------------------------------------------
/// Set the callback action invoked when the watchpoint is hit.
///
/// \param[in] callback
@ -120,7 +117,6 @@ public:
/// \return
/// \b true if the process should stop when you hit the watchpoint.
/// \b false if it should continue.
//------------------------------------------------------------------
void SetCallback(WatchpointHitCallback callback, void *callback_baton,
bool is_synchronous = false);
@ -130,7 +126,6 @@ public:
void ClearCallback();
//------------------------------------------------------------------
/// Invoke the callback action when the watchpoint is hit.
///
/// \param[in] context
@ -138,28 +133,21 @@ public:
///
/// \return
/// \b true if the target should stop at this watchpoint and \b false not.
//------------------------------------------------------------------
bool InvokeCallback(StoppointCallbackContext *context);
//------------------------------------------------------------------
// Condition
//------------------------------------------------------------------
//------------------------------------------------------------------
/// Set the watchpoint's condition.
///
/// \param[in] condition
/// The condition expression to evaluate when the watchpoint is hit.
/// Pass in nullptr to clear the condition.
//------------------------------------------------------------------
void SetCondition(const char *condition);
//------------------------------------------------------------------
/// Return a pointer to the text of the condition expression.
///
/// \return
/// A pointer to the condition expression text, or nullptr if no
// condition has been set.
//------------------------------------------------------------------
const char *GetConditionText() const;
void TurnOnEphemeralMode();

View File

@ -18,12 +18,10 @@
namespace lldb_private {
//----------------------------------------------------------------------
/// \class WatchpointList WatchpointList.h "lldb/Breakpoint/WatchpointList.h"
/// This class is used by Watchpoint to manage a list of watchpoints,
// each watchpoint in the list has a unique ID, and is unique by Address as
// well.
//----------------------------------------------------------------------
class WatchpointList {
// Only Target can make the watchpoint list, or add elements to it. This is
@ -33,17 +31,12 @@ class WatchpointList {
friend class Target;
public:
//------------------------------------------------------------------
/// Default constructor makes an empty list.
//------------------------------------------------------------------
WatchpointList();
//------------------------------------------------------------------
/// Destructor, currently does nothing.
//------------------------------------------------------------------
~WatchpointList();
//------------------------------------------------------------------
/// Add a Watchpoint to the list.
///
/// \param[in] wp_sp
@ -51,20 +44,14 @@ public:
///
/// \return
/// The ID of the Watchpoint in the list.
//------------------------------------------------------------------
lldb::watch_id_t Add(const lldb::WatchpointSP &wp_sp, bool notify);
//------------------------------------------------------------------
/// Standard "Dump" method.
//------------------------------------------------------------------
void Dump(Stream *s) const;
//------------------------------------------------------------------
/// Dump with lldb::DescriptionLevel.
//------------------------------------------------------------------
void DumpWithLevel(Stream *s, lldb::DescriptionLevel description_level) const;
//------------------------------------------------------------------
/// Returns a shared pointer to the watchpoint at address \a addr - const
/// version.
///
@ -74,10 +61,8 @@ public:
/// \result
/// A shared pointer to the watchpoint. May contain a NULL
/// pointer if the watchpoint doesn't exist.
//------------------------------------------------------------------
const lldb::WatchpointSP FindByAddress(lldb::addr_t addr) const;
//------------------------------------------------------------------
/// Returns a shared pointer to the watchpoint with watchpoint spec \a spec
/// - const version.
///
@ -87,10 +72,8 @@ public:
/// \result
/// A shared pointer to the watchpoint. May contain a NULL
/// pointer if the watchpoint doesn't exist.
//------------------------------------------------------------------
const lldb::WatchpointSP FindBySpec(std::string spec) const;
//------------------------------------------------------------------
/// Returns a shared pointer to the watchpoint with id \a watchID, const
/// version.
///
@ -100,10 +83,8 @@ public:
/// \result
/// A shared pointer to the watchpoint. May contain a NULL
/// pointer if the watchpoint doesn't exist.
//------------------------------------------------------------------
lldb::WatchpointSP FindByID(lldb::watch_id_t watchID) const;
//------------------------------------------------------------------
/// Returns the watchpoint id to the watchpoint at address \a addr.
///
/// \param[in] addr
@ -111,10 +92,8 @@ public:
///
/// \result
/// The ID of the watchpoint, or LLDB_INVALID_WATCH_ID.
//------------------------------------------------------------------
lldb::watch_id_t FindIDByAddress(lldb::addr_t addr);
//------------------------------------------------------------------
/// Returns the watchpoint id to the watchpoint with watchpoint spec \a
/// spec.
///
@ -123,10 +102,8 @@ public:
///
/// \result
/// The ID of the watchpoint, or LLDB_INVALID_WATCH_ID.
//------------------------------------------------------------------
lldb::watch_id_t FindIDBySpec(std::string spec);
//------------------------------------------------------------------
/// Returns a shared pointer to the watchpoint with index \a i.
///
/// \param[in] i
@ -135,10 +112,8 @@ public:
/// \result
/// A shared pointer to the watchpoint. May contain a NULL pointer if
/// the watchpoint doesn't exist.
//------------------------------------------------------------------
lldb::WatchpointSP GetByIndex(uint32_t i);
//------------------------------------------------------------------
/// Returns a shared pointer to the watchpoint with index \a i, const
/// version.
///
@ -148,10 +123,8 @@ public:
/// \result
/// A shared pointer to the watchpoint. May contain a NULL pointer if
/// the watchpoint location doesn't exist.
//------------------------------------------------------------------
const lldb::WatchpointSP GetByIndex(uint32_t i) const;
//------------------------------------------------------------------
/// Removes the watchpoint given by \b watchID from this list.
///
/// \param[in] watchID
@ -159,18 +132,14 @@ public:
///
/// \result
/// \b true if the watchpoint \a watchID was in the list.
//------------------------------------------------------------------
bool Remove(lldb::watch_id_t watchID, bool notify);
//------------------------------------------------------------------
/// Returns the number hit count of all watchpoints in this list.
///
/// \result
/// Hit count of all watchpoints in this list.
//------------------------------------------------------------------
uint32_t GetHitCount() const;
//------------------------------------------------------------------
/// Enquires of the watchpoint in this list with ID \a watchID whether we
/// should stop.
///
@ -182,21 +151,17 @@ public:
///
/// \return
/// \b true if we should stop, \b false otherwise.
//------------------------------------------------------------------
bool ShouldStop(StoppointCallbackContext *context, lldb::watch_id_t watchID);
//------------------------------------------------------------------
/// Returns the number of elements in this watchpoint list.
///
/// \result
/// The number of elements.
//------------------------------------------------------------------
size_t GetSize() const {
std::lock_guard<std::recursive_mutex> guard(m_mutex);
return m_watchpoints.size();
}
//------------------------------------------------------------------
/// Print a description of the watchpoints in this list to the stream \a s.
///
/// \param[in] s
@ -207,19 +172,16 @@ public:
/// provide.
///
/// \see lldb::DescriptionLevel
//------------------------------------------------------------------
void GetDescription(Stream *s, lldb::DescriptionLevel level);
void SetEnabledAll(bool enabled);
void RemoveAll(bool notify);
//------------------------------------------------------------------
/// Sets the passed in Locker to hold the Watchpoint List mutex.
///
/// \param[in] locker
/// The locker object that is set.
//------------------------------------------------------------------
void GetListMutex(std::unique_lock<std::recursive_mutex> &lock);
protected:

View File

@ -18,26 +18,19 @@
namespace lldb_private {
//----------------------------------------------------------------------
/// \class WatchpointOptions WatchpointOptions.h
/// "lldb/Breakpoint/WatchpointOptions.h" Class that manages the options on a
/// watchpoint.
//----------------------------------------------------------------------
class WatchpointOptions {
public:
//------------------------------------------------------------------
// Constructors and Destructors
//------------------------------------------------------------------
//------------------------------------------------------------------
/// Default constructor. The watchpoint is enabled, and has no condition,
/// callback, ignore count, etc...
//------------------------------------------------------------------
WatchpointOptions();
WatchpointOptions(const WatchpointOptions &rhs);
static WatchpointOptions *CopyOptionsNoCallback(WatchpointOptions &rhs);
//------------------------------------------------------------------
/// This constructor allows you to specify all the watchpoint options.
///
/// \param[in] callback
@ -49,18 +42,14 @@ public:
///
/// \param[in] thread_id
/// Only stop if \a thread_id hits the watchpoint.
//------------------------------------------------------------------
WatchpointOptions(WatchpointHitCallback callback, void *baton,
lldb::tid_t thread_id = LLDB_INVALID_THREAD_ID);
virtual ~WatchpointOptions();
//------------------------------------------------------------------
// Operators
//------------------------------------------------------------------
const WatchpointOptions &operator=(const WatchpointOptions &rhs);
//------------------------------------------------------------------
// Callbacks
//
// Watchpoint callbacks come in two forms, synchronous and asynchronous.
@ -88,9 +77,7 @@ public:
// take a bit of plumbing to get
// that to work.
//
//------------------------------------------------------------------
//------------------------------------------------------------------
/// Adds a callback to the watchpoint option set.
///
/// \param[in] callback
@ -102,19 +89,15 @@ public:
/// \param[in] synchronous
/// Whether this is a synchronous or asynchronous callback. See discussion
/// above.
//------------------------------------------------------------------
void SetCallback(WatchpointHitCallback callback,
const lldb::BatonSP &baton_sp, bool synchronous = false);
//------------------------------------------------------------------
/// Remove the callback from this option set.
//------------------------------------------------------------------
void ClearCallback();
// The rest of these functions are meant to be used only within the
// watchpoint handling mechanism.
//------------------------------------------------------------------
/// Use this function to invoke the callback for a specific stop.
///
/// \param[in] context
@ -130,72 +113,55 @@ public:
///
/// \return
/// The callback return value.
//------------------------------------------------------------------
bool InvokeCallback(StoppointCallbackContext *context,
lldb::user_id_t watch_id);
//------------------------------------------------------------------
/// Used in InvokeCallback to tell whether it is the right time to run this
/// kind of callback.
///
/// \return
/// The synchronicity of our callback.
//------------------------------------------------------------------
bool IsCallbackSynchronous() { return m_callback_is_synchronous; }
//------------------------------------------------------------------
/// Fetch the baton from the callback.
///
/// \return
/// The baton.
//------------------------------------------------------------------
Baton *GetBaton();
//------------------------------------------------------------------
/// Fetch a const version of the baton from the callback.
///
/// \return
/// The baton.
//------------------------------------------------------------------
const Baton *GetBaton() const;
//------------------------------------------------------------------
/// Return the current thread spec for this option. This will return nullptr
/// if the no thread specifications have been set for this Option yet.
/// \return
/// The thread specification pointer for this option, or nullptr if none
/// has
/// been set yet.
//------------------------------------------------------------------
const ThreadSpec *GetThreadSpecNoCreate() const;
//------------------------------------------------------------------
/// Returns a pointer to the ThreadSpec for this option, creating it. if it
/// hasn't been created already. This API is used for setting the
/// ThreadSpec items for this option.
//------------------------------------------------------------------
ThreadSpec *GetThreadSpec();
void SetThreadID(lldb::tid_t thread_id);
void GetDescription(Stream *s, lldb::DescriptionLevel level) const;
//------------------------------------------------------------------
/// Get description for callback only.
//------------------------------------------------------------------
void GetCallbackDescription(Stream *s, lldb::DescriptionLevel level) const;
//------------------------------------------------------------------
/// Returns true if the watchpoint option has a callback set.
//------------------------------------------------------------------
bool HasCallback();
//------------------------------------------------------------------
/// This is the default empty callback.
/// \return
/// The thread id for which the watchpoint hit will stop,
/// LLDB_INVALID_THREAD_ID for all threads.
//------------------------------------------------------------------
static bool NullCallback(void *baton, StoppointCallbackContext *context,
lldb::user_id_t watch_id);
@ -218,14 +184,10 @@ public:
};
protected:
//------------------------------------------------------------------
// Classes that inherit from WatchpointOptions can see and modify these
//------------------------------------------------------------------
private:
//------------------------------------------------------------------
// For WatchpointOptions only
//------------------------------------------------------------------
WatchpointHitCallback m_callback; // This is the callback function pointer
lldb::BatonSP m_callback_baton_sp; // This is the client data for the callback
bool m_callback_is_synchronous;

View File

@ -50,7 +50,6 @@ struct LineEntry;
namespace lldb_private {
//----------------------------------------------------------------------
/// \class Address Address.h "lldb/Core/Address.h"
/// A section + offset based address class.
///
@ -78,13 +77,10 @@ namespace lldb_private {
/// load addresses of the main executable and any images (shared libraries)
/// will be resolved/unresolved. When this happens, breakpoints that are in
/// one of these sections can be set/cleared.
//----------------------------------------------------------------------
class Address {
public:
//------------------------------------------------------------------
/// Dump styles allow the Address::Dump(Stream *,DumpStyle) const function
/// to display Address contents in a variety of ways.
//------------------------------------------------------------------
typedef enum {
DumpStyleInvalid, ///< Invalid dump style
DumpStyleSectionNameOffset, ///< Display as the section name + offset.
@ -127,26 +123,21 @@ public:
///< dereferenced address using DumpStyleResolvedDescription
} DumpStyle;
//------------------------------------------------------------------
/// Default constructor.
///
/// Initialize with a invalid section (NULL) and an invalid offset
/// (LLDB_INVALID_ADDRESS).
//------------------------------------------------------------------
Address() : m_section_wp(), m_offset(LLDB_INVALID_ADDRESS) {}
//------------------------------------------------------------------
/// Copy constructor
///
/// Makes a copy of the another Address object \a rhs.
///
/// \param[in] rhs
/// A const Address object reference to copy.
//------------------------------------------------------------------
Address(const Address &rhs)
: m_section_wp(rhs.m_section_wp), m_offset(rhs.m_offset) {}
//------------------------------------------------------------------
/// Construct with a section pointer and offset.
///
/// Initialize the address with the supplied \a section and \a offset.
@ -157,7 +148,6 @@ public:
///
/// \param[in] offset
/// The offset in bytes into \a section.
//------------------------------------------------------------------
Address(const lldb::SectionSP &section_sp, lldb::addr_t offset)
: m_section_wp(), // Don't init with section_sp in case section_sp is
// invalid (the weak_ptr will throw)
@ -166,7 +156,6 @@ public:
m_section_wp = section_sp;
}
//------------------------------------------------------------------
/// Construct with a virtual address and section list.
///
/// Initialize and resolve the address with the supplied virtual address \a
@ -177,12 +166,10 @@ public:
///
/// \param[in] section_list
/// A list of sections, one of which may contain the \a file_addr.
//------------------------------------------------------------------
Address(lldb::addr_t file_addr, const SectionList *section_list);
Address(lldb::addr_t abs_addr);
//------------------------------------------------------------------
/// Assignment operator.
///
/// Copies the address value from another Address object \a rhs into \a this
@ -193,21 +180,17 @@ public:
///
/// \return
/// A const Address object reference to \a this.
//------------------------------------------------------------------
const Address &operator=(const Address &rhs);
//------------------------------------------------------------------
/// Clear the object's state.
///
/// Sets the section to an invalid value (NULL) and an invalid offset
/// (LLDB_INVALID_ADDRESS).
//------------------------------------------------------------------
void Clear() {
m_section_wp.reset();
m_offset = LLDB_INVALID_ADDRESS;
}
//------------------------------------------------------------------
/// Compare two Address objects.
///
/// \param[in] lhs
@ -220,7 +203,6 @@ public:
/// \li -1 if lhs < rhs
/// \li 0 if lhs == rhs
/// \li 1 if lhs > rhs
//------------------------------------------------------------------
static int CompareFileAddress(const Address &lhs, const Address &rhs);
static int CompareLoadAddress(const Address &lhs, const Address &rhs,
@ -239,7 +221,6 @@ public:
}
};
//------------------------------------------------------------------
/// Dump a description of this object to a Stream.
///
/// Dump a description of the contents of this object to the supplied stream
@ -262,14 +243,12 @@ public:
/// in such cases.
///
/// \see Address::DumpStyle
//------------------------------------------------------------------
bool Dump(Stream *s, ExecutionContextScope *exe_scope, DumpStyle style,
DumpStyle fallback_style = DumpStyleInvalid,
uint32_t addr_byte_size = UINT32_MAX) const;
AddressClass GetAddressClass() const;
//------------------------------------------------------------------
/// Get the file address.
///
/// If an address comes from a file on disk that has section relative
@ -280,10 +259,8 @@ public:
/// The valid file virtual address, or LLDB_INVALID_ADDRESS if
/// the address doesn't have a file virtual address (image is
/// from memory only with no representation on disk).
//------------------------------------------------------------------
lldb::addr_t GetFileAddress() const;
//------------------------------------------------------------------
/// Get the load address.
///
/// If an address comes from a file on disk that has section relative
@ -296,10 +273,8 @@ public:
/// \return
/// The valid load virtual address, or LLDB_INVALID_ADDRESS if
/// the address is currently not loaded.
//------------------------------------------------------------------
lldb::addr_t GetLoadAddress(Target *target) const;
//------------------------------------------------------------------
/// Get the load address as a callable code load address.
///
/// This function will first resolve its address to a load address. Then, if
@ -312,11 +287,9 @@ public:
/// \return
/// The valid load virtual address, or LLDB_INVALID_ADDRESS if
/// the address is currently not loaded.
//------------------------------------------------------------------
lldb::addr_t GetCallableLoadAddress(Target *target,
bool is_indirect = false) const;
//------------------------------------------------------------------
/// Get the load address as an opcode load address.
///
/// This function will first resolve its address to a load address. Then, if
@ -332,21 +305,17 @@ public:
/// The valid load virtual address with extra callable bits
/// removed, or LLDB_INVALID_ADDRESS if the address is currently
/// not loaded.
//------------------------------------------------------------------
lldb::addr_t GetOpcodeLoadAddress(
Target *target,
AddressClass addr_class = AddressClass::eInvalid) const;
//------------------------------------------------------------------
/// Get the section relative offset value.
///
/// \return
/// The current offset, or LLDB_INVALID_ADDRESS if this address
/// doesn't contain a valid offset.
//------------------------------------------------------------------
lldb::addr_t GetOffset() const { return m_offset; }
//------------------------------------------------------------------
/// Check if an address is section offset.
///
/// When converting a virtual file or load address into a section offset
@ -358,12 +327,10 @@ public:
/// \return
/// Returns \b true if the address has a valid section and
/// offset, \b false otherwise.
//------------------------------------------------------------------
bool IsSectionOffset() const {
return IsValid() && (GetSection().get() != nullptr);
}
//------------------------------------------------------------------
/// Check if the object state is valid.
///
/// A valid Address object contains either a section pointer and
@ -373,18 +340,14 @@ public:
/// \return
/// Returns \b true if the offset is valid, \b false
/// otherwise.
//------------------------------------------------------------------
bool IsValid() const { return m_offset != LLDB_INVALID_ADDRESS; }
//------------------------------------------------------------------
/// Get the memory cost of this object.
///
/// \return
/// The number of bytes that this object occupies in memory.
//------------------------------------------------------------------
size_t MemorySize() const;
//------------------------------------------------------------------
/// Resolve a file virtual address using a section list.
///
/// Given a list of sections, attempt to resolve \a addr as an offset into
@ -393,11 +356,9 @@ public:
/// \return
/// Returns \b true if \a addr was able to be resolved, \b false
/// otherwise.
//------------------------------------------------------------------
bool ResolveAddressUsingFileSections(lldb::addr_t addr,
const SectionList *sections);
//------------------------------------------------------------------
/// Set the address to represent \a load_addr.
///
/// The address will attempt to find a loaded section within \a target that
@ -423,7 +384,6 @@ public:
/// address to not resolve to a section in a module, this often
/// happens for JIT'ed code, or any load addresses on the stack
/// or heap.
//------------------------------------------------------------------
bool SetLoadAddress(lldb::addr_t load_addr, Target *target,
bool allow_section_end = false);
@ -434,26 +394,21 @@ public:
bool SetCallableLoadAddress(lldb::addr_t load_addr, Target *target);
//------------------------------------------------------------------
/// Get accessor for the module for this address.
///
/// \return
/// Returns the Module pointer that this address is an offset
/// in, or NULL if this address doesn't belong in a module, or
/// isn't resolved yet.
//------------------------------------------------------------------
lldb::ModuleSP GetModule() const;
//------------------------------------------------------------------
/// Get const accessor for the section.
///
/// \return
/// Returns the const lldb::Section pointer that this address is an
/// offset in, or NULL if this address is absolute.
//------------------------------------------------------------------
lldb::SectionSP GetSection() const { return m_section_wp.lock(); }
//------------------------------------------------------------------
/// Set accessor for the offset.
///
/// \param[in] offset
@ -461,7 +416,6 @@ public:
///
/// \return
/// Returns \b true if the offset changed, \b false otherwise.
//------------------------------------------------------------------
bool SetOffset(lldb::addr_t offset) {
bool changed = m_offset != offset;
m_offset = offset;
@ -481,21 +435,18 @@ public:
return false;
}
//------------------------------------------------------------------
/// Set accessor for the section.
///
/// \param[in] section
/// A new lldb::Section pointer to use as the section base. Can
/// be NULL for absolute addresses that are not relative to
/// any section.
//------------------------------------------------------------------
void SetSection(const lldb::SectionSP &section_sp) {
m_section_wp = section_sp;
}
void ClearSection() { m_section_wp.reset(); }
//------------------------------------------------------------------
/// Reconstruct a symbol context from an address.
///
/// This class doesn't inherit from SymbolContextScope because many address
@ -504,7 +455,6 @@ public:
/// module found in the section.
///
/// \see SymbolContextScope::CalculateSymbolContext(SymbolContext*)
//------------------------------------------------------------------
uint32_t CalculateSymbolContext(SymbolContext *sc,
lldb::SymbolContextItem resolve_scope =
lldb::eSymbolContextEverything) const;
@ -521,33 +471,26 @@ public:
bool CalculateSymbolContextLineEntry(LineEntry &line_entry) const;
//------------------------------------------------------------------
// Returns true if the section should be valid, but isn't because the shared
// pointer to the section can't be reconstructed from a weak pointer that
// contains a valid weak reference to a section. Returns false if the section
// weak pointer has no reference to a section, or if the section is still
// valid
//------------------------------------------------------------------
bool SectionWasDeleted() const;
protected:
//------------------------------------------------------------------
// Member variables.
//------------------------------------------------------------------
lldb::SectionWP m_section_wp; ///< The section for the address, can be NULL.
lldb::addr_t m_offset; ///< Offset into section if \a m_section_wp is valid...
//------------------------------------------------------------------
// Returns true if the m_section_wp once had a reference to a valid section
// shared pointer, but no longer does. This can happen if we have an address
// from a module that gets unloaded and deleted. This function should only be
// called if GetSection() returns an empty shared pointer and you want to
// know if this address used to have a valid section.
//------------------------------------------------------------------
bool SectionWasDeletedPrivate() const;
};
//----------------------------------------------------------------------
// NOTE: Be careful using this operator. It can correctly compare two
// addresses from the same Module correctly. It can't compare two addresses
// from different modules in any meaningful way, but it will compare the module
@ -559,7 +502,6 @@ protected:
// address results to make much sense
//
// This basically lets Address objects be used in ordered collection classes.
//----------------------------------------------------------------------
bool operator<(const Address &lhs, const Address &rhs);
bool operator>(const Address &lhs, const Address &rhs);
bool operator==(const Address &lhs, const Address &rhs);

View File

@ -27,21 +27,16 @@ class Target;
namespace lldb_private {
//----------------------------------------------------------------------
/// \class AddressRange AddressRange.h "lldb/Core/AddressRange.h"
/// A section + offset based address range class.
//----------------------------------------------------------------------
class AddressRange {
public:
//------------------------------------------------------------------
/// Default constructor.
///
/// Initialize with a invalid section (NULL), an invalid offset
/// (LLDB_INVALID_ADDRESS), and zero byte size.
//------------------------------------------------------------------
AddressRange();
//------------------------------------------------------------------
/// Construct with a section pointer, offset, and byte_size.
///
/// Initialize the address with the supplied \a section, \a offset and \a
@ -56,11 +51,9 @@ public:
///
/// \param[in] byte_size
/// The size in bytes of the address range.
//------------------------------------------------------------------
AddressRange(const lldb::SectionSP &section, lldb::addr_t offset,
lldb::addr_t byte_size);
//------------------------------------------------------------------
/// Construct with a virtual address, section list and byte size.
///
/// Initialize and resolve the address with the supplied virtual address \a
@ -74,11 +67,9 @@ public:
///
/// \param[in] section_list
/// A list of sections, one of which may contain the \a vaddr.
//------------------------------------------------------------------
AddressRange(lldb::addr_t file_addr, lldb::addr_t byte_size,
const SectionList *section_list = nullptr);
//------------------------------------------------------------------
/// Construct with a Address object address and byte size.
///
/// Initialize by copying the section offset address in \a so_addr, and
@ -89,25 +80,19 @@ public:
///
/// \param[in] byte_size
/// The size in bytes of the address range.
//------------------------------------------------------------------
AddressRange(const Address &so_addr, lldb::addr_t byte_size);
//------------------------------------------------------------------
/// Destructor.
///
/// The destructor is virtual in case this class is subclassed.
//------------------------------------------------------------------
~AddressRange();
//------------------------------------------------------------------
/// Clear the object's state.
///
/// Sets the section to an invalid value (NULL), an invalid offset
/// (LLDB_INVALID_ADDRESS) and a zero byte size.
//------------------------------------------------------------------
void Clear();
//------------------------------------------------------------------
/// Check if a section offset address is contained in this range.
///
/// \param[in] so_addr
@ -116,11 +101,9 @@ public:
/// \return
/// Returns \b true if \a so_addr is contained in this range,
/// \b false otherwise.
//------------------------------------------------------------------
// bool
// Contains (const Address &so_addr) const;
//------------------------------------------------------------------
/// Check if a section offset address is contained in this range.
///
/// \param[in] so_addr_ptr
@ -129,11 +112,9 @@ public:
/// \return
/// Returns \b true if \a so_addr is contained in this range,
/// \b false otherwise.
//------------------------------------------------------------------
// bool
// Contains (const Address *so_addr_ptr) const;
//------------------------------------------------------------------
/// Check if a section offset \a so_addr when represented as a file address
/// is contained within this object's file address range.
///
@ -144,10 +125,8 @@ public:
/// Returns \b true if both \a this and \a so_addr have
/// resolvable file address values and \a so_addr is contained
/// in the address range, \b false otherwise.
//------------------------------------------------------------------
bool ContainsFileAddress(const Address &so_addr) const;
//------------------------------------------------------------------
/// Check if the resolved file address \a file_addr is contained within this
/// object's file address range.
///
@ -158,10 +137,8 @@ public:
/// Returns \b true if both \a this has a resolvable file
/// address value and \a so_addr is contained in the address
/// range, \b false otherwise.
//------------------------------------------------------------------
bool ContainsFileAddress(lldb::addr_t file_addr) const;
//------------------------------------------------------------------
/// Check if a section offset \a so_addr when represented as a load address
/// is contained within this object's load address range.
///
@ -172,10 +149,8 @@ public:
/// Returns \b true if both \a this and \a so_addr have
/// resolvable load address values and \a so_addr is contained
/// in the address range, \b false otherwise.
//------------------------------------------------------------------
bool ContainsLoadAddress(const Address &so_addr, Target *target) const;
//------------------------------------------------------------------
/// Check if the resolved load address \a load_addr is contained within this
/// object's load address range.
///
@ -186,10 +161,8 @@ public:
/// Returns \b true if both \a this has a resolvable load
/// address value and \a so_addr is contained in the address
/// range, \b false otherwise.
//------------------------------------------------------------------
bool ContainsLoadAddress(lldb::addr_t load_addr, Target *target) const;
//------------------------------------------------------------------
/// Dump a description of this object to a Stream.
///
/// Dump a description of the contents of this object to the supplied stream
@ -210,12 +183,10 @@ public:
/// in such cases.
///
/// \see Address::DumpStyle
//------------------------------------------------------------------
bool
Dump(Stream *s, Target *target, Address::DumpStyle style,
Address::DumpStyle fallback_style = Address::DumpStyleInvalid) const;
//------------------------------------------------------------------
/// Dump a debug description of this object to a Stream.
///
/// Dump a debug description of the contents of this object to the supplied
@ -226,57 +197,44 @@ public:
///
/// \param[in] s
/// The stream to which to dump the object description.
//------------------------------------------------------------------
void DumpDebug(Stream *s) const;
//------------------------------------------------------------------
/// Get accessor for the base address of the range.
///
/// \return
/// A reference to the base address object.
//------------------------------------------------------------------
Address &GetBaseAddress() { return m_base_addr; }
//------------------------------------------------------------------
/// Get const accessor for the base address of the range.
///
/// \return
/// A const reference to the base address object.
//------------------------------------------------------------------
const Address &GetBaseAddress() const { return m_base_addr; }
//------------------------------------------------------------------
/// Get accessor for the byte size of this range.
///
/// \return
/// The size in bytes of this address range.
//------------------------------------------------------------------
lldb::addr_t GetByteSize() const { return m_byte_size; }
//------------------------------------------------------------------
/// Get the memory cost of this object.
///
/// \return
/// The number of bytes that this object occupies in memory.
//------------------------------------------------------------------
size_t MemorySize() const {
// Noting special for the memory size of a single AddressRange object, it
// is just the size of itself.
return sizeof(AddressRange);
}
//------------------------------------------------------------------
/// Set accessor for the byte size of this range.
///
/// \param[in] byte_size
/// The new size in bytes of this address range.
//------------------------------------------------------------------
void SetByteSize(lldb::addr_t byte_size) { m_byte_size = byte_size; }
protected:
//------------------------------------------------------------------
// Member variables
//------------------------------------------------------------------
Address m_base_addr; ///< The section offset base address of this range.
lldb::addr_t m_byte_size; ///< The size in bytes of this address range.
};

View File

@ -24,19 +24,15 @@ class Stream;
}
namespace lldb_private {
//----------------------------------------------------------------------
/// \class AddressResolver AddressResolver.h "lldb/Core/AddressResolver.h"
/// This class works with SearchFilter to resolve function names and source
/// file locations to their concrete addresses.
//----------------------------------------------------------------------
//----------------------------------------------------------------------
/// General Outline:
/// The AddressResolver is a Searcher. In that protocol, the SearchFilter
/// asks the question "At what depth of the symbol context descent do you want
/// your callback to get called?" of the filter. The resolver answers this
/// question (in the GetDepth method) and provides the resolution callback.
//----------------------------------------------------------------------
class AddressResolver : public Searcher {
public:

View File

@ -28,12 +28,10 @@ class SymbolContext;
namespace lldb_private {
//----------------------------------------------------------------------
/// \class AddressResolverFileLine AddressResolverFileLine.h
/// "lldb/Core/AddressResolverFileLine.h" This class finds address for source
/// file and line. Optionally, it will look for inlined instances of the file
/// and line specification.
//----------------------------------------------------------------------
class AddressResolverFileLine : public AddressResolver {
public:

View File

@ -27,11 +27,9 @@ class SymbolContext;
namespace lldb_private {
//----------------------------------------------------------------------
/// \class AddressResolverName AddressResolverName.h
/// "lldb/Core/AddressResolverName.h" This class finds addresses for a given
/// function name, either by exact match or by regular expression.
//----------------------------------------------------------------------
class AddressResolverName : public AddressResolver {
public:

View File

@ -18,7 +18,6 @@ public:
Architecture() = default;
virtual ~Architecture() = default;
//------------------------------------------------------------------
/// This is currently intended to handle cases where a
/// program stops at an instruction that won't get executed and it
/// allows the stop reason, like "breakpoint hit", to be replaced
@ -29,10 +28,8 @@ public:
/// executed and therefore it wouldn't be correct to show the program
/// stopped at the current PC. The code is generic and applies to all
/// ARM CPUs.
//------------------------------------------------------------------
virtual void OverrideStopInfo(Thread &thread) const = 0;
//------------------------------------------------------------------
/// This method is used to get the number of bytes that should be
/// skipped, from function start address, to reach the first
/// instruction after the prologue. If overrode, it must return
@ -48,12 +45,10 @@ public:
/// be compared with current address, in order to find out the
/// number of bytes that should be skipped, in case we are stopped
/// at either function entry point.
//------------------------------------------------------------------
virtual size_t GetBytesToSkip(Symbol &func, const Address &curr_addr) const {
return 0;
}
//------------------------------------------------------------------
/// Adjust function breakpoint address, if needed. In some cases,
/// the function start address is not the right place to set the
/// breakpoint, specially in functions with multiple entry points.
@ -62,12 +57,10 @@ public:
/// both a global and a local entry point. In this case, the
/// breakpoint is adjusted to the first function address reached
/// by both entry points.
//------------------------------------------------------------------
virtual void AdjustBreakpointAddress(const Symbol &func,
Address &addr) const {}
//------------------------------------------------------------------
/// Get \a load_addr as a callable code load address for this target
///
/// Take \a load_addr and potentially add any address bits that are
@ -77,13 +70,11 @@ public:
/// adjustment will always happen. If it is set to an address class
/// that doesn't have code in it, LLDB_INVALID_ADDRESS will be
/// returned.
//------------------------------------------------------------------
virtual lldb::addr_t GetCallableLoadAddress(
lldb::addr_t addr, AddressClass addr_class = AddressClass::eInvalid) const {
return addr;
}
//------------------------------------------------------------------
/// Get \a load_addr as an opcode for this target.
///
/// Take \a load_addr and potentially strip any address bits that are
@ -94,7 +85,6 @@ public:
/// adjustment will always happen. If it is set to an address class
/// that doesn't have code in it, LLDB_INVALID_ADDRESS will be
/// returned.
//------------------------------------------------------------------
virtual lldb::addr_t GetOpcodeLoadAddress(
lldb::addr_t addr, AddressClass addr_class = AddressClass::eInvalid) const {

View File

@ -37,7 +37,6 @@ class Status;
namespace lldb_private {
//----------------------------------------------------------------------
/// \class Communication Communication.h "lldb/Core/Communication.h" An
/// abstract communications class.
///
@ -89,7 +88,6 @@ namespace lldb_private {
/// eBroadcastBitReadThreadDidExit event will be broadcast. Clients can also
/// post a \b eBroadcastBitReadThreadShouldExit event to this object which
/// will cause the read thread to exit.
//----------------------------------------------------------------------
class Communication : public Broadcaster {
public:
FLAGS_ANONYMOUS_ENUM(){
@ -115,7 +113,6 @@ public:
typedef void (*ReadThreadBytesReceived)(void *baton, const void *src,
size_t src_len);
//------------------------------------------------------------------
/// Construct the Communication object with the specified name for the
/// Broadcaster that this object inherits from.
///
@ -124,19 +121,15 @@ public:
/// complete as possible to uniquely identify this object. The
/// broadcaster name can be updated after the connect function
/// is called.
//------------------------------------------------------------------
Communication(const char *broadcaster_name);
//------------------------------------------------------------------
/// Destructor.
///
/// The destructor is virtual since this class gets subclassed.
//------------------------------------------------------------------
~Communication() override;
void Clear();
//------------------------------------------------------------------
/// Connect using the current connection by passing \a url to its connect
/// function. string.
///
@ -151,10 +144,8 @@ public:
///
/// \see Status& Communication::GetError ();
/// \see bool Connection::Connect (const char *url);
//------------------------------------------------------------------
lldb::ConnectionStatus Connect(const char *url, Status *error_ptr);
//------------------------------------------------------------------
/// Disconnect the communications connection if one is currently connected.
///
/// \return
@ -164,23 +155,19 @@ public:
///
/// \see Status& Communication::GetError ();
/// \see bool Connection::Disconnect ();
//------------------------------------------------------------------
lldb::ConnectionStatus Disconnect(Status *error_ptr = nullptr);
//------------------------------------------------------------------
/// Check if the connection is valid.
///
/// \return
/// \b True if this object is currently connected, \b false
/// otherwise.
//------------------------------------------------------------------
bool IsConnected() const;
bool HasConnection() const;
lldb_private::Connection *GetConnection() { return m_connection_sp.get(); }
//------------------------------------------------------------------
/// Read bytes from the current connection.
///
/// If no read thread is running, this function call the connection's
@ -208,11 +195,9 @@ public:
/// The number of bytes actually read.
///
/// \see size_t Connection::Read (void *, size_t);
//------------------------------------------------------------------
size_t Read(void *dst, size_t dst_len, const Timeout<std::micro> &timeout,
lldb::ConnectionStatus &status, Status *error_ptr);
//------------------------------------------------------------------
/// The actual write function that attempts to write to the communications
/// protocol.
///
@ -228,11 +213,9 @@ public:
///
/// \return
/// The number of bytes actually Written.
//------------------------------------------------------------------
size_t Write(const void *src, size_t src_len, lldb::ConnectionStatus &status,
Status *error_ptr);
//------------------------------------------------------------------
/// Sets the connection that it to be used by this class.
///
/// By making a communication class that uses different connections it
@ -245,10 +228,8 @@ public:
///
/// \see
/// class Connection
//------------------------------------------------------------------
void SetConnection(Connection *connection);
//------------------------------------------------------------------
/// Starts a read thread whose sole purpose it to read bytes from the
/// current connection. This function will call connection's read function:
///
@ -271,28 +252,22 @@ public:
/// \see size_t Connection::Read (void *, size_t);
/// \see void Communication::AppendBytesToCache (const uint8_t * bytes,
/// size_t len, bool broadcast);
//------------------------------------------------------------------
virtual bool StartReadThread(Status *error_ptr = nullptr);
//------------------------------------------------------------------
/// Stops the read thread by cancelling it.
///
/// \return
/// \b True if the read thread was successfully canceled, \b
/// false otherwise.
//------------------------------------------------------------------
virtual bool StopReadThread(Status *error_ptr = nullptr);
virtual bool JoinReadThread(Status *error_ptr = nullptr);
//------------------------------------------------------------------
/// Checks if there is a currently running read thread.
///
/// \return
/// \b True if the read thread is running, \b false otherwise.
//------------------------------------------------------------------
bool ReadThreadIsRunning();
//------------------------------------------------------------------
/// The static read thread function. This function will call the "DoRead"
/// function continuously and wait for data to become available. When data
/// is received it will append the available data to the internal cache and
@ -305,19 +280,16 @@ public:
/// \b NULL.
///
/// \see void Communication::ReadThreadGotBytes (const uint8_t *, size_t);
//------------------------------------------------------------------
static lldb::thread_result_t ReadThread(lldb::thread_arg_t comm_ptr);
void SetReadThreadBytesReceivedCallback(ReadThreadBytesReceived callback,
void *callback_baton);
//------------------------------------------------------------------
/// Wait for the read thread to process all outstanding data.
///
/// After this function returns, the read thread has processed all data that
/// has been waiting in the Connection queue.
///
//------------------------------------------------------------------
void SynchronizeWithReadThread();
static const char *ConnectionStatusAsCString(lldb::ConnectionStatus status);
@ -354,7 +326,6 @@ protected:
const Timeout<std::micro> &timeout,
lldb::ConnectionStatus &status, Status *error_ptr);
//------------------------------------------------------------------
/// Append new bytes that get read from the read thread into the internal
/// object byte cache. This will cause a \b eBroadcastBitReadThreadGotBytes
/// event to be broadcast if \a broadcast is true.
@ -373,12 +344,10 @@ protected:
///
/// \param[in] src_len
/// The number of bytes to append to the cache.
//------------------------------------------------------------------
virtual void AppendBytesToCache(const uint8_t *src, size_t src_len,
bool broadcast,
lldb::ConnectionStatus status);
//------------------------------------------------------------------
/// Get any available bytes from our data cache. If this call empties the
/// data cache, the \b eBroadcastBitReadThreadGotBytes event will be reset
/// to signify no more bytes are available.
@ -394,7 +363,6 @@ protected:
///
/// \return
/// The number of bytes extracted from the data cache.
//------------------------------------------------------------------
size_t GetCachedBytes(void *dst, size_t dst_len);
private:

View File

@ -74,12 +74,10 @@ class raw_ostream;
namespace lldb_private {
//----------------------------------------------------------------------
/// \class Debugger Debugger.h "lldb/Core/Debugger.h"
/// A class to manage flag bits.
///
/// Provides a global root objects for the debugger core.
//----------------------------------------------------------------------
class Debugger : public std::enable_shared_from_this<Debugger>,
public UserID,
@ -169,7 +167,6 @@ public:
}
ExecutionContext GetSelectedExecutionContext();
//------------------------------------------------------------------
/// Get accessor for the target list.
///
/// The target list is part of the global debugger object. This the single
@ -178,7 +175,6 @@ public:
///
/// \return
/// A global shared target list.
//------------------------------------------------------------------
TargetList &GetTargetList() { return m_target_list; }
PlatformList &GetPlatformList() { return m_platform_list; }
@ -187,10 +183,8 @@ public:
void DispatchInputEndOfFile();
//------------------------------------------------------------------
// If any of the streams are not set, set them to the in/out/err stream of
// the top most input reader to ensure they at least have something
//------------------------------------------------------------------
void AdoptTopIOHandlerFilesIfInvalid(lldb::StreamFileSP &in,
lldb::StreamFileSP &out,
lldb::StreamFileSP &err);
@ -229,9 +223,7 @@ public:
void SetLoggingCallback(lldb::LogOutputCallback log_callback, void *baton);
//----------------------------------------------------------------------
// Properties Functions
//----------------------------------------------------------------------
enum StopDisassemblyType {
eStopDisassemblyTypeNever = 0,
eStopDisassemblyTypeNoDebugInfo,
@ -416,9 +408,7 @@ protected:
lldb::ListenerSP m_forward_listener_sp;
llvm::once_flag m_clear_once;
//----------------------------------------------------------------------
// Events for m_sync_broadcaster
//----------------------------------------------------------------------
enum {
eBroadcastBitEventThreadIsListening = (1 << 0),
};

View File

@ -109,7 +109,6 @@ public:
m_address = addr;
}
//------------------------------------------------------------------
/// Dump the text representation of this Instruction to a Stream
///
/// Print the (optional) address, (optional) bytes, opcode,
@ -159,7 +158,6 @@ public:
/// Debugger::FormatDisassemblerAddress() string)
/// so this method can properly align the instruction opcodes.
/// May be 0 to indicate no indentation/alignment of the opcodes.
//------------------------------------------------------------------
virtual void Dump(Stream *s, uint32_t max_opcode_byte_size, bool show_address,
bool show_bytes, const ExecutionContext *exe_ctx,
const SymbolContext *sym_ctx,
@ -423,9 +421,7 @@ public:
uint32_t num_instructions, bool mixed_source_and_assembly,
uint32_t num_mixed_context_lines, uint32_t options, Stream &strm);
//------------------------------------------------------------------
// Constructors and Destructors
//------------------------------------------------------------------
Disassembler(const ArchSpec &arch, const char *flavor);
~Disassembler() override;
@ -535,18 +531,14 @@ protected:
return ElideMixedSourceAndDisassemblyLine(exe_ctx, sc, sl);
};
//------------------------------------------------------------------
// Classes that inherit from Disassembler can see and modify these
//------------------------------------------------------------------
ArchSpec m_arch;
InstructionList m_instruction_list;
lldb::addr_t m_base_addr;
std::string m_flavor;
private:
//------------------------------------------------------------------
// For Disassembler only
//------------------------------------------------------------------
DISALLOW_COPY_AND_ASSIGN(Disassembler);
};

View File

@ -20,7 +20,6 @@ class DataExtractor;
class ExecutionContextScope;
class Stream;
//------------------------------------------------------------------
/// Dumps \a item_count objects into the stream \a s.
///
/// Dumps \a item_count objects using \a item_format, each of which
@ -79,7 +78,6 @@ class Stream;
///
/// \return
/// The offset at which dumping ended.
//------------------------------------------------------------------
lldb::offset_t
DumpDataExtractor(const DataExtractor &DE, Stream *s, lldb::offset_t offset,
lldb::Format item_format, size_t item_byte_size,

View File

@ -44,7 +44,6 @@ class UnwindPlan;
namespace lldb_private {
//----------------------------------------------------------------------
/// \class EmulateInstruction EmulateInstruction.h
/// "lldb/Core/EmulateInstruction.h"
/// A class that allows emulation of CPU opcodes.
@ -102,7 +101,6 @@ namespace lldb_private {
/// paths in a debugger (single step prediction, finding save restore
/// locations of registers for unwinding stack frame variables) and emulating
/// the instruction is just a bonus.
//----------------------------------------------------------------------
class EmulateInstruction : public PluginInterface {
public:
@ -367,9 +365,7 @@ public:
~EmulateInstruction() override = default;
//----------------------------------------------------------------------
// Mandatory overrides
//----------------------------------------------------------------------
virtual bool
SupportsEmulatingInstructionsOfType(InstructionType inst_type) = 0;
@ -389,9 +385,7 @@ public:
virtual bool GetRegisterInfo(lldb::RegisterKind reg_kind, uint32_t reg_num,
RegisterInfo &reg_info) = 0;
//----------------------------------------------------------------------
// Optional overrides
//----------------------------------------------------------------------
virtual bool SetInstruction(const Opcode &insn_opcode,
const Address &inst_addr, Target *target);
@ -400,9 +394,7 @@ public:
static const char *TranslateRegister(lldb::RegisterKind reg_kind,
uint32_t reg_num, std::string &reg_name);
//----------------------------------------------------------------------
// RegisterInfo variants
//----------------------------------------------------------------------
bool ReadRegister(const RegisterInfo *reg_info, RegisterValue &reg_value);
uint64_t ReadRegisterUnsigned(const RegisterInfo *reg_info,
@ -414,9 +406,7 @@ public:
bool WriteRegisterUnsigned(const Context &context,
const RegisterInfo *reg_info, uint64_t reg_value);
//----------------------------------------------------------------------
// Register kind and number variants
//----------------------------------------------------------------------
bool ReadRegister(lldb::RegisterKind reg_kind, uint32_t reg_num,
RegisterValue &reg_value);
@ -520,9 +510,7 @@ protected:
Opcode m_opcode;
private:
//------------------------------------------------------------------
// For EmulateInstruction only
//------------------------------------------------------------------
DISALLOW_COPY_AND_ASSIGN(EmulateInstruction);
};

View File

@ -25,11 +25,9 @@ class Stream;
namespace lldb_private {
//----------------------------------------------------------------------
/// \class FileLineResolver FileLineResolver.h "lldb/Core/FileLineResolver.h"
/// This class finds address for source file and line. Optionally, it will
/// look for inlined instances of the file and line specification.
//----------------------------------------------------------------------
class FileLineResolver : public Searcher {
public:

View File

@ -22,19 +22,15 @@ class Stream;
namespace lldb_private {
//----------------------------------------------------------------------
/// \class FileSpecList FileSpecList.h "lldb/Core/FileSpecList.h"
/// A file collection class.
///
/// A class that contains a mutable list of FileSpec objects.
//----------------------------------------------------------------------
class FileSpecList {
public:
//------------------------------------------------------------------
/// Default constructor.
///
/// Initialize this object with an empty file list.
//------------------------------------------------------------------
FileSpecList();
/// Copy constructor.
@ -46,12 +42,9 @@ public:
/// Initialize this object from a vector of FileSpecs
FileSpecList(std::vector<FileSpec> &&rhs) : m_files(std::move(rhs)) {}
//------------------------------------------------------------------
/// Destructor.
//------------------------------------------------------------------
~FileSpecList();
//------------------------------------------------------------------
/// Assignment operator.
///
/// Replace the file list in this object with the file list from \a rhs.
@ -61,23 +54,19 @@ public:
///
/// \return
/// A const reference to this object.
//------------------------------------------------------------------
FileSpecList &operator=(const FileSpecList &rhs) = default;
/// Move-assignment operator.
FileSpecList &operator=(FileSpecList &&rhs) = default;
//------------------------------------------------------------------
/// Append a FileSpec object to the list.
///
/// Appends \a file to the end of the file list.
///
/// \param[in] file
/// A new file to append to this file list.
//------------------------------------------------------------------
void Append(const FileSpec &file);
//------------------------------------------------------------------
/// Append a FileSpec object if unique.
///
/// Appends \a file to the end of the file list if it doesn't already exist
@ -88,23 +77,17 @@ public:
///
/// \return
/// \b true if the file was appended, \b false otherwise.
//------------------------------------------------------------------
bool AppendIfUnique(const FileSpec &file);
//------------------------------------------------------------------
/// Clears the file list.
//------------------------------------------------------------------
void Clear();
//------------------------------------------------------------------
/// Dumps the file list to the supplied stream pointer "s".
///
/// \param[in] s
/// The stream that will be used to dump the object description.
//------------------------------------------------------------------
void Dump(Stream *s, const char *separator_cstr = "\n") const;
//------------------------------------------------------------------
/// Find a file index.
///
/// Find the index of the file in the file spec list that matches \a file
@ -122,10 +105,8 @@ public:
/// \return
/// The index of the file that matches \a file if it is found,
/// else UINT32_MAX is returned.
//------------------------------------------------------------------
size_t FindFileIndex(size_t idx, const FileSpec &file, bool full) const;
//------------------------------------------------------------------
/// Get file at index.
///
/// Gets a file from the file list. If \a idx is not a valid index, an empty
@ -139,10 +120,8 @@ public:
/// A copy of the FileSpec object at index \a idx. If \a idx
/// is out of range, then an empty FileSpec object will be
/// returned.
//------------------------------------------------------------------
const FileSpec &GetFileSpecAtIndex(size_t idx) const;
//------------------------------------------------------------------
/// Get file specification pointer at index.
///
/// Gets a file from the file list. The file objects that are returned can
@ -154,10 +133,8 @@ public:
/// \return
/// A pointer to a contained FileSpec object at index \a idx.
/// If \a idx is out of range, then an NULL is returned.
//------------------------------------------------------------------
const FileSpec *GetFileSpecPointerAtIndex(size_t idx) const;
//------------------------------------------------------------------
/// Get the memory cost of this object.
///
/// Return the size in bytes that this object takes in memory. This returns
@ -168,17 +145,14 @@ public:
/// The number of bytes that this object occupies in memory.
///
/// \see ConstString::StaticMemorySize ()
//------------------------------------------------------------------
size_t MemorySize() const;
bool IsEmpty() const { return m_files.empty(); }
//------------------------------------------------------------------
/// Get the number of files in the file list.
///
/// \return
/// The number of files in the file spec list.
//------------------------------------------------------------------
size_t GetSize() const;
bool Insert(size_t idx, const FileSpec &file) {

View File

@ -215,14 +215,12 @@ public:
static size_t AutoComplete(lldb_private::CompletionRequest &request);
//----------------------------------------------------------------------
// 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);

View File

@ -18,17 +18,13 @@
namespace lldb_private {
//----------------------------------------------------------------------
/// Represents style that the highlighter should apply to the given source code.
/// Stores information about how every kind of token should be annotated.
//----------------------------------------------------------------------
struct HighlightStyle {
//----------------------------------------------------------------------
/// A pair of strings that should be placed around a certain token. Usually
/// stores color codes in these strings (the suffix string is often used for
/// resetting the terminal attributes back to normal).
//----------------------------------------------------------------------
class ColorStyle {
std::string m_prefix;
std::string m_suffix;
@ -83,9 +79,7 @@ struct HighlightStyle {
/// Matches '(' or ')'
ColorStyle parentheses;
//-----------------------------------------------------------------------
// C language specific options
//-----------------------------------------------------------------------
/// Matches directives to a preprocessor (if the language has any).
ColorStyle pp_directive;
@ -94,9 +88,7 @@ struct HighlightStyle {
static HighlightStyle MakeVimStyle();
};
//----------------------------------------------------------------------
/// Annotates source code with color attributes.
//----------------------------------------------------------------------
class Highlighter {
public:
Highlighter() = default;

View File

@ -138,23 +138,19 @@ public:
const Flags &GetFlags() const { return m_flags; }
//------------------------------------------------------------------
/// Check if the input is being supplied interactively by a user
///
/// This will return true if the input stream is a terminal (tty or
/// pty) and can cause IO handlers to do different things (like
/// for a confirmation when deleting all breakpoints).
//------------------------------------------------------------------
bool GetIsInteractive();
//------------------------------------------------------------------
/// Check if the input is coming from a real terminal.
///
/// A real terminal has a valid size with a certain number of rows
/// and columns. If this function returns true, then terminal escape
/// sequences are expected to work (cursor movement escape sequences,
/// clearing lines, etc).
//------------------------------------------------------------------
bool GetIsRealTerminal();
void SetPopped(bool b);
@ -183,14 +179,12 @@ private:
DISALLOW_COPY_AND_ASSIGN(IOHandler);
};
//------------------------------------------------------------------
/// A delegate class for use with IOHandler subclasses.
///
/// The IOHandler delegate is designed to be mixed into classes so
/// they can use an IOHandler subclass to fetch input and notify the
/// object that inherits from this delegate class when a token is
/// received.
//------------------------------------------------------------------
class IOHandlerDelegate {
public:
enum class Completion { None, LLDBCommand, Expression };
@ -211,7 +205,6 @@ public:
virtual const char *IOHandlerGetFixIndentationCharacters() { return nullptr; }
//------------------------------------------------------------------
/// Called when a new line is created or one of an identified set of
/// indentation characters is typed.
///
@ -234,14 +227,12 @@ public:
/// to correct the indentation level. Positive values indicate
/// that spaces should be added, while negative values represent
/// spaces that should be removed.
//------------------------------------------------------------------
virtual int IOHandlerFixIndentation(IOHandler &io_handler,
const StringList &lines,
int cursor_position) {
return 0;
}
//------------------------------------------------------------------
/// Called when a line or lines have been retrieved.
///
/// This function can handle the current line and possibly call
@ -249,14 +240,12 @@ public:
/// "quit" is entered as a command, of when an empty line is
/// received. It is up to the delegate to determine when a line
/// should cause a IOHandler to exit.
//------------------------------------------------------------------
virtual void IOHandlerInputComplete(IOHandler &io_handler,
std::string &data) = 0;
virtual void IOHandlerInputInterrupted(IOHandler &io_handler,
std::string &data) {}
//------------------------------------------------------------------
/// Called to determine whether typing enter after the last line in
/// \a lines should end input. This function will not be called on
/// IOHandler objects that are getting single lines.
@ -271,7 +260,6 @@ public:
/// Return an boolean to indicate whether input is complete,
/// true indicates that no additional input is necessary, while
/// false indicates that more input is required.
//------------------------------------------------------------------
virtual bool IOHandlerIsInputComplete(IOHandler &io_handler,
StringList &lines) {
// Impose no requirements for input to be considered complete. subclasses
@ -287,24 +275,20 @@ public:
virtual const char *IOHandlerGetHelpPrologue() { return nullptr; }
//------------------------------------------------------------------
// Intercept the IOHandler::Interrupt() calls and do something.
//
// Return true if the interrupt was handled, false if the IOHandler should
// continue to try handle the interrupt itself.
//------------------------------------------------------------------
virtual bool IOHandlerInterrupt(IOHandler &io_handler) { return false; }
protected:
Completion m_completion; // Support for common builtin completions
};
//----------------------------------------------------------------------
// IOHandlerDelegateMultiline
//
// A IOHandlerDelegate that handles terminating multi-line input when
// the last line is equal to "end_line" which is specified in the constructor.
//----------------------------------------------------------------------
class IOHandlerDelegateMultiline : public IOHandlerDelegate {
public:
IOHandlerDelegateMultiline(const char *end_line,

View File

@ -22,7 +22,6 @@
namespace lldb_private {
//----------------------------------------------------------------------
/// \class Mangled Mangled.h "lldb/Core/Mangled.h"
/// A class that handles mangled names.
///
@ -33,7 +32,6 @@ namespace lldb_private {
/// class for their mangled names. Uniqued string pools are used for the
/// mangled, demangled, and token string values to allow for faster
/// comparisons and for efficient memory use.
//----------------------------------------------------------------------
class Mangled {
public:
enum NamePreference {
@ -48,14 +46,11 @@ public:
eManglingSchemeItanium
};
//----------------------------------------------------------------------
/// Default constructor.
///
/// Initialize with both mangled and demangled names empty.
//----------------------------------------------------------------------
Mangled();
//----------------------------------------------------------------------
/// Construct with name.
///
/// Constructor with an optional string and a boolean indicating if it is
@ -67,11 +62,9 @@ public:
/// \param[in] is_mangled
/// If \b true then \a name is a mangled name, if \b false then
/// \a name is demangled.
//----------------------------------------------------------------------
Mangled(ConstString name, bool is_mangled);
Mangled(llvm::StringRef name, bool is_mangled);
//----------------------------------------------------------------------
/// Construct with name.
///
/// Constructor with an optional string and auto-detect if \a name is
@ -79,20 +72,16 @@ public:
///
/// \param[in] name
/// The already const name to copy into this object.
//----------------------------------------------------------------------
explicit Mangled(ConstString name);
explicit Mangled(llvm::StringRef name);
//----------------------------------------------------------------------
/// Destructor
///
/// Releases its ref counts on the mangled and demangled strings that live
/// in the global string pool.
//----------------------------------------------------------------------
~Mangled();
//----------------------------------------------------------------------
/// Convert to pointer operator.
///
/// This allows code to check a Mangled object to see if it contains a valid
@ -107,10 +96,8 @@ public:
/// \return
/// A pointer to this object if either the mangled or unmangled
/// name is set, NULL otherwise.
//----------------------------------------------------------------------
operator void *() const;
//----------------------------------------------------------------------
/// Logical NOT operator.
///
/// This allows code to check a Mangled object to see if it contains an
@ -125,15 +112,11 @@ public:
/// \return
/// Returns \b true if the object has an empty mangled and
/// unmangled name, \b false otherwise.
//----------------------------------------------------------------------
bool operator!() const;
//----------------------------------------------------------------------
/// Clear the mangled and demangled values.
//----------------------------------------------------------------------
void Clear();
//----------------------------------------------------------------------
/// Compare the mangled string values
///
/// Compares the Mangled::GetName() string in \a lhs and \a rhs.
@ -148,10 +131,8 @@ public:
/// \li -1 if \a lhs is less than \a rhs
/// \li 0 if \a lhs is equal to \a rhs
/// \li 1 if \a lhs is greater than \a rhs
//----------------------------------------------------------------------
static int Compare(const Mangled &lhs, const Mangled &rhs);
//----------------------------------------------------------------------
/// Dump a description of this object to a Stream \a s.
///
/// Dump a Mangled object to stream \a s. We don't force our demangled name
@ -159,54 +140,42 @@ public:
///
/// \param[in] s
/// The stream to which to dump the object description.
//----------------------------------------------------------------------
void Dump(Stream *s) const;
//----------------------------------------------------------------------
/// Dump a debug description of this object to a Stream \a s.
///
/// \param[in] s
/// The stream to which to dump the object description.
//----------------------------------------------------------------------
void DumpDebug(Stream *s) const;
//----------------------------------------------------------------------
/// Demangled name get accessor.
///
/// \return
/// A const reference to the demangled name string object.
//----------------------------------------------------------------------
ConstString GetDemangledName(lldb::LanguageType language) const;
//----------------------------------------------------------------------
/// Display demangled name get accessor.
///
/// \return
/// A const reference to the display demangled name string object.
//----------------------------------------------------------------------
ConstString GetDisplayDemangledName(lldb::LanguageType language) const;
void SetDemangledName(ConstString name) { m_demangled = name; }
void SetMangledName(ConstString name) { m_mangled = name; }
//----------------------------------------------------------------------
/// Mangled name get accessor.
///
/// \return
/// A reference to the mangled name string object.
//----------------------------------------------------------------------
ConstString &GetMangledName() { return m_mangled; }
//----------------------------------------------------------------------
/// Mangled name get accessor.
///
/// \return
/// A const reference to the mangled name string object.
//----------------------------------------------------------------------
ConstString GetMangledName() const { return m_mangled; }
//----------------------------------------------------------------------
/// Best name get accessor.
///
/// \param[in] preference
@ -216,11 +185,9 @@ public:
/// A const reference to the preferred name string object if this
/// object has a valid name of that kind, else a const reference to the
/// other name is returned.
//----------------------------------------------------------------------
ConstString GetName(lldb::LanguageType language,
NamePreference preference = ePreferDemangled) const;
//----------------------------------------------------------------------
/// Check if "name" matches either the mangled or demangled name.
///
/// \param[in] name
@ -228,7 +195,6 @@ public:
///
/// \return
/// \b True if \a name matches either name, \b false otherwise.
//----------------------------------------------------------------------
bool NameMatches(ConstString name, lldb::LanguageType language) const {
if (m_mangled == name)
return true;
@ -237,7 +203,6 @@ public:
bool NameMatches(const RegularExpression &regex,
lldb::LanguageType language) const;
//----------------------------------------------------------------------
/// Get the memory cost of this object.
///
/// Return the size in bytes that this object takes in memory. This returns
@ -248,10 +213,8 @@ public:
/// The number of bytes that this object occupies in memory.
///
/// \see ConstString::StaticMemorySize ()
//----------------------------------------------------------------------
size_t MemorySize() const;
//----------------------------------------------------------------------
/// Set the string value in this object.
///
/// If \a is_mangled is \b true, then the mangled named is set to \a name,
@ -263,10 +226,8 @@ public:
/// \param[in] is_mangled
/// If \b true then \a name is a mangled name, if \b false then
/// \a name is demangled.
//----------------------------------------------------------------------
void SetValue(ConstString name, bool is_mangled);
//----------------------------------------------------------------------
/// Set the string value in this object.
///
/// This version auto detects if the string is mangled by inspecting the
@ -274,10 +235,8 @@ public:
///
/// \param[in] name
/// The already const version of the name for this object.
//----------------------------------------------------------------------
void SetValue(ConstString name);
//----------------------------------------------------------------------
/// Try to guess the language from the mangling.
///
/// For a mangled name to have a language it must have both a mangled and a
@ -292,13 +251,11 @@ public:
/// \return
/// The language for the mangled/demangled name, eLanguageTypeUnknown
/// if there is no mangled or demangled counterpart.
//----------------------------------------------------------------------
lldb::LanguageType GuessLanguage() const;
/// Function signature for filtering mangled names.
using SkipMangledNameFn = bool(llvm::StringRef, ManglingScheme);
//----------------------------------------------------------------------
/// Trigger explicit demangling to obtain rich mangling information. This is
/// optimized for batch processing while populating a name index. To get the
/// pure demangled name string for a single entity, use GetDemangledName()
@ -321,14 +278,11 @@ public:
///
/// \return
/// True on success, false otherwise.
//----------------------------------------------------------------------
bool DemangleWithRichManglingInfo(RichManglingContext &context,
SkipMangledNameFn *skip_mangled_name);
private:
//----------------------------------------------------------------------
/// Mangled member variables.
//----------------------------------------------------------------------
ConstString m_mangled; ///< The mangled version of the name
mutable ConstString m_demangled; ///< Mutable so we can get it on demand with
///a const version of this object

View File

@ -91,7 +91,6 @@ class VariableList;
namespace lldb_private {
//----------------------------------------------------------------------
/// \class Module Module.h "lldb/Core/Module.h"
/// A class that describes an executable image and its associated
/// object and symbol files.
@ -107,7 +106,6 @@ namespace lldb_private {
/// Module::GetSymbolVendor() is called.
///
/// The module will parse more detailed information as more queries are made.
//----------------------------------------------------------------------
class Module : public std::enable_shared_from_this<Module>,
public SymbolContextScope {
public:
@ -123,7 +121,6 @@ public:
static std::recursive_mutex &GetAllocationModuleCollectionMutex();
//------------------------------------------------------------------
/// Construct with file specification and architecture.
///
/// Clients that wish to share modules with other targets should use
@ -146,7 +143,6 @@ public:
/// The offset within an existing module used to extract a
/// module within a module (.a files and modules that contain
/// multiple architectures).
//------------------------------------------------------------------
Module(
const FileSpec &file_spec, const ArchSpec &arch,
const ConstString *object_name = nullptr,
@ -178,14 +174,11 @@ public:
return module_sp;
}
//------------------------------------------------------------------
/// Destructor.
//------------------------------------------------------------------
~Module() override;
bool MatchesModuleSpec(const ModuleSpec &module_ref);
//------------------------------------------------------------------
/// Set the load address for all sections in a module to be the file address
/// plus \a slide.
///
@ -222,15 +215,12 @@ public:
/// \return
/// /b True if any sections were successfully loaded in \a target,
/// /b false otherwise.
//------------------------------------------------------------------
bool SetLoadAddress(Target &target, lldb::addr_t value, bool value_is_offset,
bool &changed);
//------------------------------------------------------------------
/// \copydoc SymbolContextScope::CalculateSymbolContext(SymbolContext*)
///
/// \see SymbolContextScope
//------------------------------------------------------------------
void CalculateSymbolContext(SymbolContext *sc) override;
lldb::ModuleSP CalculateSymbolContextModule() override;
@ -239,7 +229,6 @@ public:
GetDescription(Stream *s,
lldb::DescriptionLevel level = lldb::eDescriptionLevelFull);
//------------------------------------------------------------------
/// Get the module path and object name.
///
/// Modules can refer to object files. In this case the specification is
@ -257,10 +246,8 @@ public:
///
/// \return
/// The object path + object name if there is one.
//------------------------------------------------------------------
std::string GetSpecificationDescription() const;
//------------------------------------------------------------------
/// Dump a description of this object to a Stream.
///
/// Dump a description of the contents of this object to the supplied stream
@ -270,17 +257,13 @@ public:
///
/// \param[in] s
/// The stream to which to dump the object description.
//------------------------------------------------------------------
void Dump(Stream *s);
//------------------------------------------------------------------
/// \copydoc SymbolContextScope::DumpSymbolContext(Stream*)
///
/// \see SymbolContextScope
//------------------------------------------------------------------
void DumpSymbolContext(Stream *s) override;
//------------------------------------------------------------------
/// Find a symbol in the object file's symbol table.
///
/// \param[in] name
@ -295,7 +278,6 @@ public:
/// \return
/// Returns a valid symbol pointer if a symbol was found,
/// nullptr otherwise.
//------------------------------------------------------------------
const Symbol *FindFirstSymbolWithNameAndType(
ConstString name,
lldb::SymbolType symbol_type = lldb::eSymbolTypeAny);
@ -308,7 +290,6 @@ public:
lldb::SymbolType symbol_type,
SymbolContextList &sc_list);
//------------------------------------------------------------------
/// Find a function symbols in the object file's symbol table.
///
/// \param[in] name
@ -324,11 +305,9 @@ public:
///
/// \return
/// The number of symbol contexts that were added to \a sc_list
//------------------------------------------------------------------
size_t FindFunctionSymbols(ConstString name, uint32_t name_type_mask,
SymbolContextList &sc_list);
//------------------------------------------------------------------
/// Find compile units by partial or full path.
///
/// Finds all compile units that match \a path in all of the modules and
@ -348,11 +327,9 @@ public:
///
/// \return
/// The number of matches added to \a sc_list.
//------------------------------------------------------------------
size_t FindCompileUnits(const FileSpec &path, bool append,
SymbolContextList &sc_list);
//------------------------------------------------------------------
/// Find functions by name.
///
/// If the function is an inlined function, it will have a block,
@ -381,14 +358,12 @@ public:
///
/// \return
/// The number of matches added to \a sc_list.
//------------------------------------------------------------------
size_t FindFunctions(ConstString name,
const CompilerDeclContext *parent_decl_ctx,
lldb::FunctionNameType name_type_mask, bool symbols_ok,
bool inlines_ok, bool append,
SymbolContextList &sc_list);
//------------------------------------------------------------------
/// Find functions by name.
///
/// If the function is an inlined function, it will have a block,
@ -408,12 +383,10 @@ public:
///
/// \return
/// The number of matches added to \a sc_list.
//------------------------------------------------------------------
size_t FindFunctions(const RegularExpression &regex, bool symbols_ok,
bool inlines_ok, bool append,
SymbolContextList &sc_list);
//------------------------------------------------------------------
/// Find addresses by file/line
///
/// \param[in] target_sp
@ -441,7 +414,6 @@ public:
std::vector<Address> &output_local,
std::vector<Address> &output_extern);
//------------------------------------------------------------------
/// Find global and static variables by name.
///
/// \param[in] name
@ -460,12 +432,10 @@ public:
///
/// \return
/// The number of matches added to \a variable_list.
//------------------------------------------------------------------
size_t FindGlobalVariables(ConstString name,
const CompilerDeclContext *parent_decl_ctx,
size_t max_matches, VariableList &variable_list);
//------------------------------------------------------------------
/// Find global and static variables by regular expression.
///
/// \param[in] regex
@ -480,11 +450,9 @@ public:
///
/// \return
/// The number of matches added to \a variable_list.
//------------------------------------------------------------------
size_t FindGlobalVariables(const RegularExpression &regex, size_t max_matches,
VariableList &variable_list);
//------------------------------------------------------------------
/// Find types by name.
///
/// Type lookups in modules go through the SymbolVendor (which will use one
@ -518,7 +486,6 @@ public:
///
/// \return
/// The number of matches added to \a type_list.
//------------------------------------------------------------------
size_t
FindTypes(ConstString type_name, bool exact_match, size_t max_matches,
llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files,
@ -527,7 +494,6 @@ public:
lldb::TypeSP FindFirstType(const SymbolContext &sc,
ConstString type_name, bool exact_match);
//------------------------------------------------------------------
/// Find types by name that are in a namespace. This function is used by the
/// expression parser when searches need to happen in an exact namespace
/// scope.
@ -544,20 +510,16 @@ public:
///
/// \return
/// The number of matches added to \a type_list.
//------------------------------------------------------------------
size_t FindTypesInNamespace(ConstString type_name,
const CompilerDeclContext *parent_decl_ctx,
size_t max_matches, TypeList &type_list);
//------------------------------------------------------------------
/// Get const accessor for the module architecture.
///
/// \return
/// A const reference to the architecture object.
//------------------------------------------------------------------
const ArchSpec &GetArchitecture() const;
//------------------------------------------------------------------
/// Get const accessor for the module file specification.
///
/// This function returns the file for the module on the host system that is
@ -566,10 +528,8 @@ public:
///
/// \return
/// A const reference to the file specification object.
//------------------------------------------------------------------
const FileSpec &GetFileSpec() const { return m_file; }
//------------------------------------------------------------------
/// Get accessor for the module platform file specification.
///
/// Platform file refers to the path of the module as it is known on the
@ -582,7 +542,6 @@ public:
///
/// \return
/// A const reference to the file specification object.
//------------------------------------------------------------------
const FileSpec &GetPlatformFileSpec() const {
if (m_platform_file)
return m_platform_file;
@ -617,16 +576,13 @@ public:
m_mod_time = mod_time;
}
//------------------------------------------------------------------
/// Tells whether this module is capable of being the main executable for a
/// process.
///
/// \return
/// \b true if it is, \b false otherwise.
//------------------------------------------------------------------
bool IsExecutable();
//------------------------------------------------------------------
/// Tells whether this module has been loaded in the target passed in. This
/// call doesn't distinguish between whether the module is loaded by the
/// dynamic loader, or by a "target module add" type call.
@ -636,19 +592,16 @@ public:
///
/// \return
/// \b true if it is, \b false otherwise.
//------------------------------------------------------------------
bool IsLoadedInTarget(Target *target);
bool LoadScriptingResourceInTarget(Target *target, Status &error,
Stream *feedback_stream = nullptr);
//------------------------------------------------------------------
/// Get the number of compile units for this module.
///
/// \return
/// The number of compile units that the symbol vendor plug-in
/// finds.
//------------------------------------------------------------------
size_t GetNumCompileUnits();
lldb::CompUnitSP GetCompileUnitAtIndex(size_t idx);
@ -657,7 +610,6 @@ public:
uint64_t GetObjectOffset() const { return m_object_offset; }
//------------------------------------------------------------------
/// Get the object file representation for the current architecture.
///
/// If the object file has not been located or parsed yet, this function
@ -670,10 +622,8 @@ public:
/// returned, else a valid object file interface will be
/// returned. The returned pointer is owned by this object and
/// remains valid as long as the object is around.
//------------------------------------------------------------------
virtual ObjectFile *GetObjectFile();
//------------------------------------------------------------------
/// Get the unified section list for the module. This is the section list
/// created by the module's object file and any debug info and symbol files
/// created by the symbol vendor.
@ -683,10 +633,8 @@ public:
///
/// \return
/// Unified module section list.
//------------------------------------------------------------------
virtual SectionList *GetSectionList();
//------------------------------------------------------------------
/// Notify the module that the file addresses for the Sections have been
/// updated.
///
@ -694,10 +642,8 @@ public:
/// should be called. Any parts of the module, object file, or symbol file
/// that has cached those file addresses must invalidate or update its
/// cache.
//------------------------------------------------------------------
virtual void SectionFileAddressesChanged();
//------------------------------------------------------------------
/// Returns a reference to the UnwindTable for this Module
///
/// The UnwindTable contains FuncUnwinders objects for any function in this
@ -709,12 +655,10 @@ public:
/// \return
/// Returns the unwind table for this module. If this object has no
/// associated object file, an empty UnwindTable is returned.
//------------------------------------------------------------------
UnwindTable &GetUnwindTable();
llvm::VersionTuple GetVersion();
//------------------------------------------------------------------
/// Load an object file from memory.
///
/// If available, the size of the object file in memory may be passed to
@ -726,11 +670,9 @@ public:
/// \return
/// The object file loaded from memory or nullptr, if the operation
/// failed (see the `error` for more information in that case).
//------------------------------------------------------------------
ObjectFile *GetMemoryObjectFile(const lldb::ProcessSP &process_sp,
lldb::addr_t header_addr, Status &error,
size_t size_to_read = 512);
//------------------------------------------------------------------
/// Get the symbol vendor interface for the current architecture.
///
/// If the symbol vendor file has not been located yet, this function will
@ -742,21 +684,17 @@ public:
/// be returned, else a valid symbol vendor plug-in interface
/// will be returned. The returned pointer is owned by this
/// object and remains valid as long as the object is around.
//------------------------------------------------------------------
virtual SymbolVendor *
GetSymbolVendor(bool can_create = true,
lldb_private::Stream *feedback_strm = nullptr);
//------------------------------------------------------------------
/// Get accessor the type list for this module.
///
/// \return
/// A valid type list pointer, or nullptr if there is no valid
/// symbol vendor for this module.
//------------------------------------------------------------------
TypeList *GetTypeList();
//------------------------------------------------------------------
/// Get a reference to the UUID value contained in this object.
///
/// If the executable image file doesn't not have a UUID value built into
@ -767,10 +705,8 @@ public:
/// A const pointer to the internal copy of the UUID value in
/// this module if this module has a valid UUID value, NULL
/// otherwise.
//------------------------------------------------------------------
const lldb_private::UUID &GetUUID();
//------------------------------------------------------------------
/// A debugging function that will cause everything in a module to
/// be parsed.
///
@ -781,12 +717,10 @@ public:
/// complete list of the resulting debug information that gets parsed, or as
/// a debug function to ensure that the module can consume all of the debug
/// data the symbol vendor provides.
//------------------------------------------------------------------
void ParseAllDebugSymbols();
bool ResolveFileAddress(lldb::addr_t vm_addr, Address &so_addr);
//------------------------------------------------------------------
/// Resolve the symbol context for the given address.
///
/// Tries to resolve the matching symbol context based on a lookup from the
@ -824,12 +758,10 @@ public:
/// The scope that has been resolved (see SymbolContext::Scope).
///
/// \see SymbolContext::Scope
//------------------------------------------------------------------
uint32_t ResolveSymbolContextForAddress(
const Address &so_addr, lldb::SymbolContextItem resolve_scope,
SymbolContext &sc, bool resolve_tail_call_address = false);
//------------------------------------------------------------------
/// Resolve items in the symbol context for a given file and line.
///
/// Tries to resolve \a file_path and \a line to a list of matching symbol
@ -869,12 +801,10 @@ public:
/// The number of matches that were added to \a sc_list.
///
/// \see SymbolContext::Scope
//------------------------------------------------------------------
uint32_t ResolveSymbolContextForFilePath(
const char *file_path, uint32_t line, bool check_inlines,
lldb::SymbolContextItem resolve_scope, SymbolContextList &sc_list);
//------------------------------------------------------------------
/// Resolve items in the symbol context for a given file and line.
///
/// Tries to resolve \a file_spec and \a line to a list of matching symbol
@ -915,7 +845,6 @@ public:
/// each item that was successfully resolved.
///
/// \see SymbolContext::Scope
//------------------------------------------------------------------
uint32_t ResolveSymbolContextsForFileSpec(
const FileSpec &file_spec, uint32_t line, bool check_inlines,
lldb::SymbolContextItem resolve_scope, SymbolContextList &sc_list);
@ -949,17 +878,13 @@ public:
void ReportErrorIfModifyDetected(const char *format, ...)
__attribute__((format(printf, 2, 3)));
//------------------------------------------------------------------
// Return true if the file backing this module has changed since the module
// was originally created since we saved the initial file modification time
// when the module first gets created.
//------------------------------------------------------------------
bool FileHasChanged() const;
//------------------------------------------------------------------
// SymbolVendor, SymbolFile and ObjectFile member objects should lock the
// module mutex to avoid deadlocks.
//------------------------------------------------------------------
std::recursive_mutex &GetMutex() const { return m_mutex; }
PathMappingList &GetSourceMappingList() { return m_source_mappings; }
@ -968,7 +893,6 @@ public:
return m_source_mappings;
}
//------------------------------------------------------------------
/// Finds a source file given a file spec using the module source path
/// remappings (if any).
///
@ -987,10 +911,8 @@ public:
/// /b true if \a orig_spec was successfully located and
/// \a new_spec is filled in with an existing file spec,
/// \b false otherwise.
//------------------------------------------------------------------
bool FindSourceFile(const FileSpec &orig_spec, FileSpec &new_spec) const;
//------------------------------------------------------------------
/// Remaps a source file given \a path into \a new_path.
///
/// Remaps \a path if any source remappings match. This function does NOT
@ -1006,11 +928,9 @@ public:
/// \return
/// /b true if \a path was successfully located and \a new_path
/// is filled in with a new source path, \b false otherwise.
//------------------------------------------------------------------
bool RemapSourceFile(llvm::StringRef path, std::string &new_path) const;
bool RemapSourceFile(const char *, std::string &) const = delete;
//----------------------------------------------------------------------
/// \class LookupInfo Module.h "lldb/Core/Module.h"
/// A class that encapsulates name lookup information.
///
@ -1032,7 +952,6 @@ public:
/// Function lookups are done in Module.cpp, ModuleList.cpp and in
/// BreakpointResolverName.cpp and they all now use this class to do lookups
/// correctly.
//----------------------------------------------------------------------
class LookupInfo {
public:
LookupInfo()
@ -1079,9 +998,7 @@ public:
};
protected:
//------------------------------------------------------------------
// Member Variables
//------------------------------------------------------------------
mutable std::recursive_mutex m_mutex; ///< A mutex to keep this object happy
///in multi-threaded environments.
@ -1136,7 +1053,6 @@ protected:
m_first_file_changed_log : 1; /// See if the module was modified after it
/// was initially opened.
//------------------------------------------------------------------
/// Resolve a file or load virtual address.
///
/// Tries to resolve \a vm_addr as a file address (if \a
@ -1169,7 +1085,6 @@ protected:
/// each item that was successfully resolved.
///
/// \see SymbolContext::Scope
//------------------------------------------------------------------
uint32_t ResolveSymbolContextForAddress(lldb::addr_t vm_addr,
bool vm_addr_is_file_addr,
lldb::SymbolContextItem resolve_scope,

View File

@ -13,36 +13,27 @@
namespace lldb_private {
//----------------------------------------------------------------------
/// \class ModuleChild ModuleChild.h "lldb/Core/ModuleChild.h"
/// A mix in class that contains a pointer back to the module
/// that owns the object which inherits from it.
//----------------------------------------------------------------------
class ModuleChild {
public:
//------------------------------------------------------------------
/// Construct with owning module.
///
/// \param[in] module
/// The module that owns the object that inherits from this
/// class.
//------------------------------------------------------------------
ModuleChild(const lldb::ModuleSP &module_sp);
//------------------------------------------------------------------
/// Copy constructor.
///
/// \param[in] rhs
/// A const ModuleChild class reference to copy.
//------------------------------------------------------------------
ModuleChild(const ModuleChild &rhs);
//------------------------------------------------------------------
/// Destructor.
//------------------------------------------------------------------
~ModuleChild();
//------------------------------------------------------------------
/// Assignment operator.
///
/// \param[in] rhs
@ -50,31 +41,24 @@ public:
///
/// \return
/// A const reference to this object.
//------------------------------------------------------------------
const ModuleChild &operator=(const ModuleChild &rhs);
//------------------------------------------------------------------
/// Get const accessor for the module pointer.
///
/// \return
/// A const pointer to the module that owns the object that
/// inherits from this class.
//------------------------------------------------------------------
lldb::ModuleSP GetModule() const;
//------------------------------------------------------------------
/// Set accessor for the module pointer.
///
/// \param[in] module
/// A new module that owns the object that inherits from this
/// class.
//------------------------------------------------------------------
void SetModule(const lldb::ModuleSP &module_sp);
protected:
//------------------------------------------------------------------
// Member variables
//------------------------------------------------------------------
lldb::ModuleWP m_module_wp; ///< The Module that owns the object that inherits
///< from this class.
};

View File

@ -83,13 +83,11 @@ public:
bool GetEnableExternalLookup() const;
};
//----------------------------------------------------------------------
/// \class ModuleList ModuleList.h "lldb/Core/ModuleList.h"
/// A collection class for Module objects.
///
/// Modules in the module collection class are stored as reference counted
/// shared pointers to Module objects.
//----------------------------------------------------------------------
class ModuleList {
public:
class Notifier {
@ -108,31 +106,24 @@ public:
virtual void NotifyModulesRemoved(lldb_private::ModuleList &module_list) = 0;
};
//------------------------------------------------------------------
/// Default constructor.
///
/// Creates an empty list of Module objects.
//------------------------------------------------------------------
ModuleList();
//------------------------------------------------------------------
/// Copy Constructor.
///
/// Creates a new module list object with a copy of the modules from \a rhs.
///
/// \param[in] rhs
/// Another module list object.
//------------------------------------------------------------------
ModuleList(const ModuleList &rhs);
ModuleList(ModuleList::Notifier *notifier);
//------------------------------------------------------------------
/// Destructor.
//------------------------------------------------------------------
~ModuleList();
//------------------------------------------------------------------
/// Assignment operator.
///
/// Copies the module list from \a rhs into this list.
@ -142,10 +133,8 @@ public:
///
/// \return
/// A const reference to this object.
//------------------------------------------------------------------
const ModuleList &operator=(const ModuleList &rhs);
//------------------------------------------------------------------
/// Append a module to the module list.
///
/// \param[in] module_sp
@ -160,10 +149,8 @@ public:
/// ModulesDidLoad may be deferred when adding multiple Modules
/// to the Target, but it must be called at the end,
/// before resuming execution.
//------------------------------------------------------------------
void Append(const lldb::ModuleSP &module_sp, bool notify = true);
//------------------------------------------------------------------
/// Append a module to the module list and remove any equivalent modules.
/// Equivalent modules are ones whose file, platform file and architecture
/// matches.
@ -172,10 +159,8 @@ public:
///
/// \param[in] module_sp
/// A shared pointer to a module to replace in this collection.
//------------------------------------------------------------------
void ReplaceEquivalent(const lldb::ModuleSP &module_sp);
//------------------------------------------------------------------
/// Append a module to the module list, if it is not already there.
///
/// \param[in] module_sp
@ -189,7 +174,6 @@ public:
/// ModulesDidLoad may be deferred when adding multiple Modules
/// to the Target, but it must be called at the end,
/// before resuming execution.
//------------------------------------------------------------------
bool AppendIfNeeded(const lldb::ModuleSP &module_sp, bool notify = true);
void Append(const ModuleList &module_list);
@ -199,26 +183,21 @@ public:
bool ReplaceModule(const lldb::ModuleSP &old_module_sp,
const lldb::ModuleSP &new_module_sp);
//------------------------------------------------------------------
/// Clear the object's state.
///
/// Clears the list of modules and releases a reference to each module
/// object and if the reference count goes to zero, the module will be
/// deleted.
//------------------------------------------------------------------
void Clear();
//------------------------------------------------------------------
/// Clear the object's state.
///
/// Clears the list of modules and releases a reference to each module
/// object and if the reference count goes to zero, the module will be
/// deleted. Also release all memory that might be held by any collection
/// classes (like std::vector)
//------------------------------------------------------------------
void Destroy();
//------------------------------------------------------------------
/// Dump the description of each module contained in this list.
///
/// Dump the description of each module contained in this list to the
@ -228,7 +207,6 @@ public:
/// The stream to which to dump the object description.
///
/// \see Module::Dump(Stream *) const
//------------------------------------------------------------------
void Dump(Stream *s) const;
void LogUUIDAndPaths(Log *log, const char *prefix_cstr);
@ -237,7 +215,6 @@ public:
size_t GetIndexForModule(const Module *module) const;
//------------------------------------------------------------------
/// Get the module shared pointer for the module at index \a idx.
///
/// \param[in] idx
@ -248,10 +225,8 @@ public:
/// \a idx is out of range.
///
/// \see ModuleList::GetSize()
//------------------------------------------------------------------
lldb::ModuleSP GetModuleAtIndex(size_t idx) const;
//------------------------------------------------------------------
/// Get the module shared pointer for the module at index \a idx without
/// acquiring the ModuleList mutex. This MUST already have been acquired
/// with ModuleList::GetMutex and locked for this call to be safe.
@ -264,10 +239,8 @@ public:
/// \a idx is out of range.
///
/// \see ModuleList::GetSize()
//------------------------------------------------------------------
lldb::ModuleSP GetModuleAtIndexUnlocked(size_t idx) const;
//------------------------------------------------------------------
/// Get the module pointer for the module at index \a idx.
///
/// \param[in] idx
@ -278,10 +251,8 @@ public:
/// of range.
///
/// \see ModuleList::GetSize()
//------------------------------------------------------------------
Module *GetModulePointerAtIndex(size_t idx) const;
//------------------------------------------------------------------
/// Get the module pointer for the module at index \a idx without acquiring
/// the ModuleList mutex. This MUST already have been acquired with
/// ModuleList::GetMutex and locked for this call to be safe.
@ -294,10 +265,8 @@ public:
/// of range.
///
/// \see ModuleList::GetSize()
//------------------------------------------------------------------
Module *GetModulePointerAtIndexUnlocked(size_t idx) const;
//------------------------------------------------------------------
/// Find compile units by partial or full path.
///
/// Finds all compile units that match \a path in all of the modules and
@ -317,33 +286,25 @@ public:
///
/// \return
/// The number of matches added to \a sc_list.
//------------------------------------------------------------------
size_t FindCompileUnits(const FileSpec &path, bool append,
SymbolContextList &sc_list) const;
//------------------------------------------------------------------
/// \see Module::FindFunctions ()
//------------------------------------------------------------------
size_t FindFunctions(ConstString name,
lldb::FunctionNameType name_type_mask,
bool include_symbols, bool include_inlines, bool append,
SymbolContextList &sc_list) const;
//------------------------------------------------------------------
/// \see Module::FindFunctionSymbols ()
//------------------------------------------------------------------
size_t FindFunctionSymbols(ConstString name,
lldb::FunctionNameType name_type_mask,
SymbolContextList &sc_list);
//------------------------------------------------------------------
/// \see Module::FindFunctions ()
//------------------------------------------------------------------
size_t FindFunctions(const RegularExpression &name, bool include_symbols,
bool include_inlines, bool append,
SymbolContextList &sc_list);
//------------------------------------------------------------------
/// Find global and static variables by name.
///
/// \param[in] name
@ -359,11 +320,9 @@ public:
///
/// \return
/// The number of matches added to \a variable_list.
//------------------------------------------------------------------
size_t FindGlobalVariables(ConstString name, size_t max_matches,
VariableList &variable_list) const;
//------------------------------------------------------------------
/// Find global and static variables by regular expression.
///
/// \param[in] regex
@ -378,11 +337,9 @@ public:
///
/// \return
/// The number of matches added to \a variable_list.
//------------------------------------------------------------------
size_t FindGlobalVariables(const RegularExpression &regex, size_t max_matches,
VariableList &variable_list) const;
//------------------------------------------------------------------
/// Finds the first module whose file specification matches \a file_spec.
///
/// \param[in] file_spec_ptr
@ -411,19 +368,16 @@ public:
///
/// \return
/// The number of matching modules found by the search.
//------------------------------------------------------------------
size_t FindModules(const ModuleSpec &module_spec,
ModuleList &matching_module_list) const;
lldb::ModuleSP FindModule(const Module *module_ptr) const;
//------------------------------------------------------------------
// Find a module by UUID
//
// The UUID value for a module is extracted from the ObjectFile and is the
// MD5 checksum, or a smarter object file equivalent, so finding modules by
// UUID values is very efficient and accurate.
//------------------------------------------------------------------
lldb::ModuleSP FindModule(const UUID &uuid) const;
lldb::ModuleSP FindFirstModule(const ModuleSpec &module_spec) const;
@ -438,7 +392,6 @@ public:
SymbolContextList &sc_list,
bool append = false) const;
//------------------------------------------------------------------
/// Find types by name.
///
/// \param[in] search_first
@ -470,7 +423,6 @@ public:
///
/// \return
/// The number of matches added to \a type_list.
//------------------------------------------------------------------
size_t FindTypes(Module *search_first, ConstString name,
bool name_is_fully_qualified, size_t max_matches,
llvm::DenseSet<SymbolFile *> &searched_symbol_files,
@ -478,7 +430,6 @@ public:
bool FindSourceFile(const FileSpec &orig_spec, FileSpec &new_spec) const;
//------------------------------------------------------------------
/// Find addresses by file/line
///
/// \param[in] target_sp
@ -506,7 +457,6 @@ public:
std::vector<Address> &output_local,
std::vector<Address> &output_extern);
//------------------------------------------------------------------
/// Remove a module from the module list.
///
/// \param[in] module_sp
@ -521,7 +471,6 @@ public:
/// ModulesDidUnload may be deferred when removing multiple Modules
/// from the Target, but it must be called at the end,
/// before resuming execution.
//------------------------------------------------------------------
bool Remove(const lldb::ModuleSP &module_sp, bool notify = true);
size_t Remove(ModuleList &module_list);
@ -532,36 +481,28 @@ public:
bool ResolveFileAddress(lldb::addr_t vm_addr, Address &so_addr) const;
//------------------------------------------------------------------
/// \copydoc Module::ResolveSymbolContextForAddress (const Address
/// &,uint32_t,SymbolContext&)
//------------------------------------------------------------------
uint32_t ResolveSymbolContextForAddress(const Address &so_addr,
lldb::SymbolContextItem resolve_scope,
SymbolContext &sc) const;
//------------------------------------------------------------------
/// \copydoc Module::ResolveSymbolContextForFilePath (const char
/// *,uint32_t,bool,uint32_t,SymbolContextList&)
//------------------------------------------------------------------
uint32_t ResolveSymbolContextForFilePath(
const char *file_path, uint32_t line, bool check_inlines,
lldb::SymbolContextItem resolve_scope, SymbolContextList &sc_list) const;
//------------------------------------------------------------------
/// \copydoc Module::ResolveSymbolContextsForFileSpec (const FileSpec
/// &,uint32_t,bool,uint32_t,SymbolContextList&)
//------------------------------------------------------------------
uint32_t ResolveSymbolContextsForFileSpec(
const FileSpec &file_spec, uint32_t line, bool check_inlines,
lldb::SymbolContextItem resolve_scope, SymbolContextList &sc_list) const;
//------------------------------------------------------------------
/// Gets the size of the module list.
///
/// \return
/// The number of modules in the module list.
//------------------------------------------------------------------
size_t GetSize() const;
bool LoadScriptingResourcesInTarget(Target *target, std::list<Status> &errors,
@ -592,9 +533,7 @@ public:
&callback) const;
protected:
//------------------------------------------------------------------
// Class typedefs.
//------------------------------------------------------------------
typedef std::vector<lldb::ModuleSP>
collection; ///< The module collection type.
@ -607,9 +546,7 @@ protected:
void ClearImpl(bool use_notifier = true);
//------------------------------------------------------------------
// Member variables.
//------------------------------------------------------------------
collection m_modules; ///< The collection of modules.
mutable std::recursive_mutex m_modules_mutex;

View File

@ -40,9 +40,7 @@ public:
static void Terminate();
//------------------------------------------------------------------
// ABI
//------------------------------------------------------------------
static bool RegisterPlugin(ConstString name, const char *description,
ABICreateInstance create_callback);
@ -53,9 +51,7 @@ public:
static ABICreateInstance
GetABICreateCallbackForPluginName(ConstString name);
//------------------------------------------------------------------
// Architecture
//------------------------------------------------------------------
using ArchitectureCreateInstance =
std::unique_ptr<Architecture> (*)(const ArchSpec &);
@ -68,9 +64,7 @@ public:
static std::unique_ptr<Architecture>
CreateArchitectureInstance(const ArchSpec &arch);
//------------------------------------------------------------------
// Disassembler
//------------------------------------------------------------------
static bool RegisterPlugin(ConstString name, const char *description,
DisassemblerCreateInstance create_callback);
@ -82,9 +76,7 @@ public:
static DisassemblerCreateInstance
GetDisassemblerCreateCallbackForPluginName(ConstString name);
//------------------------------------------------------------------
// DynamicLoader
//------------------------------------------------------------------
static bool
RegisterPlugin(ConstString name, const char *description,
DynamicLoaderCreateInstance create_callback,
@ -98,9 +90,7 @@ public:
static DynamicLoaderCreateInstance
GetDynamicLoaderCreateCallbackForPluginName(ConstString name);
//------------------------------------------------------------------
// JITLoader
//------------------------------------------------------------------
static bool
RegisterPlugin(ConstString name, const char *description,
JITLoaderCreateInstance create_callback,
@ -114,9 +104,7 @@ public:
static JITLoaderCreateInstance
GetJITLoaderCreateCallbackForPluginName(ConstString name);
//------------------------------------------------------------------
// EmulateInstruction
//------------------------------------------------------------------
static bool RegisterPlugin(ConstString name, const char *description,
EmulateInstructionCreateInstance create_callback);
@ -129,9 +117,7 @@ public:
static EmulateInstructionCreateInstance
GetEmulateInstructionCreateCallbackForPluginName(ConstString name);
//------------------------------------------------------------------
// OperatingSystem
//------------------------------------------------------------------
static bool RegisterPlugin(ConstString name, const char *description,
OperatingSystemCreateInstance create_callback,
DebuggerInitializeCallback debugger_init_callback);
@ -144,9 +130,7 @@ public:
static OperatingSystemCreateInstance
GetOperatingSystemCreateCallbackForPluginName(ConstString name);
//------------------------------------------------------------------
// Language
//------------------------------------------------------------------
static bool RegisterPlugin(ConstString name, const char *description,
LanguageCreateInstance create_callback);
@ -157,9 +141,7 @@ public:
static LanguageCreateInstance
GetLanguageCreateCallbackForPluginName(ConstString name);
//------------------------------------------------------------------
// LanguageRuntime
//------------------------------------------------------------------
static bool
RegisterPlugin(ConstString name, const char *description,
LanguageRuntimeCreateInstance create_callback,
@ -176,9 +158,7 @@ public:
static LanguageRuntimeCreateInstance
GetLanguageRuntimeCreateCallbackForPluginName(ConstString name);
//------------------------------------------------------------------
// SystemRuntime
//------------------------------------------------------------------
static bool RegisterPlugin(ConstString name, const char *description,
SystemRuntimeCreateInstance create_callback);
@ -190,9 +170,7 @@ public:
static SystemRuntimeCreateInstance
GetSystemRuntimeCreateCallbackForPluginName(ConstString name);
//------------------------------------------------------------------
// ObjectFile
//------------------------------------------------------------------
static bool
RegisterPlugin(ConstString name, const char *description,
ObjectFileCreateInstance create_callback,
@ -220,9 +198,7 @@ public:
static Status SaveCore(const lldb::ProcessSP &process_sp,
const FileSpec &outfile);
//------------------------------------------------------------------
// ObjectContainer
//------------------------------------------------------------------
static bool
RegisterPlugin(ConstString name, const char *description,
ObjectContainerCreateInstance create_callback,
@ -239,9 +215,7 @@ public:
static ObjectFileGetModuleSpecifications
GetObjectContainerGetModuleSpecificationsCallbackAtIndex(uint32_t idx);
//------------------------------------------------------------------
// Platform
//------------------------------------------------------------------
static bool
RegisterPlugin(ConstString name, const char *description,
PlatformCreateInstance create_callback,
@ -260,9 +234,7 @@ public:
static size_t AutoCompletePlatformName(llvm::StringRef partial_name,
StringList &matches);
//------------------------------------------------------------------
// Process
//------------------------------------------------------------------
static bool
RegisterPlugin(ConstString name, const char *description,
ProcessCreateInstance create_callback,
@ -279,9 +251,7 @@ public:
static const char *GetProcessPluginDescriptionAtIndex(uint32_t idx);
//------------------------------------------------------------------
// ScriptInterpreter
//------------------------------------------------------------------
static bool RegisterPlugin(ConstString name, const char *description,
lldb::ScriptLanguage script_lang,
ScriptInterpreterCreateInstance create_callback);
@ -295,11 +265,8 @@ public:
GetScriptInterpreterForLanguage(lldb::ScriptLanguage script_lang,
CommandInterpreter &interpreter);
//------------------------------------------------------------------
// StructuredDataPlugin
//------------------------------------------------------------------
//------------------------------------------------------------------
/// Register a StructuredDataPlugin class along with optional
/// callbacks for debugger initialization and Process launch info
/// filtering and manipulation.
@ -332,7 +299,6 @@ public:
///
/// \return
/// Returns true upon success; otherwise, false.
//------------------------------------------------------------------
static bool
RegisterPlugin(ConstString name, const char *description,
StructuredDataPluginCreateInstance create_callback,
@ -352,9 +318,7 @@ public:
GetStructuredDataFilterCallbackAtIndex(uint32_t idx,
bool &iteration_complete);
//------------------------------------------------------------------
// SymbolFile
//------------------------------------------------------------------
static bool
RegisterPlugin(ConstString name, const char *description,
SymbolFileCreateInstance create_callback,
@ -368,9 +332,7 @@ public:
static SymbolFileCreateInstance
GetSymbolFileCreateCallbackForPluginName(ConstString name);
//------------------------------------------------------------------
// SymbolVendor
//------------------------------------------------------------------
static bool RegisterPlugin(ConstString name, const char *description,
SymbolVendorCreateInstance create_callback);
@ -382,9 +344,7 @@ public:
static SymbolVendorCreateInstance
GetSymbolVendorCreateCallbackForPluginName(ConstString name);
//------------------------------------------------------------------
// UnwindAssembly
//------------------------------------------------------------------
static bool RegisterPlugin(ConstString name, const char *description,
UnwindAssemblyCreateInstance create_callback);
@ -396,9 +356,7 @@ public:
static UnwindAssemblyCreateInstance
GetUnwindAssemblyCreateCallbackForPluginName(ConstString name);
//------------------------------------------------------------------
// MemoryHistory
//------------------------------------------------------------------
static bool RegisterPlugin(ConstString name, const char *description,
MemoryHistoryCreateInstance create_callback);
@ -410,9 +368,7 @@ public:
static MemoryHistoryCreateInstance
GetMemoryHistoryCreateCallbackForPluginName(ConstString name);
//------------------------------------------------------------------
// InstrumentationRuntime
//------------------------------------------------------------------
static bool
RegisterPlugin(ConstString name, const char *description,
InstrumentationRuntimeCreateInstance create_callback,
@ -430,9 +386,7 @@ public:
static InstrumentationRuntimeCreateInstance
GetInstrumentationRuntimeCreateCallbackForPluginName(ConstString name);
//------------------------------------------------------------------
// TypeSystem
//------------------------------------------------------------------
static bool RegisterPlugin(
ConstString name, const char *description,
TypeSystemCreateInstance create_callback,
@ -453,9 +407,7 @@ public:
GetTypeSystemEnumerateSupportedLanguagesCallbackForPluginName(
ConstString name);
//------------------------------------------------------------------
// REPL
//------------------------------------------------------------------
static bool
RegisterPlugin(ConstString name, const char *description,
REPLCreateInstance create_callback,
@ -475,13 +427,11 @@ public:
GetREPLSystemEnumerateSupportedLanguagesCallbackForPluginName(
ConstString name);
//------------------------------------------------------------------
// Some plug-ins might register a DebuggerInitializeCallback callback when
// registering the plug-in. After a new Debugger instance is created, this
// DebuggerInitialize function will get called. This allows plug-ins to
// install Properties and do any other initialization that requires a
// debugger instance.
//------------------------------------------------------------------
static void DebuggerInitialize(Debugger &debugger);
static lldb::OptionValuePropertiesSP

View File

@ -16,28 +16,22 @@
#include <vector>
//----------------------------------------------------------------------
// C string less than compare function object
//----------------------------------------------------------------------
struct CStringCompareFunctionObject {
bool operator()(const char *s1, const char *s2) const {
return strcmp(s1, s2) < 0;
}
};
//----------------------------------------------------------------------
// C string equality function object (binary predicate).
//----------------------------------------------------------------------
struct CStringEqualBinaryPredicate {
bool operator()(const char *s1, const char *s2) const {
return strcmp(s1, s2) == 0;
}
};
//----------------------------------------------------------------------
// Templated type for finding an entry in a std::map<F,S> whose value is equal
// to something
//----------------------------------------------------------------------
template <class F, class S> class ValueEquals {
public:
ValueEquals(const S &val) : second_value(val) {}

View File

@ -50,16 +50,12 @@ class Target;
namespace lldb_private {
//----------------------------------------------------------------------
/// \class Searcher SearchFilter.h "lldb/Core/SearchFilter.h" Class that is
/// driven by the SearchFilter to search the SymbolContext space of the target
/// program.
//----------------------------------------------------------------------
//----------------------------------------------------------------------
/// General Outline:
/// Provides the callback and search depth for the SearchFilter search.
//----------------------------------------------------------------------
class Searcher {
public:
@ -79,23 +75,18 @@ public:
virtual lldb::SearchDepth GetDepth() = 0;
//------------------------------------------------------------------
/// Prints a canonical description for the searcher to the stream \a s.
///
/// \param[in] s
/// Stream to which the output is copied.
//------------------------------------------------------------------
virtual void GetDescription(Stream *s);
};
//----------------------------------------------------------------------
/// \class SearchFilter SearchFilter.h "lldb/Core/SearchFilter.h" Class
/// descends through the SymbolContext space of the target, applying a filter
/// at each stage till it reaches the depth specified by the GetDepth method
/// of the searcher, and calls its callback at that point.
//----------------------------------------------------------------------
//----------------------------------------------------------------------
/// General Outline:
/// Provides the callback and search depth for the SearchFilter search.
///
@ -106,16 +97,13 @@ public:
/// that since the resolution of the Searcher may be greater than that of the
/// SearchFilter, before the Searcher qualifies an address it should pass it
/// to "AddressPasses." The default implementation is "Everything Passes."
//----------------------------------------------------------------------
class SearchFilter {
public:
//------------------------------------------------------------------
/// The basic constructor takes a Target, which gives the space to search.
///
/// \param[in] target
/// The Target that provides the module list to search.
//------------------------------------------------------------------
SearchFilter(const lldb::TargetSP &target_sp);
SearchFilter(const SearchFilter &rhs);
@ -126,17 +114,14 @@ public:
SearchFilter &operator=(const SearchFilter &rhs);
//------------------------------------------------------------------
/// Call this method with a file spec to see if that spec passes the filter.
///
/// \param[in] spec
/// The file spec to check against the filter.
/// \return
/// \b true if \a spec passes, and \b false otherwise.
//------------------------------------------------------------------
virtual bool ModulePasses(const FileSpec &spec);
//------------------------------------------------------------------
/// Call this method with a Module to see if that module passes the filter.
///
/// \param[in] module
@ -144,10 +129,8 @@ public:
///
/// \return
/// \b true if \a module passes, and \b false otherwise.
//------------------------------------------------------------------
virtual bool ModulePasses(const lldb::ModuleSP &module_sp);
//------------------------------------------------------------------
/// Call this method with a Address to see if \a address passes the filter.
///
/// \param[in] addr
@ -155,10 +138,8 @@ public:
///
/// \return
/// \b true if \a address passes, and \b false otherwise.
//------------------------------------------------------------------
virtual bool AddressPasses(Address &addr);
//------------------------------------------------------------------
/// Call this method with a FileSpec to see if \a file spec passes the
/// filter as the name of a compilation unit.
///
@ -167,10 +148,8 @@ public:
///
/// \return
/// \b true if \a file spec passes, and \b false otherwise.
//------------------------------------------------------------------
virtual bool CompUnitPasses(FileSpec &fileSpec);
//------------------------------------------------------------------
/// Call this method with a CompileUnit to see if \a comp unit passes the
/// filter.
///
@ -179,10 +158,8 @@ public:
///
/// \return
/// \b true if \a Comp Unit passes, and \b false otherwise.
//------------------------------------------------------------------
virtual bool CompUnitPasses(CompileUnit &compUnit);
//------------------------------------------------------------------
/// Call this method with a Function to see if \a function passes the
/// filter.
///
@ -191,19 +168,15 @@ public:
///
/// \return
/// \b true if \a function passes, and \b false otherwise.
//------------------------------------------------------------------
virtual bool FunctionPasses(Function &function);
//------------------------------------------------------------------
/// Call this method to do the search using the Searcher.
///
/// \param[in] searcher
/// The searcher to drive with this search.
///
//------------------------------------------------------------------
virtual void Search(Searcher &searcher);
//------------------------------------------------------------------
/// Call this method to do the search using the Searcher in the module list
/// \a modules.
///
@ -213,10 +186,8 @@ public:
/// \param[in] modules
/// The module list within which to restrict the search.
///
//------------------------------------------------------------------
virtual void SearchInModuleList(Searcher &searcher, ModuleList &modules);
//------------------------------------------------------------------
/// This determines which items are REQUIRED for the filter to pass. For
/// instance, if you are filtering by Compilation Unit, obviously symbols
/// that have no compilation unit can't pass So return eSymbolContextCU and
@ -227,20 +198,15 @@ public:
/// The required elements for the search, which is an or'ed together
/// set of lldb:SearchContextItem enum's.
///
//------------------------------------------------------------------
virtual uint32_t GetFilterRequiredItems();
//------------------------------------------------------------------
/// Prints a canonical description for the search filter to the stream \a s.
///
/// \param[in] s
/// Stream to which the output is copied.
//------------------------------------------------------------------
virtual void GetDescription(Stream *s);
//------------------------------------------------------------------
/// Standard "Dump" method. At present it does nothing.
//------------------------------------------------------------------
virtual void Dump(Stream *s) const;
lldb::SearchFilterSP CopyForBreakpoint(Breakpoint &breakpoint);
@ -328,12 +294,10 @@ private:
unsigned char SubclassID;
};
//----------------------------------------------------------------------
/// \class SearchFilterForUnconstrainedSearches SearchFilter.h
/// "lldb/Core/SearchFilter.h" This is a SearchFilter that searches through
/// all modules. It also consults the
/// Target::ModuleIsExcludedForUnconstrainedSearches.
//----------------------------------------------------------------------
class SearchFilterForUnconstrainedSearches : public SearchFilter {
public:
SearchFilterForUnconstrainedSearches(const lldb::TargetSP &target_sp)
@ -356,14 +320,11 @@ protected:
lldb::SearchFilterSP DoCopyForBreakpoint(Breakpoint &breakpoint) override;
};
//----------------------------------------------------------------------
/// \class SearchFilterByModule SearchFilter.h "lldb/Core/SearchFilter.h" This
/// is a SearchFilter that restricts the search to a given module.
//----------------------------------------------------------------------
class SearchFilterByModule : public SearchFilter {
public:
//------------------------------------------------------------------
/// The basic constructor takes a Target, which gives the space to search,
/// and the module to restrict the search to.
///
@ -372,7 +333,6 @@ public:
///
/// \param[in] module
/// The Module that limits the search.
//------------------------------------------------------------------
SearchFilterByModule(const lldb::TargetSP &targetSP, const FileSpec &module);
SearchFilterByModule(const SearchFilterByModule &rhs);
@ -415,7 +375,6 @@ private:
class SearchFilterByModuleList : public SearchFilter {
public:
//------------------------------------------------------------------
/// The basic constructor takes a Target, which gives the space to search,
/// and the module list to restrict the search to.
///
@ -424,7 +383,6 @@ public:
///
/// \param[in] module
/// The Module that limits the search.
//------------------------------------------------------------------
SearchFilterByModuleList(const lldb::TargetSP &targetSP,
const FileSpecList &module_list);
@ -474,7 +432,6 @@ protected:
class SearchFilterByModuleListAndCU : public SearchFilterByModuleList {
public:
//------------------------------------------------------------------
/// The basic constructor takes a Target, which gives the space to search,
/// and the module list to restrict the search to.
///
@ -483,7 +440,6 @@ public:
///
/// \param[in] module
/// The Module that limits the search.
//------------------------------------------------------------------
SearchFilterByModuleListAndCU(const lldb::TargetSP &targetSP,
const FileSpecList &module_list,
const FileSpecList &cu_list);

View File

@ -189,20 +189,15 @@ public:
void SetIsThreadSpecific(bool b) { m_thread_specific = b; }
//------------------------------------------------------------------
/// Get the permissions as OR'ed bits from lldb::Permissions
//------------------------------------------------------------------
uint32_t GetPermissions() const;
//------------------------------------------------------------------
/// Set the permissions using bits OR'ed from lldb::Permissions
//------------------------------------------------------------------
void SetPermissions(uint32_t permissions);
ObjectFile *GetObjectFile() { return m_obj_file; }
const ObjectFile *GetObjectFile() const { return m_obj_file; }
//------------------------------------------------------------------
/// Read the section data from the object file that the section
/// resides in.
///
@ -220,11 +215,9 @@ public:
/// The number of bytes read from the section, or zero if the
/// section has no data or \a offset is not a valid offset
/// in this section.
//------------------------------------------------------------------
lldb::offset_t GetSectionData(void *dst, lldb::offset_t dst_len,
lldb::offset_t offset = 0);
//------------------------------------------------------------------
/// Get the shared reference to the section data from the object
/// file that the section resides in. No copies of the data will be
/// make unless the object file has been read from memory. If the
@ -238,7 +231,6 @@ public:
/// The number of bytes read from the section, or zero if the
/// section has no data or \a offset is not a valid offset
/// in this section.
//------------------------------------------------------------------
lldb::offset_t GetSectionData(DataExtractor &data);
uint32_t GetLog2Align() { return m_log2align; }

View File

@ -117,9 +117,7 @@ public:
FileCache m_file_cache;
};
//------------------------------------------------------------------
// Constructors and Destructors
//------------------------------------------------------------------
// A source manager can be made with a non-null target, in which case it can
// use the path remappings to find
// source files that are not in their build locations. With no target it

View File

@ -21,9 +21,7 @@ namespace lldb_private {
class StreamFile : public Stream {
public:
//------------------------------------------------------------------
// Constructors and Destructors
//------------------------------------------------------------------
StreamFile();
StreamFile(uint32_t flags, uint32_t addr_size, lldb::ByteOrder byte_order);
@ -47,9 +45,7 @@ public:
protected:
//------------------------------------------------------------------
// Classes that inherit from StreamFile can see and modify these
//------------------------------------------------------------------
File m_file;
size_t WriteImpl(const void *s, size_t length) override;

View File

@ -21,9 +21,7 @@ public:
typedef std::map<_Key, _Tp> collection;
typedef typename collection::iterator iterator;
typedef typename collection::const_iterator const_iterator;
//------------------------------------------------------------------
// Constructors and Destructors
//------------------------------------------------------------------
ThreadSafeSTLMap() : m_collection(), m_mutex() {}
~ThreadSafeSTLMap() {}
@ -121,9 +119,7 @@ private:
collection m_collection;
mutable std::recursive_mutex m_mutex;
//------------------------------------------------------------------
// For ThreadSafeSTLMap only
//------------------------------------------------------------------
DISALLOW_COPY_AND_ASSIGN(ThreadSafeSTLMap);
};

View File

@ -22,9 +22,7 @@ public:
typedef std::vector<_Object> collection;
typedef typename collection::iterator iterator;
typedef typename collection::const_iterator const_iterator;
//------------------------------------------------------------------
// Constructors and Destructors
//------------------------------------------------------------------
ThreadSafeSTLVector() : m_collection(), m_mutex() {}
~ThreadSafeSTLVector() = default;
@ -65,9 +63,7 @@ private:
collection m_collection;
mutable std::recursive_mutex m_mutex;
//------------------------------------------------------------------
// For ThreadSafeSTLVector only
//------------------------------------------------------------------
DISALLOW_COPY_AND_ASSIGN(ThreadSafeSTLVector);
};

View File

@ -18,9 +18,7 @@ namespace lldb_private {
template <class T> class ThreadSafeValue {
public:
//------------------------------------------------------------------
// Constructors and Destructors
//------------------------------------------------------------------
ThreadSafeValue() : m_value(), m_mutex() {}
ThreadSafeValue(const T &value) : m_value(value), m_mutex() {}
@ -55,9 +53,7 @@ private:
T m_value;
mutable std::recursive_mutex m_mutex;
//------------------------------------------------------------------
// For ThreadSafeValue only
//------------------------------------------------------------------
DISALLOW_COPY_AND_ASSIGN(ThreadSafeValue);
};

View File

@ -17,14 +17,12 @@
namespace lldb_private {
//----------------------------------------------------------------------
// Templatized uniqued string map.
//
// This map is useful for mapping unique C string names to values of type T.
// Each "const char *" name added must be unique for a given
// C string value. ConstString::GetCString() can provide such strings.
// Any other string table that has guaranteed unique values can also be used.
//----------------------------------------------------------------------
template <typename T> class UniqueCStringMap {
public:
struct Entry {
@ -44,11 +42,9 @@ public:
T value;
};
//------------------------------------------------------------------
// Call this function multiple times to add a bunch of entries to this map,
// then later call UniqueCStringMap<T>::Sort() before doing any searches by
// name.
//------------------------------------------------------------------
void Append(ConstString unique_cstr, const T &value) {
m_map.push_back(typename UniqueCStringMap<T>::Entry(unique_cstr, value));
}
@ -57,10 +53,8 @@ public:
void Clear() { m_map.clear(); }
//------------------------------------------------------------------
// Call this function to always keep the map sorted when putting entries into
// the map.
//------------------------------------------------------------------
void Insert(ConstString unique_cstr, const T &value) {
typename UniqueCStringMap<T>::Entry e(unique_cstr, value);
m_map.insert(std::upper_bound(m_map.begin(), m_map.end(), e), e);
@ -70,12 +64,10 @@ public:
m_map.insert(std::upper_bound(m_map.begin(), m_map.end(), e), e);
}
//------------------------------------------------------------------
// Get an entries by index in a variety of forms.
//
// The caller is responsible for ensuring that the collection does not change
// during while using the returned values.
//------------------------------------------------------------------
bool GetValueAtIndex(uint32_t idx, T &value) const {
if (idx < m_map.size()) {
value = m_map[idx].value;
@ -102,14 +94,12 @@ public:
return ((idx < m_map.size()) ? m_map[idx].cstring : ConstString());
}
//------------------------------------------------------------------
// Find the value for the unique string in the map.
//
// Return the value for \a unique_cstr if one is found, return \a fail_value
// otherwise. This method works well for simple type
// T values and only if there is a sensible failure value that can
// be returned and that won't match any existing values.
//------------------------------------------------------------------
T Find(ConstString unique_cstr, T fail_value) const {
Entry search_entry(unique_cstr);
const_iterator end = m_map.end();
@ -121,13 +111,11 @@ public:
return fail_value;
}
//------------------------------------------------------------------
// Get a pointer to the first entry that matches "name". nullptr will be
// returned if there is no entry that matches "name".
//
// The caller is responsible for ensuring that the collection does not change
// during while using the returned pointer.
//------------------------------------------------------------------
const Entry *FindFirstValueForName(ConstString unique_cstr) const {
Entry search_entry(unique_cstr);
const_iterator end = m_map.end();
@ -137,14 +125,12 @@ public:
return nullptr;
}
//------------------------------------------------------------------
// Get a pointer to the next entry that matches "name" from a previously
// returned Entry pointer. nullptr will be returned if there is no subsequent
// entry that matches "name".
//
// The caller is responsible for ensuring that the collection does not change
// during while using the returned pointer.
//------------------------------------------------------------------
const Entry *FindNextValueForName(const Entry *entry_ptr) const {
if (!m_map.empty()) {
const Entry *first_entry = &m_map[0];
@ -187,25 +173,18 @@ public:
return values.size() - start_size;
}
//------------------------------------------------------------------
// Get the total number of entries in this map.
//------------------------------------------------------------------
size_t GetSize() const { return m_map.size(); }
//------------------------------------------------------------------
// Returns true if this map is empty.
//------------------------------------------------------------------
bool IsEmpty() const { return m_map.empty(); }
//------------------------------------------------------------------
// Reserve memory for at least "n" entries in the map. This is useful to call
// when you know you will be adding a lot of entries using
// UniqueCStringMap::Append() (which should be followed by a call to
// UniqueCStringMap::Sort()) or to UniqueCStringMap::Insert().
//------------------------------------------------------------------
void Reserve(size_t n) { m_map.reserve(n); }
//------------------------------------------------------------------
// Sort the unsorted contents in this map. A typical code flow would be:
// size_t approximate_num_entries = ....
// UniqueCStringMap<uint32_t> my_map;
@ -215,16 +194,13 @@ public:
// my_map.Append (UniqueCStringMap::Entry(GetName(...), GetValue(...)));
// }
// my_map.Sort();
//------------------------------------------------------------------
void Sort() { llvm::sort(m_map.begin(), m_map.end()); }
//------------------------------------------------------------------
// Since we are using a vector to contain our items it will always double its
// memory consumption as things are added to the vector, so if you intend to
// keep a UniqueCStringMap around and have a lot of entries in the map, you
// will want to call this function to create a new vector and copy _only_ the
// exact size needed as part of the finalization of the string map.
//------------------------------------------------------------------
void SizeToFit() {
if (m_map.size() < m_map.capacity()) {
collection temp(m_map.begin(), m_map.end());

View File

@ -379,16 +379,12 @@ public:
virtual bool CanProvideValue();
//------------------------------------------------------------------
// Subclasses must implement the functions below.
//------------------------------------------------------------------
virtual uint64_t GetByteSize() = 0;
virtual lldb::ValueType GetValueType() const = 0;
//------------------------------------------------------------------
// Subclasses can implement the functions below.
//------------------------------------------------------------------
virtual ConstString GetTypeName();
virtual ConstString GetDisplayTypeName();
@ -478,9 +474,7 @@ public:
virtual bool GetDeclaration(Declaration &decl);
//------------------------------------------------------------------
// The functions below should NOT be modified by subclasses
//------------------------------------------------------------------
const Status &GetError();
ConstString GetName() const;
@ -788,7 +782,6 @@ public:
void SetHasCompleteType() { m_did_calculate_complete_objc_class_type = true; }
//------------------------------------------------------------------
/// Find out if a ValueObject might have children.
///
/// This call is much more efficient than CalculateNumChildren() as
@ -803,7 +796,6 @@ public:
/// \return
/// Returns \b true if the ValueObject might have children, or \b
/// false otherwise.
//------------------------------------------------------------------
virtual bool MightHaveChildren();
virtual lldb::VariableSP GetVariable() { return nullptr; }
@ -858,9 +850,7 @@ protected:
size_t m_children_count;
};
//------------------------------------------------------------------
// Classes that inherit from ValueObject can see and modify these
//------------------------------------------------------------------
ValueObject
*m_parent; // The parent value object, or nullptr if this has no parent
ValueObject *m_root; // The root of the hierarchy for this ValueObject (or
@ -943,9 +933,7 @@ protected:
friend class ValueObjectConstResultImpl;
friend class ValueObjectSynthetic; // For ClearUserVisibleData
//------------------------------------------------------------------
// Constructors and Destructors
//------------------------------------------------------------------
// Use the no-argument constructor to make a constant variable object (with
// no ExecutionContextScope.)
@ -1005,9 +993,7 @@ protected:
void ClearDynamicTypeInformation();
//------------------------------------------------------------------
// Subclasses must implement the functions below.
//------------------------------------------------------------------
virtual CompilerType GetCompilerTypeImpl() = 0;
@ -1031,14 +1017,12 @@ private:
DISALLOW_COPY_AND_ASSIGN(ValueObject);
};
//------------------------------------------------------------------------------
// A value object manager class that is seeded with the static variable value
// and it vends the user facing value object. If the type is dynamic it can
// vend the dynamic type. If this user type also has a synthetic type
// associated with it, it will vend the synthetic type. The class watches the
// process' stop
// ID and will update the user type when needed.
//------------------------------------------------------------------------------
class ValueObjectManager {
// The root value object is the static typed variable object.
lldb::ValueObjectSP m_root_valobj_sp;

View File

@ -24,9 +24,7 @@ class ConstString;
namespace lldb_private {
//---------------------------------------------------------------------------------
// A ValueObject that represents a given value represented as a different type.
//---------------------------------------------------------------------------------
class ValueObjectCast : public ValueObject {
public:
~ValueObjectCast() override;

View File

@ -25,9 +25,7 @@
namespace lldb_private {
//----------------------------------------------------------------------
// A child of another ValueObject.
//----------------------------------------------------------------------
class ValueObjectChild : public ValueObject {
public:
~ValueObjectChild() override;

View File

@ -35,9 +35,7 @@ class Module;
}
namespace lldb_private {
//----------------------------------------------------------------------
// A frozen ValueObject copied into host memory
//----------------------------------------------------------------------
class ValueObjectConstResult : public ValueObject {
public:
~ValueObjectConstResult() override;

View File

@ -31,9 +31,7 @@ class ValueObject;
namespace lldb_private {
//----------------------------------------------------------------------
// A child of a ValueObjectConstResult.
//----------------------------------------------------------------------
class ValueObjectConstResultChild : public ValueObjectChild {
public:
ValueObjectConstResultChild(ValueObject &parent,

View File

@ -32,11 +32,9 @@ class ValueObject;
namespace lldb_private {
//----------------------------------------------------------------------
// A class wrapping common implementation details for operations in
// ValueObjectConstResult ( & Child ) that may need to jump from the host
// memory space into the target's memory space
//----------------------------------------------------------------------
class ValueObjectConstResultImpl {
public:
ValueObjectConstResultImpl(ValueObject *valobj,

View File

@ -35,10 +35,8 @@ class Status;
}
namespace lldb_private {
//----------------------------------------------------------------------
// A ValueObject that represents memory at a given address, viewed as some
// set lldb type.
//----------------------------------------------------------------------
class ValueObjectDynamicValue : public ValueObject {
public:
~ValueObjectDynamicValue() override;

View File

@ -22,14 +22,10 @@ class ValueObject;
namespace lldb_private {
//----------------------------------------------------------------------
// A collection of ValueObject values that
//----------------------------------------------------------------------
class ValueObjectList {
public:
//------------------------------------------------------------------
// Constructors and Destructors
//------------------------------------------------------------------
ValueObjectList();
ValueObjectList(const ValueObjectList &rhs);
@ -67,9 +63,7 @@ public:
}
protected:
typedef std::vector<lldb::ValueObjectSP> collection;
//------------------------------------------------------------------
// Classes that inherit from ValueObjectList can see and modify these
//------------------------------------------------------------------
collection m_value_objects;
};

View File

@ -27,10 +27,8 @@ class ExecutionContextScope;
namespace lldb_private {
//----------------------------------------------------------------------
// A ValueObject that represents memory at a given address, viewed as some
// set lldb type.
//----------------------------------------------------------------------
class ValueObjectMemory : public ValueObject {
public:
~ValueObjectMemory() override;
@ -74,9 +72,7 @@ private:
ValueObjectMemory(ExecutionContextScope *exe_scope, llvm::StringRef name,
const Address &address, const CompilerType &ast_type);
//------------------------------------------------------------------
// For ValueObject only
//------------------------------------------------------------------
DISALLOW_COPY_AND_ASSIGN(ValueObjectMemory);
};

View File

@ -39,10 +39,8 @@ class Stream;
namespace lldb_private {
//----------------------------------------------------------------------
// A ValueObject that contains a root variable that may or may not
// have children.
//----------------------------------------------------------------------
class ValueObjectRegisterContext : public ValueObject {
public:
~ValueObjectRegisterContext() override;
@ -74,9 +72,7 @@ protected:
private:
ValueObjectRegisterContext(ValueObject &parent,
lldb::RegisterContextSP &reg_ctx_sp);
//------------------------------------------------------------------
// For ValueObject only
//------------------------------------------------------------------
DISALLOW_COPY_AND_ASSIGN(ValueObjectRegisterContext);
};
@ -123,9 +119,7 @@ private:
ValueObjectRegisterSet(ExecutionContextScope *exe_scope,
lldb::RegisterContextSP &reg_ctx_sp, uint32_t set_idx);
//------------------------------------------------------------------
// For ValueObject only
//------------------------------------------------------------------
DISALLOW_COPY_AND_ASSIGN(ValueObjectRegisterSet);
};
@ -179,9 +173,7 @@ private:
ValueObjectRegister(ExecutionContextScope *exe_scope,
lldb::RegisterContextSP &reg_ctx_sp, uint32_t reg_num);
//------------------------------------------------------------------
// For ValueObject only
//------------------------------------------------------------------
DISALLOW_COPY_AND_ASSIGN(ValueObjectRegister);
};

View File

@ -35,13 +35,11 @@ class SyntheticChildrenFrontEnd;
}
namespace lldb_private {
//----------------------------------------------------------------------
// A ValueObject that obtains its children from some source other than
// real information
// This is currently used to implement Python-based children and filters but
// you can bind it to any source of synthetic information and have it behave
// accordingly
//----------------------------------------------------------------------
class ValueObjectSynthetic : public ValueObject {
public:
~ValueObjectSynthetic() override;

View File

@ -39,10 +39,8 @@ class SymbolContextScope;
namespace lldb_private {
//----------------------------------------------------------------------
// A ValueObject that contains a root variable that may or may not
// have children.
//----------------------------------------------------------------------
class ValueObjectVariable : public ValueObject {
public:
~ValueObjectVariable() override;
@ -91,9 +89,7 @@ protected:
private:
ValueObjectVariable(ExecutionContextScope *exe_scope,
const lldb::VariableSP &var_sp);
//------------------------------------------------------------------
// For ValueObject only
//------------------------------------------------------------------
DISALLOW_COPY_AND_ASSIGN(ValueObjectVariable);
};

View File

@ -21,7 +21,6 @@ class DWARFUnit;
namespace lldb_private {
//----------------------------------------------------------------------
/// \class DWARFExpression DWARFExpression.h
/// "lldb/Expression/DWARFExpression.h" Encapsulates a DWARF location
/// expression and interprets it.
@ -33,7 +32,6 @@ namespace lldb_private {
/// overhead from copying JIT-compiled code into the target is too high or
/// where the target cannot be run. This class encapsulates a single DWARF
/// location expression or a location list and interprets it.
//----------------------------------------------------------------------
class DWARFExpression {
public:
enum LocationListFormat : uint8_t {
@ -45,12 +43,9 @@ public:
// (.debug_loclists/.debug_loclists.dwo).
};
//------------------------------------------------------------------
/// Constructor
//------------------------------------------------------------------
explicit DWARFExpression(DWARFUnit *dwarf_cu);
//------------------------------------------------------------------
/// Constructor
///
/// \param[in] data
@ -62,22 +57,16 @@ public:
///
/// \param[in] data_length
/// The byte length of the location expression.
//------------------------------------------------------------------
DWARFExpression(lldb::ModuleSP module, const DataExtractor &data,
DWARFUnit *dwarf_cu, lldb::offset_t data_offset,
lldb::offset_t data_length);
//------------------------------------------------------------------
/// Copy constructor
//------------------------------------------------------------------
DWARFExpression(const DWARFExpression &rhs);
//------------------------------------------------------------------
/// Destructor
//------------------------------------------------------------------
virtual ~DWARFExpression();
//------------------------------------------------------------------
/// Print the description of the expression to a stream
///
/// \param[in] s
@ -96,21 +85,15 @@ public:
/// \param[in] abi
/// An optional ABI plug-in that can be used to resolve register
/// names.
//------------------------------------------------------------------
void GetDescription(Stream *s, lldb::DescriptionLevel level,
lldb::addr_t location_list_base_addr, ABI *abi) const;
//------------------------------------------------------------------
/// Return true if the location expression contains data
//------------------------------------------------------------------
bool IsValid() const;
//------------------------------------------------------------------
/// Return true if a location list was provided
//------------------------------------------------------------------
bool IsLocationList() const;
//------------------------------------------------------------------
/// Search for a load address in the location list
///
/// \param[in] process
@ -122,7 +105,6 @@ public:
/// \return
/// True if IsLocationList() is true and the address was found;
/// false otherwise.
//------------------------------------------------------------------
// bool
// LocationListContainsLoadAddress (Process* process, const Address &addr)
// const;
@ -130,7 +112,6 @@ public:
bool LocationListContainsAddress(lldb::addr_t loclist_base_addr,
lldb::addr_t addr) const;
//------------------------------------------------------------------
/// If a location is not a location list, return true if the location
/// contains a DW_OP_addr () opcode in the stream that matches \a file_addr.
/// If file_addr is LLDB_INVALID_ADDRESS, the this function will return true
@ -150,7 +131,6 @@ public:
/// \return
/// LLDB_INVALID_ADDRESS if the location doesn't contain a
/// DW_OP_addr for \a op_addr_idx, otherwise a valid file address
//------------------------------------------------------------------
lldb::addr_t GetLocation_DW_OP_addr(uint32_t op_addr_idx, bool &error) const;
bool Update_DW_OP_addr(lldb::addr_t file_addr);
@ -164,17 +144,14 @@ public:
std::function<lldb::addr_t(lldb::addr_t file_addr)> const
&link_address_callback);
//------------------------------------------------------------------
/// Make the expression parser read its location information from a given
/// data source. Does not change the offset and length
///
/// \param[in] data
/// A data extractor configured to read the DWARF location expression's
/// bytecode.
//------------------------------------------------------------------
void SetOpcodeData(const DataExtractor &data);
//------------------------------------------------------------------
/// Make the expression parser read its location information from a given
/// data source
///
@ -190,11 +167,9 @@ public:
///
/// \param[in] data_length
/// The byte length of the location expression.
//------------------------------------------------------------------
void SetOpcodeData(lldb::ModuleSP module_sp, const DataExtractor &data,
lldb::offset_t data_offset, lldb::offset_t data_length);
//------------------------------------------------------------------
/// Copy the DWARF location expression into a local buffer.
///
/// It is a good idea to copy the data so we don't keep the entire object
@ -219,7 +194,6 @@ public:
///
/// \param[in] data_length
/// The byte length of the location expression.
//------------------------------------------------------------------
void CopyOpcodeData(lldb::ModuleSP module_sp, const DataExtractor &data,
lldb::offset_t data_offset, lldb::offset_t data_length);
@ -230,7 +204,6 @@ public:
lldb::offset_t const_value_byte_size,
uint8_t addr_byte_size);
//------------------------------------------------------------------
/// Tells the expression that it refers to a location list.
///
/// \param[in] slide
@ -239,42 +212,32 @@ public:
/// offsets into the object that owns the location list. We need
/// to make location lists relative to the objects that own them
/// so we can relink addresses on the fly.
//------------------------------------------------------------------
void SetLocationListSlide(lldb::addr_t slide);
//------------------------------------------------------------------
/// Return the call-frame-info style register kind
//------------------------------------------------------------------
int GetRegisterKind();
//------------------------------------------------------------------
/// Set the call-frame-info style register kind
///
/// \param[in] reg_kind
/// The register kind.
//------------------------------------------------------------------
void SetRegisterKind(lldb::RegisterKind reg_kind);
//------------------------------------------------------------------
/// Wrapper for the static evaluate function that accepts an
/// ExecutionContextScope instead of an ExecutionContext and uses member
/// variables to populate many operands
//------------------------------------------------------------------
bool Evaluate(ExecutionContextScope *exe_scope,
lldb::addr_t loclist_base_load_addr,
const Value *initial_value_ptr, const Value *object_address_ptr,
Value &result, Status *error_ptr) const;
//------------------------------------------------------------------
/// Wrapper for the static evaluate function that uses member variables to
/// populate many operands
//------------------------------------------------------------------
bool Evaluate(ExecutionContext *exe_ctx, RegisterContext *reg_ctx,
lldb::addr_t loclist_base_load_addr,
const Value *initial_value_ptr, const Value *object_address_ptr,
Value &result, Status *error_ptr) const;
//------------------------------------------------------------------
/// Evaluate a DWARF location expression in a particular context
///
/// \param[in] exe_ctx
@ -332,7 +295,6 @@ public:
/// \return
/// True on success; false otherwise. If error_ptr is non-NULL,
/// details of the failure are provided through it.
//------------------------------------------------------------------
static bool Evaluate(ExecutionContext *exe_ctx, RegisterContext *reg_ctx,
lldb::ModuleSP opcode_ctx, const DataExtractor &opcodes,
DWARFUnit *dwarf_cu, const lldb::offset_t offset,
@ -366,7 +328,6 @@ public:
bool MatchesOperand(StackFrame &frame, const Instruction::Operand &op);
protected:
//------------------------------------------------------------------
/// Pretty-prints the location expression to a stream
///
/// \param[in] stream
@ -384,7 +345,6 @@ protected:
/// \param[in] abi
/// An optional ABI plug-in that can be used to resolve register
/// names.
//------------------------------------------------------------------
void DumpLocation(Stream *s, lldb::offset_t offset, lldb::offset_t length,
lldb::DescriptionLevel level, ABI *abi) const;
@ -398,9 +358,7 @@ protected:
bool GetOpAndEndOffsets(StackFrame &frame, lldb::offset_t &op_offset,
lldb::offset_t &end_offset);
//------------------------------------------------------------------
/// Classes that inherit from DWARFExpression can see and modify these
//------------------------------------------------------------------
lldb::ModuleWP m_module_wp; ///< Module which defined this expression.
DataExtractor m_data; ///< A data extractor capable of reading opcode bytes

View File

@ -22,7 +22,6 @@ namespace lldb_private {
class RecordingMemoryManager;
//----------------------------------------------------------------------
/// \class Expression Expression.h "lldb/Expression/Expression.h" Encapsulates
/// a single expression for use in lldb
///
@ -31,7 +30,6 @@ class RecordingMemoryManager;
/// objects needed to parse and interpret or JIT an expression. It uses the
/// expression parser appropriate to the language of the expression to produce
/// LLVM IR from the expression.
//----------------------------------------------------------------------
class Expression {
public:
/// Discriminator for LLVM-style RTTI (dyn_cast<> et al.)
@ -51,65 +49,43 @@ public:
Expression(ExecutionContextScope &exe_scope, ExpressionKind kind);
//------------------------------------------------------------------
/// Destructor
//------------------------------------------------------------------
virtual ~Expression() {}
//------------------------------------------------------------------
/// Return the string that the parser should parse. Must be a full
/// translation unit.
//------------------------------------------------------------------
virtual const char *Text() = 0;
//------------------------------------------------------------------
/// Return the function name that should be used for executing the
/// expression. Text() should contain the definition of this function.
//------------------------------------------------------------------
virtual const char *FunctionName() = 0;
//------------------------------------------------------------------
/// Return the language that should be used when parsing. To use the
/// default, return eLanguageTypeUnknown.
//------------------------------------------------------------------
virtual lldb::LanguageType Language() { return lldb::eLanguageTypeUnknown; }
//------------------------------------------------------------------
/// Return the desired result type of the function, or eResultTypeAny if
/// indifferent.
//------------------------------------------------------------------
virtual ResultType DesiredResultType() { return eResultTypeAny; }
//------------------------------------------------------------------
/// Flags
//------------------------------------------------------------------
//------------------------------------------------------------------
/// Return true if validation code should be inserted into the expression.
//------------------------------------------------------------------
virtual bool NeedsValidation() = 0;
//------------------------------------------------------------------
/// Return true if external variables in the expression should be resolved.
//------------------------------------------------------------------
virtual bool NeedsVariableResolution() = 0;
virtual EvaluateExpressionOptions *GetOptions() { return nullptr; };
//------------------------------------------------------------------
/// Return the address of the function's JIT-compiled code, or
/// LLDB_INVALID_ADDRESS if the function is not JIT compiled
//------------------------------------------------------------------
lldb::addr_t StartAddress() { return m_jit_start_addr; }
//------------------------------------------------------------------
/// Called to notify the expression that it is about to be executed.
//------------------------------------------------------------------
virtual void WillStartExecuting() {}
//------------------------------------------------------------------
/// Called to notify the expression that its execution has finished.
//------------------------------------------------------------------
virtual void DidFinishExecuting() {}
virtual ExpressionTypeSystemHelper *GetTypeSystemHelper() { return nullptr; }

View File

@ -18,16 +18,13 @@ namespace lldb_private {
class IRExecutionUnit;
//----------------------------------------------------------------------
/// \class ExpressionParser ExpressionParser.h
/// "lldb/Expression/ExpressionParser.h" Encapsulates an instance of a
/// compiler that can parse expressions.
///
/// ExpressionParser is the base class for llvm based Expression parsers.
//----------------------------------------------------------------------
class ExpressionParser {
public:
//------------------------------------------------------------------
/// Constructor
///
/// Initializes class variables.
@ -39,17 +36,13 @@ public:
///
/// \param[in] expr
/// The expression to be parsed.
//------------------------------------------------------------------
ExpressionParser(ExecutionContextScope *exe_scope, Expression &expr,
bool generate_debug_info)
: m_expr(expr), m_generate_debug_info(generate_debug_info) {}
//------------------------------------------------------------------
/// Destructor
//------------------------------------------------------------------
virtual ~ExpressionParser(){};
//------------------------------------------------------------------
/// Attempts to find possible command line completions for the given
/// expression.
///
@ -80,11 +73,9 @@ public:
/// \return
/// True if we added any completion results to the output;
/// false otherwise.
//------------------------------------------------------------------
virtual bool Complete(CompletionRequest &request, unsigned line, unsigned pos,
unsigned typed_pos) = 0;
//------------------------------------------------------------------
/// Parse a single expression and convert it to IR using Clang. Don't wrap
/// the expression in anything at all.
///
@ -94,10 +85,8 @@ public:
/// \return
/// The number of errors encountered during parsing. 0 means
/// success.
//------------------------------------------------------------------
virtual unsigned Parse(DiagnosticManager &diagnostic_manager) = 0;
//------------------------------------------------------------------
/// Try to use the FixIts in the diagnostic_manager to rewrite the
/// expression. If successful, the rewritten expression is stored in the
/// diagnostic_manager, get it out with GetFixedExpression.
@ -107,12 +96,10 @@ public:
///
/// \return
/// \b true if the rewrite was successful, \b false otherwise.
//------------------------------------------------------------------
virtual bool RewriteExpression(DiagnosticManager &diagnostic_manager) {
return false;
}
//------------------------------------------------------------------
/// Ready an already-parsed expression for execution, possibly evaluating it
/// statically.
///
@ -143,7 +130,6 @@ public:
/// \return
/// An error code indicating the success or failure of the operation.
/// Test with Success().
//------------------------------------------------------------------
virtual Status
PrepareForExecution(lldb::addr_t &func_addr, lldb::addr_t &func_end,
std::shared_ptr<IRExecutionUnit> &execution_unit_sp,

View File

@ -14,7 +14,6 @@
namespace lldb_private {
//----------------------------------------------------------------------
/// \class ExpressionTypeSystemHelper ExpressionTypeSystemHelper.h
/// "lldb/Expression/ExpressionTypeSystemHelper.h"
/// A helper object that the Expression can pass to its ExpressionParser
@ -23,7 +22,6 @@ namespace lldb_private {
/// dyn_cast so that the expression parser can cast it back to the requisite
/// specific type.
///
//----------------------------------------------------------------------
class ExpressionTypeSystemHelper {
public:

View File

@ -25,9 +25,7 @@ class ClangExpressionVariable;
class ExpressionVariable
: public std::enable_shared_from_this<ExpressionVariable> {
public:
//----------------------------------------------------------------------
// See TypeSystem.h for how to add subclasses to this.
//----------------------------------------------------------------------
enum LLVMCastKind { eKindClang, eKindSwift, eKindGo, kNumKinds };
LLVMCastKind getKind() const { return m_kind; }
@ -118,18 +116,14 @@ public:
LLVMCastKind m_kind;
};
//----------------------------------------------------------------------
/// \class ExpressionVariableList ExpressionVariable.h
/// "lldb/Expression/ExpressionVariable.h"
/// A list of variable references.
///
/// This class stores variables internally, acting as the permanent store.
//----------------------------------------------------------------------
class ExpressionVariableList {
public:
//----------------------------------------------------------------------
/// Implementation of methods in ExpressionVariableListBase
//----------------------------------------------------------------------
size_t GetSize() { return m_variables.size(); }
lldb::ExpressionVariableSP GetVariableAtIndex(size_t index) {
@ -160,7 +154,6 @@ public:
return false;
}
//----------------------------------------------------------------------
/// Finds a variable by name in the list.
///
/// \param[in] name
@ -169,7 +162,6 @@ public:
/// \return
/// The variable requested, or nullptr if that variable is not in the
/// list.
//----------------------------------------------------------------------
lldb::ExpressionVariableSP GetVariable(ConstString name) {
lldb::ExpressionVariableSP var_sp;
for (size_t index = 0, size = GetSize(); index < size; ++index) {
@ -214,9 +206,7 @@ private:
class PersistentExpressionState : public ExpressionVariableList {
public:
//----------------------------------------------------------------------
// See TypeSystem.h for how to add subclasses to this.
//----------------------------------------------------------------------
enum LLVMCastKind { eKindClang, eKindSwift, eKindGo, kNumKinds };
LLVMCastKind getKind() const { return m_kind; }

View File

@ -22,7 +22,6 @@
namespace lldb_private {
//----------------------------------------------------------------------
/// \class FunctionCaller FunctionCaller.h "lldb/Expression/FunctionCaller.h"
/// Encapsulates a function that can be called.
///
@ -54,7 +53,6 @@ namespace lldb_private {
///
/// Any of the methods that take arg_addr_ptr can be passed nullptr, and the
/// argument space will be managed for you.
//----------------------------------------------------------------------
class FunctionCaller : public Expression {
public:
/// LLVM-style RTTI support.
@ -62,7 +60,6 @@ public:
return E->getKind() == eKindFunctionCaller;
}
//------------------------------------------------------------------
/// Constructor
///
/// \param[in] exe_scope
@ -82,18 +79,14 @@ public:
/// \param[in] arg_value_list
/// The default values to use when calling this function. Can
/// be overridden using WriteFunctionArguments().
//------------------------------------------------------------------
FunctionCaller(ExecutionContextScope &exe_scope,
const CompilerType &return_type,
const Address &function_address,
const ValueList &arg_value_list, const char *name);
//------------------------------------------------------------------
/// Destructor
//------------------------------------------------------------------
~FunctionCaller() override;
//------------------------------------------------------------------
/// Compile the wrapper function
///
/// \param[in] thread_to_use_sp
@ -106,11 +99,9 @@ public:
///
/// \return
/// The number of errors.
//------------------------------------------------------------------
virtual unsigned CompileFunction(lldb::ThreadSP thread_to_use_sp,
DiagnosticManager &diagnostic_manager) = 0;
//------------------------------------------------------------------
/// Insert the default function wrapper and its default argument struct
///
/// \param[in] exe_ctx
@ -127,11 +118,9 @@ public:
///
/// \return
/// True on success; false otherwise.
//------------------------------------------------------------------
bool InsertFunction(ExecutionContext &exe_ctx, lldb::addr_t &args_addr_ref,
DiagnosticManager &diagnostic_manager);
//------------------------------------------------------------------
/// Insert the default function wrapper (using the JIT)
///
/// \param[in] exe_ctx
@ -143,11 +132,9 @@ public:
///
/// \return
/// True on success; false otherwise.
//------------------------------------------------------------------
bool WriteFunctionWrapper(ExecutionContext &exe_ctx,
DiagnosticManager &diagnostic_manager);
//------------------------------------------------------------------
/// Insert the default function argument struct
///
/// \param[in] exe_ctx
@ -164,12 +151,10 @@ public:
///
/// \return
/// True on success; false otherwise.
//------------------------------------------------------------------
bool WriteFunctionArguments(ExecutionContext &exe_ctx,
lldb::addr_t &args_addr_ref,
DiagnosticManager &diagnostic_manager);
//------------------------------------------------------------------
/// Insert an argument struct with a non-default function address and non-
/// default argument values
///
@ -190,13 +175,11 @@ public:
///
/// \return
/// True on success; false otherwise.
//------------------------------------------------------------------
bool WriteFunctionArguments(ExecutionContext &exe_ctx,
lldb::addr_t &args_addr_ref,
ValueList &arg_values,
DiagnosticManager &diagnostic_manager);
//------------------------------------------------------------------
/// Run the function this FunctionCaller was created with.
///
/// This is the full version.
@ -228,13 +211,11 @@ public:
/// \return
/// Returns one of the ExpressionResults enum indicating function call
/// status.
//------------------------------------------------------------------
lldb::ExpressionResults
ExecuteFunction(ExecutionContext &exe_ctx, lldb::addr_t *args_addr_ptr,
const EvaluateExpressionOptions &options,
DiagnosticManager &diagnostic_manager, Value &results);
//------------------------------------------------------------------
/// Get a thread plan to run the function this FunctionCaller was created
/// with.
///
@ -259,13 +240,11 @@ public:
///
/// \return
/// A ThreadPlan shared pointer for executing the function.
//------------------------------------------------------------------
lldb::ThreadPlanSP
GetThreadPlanToCallFunction(ExecutionContext &exe_ctx, lldb::addr_t args_addr,
const EvaluateExpressionOptions &options,
DiagnosticManager &diagnostic_manager);
//------------------------------------------------------------------
/// Get the result of the function from its struct
///
/// \param[in] exe_ctx
@ -279,11 +258,9 @@ public:
///
/// \return
/// True on success; false otherwise.
//------------------------------------------------------------------
bool FetchFunctionResults(ExecutionContext &exe_ctx, lldb::addr_t args_addr,
Value &ret_value);
//------------------------------------------------------------------
/// Deallocate the arguments structure
///
/// \param[in] exe_ctx
@ -292,42 +269,29 @@ public:
///
/// \param[in] args_addr
/// The address of the argument struct.
//------------------------------------------------------------------
void DeallocateFunctionResults(ExecutionContext &exe_ctx,
lldb::addr_t args_addr);
//------------------------------------------------------------------
/// Interface for ClangExpression
//------------------------------------------------------------------
//------------------------------------------------------------------
/// Return the string that the parser should parse. Must be a full
/// translation unit.
//------------------------------------------------------------------
const char *Text() override { return m_wrapper_function_text.c_str(); }
//------------------------------------------------------------------
/// Return the function name that should be used for executing the
/// expression. Text() should contain the definition of this function.
//------------------------------------------------------------------
const char *FunctionName() override {
return m_wrapper_function_name.c_str();
}
//------------------------------------------------------------------
/// Return the object that the parser should use when registering local
/// variables. May be nullptr if the Expression doesn't care.
//------------------------------------------------------------------
ExpressionVariableList *LocalVariables() { return nullptr; }
//------------------------------------------------------------------
/// Return true if validation code should be inserted into the expression.
//------------------------------------------------------------------
bool NeedsValidation() override { return false; }
//------------------------------------------------------------------
/// Return true if external variables in the expression should be resolved.
//------------------------------------------------------------------
bool NeedsVariableResolution() override { return false; }
ValueList GetArgumentValues() const { return m_arg_values; }
@ -366,7 +330,6 @@ protected:
bool m_struct_valid; ///< True if the ASTStructExtractor has populated the
///variables below.
//------------------------------------------------------------------
/// These values are populated by the ASTStructExtractor
size_t m_struct_size; ///< The size of the argument struct, in bytes.
std::vector<uint64_t>
@ -374,7 +337,6 @@ protected:
uint64_t m_return_size; ///< The size of the result variable, in bytes.
uint64_t m_return_offset; ///< The offset of the result variable in the
///struct, in bytes.
//------------------------------------------------------------------
ValueList m_arg_values; ///< The default values of the arguments.

View File

@ -30,7 +30,6 @@ class ClangExpressionDeclMap;
class ExecutionContext;
class Stream;
//----------------------------------------------------------------------
/// \class DynamicCheckerFunctions IRDynamicChecks.h
/// "lldb/Expression/IRDynamicChecks.h" Encapsulates dynamic check functions
/// used by expressions.
@ -44,20 +43,14 @@ class Stream;
///
/// The class installs each checker function into the target process and makes
/// it available to IRDynamicChecks to use.
//----------------------------------------------------------------------
class DynamicCheckerFunctions {
public:
//------------------------------------------------------------------
/// Constructor
//------------------------------------------------------------------
DynamicCheckerFunctions();
//------------------------------------------------------------------
/// Destructor
//------------------------------------------------------------------
~DynamicCheckerFunctions();
//------------------------------------------------------------------
/// Install the utility functions into a process. This binds the instance
/// of DynamicCheckerFunctions to that process.
///
@ -70,7 +63,6 @@ public:
/// \return
/// True on success; false on failure, or if the functions have
/// already been installed.
//------------------------------------------------------------------
bool Install(DiagnosticManager &diagnostic_manager,
ExecutionContext &exe_ctx);
@ -80,7 +72,6 @@ public:
std::unique_ptr<UtilityFunction> m_objc_object_check;
};
//----------------------------------------------------------------------
/// \class IRDynamicChecks IRDynamicChecks.h
/// "lldb/Expression/IRDynamicChecks.h" Adds dynamic checks to a user-entered
/// expression to reduce its likelihood of crashing
@ -91,10 +82,8 @@ public:
///
/// IRDynamicChecks adds calls to the functions in DynamicCheckerFunctions to
/// appropriate locations in an expression's IR.
//----------------------------------------------------------------------
class IRDynamicChecks : public llvm::ModulePass {
public:
//------------------------------------------------------------------
/// Constructor
///
/// \param[in] checker_functions
@ -106,16 +95,12 @@ public:
/// \param[in] decl_map
/// The mapping used to look up entities in the target process. In
/// this case, used to find objc_msgSend
//------------------------------------------------------------------
IRDynamicChecks(DynamicCheckerFunctions &checker_functions,
const char *func_name = "$__lldb_expr");
//------------------------------------------------------------------
/// Destructor
//------------------------------------------------------------------
~IRDynamicChecks() override;
//------------------------------------------------------------------
/// Run this IR transformer on a single module
///
/// \param[in] M
@ -125,28 +110,20 @@ public:
///
/// \return
/// True on success; false otherwise
//------------------------------------------------------------------
bool runOnModule(llvm::Module &M) override;
//------------------------------------------------------------------
/// Interface stub
//------------------------------------------------------------------
void assignPassManager(
llvm::PMStack &PMS,
llvm::PassManagerType T = llvm::PMT_ModulePassManager) override;
//------------------------------------------------------------------
/// Returns PMT_ModulePassManager
//------------------------------------------------------------------
llvm::PassManagerType getPotentialPassManagerType() const override;
private:
//------------------------------------------------------------------
/// A basic block-level pass to find all pointer dereferences and
/// validate them before use.
//------------------------------------------------------------------
//------------------------------------------------------------------
/// The top-level pass implementation
///
/// \param[in] M
@ -157,7 +134,6 @@ private:
///
/// \return
/// True on success; false otherwise
//------------------------------------------------------------------
bool FindDataLoads(llvm::Module &M, llvm::BasicBlock &BB);
std::string m_func_name; ///< The name of the function to add checks to

View File

@ -36,7 +36,6 @@ namespace lldb_private {
class Status;
//----------------------------------------------------------------------
/// \class IRExecutionUnit IRExecutionUnit.h
/// "lldb/Expression/IRExecutionUnit.h" Contains the IR and, optionally, JIT-
/// compiled code for a module.
@ -54,22 +53,17 @@ class Status;
/// is how the JIT emits code. Because LLDB needs to move JIT-compiled code
/// into the target process, the IRExecutionUnit knows how to copy the emitted
/// code into the target process.
//----------------------------------------------------------------------
class IRExecutionUnit : public std::enable_shared_from_this<IRExecutionUnit>,
public IRMemoryMap,
public ObjectFileJITDelegate {
public:
//------------------------------------------------------------------
/// Constructor
//------------------------------------------------------------------
IRExecutionUnit(std::unique_ptr<llvm::LLVMContext> &context_up,
std::unique_ptr<llvm::Module> &module_up, ConstString &name,
const lldb::TargetSP &target_sp, const SymbolContext &sym_ctx,
std::vector<std::string> &cpu_features);
//------------------------------------------------------------------
/// Destructor
//------------------------------------------------------------------
~IRExecutionUnit() override;
ConstString GetFunctionName() { return m_name; }
@ -84,19 +78,15 @@ public:
void GetRunnableInfo(Status &error, lldb::addr_t &func_addr,
lldb::addr_t &func_end);
//------------------------------------------------------------------
/// Accessors for IRForTarget and other clients that may want binary data
/// placed on their behalf. The binary data is owned by the IRExecutionUnit
/// unless the client explicitly chooses to free it.
//------------------------------------------------------------------
lldb::addr_t WriteNow(const uint8_t *bytes, size_t size, Status &error);
void FreeNow(lldb::addr_t allocation);
//------------------------------------------------------------------
/// ObjectFileJITDelegate overrides
//------------------------------------------------------------------
lldb::ByteOrder GetByteOrder() const override;
uint32_t GetAddressByteSize() const override;
@ -115,7 +105,6 @@ public:
void GetStaticInitializers(std::vector<lldb::addr_t> &static_initializers);
//----------------------------------------------------------------------
/// \class JittedFunction IRExecutionUnit.h
/// "lldb/Expression/IRExecutionUnit.h"
/// Encapsulates a single function that has been generated by the JIT.
@ -123,14 +112,12 @@ public:
/// Functions that have been generated by the JIT are first resident in the
/// local process, and then placed in the target process. JittedFunction
/// represents a function possibly resident in both.
//----------------------------------------------------------------------
struct JittedEntity {
ConstString m_name; ///< The function's name
lldb::addr_t m_local_addr; ///< The address of the function in LLDB's memory
lldb::addr_t
m_remote_addr; ///< The address of the function in the target's memory
//------------------------------------------------------------------
/// Constructor
///
/// Initializes class variabes.
@ -145,7 +132,6 @@ public:
/// \param[in] remote_addr
/// The address of the function in the target, or LLDB_INVALID_ADDRESS
/// if it is not present in the target's memory.
//------------------------------------------------------------------
JittedEntity(const char *name,
lldb::addr_t local_addr = LLDB_INVALID_ADDRESS,
lldb::addr_t remote_addr = LLDB_INVALID_ADDRESS)
@ -176,7 +162,6 @@ public:
}
private:
//------------------------------------------------------------------
/// Look up the object in m_address_map that contains a given address, find
/// where it was copied to, and return the remote address at the same offset
/// into the copied entity
@ -186,10 +171,8 @@ private:
///
/// \return
/// The address in the target process.
//------------------------------------------------------------------
lldb::addr_t GetRemoteAddressForLocal(lldb::addr_t local_address);
//------------------------------------------------------------------
/// Look up the object in m_address_map that contains a given address, find
/// where it was copied to, and return its address range in the target
/// process
@ -199,11 +182,9 @@ private:
///
/// \return
/// The range of the containing object in the target process.
//------------------------------------------------------------------
typedef std::pair<lldb::addr_t, uintptr_t> AddrRange;
AddrRange GetRemoteRangeForLocal(lldb::addr_t local_address);
//------------------------------------------------------------------
/// Commit all allocations to the process and record where they were stored.
///
/// \param[in] process
@ -213,18 +194,14 @@ private:
/// True <=> all allocations were performed successfully.
/// This method will attempt to free allocated memory if the
/// operation fails.
//------------------------------------------------------------------
bool CommitAllocations(lldb::ProcessSP &process_sp);
//------------------------------------------------------------------
/// Report all committed allocations to the execution engine.
///
/// \param[in] engine
/// The execution engine to notify.
//------------------------------------------------------------------
void ReportAllocations(llvm::ExecutionEngine &engine);
//------------------------------------------------------------------
/// Write the contents of all allocations to the process.
///
/// \param[in] local_address
@ -232,7 +209,6 @@ private:
///
/// \return
/// True <=> all allocations were performed successfully.
//------------------------------------------------------------------
bool WriteData(lldb::ProcessSP &process_sp);
Status DisassembleFunction(Stream &stream, lldb::ProcessSP &process_sp);
@ -266,7 +242,6 @@ private:
~MemoryManager() override;
//------------------------------------------------------------------
/// Allocate space for executable code, and add it to the m_spaceBlocks
/// map
///
@ -281,12 +256,10 @@ private:
///
/// \return
/// Allocated space.
//------------------------------------------------------------------
uint8_t *allocateCodeSection(uintptr_t Size, unsigned Alignment,
unsigned SectionID,
llvm::StringRef SectionName) override;
//------------------------------------------------------------------
/// Allocate space for data, and add it to the m_spaceBlocks map
///
/// \param[in] Size
@ -303,13 +276,11 @@ private:
///
/// \return
/// Allocated space.
//------------------------------------------------------------------
uint8_t *allocateDataSection(uintptr_t Size, unsigned Alignment,
unsigned SectionID,
llvm::StringRef SectionName,
bool IsReadOnly) override;
//------------------------------------------------------------------
/// Called when object loading is complete and section page permissions
/// can be applied. Currently unimplemented for LLDB.
///
@ -318,7 +289,6 @@ private:
///
/// \return
/// True in case of failure, false in case of success.
//------------------------------------------------------------------
bool finalizeMemory(std::string *ErrMsg) override {
// TODO: Ensure that the instruction cache is flushed because
// relocations are updated by dy-load. See:
@ -348,14 +318,12 @@ private:
static const unsigned eSectionIDInvalid = (unsigned)-1;
//----------------------------------------------------------------------
/// \class AllocationRecord IRExecutionUnit.h
/// "lldb/Expression/IRExecutionUnit.h" Encapsulates a single allocation
/// request made by the JIT.
///
/// Allocations made by the JIT are first queued up and then applied in bulk
/// to the underlying process.
//----------------------------------------------------------------------
enum class AllocationKind { Stub, Code, Data, Global, Bytes };
static lldb::SectionType

View File

@ -26,7 +26,6 @@ class ClangExpressionDeclMap;
class IRMemoryMap;
}
//----------------------------------------------------------------------
/// \class IRInterpreter IRInterpreter.h "lldb/Expression/IRInterpreter.h"
/// Attempt to interpret the function's code if it does not require
/// running the target.
@ -34,7 +33,6 @@ class IRMemoryMap;
/// In some cases, the IR for an expression can be evaluated entirely in the
/// debugger, manipulating variables but not executing any code in the target.
/// The IRInterpreter attempts to do this.
//----------------------------------------------------------------------
class IRInterpreter {
public:
static bool CanInterpret(llvm::Module &module, llvm::Function &function,

View File

@ -17,7 +17,6 @@
namespace lldb_private {
//----------------------------------------------------------------------
/// \class IRMemoryMap IRMemoryMap.h "lldb/Expression/IRMemoryMap.h"
/// Encapsulates memory that may exist in the process but must
/// also be available in the host process.
@ -32,7 +31,6 @@ namespace lldb_private {
/// address in the tar at which they reside. If the inferior does not exist,
/// allocations still get made-up addresses. If an inferior appears at some
/// point, then those addresses need to be re-mapped.
//----------------------------------------------------------------------
class IRMemoryMap {
public:
IRMemoryMap(lldb::TargetSP target_sp);

View File

@ -19,7 +19,6 @@
namespace lldb_private {
//----------------------------------------------------------------------
/// \class LLVMUserExpression LLVMUserExpression.h
/// "lldb/Expression/LLVMUserExpression.h" Encapsulates a one-time expression
/// for use in lldb.
@ -30,7 +29,6 @@ namespace lldb_private {
/// expression. The actual parsing part will be provided by the specific
/// implementations of LLVMUserExpression - which will be vended through the
/// appropriate TypeSystem.
//----------------------------------------------------------------------
class LLVMUserExpression : public UserExpression {
public:
/// LLVM-style RTTI support.
@ -65,10 +63,8 @@ public:
bool CanInterpret() override { return m_can_interpret; }
//------------------------------------------------------------------
/// Return the string that the parser should parse. Must be a full
/// translation unit.
//------------------------------------------------------------------
const char *Text() override { return m_transformed_text.c_str(); }
lldb::ModuleSP GetJITModule() override;

View File

@ -20,9 +20,7 @@ namespace lldb_private {
class REPL : public IOHandlerDelegate {
public:
//----------------------------------------------------------------------
// See TypeSystem.h for how to add subclasses to this.
//----------------------------------------------------------------------
enum LLVMCastKind { eKindClang, eKindSwift, eKindGo, kNumKinds };
LLVMCastKind getKind() const { return m_kind; }
@ -31,7 +29,6 @@ public:
~REPL() override;
//------------------------------------------------------------------
/// Get a REPL with an existing target (or, failing that, a debugger to use),
/// and (optional) extra arguments for the compiler.
///
@ -55,7 +52,6 @@ public:
///
/// \return
/// The range of the containing object in the target process.
//------------------------------------------------------------------
static lldb::REPLSP Create(Status &Status, lldb::LanguageType language,
Debugger *debugger, Target *target,
const char *repl_options);
@ -82,9 +78,7 @@ public:
Status RunLoop();
//------------------------------------------------------------------
// IOHandler::Delegate functions
//------------------------------------------------------------------
void IOHandlerActivated(IOHandler &io_handler, bool interactive) override;
bool IOHandlerInterrupt(IOHandler &io_handler) override;
@ -117,9 +111,7 @@ public:
protected:
static int CalculateActualIndentation(const StringList &lines);
//----------------------------------------------------------------------
// Subclasses should override these functions to implement a functional REPL.
//----------------------------------------------------------------------
virtual Status DoInitialization() = 0;

View File

@ -23,7 +23,6 @@
namespace lldb_private {
//----------------------------------------------------------------------
/// \class UserExpression UserExpression.h "lldb/Expression/UserExpression.h"
/// Encapsulates a one-time expression for use in lldb.
///
@ -33,7 +32,6 @@ namespace lldb_private {
/// JIT an expression. The actual parsing part will be provided by the specific
/// implementations of UserExpression - which will be vended through the
/// appropriate TypeSystem.
//----------------------------------------------------------------------
class UserExpression : public Expression {
public:
/// LLVM-style RTTI support.
@ -43,7 +41,6 @@ public:
enum { kDefaultTimeout = 500000u };
//------------------------------------------------------------------
/// Constructor
///
/// \param[in] expr
@ -61,19 +58,15 @@ public:
/// \param[in] desired_type
/// If not eResultTypeAny, the type to use for the expression
/// result.
//------------------------------------------------------------------
UserExpression(ExecutionContextScope &exe_scope, llvm::StringRef expr,
llvm::StringRef prefix, lldb::LanguageType language,
ResultType desired_type,
const EvaluateExpressionOptions &options,
ExpressionKind kind);
//------------------------------------------------------------------
/// Destructor
//------------------------------------------------------------------
~UserExpression() override;
//------------------------------------------------------------------
/// Parse the expression
///
/// \param[in] diagnostic_manager
@ -93,13 +86,11 @@ public:
///
/// \return
/// True on success (no errors); false otherwise.
//------------------------------------------------------------------
virtual bool Parse(DiagnosticManager &diagnostic_manager,
ExecutionContext &exe_ctx,
lldb_private::ExecutionPolicy execution_policy,
bool keep_result_in_memory, bool generate_debug_info) = 0;
//------------------------------------------------------------------
/// Attempts to find possible command line completions for the given
/// (possible incomplete) user expression.
///
@ -121,7 +112,6 @@ public:
/// \return
/// True if we added any completion results to the output;
/// false otherwise.
//------------------------------------------------------------------
virtual bool Complete(ExecutionContext &exe_ctx, CompletionRequest &request,
unsigned complete_pos) {
return false;
@ -131,7 +121,6 @@ public:
bool MatchesContext(ExecutionContext &exe_ctx);
//------------------------------------------------------------------
/// Execute the parsed expression by callinng the derived class's DoExecute
/// method.
///
@ -158,14 +147,12 @@ public:
///
/// \return
/// A Process::Execution results value.
//------------------------------------------------------------------
lldb::ExpressionResults Execute(DiagnosticManager &diagnostic_manager,
ExecutionContext &exe_ctx,
const EvaluateExpressionOptions &options,
lldb::UserExpressionSP &shared_ptr_to_me,
lldb::ExpressionVariableSP &result);
//------------------------------------------------------------------
/// Apply the side effects of the function to program state.
///
/// \param[in] diagnostic_manager
@ -187,49 +174,34 @@ public:
///
/// \return
/// A Process::Execution results value.
//------------------------------------------------------------------
virtual bool FinalizeJITExecution(
DiagnosticManager &diagnostic_manager, ExecutionContext &exe_ctx,
lldb::ExpressionVariableSP &result,
lldb::addr_t function_stack_bottom = LLDB_INVALID_ADDRESS,
lldb::addr_t function_stack_top = LLDB_INVALID_ADDRESS) = 0;
//------------------------------------------------------------------
/// Return the string that the parser should parse.
//------------------------------------------------------------------
const char *Text() override { return m_expr_text.c_str(); }
//------------------------------------------------------------------
/// Return the string that the user typed.
//------------------------------------------------------------------
const char *GetUserText() { return m_expr_text.c_str(); }
//------------------------------------------------------------------
/// Return the function name that should be used for executing the
/// expression. Text() should contain the definition of this function.
//------------------------------------------------------------------
const char *FunctionName() override { return "$__lldb_expr"; }
//------------------------------------------------------------------
/// Return the language that should be used when parsing. To use the
/// default, return eLanguageTypeUnknown.
//------------------------------------------------------------------
lldb::LanguageType Language() override { return m_language; }
//------------------------------------------------------------------
/// Return the desired result type of the function, or eResultTypeAny if
/// indifferent.
//------------------------------------------------------------------
ResultType DesiredResultType() override { return m_desired_type; }
//------------------------------------------------------------------
/// Return true if validation code should be inserted into the expression.
//------------------------------------------------------------------
bool NeedsValidation() override { return true; }
//------------------------------------------------------------------
/// Return true if external variables in the expression should be resolved.
//------------------------------------------------------------------
bool NeedsVariableResolution() override { return true; }
EvaluateExpressionOptions *GetOptions() override { return &m_options; }
@ -241,7 +213,6 @@ public:
virtual lldb::ModuleSP GetJITModule() { return lldb::ModuleSP(); }
//------------------------------------------------------------------
/// Evaluate one expression in the scratch context of the target passed in
/// the exe_ctx and return its result.
///
@ -287,7 +258,6 @@ public:
/// \result
/// A Process::ExpressionResults value. eExpressionCompleted for
/// success.
//------------------------------------------------------------------
static lldb::ExpressionResults
Evaluate(ExecutionContext &exe_ctx, const EvaluateExpressionOptions &options,
llvm::StringRef expr_cstr, llvm::StringRef expr_prefix,
@ -316,10 +286,8 @@ protected:
static lldb::addr_t GetObjectPointer(lldb::StackFrameSP frame_sp,
ConstString &object_name, Status &err);
//------------------------------------------------------------------
/// Populate m_in_cplusplus_method and m_in_objectivec_method based on the
/// environment.
//------------------------------------------------------------------
void InstallContext(ExecutionContext &exe_ctx);

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