Index: examples/darwin/heap_find/heap/heap_find.cpp =================================================================== --- examples/darwin/heap_find/heap/heap_find.cpp +++ examples/darwin/heap_find/heap/heap_find.cpp @@ -79,9 +79,7 @@ // C++ includes #include -//---------------------------------------------------------------------- // Redefine private types from "/usr/local/include/stack_logging.h" -//---------------------------------------------------------------------- typedef struct { uint32_t type_flags; uint64_t stack_identifier; @@ -89,9 +87,7 @@ 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 @@ // 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 @@ 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 @@ 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 @@ return NULL; } -//---------------------------------------------------------------------- // ObjCClasses -//---------------------------------------------------------------------- class ObjCClasses { public: ObjCClasses() : m_objc_class_ptrs(NULL), m_size(0) {} @@ -356,16 +340,12 @@ 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 @@ 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 @@ } } -//---------------------------------------------------------------------- // 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ } } -//---------------------------------------------------------------------- // 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 @@ 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 Index: examples/functions/main.cpp =================================================================== --- examples/functions/main.cpp +++ examples/functions/main.cpp @@ -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 @@ // // $ DYLD_FRAMEWORK_PATH=/Volumes/data/lldb/tot/build/Debug ./a.out // executable_path1 [executable_path2 ...] -//---------------------------------------------------------------------- class LLDBSentry { public: LLDBSentry() { Index: examples/interposing/darwin/fd_interposing/FDInterposing.cpp =================================================================== --- examples/interposing/darwin/fd_interposing/FDInterposing.cpp +++ examples/interposing/darwin/fd_interposing/FDInterposing.cpp @@ -68,11 +68,9 @@ #include #include -//---------------------------------------------------------------------- /// \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 @@ 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 @@ DISALLOW_COPY_AND_ASSIGN(String); }; -//---------------------------------------------------------------------- // Type definitions -//---------------------------------------------------------------------- typedef std::vector Frames; class FDEvent; typedef std::vector Frames; typedef std::tr1::shared_ptr FDEventSP; typedef std::tr1::shared_ptr 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 @@ 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 class Errno { public: // Save errno only if we are supposed to @@ -235,9 +225,7 @@ typedef std::vector FDEventArray; typedef std::map 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 @@ // 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 @@ } } -//---------------------------------------------------------------------- // 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 @@ } } -//---------------------------------------------------------------------- // 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 @@ } } -//---------------------------------------------------------------------- // 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 @@ } } -//---------------------------------------------------------------------- // 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 @@ } } -//---------------------------------------------------------------------- // __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 @@ } } -//---------------------------------------------------------------------- // kqueue() interpose function -//---------------------------------------------------------------------- extern "C" int kqueue$__interposed__(void) { const int pid = get_interposed_pid(); if (pid >= 0) { @@ -699,9 +673,7 @@ } } -//---------------------------------------------------------------------- // 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 @@ } } -//---------------------------------------------------------------------- // 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 @@ } } -//---------------------------------------------------------------------- // accept$NOCANCEL() interpose function -//---------------------------------------------------------------------- extern "C" int accept$NOCANCEL$__interposed__(int socket, struct sockaddr *address, socklen_t *address_len) { @@ -766,9 +734,7 @@ } } -//---------------------------------------------------------------------- // dup() interpose function -//---------------------------------------------------------------------- extern "C" int dup$__interposed__(int fd2) { const int pid = get_interposed_pid(); if (pid >= 0) { @@ -787,9 +753,7 @@ } } -//---------------------------------------------------------------------- // 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 @@ } } -//---------------------------------------------------------------------- // close() interpose function -//---------------------------------------------------------------------- extern "C" int close$__interposed__(int fd) { const int pid = get_interposed_pid(); if (pid >= 0) { @@ -859,9 +821,7 @@ } } -//---------------------------------------------------------------------- // 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 @@ } } -//---------------------------------------------------------------------- // pipe() interpose function -//---------------------------------------------------------------------- extern "C" int pipe$__interposed__(int fds[2]) { const int pid = get_interposed_pid(); if (pid >= 0) { @@ -926,7 +884,6 @@ } } -//---------------------------------------------------------------------- // get_fd_history() // // This function allows runtime access to the file descriptor history. @@ -936,7 +893,6 @@ // // @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 @@ } } -//---------------------------------------------------------------------- // Interposing -//---------------------------------------------------------------------- // FD creation routines DYLD_INTERPOSE(accept$__interposed__, accept); DYLD_INTERPOSE(accept$NOCANCEL$__interposed__, accept$NOCANCEL); Index: examples/lookup/main.cpp =================================================================== --- examples/lookup/main.cpp +++ examples/lookup/main.cpp @@ -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 @@ // // $ DYLD_FRAMEWORK_PATH=/Volumes/data/lldb/svn/ToT/build/Debug ./a.out // executable_path file_address -//---------------------------------------------------------------------- class LLDBSentry { public: LLDBSentry() { Index: include/lldb/API/SBAttachInfo.h =================================================================== --- include/lldb/API/SBAttachInfo.h +++ include/lldb/API/SBAttachInfo.h @@ -21,7 +21,6 @@ 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 @@ /// \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 @@ /// 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 @@ bool GetWaitForLaunch(); - //------------------------------------------------------------------ /// Set attach by process name settings. /// /// Designed to be used after a call to SBAttachInfo::SetExecutable(). @@ -88,10 +83,8 @@ /// \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 @@ /// 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 @@ 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: Index: include/lldb/API/SBBlock.h =================================================================== --- include/lldb/API/SBBlock.h +++ include/lldb/API/SBBlock.h @@ -60,7 +60,6 @@ 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 @@ /// 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); Index: include/lldb/API/SBCommandInterpreter.h =================================================================== --- include/lldb/API/SBCommandInterpreter.h +++ include/lldb/API/SBCommandInterpreter.h @@ -190,16 +190,13 @@ 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 @@ /// 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: Index: include/lldb/API/SBCompileUnit.h =================================================================== --- include/lldb/API/SBCompileUnit.h +++ include/lldb/API/SBCompileUnit.h @@ -48,7 +48,6 @@ 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 @@ /// /// \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(); Index: include/lldb/API/SBInstructionList.h =================================================================== --- include/lldb/API/SBInstructionList.h +++ include/lldb/API/SBInstructionList.h @@ -33,11 +33,9 @@ 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); Index: include/lldb/API/SBLaunchInfo.h =================================================================== --- include/lldb/API/SBLaunchInfo.h +++ include/lldb/API/SBLaunchInfo.h @@ -42,7 +42,6 @@ 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 @@ /// 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(); Index: include/lldb/API/SBMemoryRegionInfo.h =================================================================== --- include/lldb/API/SBMemoryRegionInfo.h +++ include/lldb/API/SBMemoryRegionInfo.h @@ -27,56 +27,43 @@ 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 @@ /// 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; Index: include/lldb/API/SBModule.h =================================================================== --- include/lldb/API/SBModule.h +++ include/lldb/API/SBModule.h @@ -37,7 +37,6 @@ 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 @@ /// /// \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 @@ /// /// \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 @@ /// /// \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 @@ /// /// \param[in] file /// A file specification object. - //------------------------------------------------------------------ bool SetRemoteInstallFileSpec(lldb::SBFileSpec &file); lldb::ByteOrder GetByteOrder(); @@ -130,7 +122,6 @@ lldb::SBCompileUnit GetCompileUnitAtIndex(uint32_t); - //------------------------------------------------------------------ /// Find compile units related to *this module and passed source /// file. /// @@ -141,7 +132,6 @@ /// \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 @@ size_t GetNumSections(); lldb::SBSection GetSectionAtIndex(size_t idx); - //------------------------------------------------------------------ /// Find functions by name. /// /// \param[in] name @@ -174,12 +163,10 @@ /// \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 @@ /// /// \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 @@ /// /// \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 @@ 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 @@ /// \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 @@ /// /// \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 @@ /// 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 @@ /// /// \return /// A const reference to the file specification object. - //------------------------------------------------------------------ lldb::SBFileSpec GetSymbolFileSpec() const; lldb::SBAddress GetObjectFileHeaderAddress() const; Index: include/lldb/API/SBModuleSpec.h =================================================================== --- include/lldb/API/SBModuleSpec.h +++ include/lldb/API/SBModuleSpec.h @@ -30,7 +30,6 @@ 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 @@ /// /// \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 @@ /// /// \return /// A const reference to the file specification object. - //------------------------------------------------------------------ lldb::SBFileSpec GetPlatformFileSpec(); void SetPlatformFileSpec(const lldb::SBFileSpec &fspec); Index: include/lldb/API/SBPlatform.h =================================================================== --- include/lldb/API/SBPlatform.h +++ include/lldb/API/SBPlatform.h @@ -109,9 +109,7 @@ bool IsConnected(); - //---------------------------------------------------------------------- // The following functions will work if the platform is connected - //---------------------------------------------------------------------- const char *GetTriple(); const char *GetHostname(); Index: include/lldb/API/SBProcess.h =================================================================== --- include/lldb/API/SBProcess.h +++ include/lldb/API/SBProcess.h @@ -22,9 +22,7 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ const char *GetExitDescription(); - //------------------------------------------------------------------ /// Gets the process ID /// /// Returns the process identifier for the process as it is known @@ -142,10 +129,8 @@ /// 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 @@ /// 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 @@ 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 @@ /// /// \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 @@ bool GetDescription(lldb::SBStream &description); - //------------------------------------------------------------------ /// Start Tracing with the given SBTraceOptions. /// /// \param[in] options @@ -260,12 +241,10 @@ /// \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 @@ /// 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 @@ /// 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 @@ /// 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 @@ lldb::SBError SendEventData(const char *data); - //------------------------------------------------------------------ /// Return the number of different thread-origin extended backtraces /// this process can support. /// @@ -364,10 +337,8 @@ /// \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 @@ /// /// \return /// The name at that index. - //------------------------------------------------------------------ const char *GetExtendedBacktraceTypeAtIndex(uint32_t idx); lldb::SBThreadCollection GetHistoryThreads(addr_t addr); @@ -389,7 +359,6 @@ /// 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 @@ /// \return /// An error object describes any errors that occurred while /// querying load_addr. - //------------------------------------------------------------------ lldb::SBError GetMemoryRegionInfo(lldb::addr_t load_addr, lldb::SBMemoryRegionInfo ®ion_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: Index: include/lldb/API/SBSection.h =================================================================== --- include/lldb/API/SBSection.h +++ include/lldb/API/SBSection.h @@ -54,7 +54,6 @@ 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 @@ /// /// \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 @@ /// /// \return /// The number of host (8-bit) bytes needed to hold a target byte - //------------------------------------------------------------------ uint32_t GetTargetByteSize(); bool operator==(const lldb::SBSection &rhs); Index: include/lldb/API/SBStructuredData.h =================================================================== --- include/lldb/API/SBStructuredData.h +++ include/lldb/API/SBStructuredData.h @@ -40,53 +40,36 @@ 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 @@ /// \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: Index: include/lldb/API/SBSymbol.h =================================================================== --- include/lldb/API/SBSymbol.h +++ include/lldb/API/SBSymbol.h @@ -55,16 +55,12 @@ 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: Index: include/lldb/API/SBTarget.h =================================================================== --- include/lldb/API/SBTarget.h +++ include/lldb/API/SBTarget.h @@ -28,9 +28,7 @@ class LLDB_API SBTarget { public: - //------------------------------------------------------------------ // Broadcaster bits. - //------------------------------------------------------------------ enum { eBroadcastBitBreakpointChanged = (1 << 0), eBroadcastBitModulesLoaded = (1 << 1), @@ -39,18 +37,14 @@ 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 @@ 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 @@ /// /// \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 @@ /// \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 @@ /// /// \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 @@ 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 @@ /// /// \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 @@ SBProcess Attach(SBAttachInfo &attach_info, SBError &error); - //------------------------------------------------------------------ /// Attach to process with pid. /// /// \param[in] listener @@ -237,11 +216,9 @@ /// /// \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 @@ /// /// \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 @@ /// /// \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 @@ lldb::SBModule FindModule(const lldb::SBFileSpec &file_spec); - //------------------------------------------------------------------ /// Find compile units related to *this target and passed source /// file. /// @@ -327,7 +300,6 @@ /// \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 @@ 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 @@ /// \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 @@ /// \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 @@ /// \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 @@ /// \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 @@ /// \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 @@ /// /// \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 @@ /// /// \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 @@ /// /// \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 @@ /// /// \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 @@ /// /// \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 @@ /// 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 @@ /// 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 @@ /// /// \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 @@ lldb::SBBreakpoint BreakpointCreateBySBAddress(SBAddress &address); - //------------------------------------------------------------------ /// Create a breakpoint using a scripted resolver. /// /// \param[in] class_name @@ -706,7 +647,6 @@ /// \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 @@ 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 @@ /// /// \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 @@ /// /// \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 @@ /// /// \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 @@ /// /// \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 @@ 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; Index: include/lldb/API/SBThread.h =================================================================== --- include/lldb/API/SBThread.h +++ include/lldb/API/SBThread.h @@ -51,7 +51,6 @@ /// 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 @@ /// eStopReasonException N exception data /// eStopReasonExec 0 /// eStopReasonPlanComplete 0 - //-------------------------------------------------------------------------- uint64_t GetStopReasonDataAtIndex(uint32_t idx); bool GetStopReasonExtendedInfoAsJSON(lldb::SBStream &stream); @@ -134,7 +132,6 @@ 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 @@ /// 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); Index: include/lldb/API/SBThreadPlan.h =================================================================== --- include/lldb/API/SBThreadPlan.h +++ include/lldb/API/SBThreadPlan.h @@ -42,7 +42,6 @@ /// 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 @@ /// eStopReasonException N exception data /// eStopReasonExec 0 /// eStopReasonPlanComplete 0 - //-------------------------------------------------------------------------- uint64_t GetStopReasonDataAtIndex(uint32_t idx); SBThread GetThread() const; Index: include/lldb/API/SBTrace.h =================================================================== --- include/lldb/API/SBTrace.h +++ include/lldb/API/SBTrace.h @@ -19,7 +19,6 @@ class LLDB_API SBTrace { public: SBTrace(); - //------------------------------------------------------------------ /// Obtain the trace data as raw bytes. /// /// \param[out] error @@ -47,19 +46,15 @@ /// /// \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 @@ /// 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 @@ /// /// \param[out] error /// An error explaining what went wrong. - //------------------------------------------------------------------ void GetTraceConfig(SBTraceOptions &options, SBError &error); lldb::user_id_t GetTraceUID(); Index: include/lldb/API/SBValue.h =================================================================== --- include/lldb/API/SBValue.h +++ include/lldb/API/SBValue.h @@ -137,7 +137,6 @@ 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 @@ /// /// \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 @@ 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 @@ /// \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 @@ /// \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 @@ /// \return /// Returns \b true if the SBValue might have children, or \b /// false otherwise. - //------------------------------------------------------------------ bool MightHaveChildren(); bool IsRuntimeSupportValue(); @@ -315,7 +307,6 @@ SBValue(const lldb::ValueObjectSP &value_sp); - //------------------------------------------------------------------ /// Watch this value if it resides in memory. /// /// Sets a watchpoint on the value. @@ -340,14 +331,12 @@ /// 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 @@ /// 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 @@ /// \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 @@ 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 @@ /// \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 Index: include/lldb/Breakpoint/Breakpoint.h =================================================================== --- include/lldb/Breakpoint/Breakpoint.h +++ include/lldb/Breakpoint/Breakpoint.h @@ -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 @@ /// 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, 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 @@ 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 @@ /// \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 @@ /// /// \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 @@ /// \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 @@ /// 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 @@ /// 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 @@ /// 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 @@ /// \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 @@ /// 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 @@ /// 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 @@ /// \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 @@ const char *GetQueueName() const; - //------------------------------------------------------------------ /// Set the callback action invoked when the breakpoint is hit. /// /// \param[in] callback @@ -456,7 +389,6 @@ /// \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 @@ 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 @@ /// 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 @@ /// /// \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 @@ 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 @@ /// 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 @@ /// /// \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 @@ } } - //------------------------------------------------------------------ /// Set a pre-condition filter that overrides all user provided /// filters/callbacks etc. /// @@ -655,7 +558,6 @@ /// 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 @@ 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 @@ /// 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 @@ // 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 Index: include/lldb/Breakpoint/BreakpointID.h =================================================================== --- include/lldb/Breakpoint/BreakpointID.h +++ include/lldb/Breakpoint/BreakpointID.h @@ -18,9 +18,7 @@ namespace lldb_private { -//---------------------------------------------------------------------- // class BreakpointID -//---------------------------------------------------------------------- class BreakpointID { public: @@ -50,7 +48,6 @@ static bool IsValidIDExpression(llvm::StringRef str); static llvm::ArrayRef 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 @@ /// 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 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 @@ /// \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 @@ /// \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); Index: include/lldb/Breakpoint/BreakpointIDList.h =================================================================== --- include/lldb/Breakpoint/BreakpointIDList.h +++ include/lldb/Breakpoint/BreakpointIDList.h @@ -20,9 +20,7 @@ namespace lldb_private { -//---------------------------------------------------------------------- // class BreakpointIDList -//---------------------------------------------------------------------- class BreakpointIDList { public: Index: include/lldb/Breakpoint/BreakpointList.h =================================================================== --- include/lldb/Breakpoint/BreakpointList.h +++ include/lldb/Breakpoint/BreakpointList.h @@ -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 @@ ~BreakpointList(); - //------------------------------------------------------------------ /// Add the breakpoint \a bp_sp to the list. /// /// \param[in] bp_sp @@ -40,15 +35,11 @@ /// /// \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 @@ /// \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 @@ /// \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 @@ /// /// \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 guard(m_mutex); return m_breakpoints.size(); } - //------------------------------------------------------------------ /// Removes the breakpoint given by \b breakID from this list. /// /// \param[in] breakID @@ -103,10 +86,8 @@ /// /// \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 @@ /// \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 @@ /// \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 @@ 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 &lock); protected: Index: include/lldb/Breakpoint/BreakpointLocation.h =================================================================== --- include/lldb/Breakpoint/BreakpointLocation.h +++ include/lldb/Breakpoint/BreakpointLocation.h @@ -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 @@ /// 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, @@ -44,27 +40,20 @@ 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 @@ /// \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 @@ /// for the callback. /// /// \see lldb_private::Baton - //------------------------------------------------------------------ void SetCallback(BreakpointHitCallback callback, const lldb::BatonSP &callback_baton_sp, bool is_synchronous); @@ -146,31 +118,25 @@ 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 @@ 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 @@ /// 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 @@ /// /// \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 @@ /// \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 @@ /// \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 @@ /// /// \return /// \b true or \b false as given in the description above. - //------------------------------------------------------------------ bool EquivalentToLocation(BreakpointLocation &location); protected: @@ -339,7 +277,6 @@ 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 @@ /// \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 @@ void UndoBumpHitCount(); - //------------------------------------------------------------------ // Constructors and Destructors // // Only the Breakpoint can make breakpoint locations, and it owns them. - //------------------------------------------------------------------ - //------------------------------------------------------------------ /// Constructor. /// /// \param[in] owner @@ -383,15 +316,12 @@ /// /// \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; Index: include/lldb/Breakpoint/BreakpointLocationCollection.h =================================================================== --- include/lldb/Breakpoint/BreakpointLocationCollection.h +++ include/lldb/Breakpoint/BreakpointLocationCollection.h @@ -25,7 +25,6 @@ BreakpointLocationCollection &operator=(const BreakpointLocationCollection &rhs); - //------------------------------------------------------------------ /// Add the breakpoint \a bp_loc_sp to the list. /// /// \param[in] bp_sp @@ -34,10 +33,8 @@ /// /// \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 @@ /// /// \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 @@ /// \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 @@ /// \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 @@ /// \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 @@ /// \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 @@ /// /// \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 @@ /// 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 @@ /// 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 collection; Index: include/lldb/Breakpoint/BreakpointLocationList.h =================================================================== --- include/lldb/Breakpoint/BreakpointLocationList.h +++ include/lldb/Breakpoint/BreakpointLocationList.h @@ -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 @@ 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 @@ /// \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 @@ /// \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 @@ /// /// \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 @@ /// /// \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 @@ /// \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 @@ /// \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 @@ /// /// \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 @@ /// 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 @@ /// /// \result /// Returns breakpoint location id. - //------------------------------------------------------------------ lldb::BreakpointLocationSP Create(const Address &addr, bool resolve_indirect_symbols); Index: include/lldb/Breakpoint/BreakpointOptions.h =================================================================== --- include/lldb/Breakpoint/BreakpointOptions.h +++ include/lldb/Breakpoint/BreakpointOptions.h @@ -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 @@ typedef std::shared_ptr 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 @@ /// \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 @@ 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 @@ // 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 @@ /// \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 @@ 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 @@ /// \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 @@ /// /// \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 &cmd_data); void Clear(); @@ -402,9 +340,7 @@ } 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 @@ void SetThreadSpec(std::unique_ptr &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; Index: include/lldb/Breakpoint/BreakpointResolver.h =================================================================== --- include/lldb/Breakpoint/BreakpointResolver.h +++ include/lldb/Breakpoint/BreakpointResolver.h @@ -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 @@ /// 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 @@ /// /// \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 @@ 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 @@ // 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 @@ } 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 Index: include/lldb/Breakpoint/BreakpointResolverAddress.h =================================================================== --- include/lldb/Breakpoint/BreakpointResolverAddress.h +++ include/lldb/Breakpoint/BreakpointResolverAddress.h @@ -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: Index: include/lldb/Breakpoint/BreakpointResolverFileLine.h =================================================================== --- include/lldb/Breakpoint/BreakpointResolverFileLine.h +++ include/lldb/Breakpoint/BreakpointResolverFileLine.h @@ -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: Index: include/lldb/Breakpoint/BreakpointResolverFileRegex.h =================================================================== --- include/lldb/Breakpoint/BreakpointResolverFileRegex.h +++ include/lldb/Breakpoint/BreakpointResolverFileRegex.h @@ -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: Index: include/lldb/Breakpoint/BreakpointResolverName.h =================================================================== --- include/lldb/Breakpoint/BreakpointResolverName.h +++ include/lldb/Breakpoint/BreakpointResolverName.h @@ -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: Index: include/lldb/Breakpoint/BreakpointResolverScripted.h =================================================================== --- include/lldb/Breakpoint/BreakpointResolverScripted.h +++ include/lldb/Breakpoint/BreakpointResolverScripted.h @@ -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: Index: include/lldb/Breakpoint/BreakpointSite.h =================================================================== --- include/lldb/Breakpoint/BreakpointSite.h +++ include/lldb/Breakpoint/BreakpointSite.h @@ -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 @@ /// 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, public StoppointLocation { @@ -49,68 +47,47 @@ ~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 @@ /// /// \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 @@ /// 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 @@ /// /// \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 @@ /// 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 @@ /// 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 @@ /// \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 @@ 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. Index: include/lldb/Breakpoint/BreakpointSiteList.h =================================================================== --- include/lldb/Breakpoint/BreakpointSiteList.h +++ include/lldb/Breakpoint/BreakpointSiteList.h @@ -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 @@ 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 @@ /// /// \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 @@ /// \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 @@ /// 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 @@ /// 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 @@ /// /// \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 @@ /// \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 const &callback); - //------------------------------------------------------------------ /// Removes the breakpoint site given by \b breakID from this list. /// /// \param[in] breakID @@ -134,10 +113,8 @@ /// /// \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 @@ /// /// \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 @@ 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 @@ /// /// \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 guard(m_mutex); return m_bp_site_list.size(); Index: include/lldb/Breakpoint/Stoppoint.h =================================================================== --- include/lldb/Breakpoint/Stoppoint.h +++ include/lldb/Breakpoint/Stoppoint.h @@ -16,16 +16,12 @@ class Stoppoint { public: - //------------------------------------------------------------------ // Constructors and Destructors - //------------------------------------------------------------------ Stoppoint(); virtual ~Stoppoint(); - //------------------------------------------------------------------ // Methods - //------------------------------------------------------------------ virtual void Dump(Stream *) = 0; virtual bool IsEnabled() = 0; @@ -40,9 +36,7 @@ lldb::break_id_t m_bid; private: - //------------------------------------------------------------------ // For Stoppoint only - //------------------------------------------------------------------ DISALLOW_COPY_AND_ASSIGN(Stoppoint); }; Index: include/lldb/Breakpoint/StoppointCallbackContext.h =================================================================== --- include/lldb/Breakpoint/StoppointCallbackContext.h +++ include/lldb/Breakpoint/StoppointCallbackContext.h @@ -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 @@ 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 Index: include/lldb/Breakpoint/StoppointLocation.h =================================================================== --- include/lldb/Breakpoint/StoppointLocation.h +++ include/lldb/Breakpoint/StoppointLocation.h @@ -17,9 +17,7 @@ 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 @@ 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 @@ 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 @@ void DecrementHitCount(); private: - //------------------------------------------------------------------ // For StoppointLocation only - //------------------------------------------------------------------ DISALLOW_COPY_AND_ASSIGN(StoppointLocation); StoppointLocation(); // Disallow default constructor }; Index: include/lldb/Breakpoint/Watchpoint.h =================================================================== --- include/lldb/Breakpoint/Watchpoint.h +++ include/lldb/Breakpoint/Watchpoint.h @@ -97,15 +97,12 @@ 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 @@ /// \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 @@ void ClearCallback(); - //------------------------------------------------------------------ /// Invoke the callback action when the watchpoint is hit. /// /// \param[in] context @@ -138,28 +133,21 @@ /// /// \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(); Index: include/lldb/Breakpoint/WatchpointList.h =================================================================== --- include/lldb/Breakpoint/WatchpointList.h +++ include/lldb/Breakpoint/WatchpointList.h @@ -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 @@ 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 @@ /// /// \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 @@ /// \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 @@ /// \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 @@ /// \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 @@ /// /// \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 @@ /// /// \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 @@ /// \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 @@ /// \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 @@ /// /// \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 @@ /// /// \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 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 @@ /// 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 &lock); protected: Index: include/lldb/Breakpoint/WatchpointOptions.h =================================================================== --- include/lldb/Breakpoint/WatchpointOptions.h +++ include/lldb/Breakpoint/WatchpointOptions.h @@ -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 @@ /// /// \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 @@ // 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 @@ /// \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 @@ /// /// \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 @@ }; 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; Index: include/lldb/Core/Address.h =================================================================== --- include/lldb/Core/Address.h +++ include/lldb/Core/Address.h @@ -50,7 +50,6 @@ namespace lldb_private { -//---------------------------------------------------------------------- /// \class Address Address.h "lldb/Core/Address.h" /// A section + offset based address class. /// @@ -78,13 +77,10 @@ /// 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 @@ ///< 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 @@ /// /// \param[in] offset /// The offset in bytes into \a section. - //------------------------------------------------------------------ Address(const lldb::SectionSP §ion_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 @@ 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 @@ /// /// \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 @@ /// /// \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 @@ /// \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 @@ } }; - //------------------------------------------------------------------ /// 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 @@ /// 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 @@ /// 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 @@ /// \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 @@ /// \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 @@ /// 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 @@ /// \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 @@ /// \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 @@ /// \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 @@ /// 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 @@ 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 @@ /// /// \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 @@ 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 §ion_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 @@ /// 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 @@ 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 @@ // 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); Index: include/lldb/Core/AddressRange.h =================================================================== --- include/lldb/Core/AddressRange.h +++ include/lldb/Core/AddressRange.h @@ -27,21 +27,16 @@ 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 @@ /// /// \param[in] byte_size /// The size in bytes of the address range. - //------------------------------------------------------------------ AddressRange(const lldb::SectionSP §ion, 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 @@ /// /// \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 @@ /// /// \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 @@ /// \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 @@ /// \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 @@ /// 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 @@ /// 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 @@ /// 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 @@ /// 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 @@ /// 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 @@ /// /// \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. }; Index: include/lldb/Core/AddressResolver.h =================================================================== --- include/lldb/Core/AddressResolver.h +++ include/lldb/Core/AddressResolver.h @@ -24,19 +24,15 @@ } 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: Index: include/lldb/Core/AddressResolverFileLine.h =================================================================== --- include/lldb/Core/AddressResolverFileLine.h +++ include/lldb/Core/AddressResolverFileLine.h @@ -28,12 +28,10 @@ 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: Index: include/lldb/Core/AddressResolverName.h =================================================================== --- include/lldb/Core/AddressResolverName.h +++ include/lldb/Core/AddressResolverName.h @@ -27,11 +27,9 @@ 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: Index: include/lldb/Core/Architecture.h =================================================================== --- include/lldb/Core/Architecture.h +++ include/lldb/Core/Architecture.h @@ -18,7 +18,6 @@ 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 @@ /// 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 @@ /// 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 @@ /// 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 @@ /// 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 @@ /// 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 { Index: include/lldb/Core/Communication.h =================================================================== --- include/lldb/Core/Communication.h +++ include/lldb/Core/Communication.h @@ -37,7 +37,6 @@ namespace lldb_private { -//---------------------------------------------------------------------- /// \class Communication Communication.h "lldb/Core/Communication.h" An /// abstract communications class. /// @@ -89,7 +88,6 @@ /// 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 @@ 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 @@ /// 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 @@ /// /// \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 @@ /// /// \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 @@ /// 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 &timeout, lldb::ConnectionStatus &status, Status *error_ptr); - //------------------------------------------------------------------ /// The actual write function that attempts to write to the communications /// protocol. /// @@ -228,11 +213,9 @@ /// /// \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 @@ /// /// \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 @@ /// \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 @@ /// \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 @@ const Timeout &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 @@ /// /// \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 @@ /// /// \return /// The number of bytes extracted from the data cache. - //------------------------------------------------------------------ size_t GetCachedBytes(void *dst, size_t dst_len); private: Index: include/lldb/Core/Debugger.h =================================================================== --- include/lldb/Core/Debugger.h +++ include/lldb/Core/Debugger.h @@ -74,12 +74,10 @@ 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, public UserID, @@ -169,7 +167,6 @@ } 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 @@ /// /// \return /// A global shared target list. - //------------------------------------------------------------------ TargetList &GetTargetList() { return m_target_list; } PlatformList &GetPlatformList() { return m_platform_list; } @@ -187,10 +183,8 @@ 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 @@ void SetLoggingCallback(lldb::LogOutputCallback log_callback, void *baton); - //---------------------------------------------------------------------- // Properties Functions - //---------------------------------------------------------------------- enum StopDisassemblyType { eStopDisassemblyTypeNever = 0, eStopDisassemblyTypeNoDebugInfo, @@ -416,9 +408,7 @@ lldb::ListenerSP m_forward_listener_sp; llvm::once_flag m_clear_once; - //---------------------------------------------------------------------- // Events for m_sync_broadcaster - //---------------------------------------------------------------------- enum { eBroadcastBitEventThreadIsListening = (1 << 0), }; Index: include/lldb/Core/Disassembler.h =================================================================== --- include/lldb/Core/Disassembler.h +++ include/lldb/Core/Disassembler.h @@ -109,7 +109,6 @@ m_address = addr; } - //------------------------------------------------------------------ /// Dump the text representation of this Instruction to a Stream /// /// Print the (optional) address, (optional) bytes, opcode, @@ -159,7 +158,6 @@ /// 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 @@ 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 @@ 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); }; Index: include/lldb/Core/DumpDataExtractor.h =================================================================== --- include/lldb/Core/DumpDataExtractor.h +++ include/lldb/Core/DumpDataExtractor.h @@ -20,7 +20,6 @@ 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 @@ /// /// \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, Index: include/lldb/Core/EmulateInstruction.h =================================================================== --- include/lldb/Core/EmulateInstruction.h +++ include/lldb/Core/EmulateInstruction.h @@ -44,7 +44,6 @@ namespace lldb_private { -//---------------------------------------------------------------------- /// \class EmulateInstruction EmulateInstruction.h /// "lldb/Core/EmulateInstruction.h" /// A class that allows emulation of CPU opcodes. @@ -102,7 +101,6 @@ /// 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 @@ ~EmulateInstruction() override = default; - //---------------------------------------------------------------------- // Mandatory overrides - //---------------------------------------------------------------------- virtual bool SupportsEmulatingInstructionsOfType(InstructionType inst_type) = 0; @@ -389,9 +385,7 @@ virtual bool GetRegisterInfo(lldb::RegisterKind reg_kind, uint32_t reg_num, RegisterInfo ®_info) = 0; - //---------------------------------------------------------------------- // Optional overrides - //---------------------------------------------------------------------- virtual bool SetInstruction(const Opcode &insn_opcode, const Address &inst_addr, Target *target); @@ -400,9 +394,7 @@ static const char *TranslateRegister(lldb::RegisterKind reg_kind, uint32_t reg_num, std::string ®_name); - //---------------------------------------------------------------------- // RegisterInfo variants - //---------------------------------------------------------------------- bool ReadRegister(const RegisterInfo *reg_info, RegisterValue ®_value); uint64_t ReadRegisterUnsigned(const RegisterInfo *reg_info, @@ -414,9 +406,7 @@ 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 ®_value); @@ -520,9 +510,7 @@ Opcode m_opcode; private: - //------------------------------------------------------------------ // For EmulateInstruction only - //------------------------------------------------------------------ DISALLOW_COPY_AND_ASSIGN(EmulateInstruction); }; Index: include/lldb/Core/FileLineResolver.h =================================================================== --- include/lldb/Core/FileLineResolver.h +++ include/lldb/Core/FileLineResolver.h @@ -25,11 +25,9 @@ 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: Index: include/lldb/Core/FileSpecList.h =================================================================== --- include/lldb/Core/FileSpecList.h +++ include/lldb/Core/FileSpecList.h @@ -22,19 +22,15 @@ 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 @@ /// Initialize this object from a vector of FileSpecs FileSpecList(std::vector &&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 @@ /// /// \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 @@ /// /// \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 @@ /// \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 @@ /// 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 @@ /// \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 @@ /// 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) { Index: include/lldb/Core/FormatEntity.h =================================================================== --- include/lldb/Core/FormatEntity.h +++ include/lldb/Core/FormatEntity.h @@ -215,14 +215,12 @@ 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); Index: include/lldb/Core/Highlighter.h =================================================================== --- include/lldb/Core/Highlighter.h +++ include/lldb/Core/Highlighter.h @@ -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 @@ /// 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 @@ static HighlightStyle MakeVimStyle(); }; -//---------------------------------------------------------------------- /// Annotates source code with color attributes. -//---------------------------------------------------------------------- class Highlighter { public: Highlighter() = default; Index: include/lldb/Core/IOHandler.h =================================================================== --- include/lldb/Core/IOHandler.h +++ include/lldb/Core/IOHandler.h @@ -138,23 +138,19 @@ 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 @@ 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 @@ 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 @@ /// 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 @@ /// "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 @@ /// 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 @@ 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, Index: include/lldb/Core/Mangled.h =================================================================== --- include/lldb/Core/Mangled.h +++ include/lldb/Core/Mangled.h @@ -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 @@ /// 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 @@ 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 @@ /// \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 @@ /// /// \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 @@ /// \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 @@ /// \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 @@ /// \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 @@ /// /// \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 @@ /// 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 @@ /// /// \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 @@ bool NameMatches(const RegularExpression ®ex, 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 @@ /// 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 @@ /// \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 @@ /// /// \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 @@ /// \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 @@ /// /// \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 Index: include/lldb/Core/Module.h =================================================================== --- include/lldb/Core/Module.h +++ include/lldb/Core/Module.h @@ -91,7 +91,6 @@ 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 @@ /// Module::GetSymbolVendor() is called. /// /// The module will parse more detailed information as more queries are made. -//---------------------------------------------------------------------- class Module : public std::enable_shared_from_this, public SymbolContextScope { public: @@ -123,7 +121,6 @@ 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 @@ /// 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 @@ 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 @@ /// \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 @@ 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 @@ /// /// \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 @@ /// /// \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 @@ /// \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 @@ 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 @@ /// /// \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 @@ /// /// \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 @@ /// /// \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 @@ /// /// \return /// The number of matches added to \a sc_list. - //------------------------------------------------------------------ size_t FindFunctions(const RegularExpression ®ex, bool symbols_ok, bool inlines_ok, bool append, SymbolContextList &sc_list); - //------------------------------------------------------------------ /// Find addresses by file/line /// /// \param[in] target_sp @@ -441,7 +414,6 @@ std::vector
&output_local, std::vector
&output_extern); - //------------------------------------------------------------------ /// Find global and static variables by name. /// /// \param[in] name @@ -460,12 +432,10 @@ /// /// \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 @@ /// /// \return /// The number of matches added to \a variable_list. - //------------------------------------------------------------------ size_t FindGlobalVariables(const RegularExpression ®ex, 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 @@ /// /// \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 &searched_symbol_files, @@ -527,7 +494,6 @@ 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 @@ /// /// \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 @@ /// /// \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 @@ /// /// \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 @@ 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 @@ /// /// \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 @@ 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 @@ /// 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 @@ /// /// \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 @@ /// 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 @@ /// \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 @@ /// \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 @@ /// 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 @@ /// 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 @@ /// 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 @@ /// 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 @@ /// 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 @@ /// 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 @@ 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 @@ return m_source_mappings; } - //------------------------------------------------------------------ /// Finds a source file given a file spec using the module source path /// remappings (if any). /// @@ -987,10 +911,8 @@ /// /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 @@ /// \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 @@ /// 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 @@ }; protected: - //------------------------------------------------------------------ // Member Variables - //------------------------------------------------------------------ mutable std::recursive_mutex m_mutex; ///< A mutex to keep this object happy ///in multi-threaded environments. @@ -1136,7 +1053,6 @@ 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 @@ /// 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, Index: include/lldb/Core/ModuleChild.h =================================================================== --- include/lldb/Core/ModuleChild.h +++ include/lldb/Core/ModuleChild.h @@ -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 @@ /// /// \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. }; Index: include/lldb/Core/ModuleList.h =================================================================== --- include/lldb/Core/ModuleList.h +++ include/lldb/Core/ModuleList.h @@ -83,13 +83,11 @@ 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 @@ 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 @@ /// /// \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 @@ /// 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 @@ /// /// \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 @@ /// 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 @@ 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 @@ /// 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 @@ 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 @@ /// \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 @@ /// \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 @@ /// 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 @@ /// 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 @@ /// /// \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 @@ /// /// \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 @@ /// /// \return /// The number of matches added to \a variable_list. - //------------------------------------------------------------------ size_t FindGlobalVariables(const RegularExpression ®ex, 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 @@ /// /// \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 @@ SymbolContextList &sc_list, bool append = false) const; - //------------------------------------------------------------------ /// Find types by name. /// /// \param[in] search_first @@ -470,7 +423,6 @@ /// /// \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 &searched_symbol_files, @@ -478,7 +430,6 @@ bool FindSourceFile(const FileSpec &orig_spec, FileSpec &new_spec) const; - //------------------------------------------------------------------ /// Find addresses by file/line /// /// \param[in] target_sp @@ -506,7 +457,6 @@ std::vector
&output_local, std::vector
&output_extern); - //------------------------------------------------------------------ /// Remove a module from the module list. /// /// \param[in] module_sp @@ -521,7 +471,6 @@ /// 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 @@ 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 &errors, @@ -592,9 +533,7 @@ &callback) const; protected: - //------------------------------------------------------------------ // Class typedefs. - //------------------------------------------------------------------ typedef std::vector collection; ///< The module collection type. @@ -607,9 +546,7 @@ void ClearImpl(bool use_notifier = true); - //------------------------------------------------------------------ // Member variables. - //------------------------------------------------------------------ collection m_modules; ///< The collection of modules. mutable std::recursive_mutex m_modules_mutex; Index: include/lldb/Core/PluginManager.h =================================================================== --- include/lldb/Core/PluginManager.h +++ include/lldb/Core/PluginManager.h @@ -40,9 +40,7 @@ static void Terminate(); - //------------------------------------------------------------------ // ABI - //------------------------------------------------------------------ static bool RegisterPlugin(ConstString name, const char *description, ABICreateInstance create_callback); @@ -53,9 +51,7 @@ static ABICreateInstance GetABICreateCallbackForPluginName(ConstString name); - //------------------------------------------------------------------ // Architecture - //------------------------------------------------------------------ using ArchitectureCreateInstance = std::unique_ptr (*)(const ArchSpec &); @@ -68,9 +64,7 @@ static std::unique_ptr CreateArchitectureInstance(const ArchSpec &arch); - //------------------------------------------------------------------ // Disassembler - //------------------------------------------------------------------ static bool RegisterPlugin(ConstString name, const char *description, DisassemblerCreateInstance create_callback); @@ -82,9 +76,7 @@ static DisassemblerCreateInstance GetDisassemblerCreateCallbackForPluginName(ConstString name); - //------------------------------------------------------------------ // DynamicLoader - //------------------------------------------------------------------ static bool RegisterPlugin(ConstString name, const char *description, DynamicLoaderCreateInstance create_callback, @@ -98,9 +90,7 @@ static DynamicLoaderCreateInstance GetDynamicLoaderCreateCallbackForPluginName(ConstString name); - //------------------------------------------------------------------ // JITLoader - //------------------------------------------------------------------ static bool RegisterPlugin(ConstString name, const char *description, JITLoaderCreateInstance create_callback, @@ -114,9 +104,7 @@ static JITLoaderCreateInstance GetJITLoaderCreateCallbackForPluginName(ConstString name); - //------------------------------------------------------------------ // EmulateInstruction - //------------------------------------------------------------------ static bool RegisterPlugin(ConstString name, const char *description, EmulateInstructionCreateInstance create_callback); @@ -129,9 +117,7 @@ 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 @@ static OperatingSystemCreateInstance GetOperatingSystemCreateCallbackForPluginName(ConstString name); - //------------------------------------------------------------------ // Language - //------------------------------------------------------------------ static bool RegisterPlugin(ConstString name, const char *description, LanguageCreateInstance create_callback); @@ -157,9 +141,7 @@ static LanguageCreateInstance GetLanguageCreateCallbackForPluginName(ConstString name); - //------------------------------------------------------------------ // LanguageRuntime - //------------------------------------------------------------------ static bool RegisterPlugin(ConstString name, const char *description, LanguageRuntimeCreateInstance create_callback, @@ -176,9 +158,7 @@ static LanguageRuntimeCreateInstance GetLanguageRuntimeCreateCallbackForPluginName(ConstString name); - //------------------------------------------------------------------ // SystemRuntime - //------------------------------------------------------------------ static bool RegisterPlugin(ConstString name, const char *description, SystemRuntimeCreateInstance create_callback); @@ -190,9 +170,7 @@ static SystemRuntimeCreateInstance GetSystemRuntimeCreateCallbackForPluginName(ConstString name); - //------------------------------------------------------------------ // ObjectFile - //------------------------------------------------------------------ static bool RegisterPlugin(ConstString name, const char *description, ObjectFileCreateInstance create_callback, @@ -220,9 +198,7 @@ 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 @@ static ObjectFileGetModuleSpecifications GetObjectContainerGetModuleSpecificationsCallbackAtIndex(uint32_t idx); - //------------------------------------------------------------------ // Platform - //------------------------------------------------------------------ static bool RegisterPlugin(ConstString name, const char *description, PlatformCreateInstance create_callback, @@ -260,9 +234,7 @@ 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 @@ 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 @@ 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 @@ /// /// \return /// Returns true upon success; otherwise, false. - //------------------------------------------------------------------ static bool RegisterPlugin(ConstString name, const char *description, StructuredDataPluginCreateInstance create_callback, @@ -352,9 +318,7 @@ GetStructuredDataFilterCallbackAtIndex(uint32_t idx, bool &iteration_complete); - //------------------------------------------------------------------ // SymbolFile - //------------------------------------------------------------------ static bool RegisterPlugin(ConstString name, const char *description, SymbolFileCreateInstance create_callback, @@ -368,9 +332,7 @@ static SymbolFileCreateInstance GetSymbolFileCreateCallbackForPluginName(ConstString name); - //------------------------------------------------------------------ // SymbolVendor - //------------------------------------------------------------------ static bool RegisterPlugin(ConstString name, const char *description, SymbolVendorCreateInstance create_callback); @@ -382,9 +344,7 @@ static SymbolVendorCreateInstance GetSymbolVendorCreateCallbackForPluginName(ConstString name); - //------------------------------------------------------------------ // UnwindAssembly - //------------------------------------------------------------------ static bool RegisterPlugin(ConstString name, const char *description, UnwindAssemblyCreateInstance create_callback); @@ -396,9 +356,7 @@ static UnwindAssemblyCreateInstance GetUnwindAssemblyCreateCallbackForPluginName(ConstString name); - //------------------------------------------------------------------ // MemoryHistory - //------------------------------------------------------------------ static bool RegisterPlugin(ConstString name, const char *description, MemoryHistoryCreateInstance create_callback); @@ -410,9 +368,7 @@ static MemoryHistoryCreateInstance GetMemoryHistoryCreateCallbackForPluginName(ConstString name); - //------------------------------------------------------------------ // InstrumentationRuntime - //------------------------------------------------------------------ static bool RegisterPlugin(ConstString name, const char *description, InstrumentationRuntimeCreateInstance create_callback, @@ -430,9 +386,7 @@ static InstrumentationRuntimeCreateInstance GetInstrumentationRuntimeCreateCallbackForPluginName(ConstString name); - //------------------------------------------------------------------ // TypeSystem - //------------------------------------------------------------------ static bool RegisterPlugin( ConstString name, const char *description, TypeSystemCreateInstance create_callback, @@ -453,9 +407,7 @@ GetTypeSystemEnumerateSupportedLanguagesCallbackForPluginName( ConstString name); - //------------------------------------------------------------------ // REPL - //------------------------------------------------------------------ static bool RegisterPlugin(ConstString name, const char *description, REPLCreateInstance create_callback, @@ -475,13 +427,11 @@ 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 Index: include/lldb/Core/STLUtils.h =================================================================== --- include/lldb/Core/STLUtils.h +++ include/lldb/Core/STLUtils.h @@ -16,28 +16,22 @@ #include -//---------------------------------------------------------------------- // 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 whose value is equal // to something -//---------------------------------------------------------------------- template class ValueEquals { public: ValueEquals(const S &val) : second_value(val) {} Index: include/lldb/Core/SearchFilter.h =================================================================== --- include/lldb/Core/SearchFilter.h +++ include/lldb/Core/SearchFilter.h @@ -50,16 +50,12 @@ 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 @@ 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 @@ /// 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 @@ 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 @@ /// /// \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 @@ /// /// \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 @@ /// /// \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 @@ /// /// \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 @@ /// /// \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 @@ /// \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 @@ /// 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 @@ 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 @@ 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 @@ /// /// \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 @@ 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 @@ /// /// \param[in] module /// The Module that limits the search. - //------------------------------------------------------------------ SearchFilterByModuleList(const lldb::TargetSP &targetSP, const FileSpecList &module_list); @@ -474,7 +432,6 @@ 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 @@ /// /// \param[in] module /// The Module that limits the search. - //------------------------------------------------------------------ SearchFilterByModuleListAndCU(const lldb::TargetSP &targetSP, const FileSpecList &module_list, const FileSpecList &cu_list); Index: include/lldb/Core/Section.h =================================================================== --- include/lldb/Core/Section.h +++ include/lldb/Core/Section.h @@ -189,20 +189,15 @@ 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 @@ /// 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 @@ /// 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; } Index: include/lldb/Core/SourceManager.h =================================================================== --- include/lldb/Core/SourceManager.h +++ include/lldb/Core/SourceManager.h @@ -117,9 +117,7 @@ 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 Index: include/lldb/Core/StreamFile.h =================================================================== --- include/lldb/Core/StreamFile.h +++ include/lldb/Core/StreamFile.h @@ -21,9 +21,7 @@ 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 @@ protected: - //------------------------------------------------------------------ // Classes that inherit from StreamFile can see and modify these - //------------------------------------------------------------------ File m_file; size_t WriteImpl(const void *s, size_t length) override; Index: include/lldb/Core/ThreadSafeSTLMap.h =================================================================== --- include/lldb/Core/ThreadSafeSTLMap.h +++ include/lldb/Core/ThreadSafeSTLMap.h @@ -21,9 +21,7 @@ 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 @@ collection m_collection; mutable std::recursive_mutex m_mutex; - //------------------------------------------------------------------ // For ThreadSafeSTLMap only - //------------------------------------------------------------------ DISALLOW_COPY_AND_ASSIGN(ThreadSafeSTLMap); }; Index: include/lldb/Core/ThreadSafeSTLVector.h =================================================================== --- include/lldb/Core/ThreadSafeSTLVector.h +++ include/lldb/Core/ThreadSafeSTLVector.h @@ -22,9 +22,7 @@ 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 @@ collection m_collection; mutable std::recursive_mutex m_mutex; - //------------------------------------------------------------------ // For ThreadSafeSTLVector only - //------------------------------------------------------------------ DISALLOW_COPY_AND_ASSIGN(ThreadSafeSTLVector); }; Index: include/lldb/Core/ThreadSafeValue.h =================================================================== --- include/lldb/Core/ThreadSafeValue.h +++ include/lldb/Core/ThreadSafeValue.h @@ -18,9 +18,7 @@ template class ThreadSafeValue { public: - //------------------------------------------------------------------ // Constructors and Destructors - //------------------------------------------------------------------ ThreadSafeValue() : m_value(), m_mutex() {} ThreadSafeValue(const T &value) : m_value(value), m_mutex() {} @@ -55,9 +53,7 @@ T m_value; mutable std::recursive_mutex m_mutex; - //------------------------------------------------------------------ // For ThreadSafeValue only - //------------------------------------------------------------------ DISALLOW_COPY_AND_ASSIGN(ThreadSafeValue); }; Index: include/lldb/Core/UniqueCStringMap.h =================================================================== --- include/lldb/Core/UniqueCStringMap.h +++ include/lldb/Core/UniqueCStringMap.h @@ -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 class UniqueCStringMap { public: struct Entry { @@ -44,11 +42,9 @@ T value; }; - //------------------------------------------------------------------ // Call this function multiple times to add a bunch of entries to this map, // then later call UniqueCStringMap::Sort() before doing any searches by // name. - //------------------------------------------------------------------ void Append(ConstString unique_cstr, const T &value) { m_map.push_back(typename UniqueCStringMap::Entry(unique_cstr, value)); } @@ -57,10 +53,8 @@ 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::Entry e(unique_cstr, value); m_map.insert(std::upper_bound(m_map.begin(), m_map.end(), e), e); @@ -70,12 +64,10 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 my_map; @@ -215,16 +194,13 @@ // 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()); Index: include/lldb/Core/ValueObject.h =================================================================== --- include/lldb/Core/ValueObject.h +++ include/lldb/Core/ValueObject.h @@ -379,16 +379,12 @@ 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 @@ virtual bool GetDeclaration(Declaration &decl); - //------------------------------------------------------------------ // The functions below should NOT be modified by subclasses - //------------------------------------------------------------------ const Status &GetError(); ConstString GetName() const; @@ -788,7 +782,6 @@ 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 @@ /// \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 @@ 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 @@ 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 @@ void ClearDynamicTypeInformation(); - //------------------------------------------------------------------ // Subclasses must implement the functions below. - //------------------------------------------------------------------ virtual CompilerType GetCompilerTypeImpl() = 0; @@ -1031,14 +1017,12 @@ 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; Index: include/lldb/Core/ValueObjectCast.h =================================================================== --- include/lldb/Core/ValueObjectCast.h +++ include/lldb/Core/ValueObjectCast.h @@ -24,9 +24,7 @@ namespace lldb_private { -//--------------------------------------------------------------------------------- // A ValueObject that represents a given value represented as a different type. -//--------------------------------------------------------------------------------- class ValueObjectCast : public ValueObject { public: ~ValueObjectCast() override; Index: include/lldb/Core/ValueObjectChild.h =================================================================== --- include/lldb/Core/ValueObjectChild.h +++ include/lldb/Core/ValueObjectChild.h @@ -25,9 +25,7 @@ namespace lldb_private { -//---------------------------------------------------------------------- // A child of another ValueObject. -//---------------------------------------------------------------------- class ValueObjectChild : public ValueObject { public: ~ValueObjectChild() override; Index: include/lldb/Core/ValueObjectConstResult.h =================================================================== --- include/lldb/Core/ValueObjectConstResult.h +++ include/lldb/Core/ValueObjectConstResult.h @@ -35,9 +35,7 @@ } namespace lldb_private { -//---------------------------------------------------------------------- // A frozen ValueObject copied into host memory -//---------------------------------------------------------------------- class ValueObjectConstResult : public ValueObject { public: ~ValueObjectConstResult() override; Index: include/lldb/Core/ValueObjectConstResultChild.h =================================================================== --- include/lldb/Core/ValueObjectConstResultChild.h +++ include/lldb/Core/ValueObjectConstResultChild.h @@ -31,9 +31,7 @@ namespace lldb_private { -//---------------------------------------------------------------------- // A child of a ValueObjectConstResult. -//---------------------------------------------------------------------- class ValueObjectConstResultChild : public ValueObjectChild { public: ValueObjectConstResultChild(ValueObject &parent, Index: include/lldb/Core/ValueObjectConstResultImpl.h =================================================================== --- include/lldb/Core/ValueObjectConstResultImpl.h +++ include/lldb/Core/ValueObjectConstResultImpl.h @@ -32,11 +32,9 @@ 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, Index: include/lldb/Core/ValueObjectDynamicValue.h =================================================================== --- include/lldb/Core/ValueObjectDynamicValue.h +++ include/lldb/Core/ValueObjectDynamicValue.h @@ -35,10 +35,8 @@ } 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; Index: include/lldb/Core/ValueObjectList.h =================================================================== --- include/lldb/Core/ValueObjectList.h +++ include/lldb/Core/ValueObjectList.h @@ -22,14 +22,10 @@ namespace lldb_private { -//---------------------------------------------------------------------- // A collection of ValueObject values that -//---------------------------------------------------------------------- class ValueObjectList { public: - //------------------------------------------------------------------ // Constructors and Destructors - //------------------------------------------------------------------ ValueObjectList(); ValueObjectList(const ValueObjectList &rhs); @@ -67,9 +63,7 @@ } protected: typedef std::vector collection; - //------------------------------------------------------------------ // Classes that inherit from ValueObjectList can see and modify these - //------------------------------------------------------------------ collection m_value_objects; }; Index: include/lldb/Core/ValueObjectMemory.h =================================================================== --- include/lldb/Core/ValueObjectMemory.h +++ include/lldb/Core/ValueObjectMemory.h @@ -27,10 +27,8 @@ 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 @@ ValueObjectMemory(ExecutionContextScope *exe_scope, llvm::StringRef name, const Address &address, const CompilerType &ast_type); - //------------------------------------------------------------------ // For ValueObject only - //------------------------------------------------------------------ DISALLOW_COPY_AND_ASSIGN(ValueObjectMemory); }; Index: include/lldb/Core/ValueObjectRegister.h =================================================================== --- include/lldb/Core/ValueObjectRegister.h +++ include/lldb/Core/ValueObjectRegister.h @@ -39,10 +39,8 @@ 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 @@ private: ValueObjectRegisterContext(ValueObject &parent, lldb::RegisterContextSP ®_ctx_sp); - //------------------------------------------------------------------ // For ValueObject only - //------------------------------------------------------------------ DISALLOW_COPY_AND_ASSIGN(ValueObjectRegisterContext); }; @@ -123,9 +119,7 @@ ValueObjectRegisterSet(ExecutionContextScope *exe_scope, lldb::RegisterContextSP ®_ctx_sp, uint32_t set_idx); - //------------------------------------------------------------------ // For ValueObject only - //------------------------------------------------------------------ DISALLOW_COPY_AND_ASSIGN(ValueObjectRegisterSet); }; @@ -179,9 +173,7 @@ ValueObjectRegister(ExecutionContextScope *exe_scope, lldb::RegisterContextSP ®_ctx_sp, uint32_t reg_num); - //------------------------------------------------------------------ // For ValueObject only - //------------------------------------------------------------------ DISALLOW_COPY_AND_ASSIGN(ValueObjectRegister); }; Index: include/lldb/Core/ValueObjectSyntheticFilter.h =================================================================== --- include/lldb/Core/ValueObjectSyntheticFilter.h +++ include/lldb/Core/ValueObjectSyntheticFilter.h @@ -35,13 +35,11 @@ } 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; Index: include/lldb/Core/ValueObjectVariable.h =================================================================== --- include/lldb/Core/ValueObjectVariable.h +++ include/lldb/Core/ValueObjectVariable.h @@ -39,10 +39,8 @@ 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 @@ private: ValueObjectVariable(ExecutionContextScope *exe_scope, const lldb::VariableSP &var_sp); - //------------------------------------------------------------------ // For ValueObject only - //------------------------------------------------------------------ DISALLOW_COPY_AND_ASSIGN(ValueObjectVariable); }; Index: include/lldb/Expression/DWARFExpression.h =================================================================== --- include/lldb/Expression/DWARFExpression.h +++ include/lldb/Expression/DWARFExpression.h @@ -21,7 +21,6 @@ namespace lldb_private { -//---------------------------------------------------------------------- /// \class DWARFExpression DWARFExpression.h /// "lldb/Expression/DWARFExpression.h" Encapsulates a DWARF location /// expression and interprets it. @@ -33,7 +32,6 @@ /// 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 @@ // (.debug_loclists/.debug_loclists.dwo). }; - //------------------------------------------------------------------ /// Constructor - //------------------------------------------------------------------ explicit DWARFExpression(DWARFUnit *dwarf_cu); - //------------------------------------------------------------------ /// Constructor /// /// \param[in] data @@ -62,22 +57,16 @@ /// /// \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 @@ /// \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 @@ /// \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 @@ 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 @@ /// \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 @@ std::function 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 @@ /// /// \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 @@ /// /// \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 @@ 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 @@ /// 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 @@ /// \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 @@ bool MatchesOperand(StackFrame &frame, const Instruction::Operand &op); protected: - //------------------------------------------------------------------ /// Pretty-prints the location expression to a stream /// /// \param[in] stream @@ -384,7 +345,6 @@ /// \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 @@ 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 Index: include/lldb/Expression/Expression.h =================================================================== --- include/lldb/Expression/Expression.h +++ include/lldb/Expression/Expression.h @@ -22,7 +22,6 @@ class RecordingMemoryManager; -//---------------------------------------------------------------------- /// \class Expression Expression.h "lldb/Expression/Expression.h" Encapsulates /// a single expression for use in lldb /// @@ -31,7 +30,6 @@ /// 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 @@ 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; } Index: include/lldb/Expression/ExpressionParser.h =================================================================== --- include/lldb/Expression/ExpressionParser.h +++ include/lldb/Expression/ExpressionParser.h @@ -18,16 +18,13 @@ 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 @@ /// /// \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 @@ /// \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 @@ /// \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 @@ /// /// \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 @@ /// \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 &execution_unit_sp, Index: include/lldb/Expression/ExpressionTypeSystemHelper.h =================================================================== --- include/lldb/Expression/ExpressionTypeSystemHelper.h +++ include/lldb/Expression/ExpressionTypeSystemHelper.h @@ -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 @@ /// dyn_cast so that the expression parser can cast it back to the requisite /// specific type. /// -//---------------------------------------------------------------------- class ExpressionTypeSystemHelper { public: Index: include/lldb/Expression/ExpressionVariable.h =================================================================== --- include/lldb/Expression/ExpressionVariable.h +++ include/lldb/Expression/ExpressionVariable.h @@ -25,9 +25,7 @@ class ExpressionVariable : public std::enable_shared_from_this { 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 @@ 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 @@ return false; } - //---------------------------------------------------------------------- /// Finds a variable by name in the list. /// /// \param[in] name @@ -169,7 +162,6 @@ /// \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 @@ 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; } Index: include/lldb/Expression/FunctionCaller.h =================================================================== --- include/lldb/Expression/FunctionCaller.h +++ include/lldb/Expression/FunctionCaller.h @@ -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 @@ /// /// 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 @@ return E->getKind() == eKindFunctionCaller; } - //------------------------------------------------------------------ /// Constructor /// /// \param[in] exe_scope @@ -82,18 +79,14 @@ /// \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 @@ /// /// \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 @@ /// /// \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 @@ /// /// \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 @@ /// /// \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 @@ /// /// \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 @@ /// \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 @@ /// /// \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 @@ /// /// \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 @@ /// /// \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 @@ 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 @@ -374,7 +337,6 @@ 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. Index: include/lldb/Expression/IRDynamicChecks.h =================================================================== --- include/lldb/Expression/IRDynamicChecks.h +++ include/lldb/Expression/IRDynamicChecks.h @@ -30,7 +30,6 @@ class ExecutionContext; class Stream; -//---------------------------------------------------------------------- /// \class DynamicCheckerFunctions IRDynamicChecks.h /// "lldb/Expression/IRDynamicChecks.h" Encapsulates dynamic check functions /// used by expressions. @@ -44,20 +43,14 @@ /// /// 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 @@ /// \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 @@ std::unique_ptr 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 @@ /// /// 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 @@ /// \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 @@ /// /// \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 @@ /// /// \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 Index: include/lldb/Expression/IRExecutionUnit.h =================================================================== --- include/lldb/Expression/IRExecutionUnit.h +++ include/lldb/Expression/IRExecutionUnit.h @@ -36,7 +36,6 @@ 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 @@ /// 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, public IRMemoryMap, public ObjectFileJITDelegate { public: - //------------------------------------------------------------------ /// Constructor - //------------------------------------------------------------------ IRExecutionUnit(std::unique_ptr &context_up, std::unique_ptr &module_up, ConstString &name, const lldb::TargetSP &target_sp, const SymbolContext &sym_ctx, std::vector &cpu_features); - //------------------------------------------------------------------ /// Destructor - //------------------------------------------------------------------ ~IRExecutionUnit() override; ConstString GetFunctionName() { return m_name; } @@ -84,19 +78,15 @@ 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 @@ void GetStaticInitializers(std::vector &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 @@ /// 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 @@ /// \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 @@ } 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 @@ /// /// \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 @@ /// /// \return /// The range of the containing object in the target process. - //------------------------------------------------------------------ typedef std::pair 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 @@ /// 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 @@ /// /// \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 @@ ~MemoryManager() override; - //------------------------------------------------------------------ /// Allocate space for executable code, and add it to the m_spaceBlocks /// map /// @@ -281,12 +256,10 @@ /// /// \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 @@ /// /// \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 @@ /// /// \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 @@ 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 Index: include/lldb/Expression/IRInterpreter.h =================================================================== --- include/lldb/Expression/IRInterpreter.h +++ include/lldb/Expression/IRInterpreter.h @@ -26,7 +26,6 @@ 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 @@ /// 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, Index: include/lldb/Expression/IRMemoryMap.h =================================================================== --- include/lldb/Expression/IRMemoryMap.h +++ include/lldb/Expression/IRMemoryMap.h @@ -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 @@ /// 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); Index: include/lldb/Expression/LLVMUserExpression.h =================================================================== --- include/lldb/Expression/LLVMUserExpression.h +++ include/lldb/Expression/LLVMUserExpression.h @@ -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 @@ /// 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 @@ 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; Index: include/lldb/Expression/REPL.h =================================================================== --- include/lldb/Expression/REPL.h +++ include/lldb/Expression/REPL.h @@ -20,9 +20,7 @@ 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 @@ ~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 @@ /// /// \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 @@ Status RunLoop(); - //------------------------------------------------------------------ // IOHandler::Delegate functions - //------------------------------------------------------------------ void IOHandlerActivated(IOHandler &io_handler, bool interactive) override; bool IOHandlerInterrupt(IOHandler &io_handler) override; @@ -117,9 +111,7 @@ protected: static int CalculateActualIndentation(const StringList &lines); - //---------------------------------------------------------------------- // Subclasses should override these functions to implement a functional REPL. - //---------------------------------------------------------------------- virtual Status DoInitialization() = 0; Index: include/lldb/Expression/UserExpression.h =================================================================== --- include/lldb/Expression/UserExpression.h +++ include/lldb/Expression/UserExpression.h @@ -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 @@ /// 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 @@ enum { kDefaultTimeout = 500000u }; - //------------------------------------------------------------------ /// Constructor /// /// \param[in] expr @@ -61,19 +58,15 @@ /// \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 @@ /// /// \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 @@ /// \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 @@ bool MatchesContext(ExecutionContext &exe_ctx); - //------------------------------------------------------------------ /// Execute the parsed expression by callinng the derived class's DoExecute /// method. /// @@ -158,14 +147,12 @@ /// /// \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 @@ /// /// \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 @@ 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 @@ /// \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 @@ 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); Index: include/lldb/Expression/UtilityFunction.h =================================================================== --- include/lldb/Expression/UtilityFunction.h +++ include/lldb/Expression/UtilityFunction.h @@ -19,7 +19,6 @@ namespace lldb_private { -//---------------------------------------------------------------------- /// \class UtilityFunction UtilityFunction.h /// "lldb/Expression/UtilityFunction.h" Encapsulates a bit of source code that /// provides a function that is callable @@ -28,7 +27,6 @@ /// and as a backend for the expr command. UtilityFunction encapsulates a /// self-contained function meant to be used from other code. Utility /// functions can perform error-checking for ClangUserExpressions, -//---------------------------------------------------------------------- class UtilityFunction : public Expression { public: /// LLVM-style RTTI support. @@ -36,7 +34,6 @@ return E->getKind() == eKindUtilityFunction; } - //------------------------------------------------------------------ /// Constructor /// /// \param[in] text @@ -44,13 +41,11 @@ /// /// \param[in] name /// The name of the function, as used in the text. - //------------------------------------------------------------------ UtilityFunction(ExecutionContextScope &exe_scope, const char *text, const char *name, ExpressionKind kind); ~UtilityFunction() override; - //------------------------------------------------------------------ /// Install the utility function into a process /// /// \param[in] diagnostic_manager @@ -61,11 +56,9 @@ /// /// \return /// True on success (no errors); false otherwise. - //------------------------------------------------------------------ virtual bool Install(DiagnosticManager &diagnostic_manager, ExecutionContext &exe_ctx) = 0; - //------------------------------------------------------------------ /// Check whether the given PC is inside the function /// /// Especially useful if the function dereferences nullptr to indicate a @@ -77,39 +70,28 @@ /// \return /// True if the program counter falls within the function's bounds; /// false if not (or the function is not JIT compiled) - //------------------------------------------------------------------ bool ContainsAddress(lldb::addr_t address) { // nothing is both >= LLDB_INVALID_ADDRESS and < LLDB_INVALID_ADDRESS, so // this always returns false if the function is not JIT compiled yet return (address >= m_jit_start_addr && address < m_jit_end_addr); } - //------------------------------------------------------------------ /// Return the string that the parser should parse. Must be a full /// translation unit. - //------------------------------------------------------------------ const char *Text() override { return m_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_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; } // This makes the function caller function. Pass in the ThreadSP if you have Index: include/lldb/Host/Debug.h =================================================================== --- include/lldb/Host/Debug.h +++ include/lldb/Host/Debug.h @@ -15,9 +15,7 @@ namespace lldb_private { -//------------------------------------------------------------------ // Tells a thread what it needs to do when the process is resumed. -//------------------------------------------------------------------ struct ResumeAction { lldb::tid_t tid; // The thread ID that this action applies to, // LLDB_INVALID_THREAD_ID for the default thread @@ -28,12 +26,10 @@ // value is > 0 }; -//------------------------------------------------------------------ // A class that contains instructions for all threads for // NativeProcessProtocol::Resume(). Each thread can either run, stay suspended, // or step when the process is resumed. We optionally have the ability to also // send a signal to the thread when the action is run or step. -//------------------------------------------------------------------ class ResumeActionList { public: ResumeActionList() : m_actions(), m_signal_handled() {} Index: include/lldb/Host/File.h =================================================================== --- include/lldb/Host/File.h +++ include/lldb/Host/File.h @@ -21,13 +21,11 @@ namespace lldb_private { -//---------------------------------------------------------------------- /// \class File File.h "lldb/Host/File.h" /// A file class. /// /// A file class that divides abstracts the LLDB core from host file /// functionality. -//---------------------------------------------------------------------- class File : public IOObject { public: static int kInvalidDescriptor; @@ -72,18 +70,15 @@ m_is_interactive(eLazyBoolCalculate), m_is_real_terminal(eLazyBoolCalculate) {} - //------------------------------------------------------------------ /// Destructor. /// /// The destructor is virtual in case this class is subclassed. - //------------------------------------------------------------------ ~File() override; bool IsValid() const override { return DescriptorIsValid() || StreamIsValid(); } - //------------------------------------------------------------------ /// Convert to pointer operator. /// /// This allows code to check a File object to see if it contains anything @@ -98,10 +93,8 @@ /// \return /// A pointer to this object if either the directory or filename /// is valid, nullptr otherwise. - //------------------------------------------------------------------ operator bool() const { return DescriptorIsValid() || StreamIsValid(); } - //------------------------------------------------------------------ /// Logical NOT operator. /// /// This allows code to check a File object to see if it is invalid using @@ -116,15 +109,12 @@ /// \return /// Returns \b true if the object has an empty directory and /// filename, \b false otherwise. - //------------------------------------------------------------------ bool operator!() const { return !DescriptorIsValid() && !StreamIsValid(); } - //------------------------------------------------------------------ /// Get the file spec for this file. /// /// \return /// A reference to the file specification object. - //------------------------------------------------------------------ Status GetFileSpec(FileSpec &file_spec) const; Status Close() override; @@ -141,7 +131,6 @@ void SetStream(FILE *fh, bool transfer_ownership); - //------------------------------------------------------------------ /// Read bytes from a file from the current file position. /// /// NOTE: This function is NOT thread safe. Use the read function @@ -158,10 +147,8 @@ /// \return /// An error object that indicates success or the reason for /// failure. - //------------------------------------------------------------------ Status Read(void *buf, size_t &num_bytes) override; - //------------------------------------------------------------------ /// Write bytes to a file at the current file position. /// /// NOTE: This function is NOT thread safe. Use the write function @@ -179,10 +166,8 @@ /// \return /// An error object that indicates success or the reason for /// failure. - //------------------------------------------------------------------ Status Write(const void *buf, size_t &num_bytes) override; - //------------------------------------------------------------------ /// Seek to an offset relative to the beginning of the file. /// /// NOTE: This function is NOT thread safe, other threads that @@ -201,10 +186,8 @@ /// /// \return /// The resulting seek offset, or -1 on error. - //------------------------------------------------------------------ off_t SeekFromStart(off_t offset, Status *error_ptr = nullptr); - //------------------------------------------------------------------ /// Seek to an offset relative to the current file position. /// /// NOTE: This function is NOT thread safe, other threads that @@ -223,10 +206,8 @@ /// /// \return /// The resulting seek offset, or -1 on error. - //------------------------------------------------------------------ off_t SeekFromCurrent(off_t offset, Status *error_ptr = nullptr); - //------------------------------------------------------------------ /// Seek to an offset relative to the end of the file. /// /// NOTE: This function is NOT thread safe, other threads that @@ -246,10 +227,8 @@ /// /// \return /// The resulting seek offset, or -1 on error. - //------------------------------------------------------------------ off_t SeekFromEnd(off_t offset, Status *error_ptr = nullptr); - //------------------------------------------------------------------ /// Read bytes from a file from the specified file offset. /// /// NOTE: This function is thread safe in that clients manager their @@ -271,10 +250,8 @@ /// \return /// An error object that indicates success or the reason for /// failure. - //------------------------------------------------------------------ Status Read(void *dst, size_t &num_bytes, off_t &offset); - //------------------------------------------------------------------ /// Read bytes from a file from the specified file offset. /// /// NOTE: This function is thread safe in that clients manager their @@ -302,11 +279,9 @@ /// \return /// An error object that indicates success or the reason for /// failure. - //------------------------------------------------------------------ Status Read(size_t &num_bytes, off_t &offset, bool null_terminate, lldb::DataBufferSP &data_buffer_sp); - //------------------------------------------------------------------ /// Write bytes to a file at the specified file offset. /// /// NOTE: This function is thread safe in that clients manager their @@ -330,46 +305,36 @@ /// \return /// An error object that indicates success or the reason for /// failure. - //------------------------------------------------------------------ Status Write(const void *src, size_t &num_bytes, off_t &offset); - //------------------------------------------------------------------ /// Flush the current stream /// /// \return /// An error object that indicates success or the reason for /// failure. - //------------------------------------------------------------------ Status Flush(); - //------------------------------------------------------------------ /// Sync to disk. /// /// \return /// An error object that indicates success or the reason for /// failure. - //------------------------------------------------------------------ Status Sync(); - //------------------------------------------------------------------ /// Get the permissions for a this file. /// /// \return /// Bits logical OR'ed together from the permission bits defined /// in lldb_private::File::Permissions. - //------------------------------------------------------------------ uint32_t GetPermissions(Status &error) const; - //------------------------------------------------------------------ /// Return true if this file is interactive. /// /// \return /// True if this file is a terminal (tty or pty), false /// otherwise. - //------------------------------------------------------------------ bool GetIsInteractive(); - //------------------------------------------------------------------ /// Return true if this file from a real terminal. /// /// Just knowing a file is a interactive isn't enough, we also need to know @@ -379,12 +344,10 @@ /// \return /// True if this file is a terminal (tty, not a pty) that has /// a non-zero width and height, false otherwise. - //------------------------------------------------------------------ bool GetIsRealTerminal(); bool GetIsTerminalWithColors(); - //------------------------------------------------------------------ /// Output printf formatted output to the stream. /// /// Print some formatted output to the stream. @@ -395,7 +358,6 @@ /// \param[in] ... /// Variable arguments that are needed for the printf style /// format string \a format. - //------------------------------------------------------------------ size_t Printf(const char *format, ...) __attribute__((format(printf, 2, 3))); size_t PrintfVarArg(const char *format, va_list args); @@ -411,9 +373,7 @@ void CalculateInteractiveAndTerminal(); - //------------------------------------------------------------------ // Member variables - //------------------------------------------------------------------ int m_descriptor; FILE *m_stream; uint32_t m_options; Index: include/lldb/Host/Host.h =================================================================== --- include/lldb/Host/Host.h +++ include/lldb/Host/Host.h @@ -30,9 +30,7 @@ class ProcessInstanceInfoList; class ProcessInstanceInfoMatch; -//---------------------------------------------------------------------- // Exit Type for inferior processes -//---------------------------------------------------------------------- struct WaitStatus { enum Type : uint8_t { Exit, // The status represents the return code from normal @@ -57,12 +55,10 @@ inline bool operator!=(WaitStatus a, WaitStatus b) { return !(a == b); } -//---------------------------------------------------------------------- /// \class Host Host.h "lldb/Host/Host.h" /// A class that provides host computer information. /// /// Host is a class that answers information about the host operating system. -//---------------------------------------------------------------------- class Host { public: typedef std::function // Exit value of process if signal is zero MonitorChildProcessCallback; - //------------------------------------------------------------------ /// Start monitoring a child process. /// /// Allows easy monitoring of child processes. \a callback will be called @@ -104,7 +99,6 @@ /// was spawned to monitor \a pid. /// /// \see static void Host::StopMonitoringChildProcess (uint32_t) - //------------------------------------------------------------------ static HostThread StartMonitoringChildProcess(const MonitorChildProcessCallback &callback, lldb::pid_t pid, bool monitor_signals); @@ -116,28 +110,23 @@ static void SystemLog(SystemLogType type, const char *format, va_list args); - //------------------------------------------------------------------ /// Get the process ID for the calling process. /// /// \return /// The process ID for the current process. - //------------------------------------------------------------------ static lldb::pid_t GetCurrentProcessID(); static void Kill(lldb::pid_t pid, int signo); - //------------------------------------------------------------------ /// Get the thread token (the one returned by ThreadCreate when the thread /// was created) for the calling thread in the current process. /// /// \return /// The thread token for the calling thread in the current process. - //------------------------------------------------------------------ static lldb::thread_t GetCurrentThread(); static const char *GetSignalAsCString(int signo); - //------------------------------------------------------------------ /// Given an address in the current process (the process that is running the /// LLDB code), return the name of the module that it comes from. This can /// be useful when you need to know the path to the shared library that your @@ -151,10 +140,8 @@ /// \b A file spec with the module that contains \a host_addr, /// which may be invalid if \a host_addr doesn't fall into /// any valid module address range. - //------------------------------------------------------------------ static FileSpec GetModuleFileSpecForHostAddress(const void *host_addr); - //------------------------------------------------------------------ /// If you have an executable that is in a bundle and want to get back to /// the bundle directory from the path itself, this function will change a /// path to a file within a bundle to the bundle directory itself. @@ -170,11 +157,9 @@ /// \return /// \b true if \a file was resolved in \a bundle_directory, /// \b false otherwise. - //------------------------------------------------------------------ static bool GetBundleDirectory(const FileSpec &file, FileSpec &bundle_directory); - //------------------------------------------------------------------ /// When executable files may live within a directory, where the directory /// represents an executable bundle (like the MacOSX app bundles), then /// locate the executable within the containing bundle. @@ -187,7 +172,6 @@ /// \return /// \b true if \a file was resolved, \b false if this function /// was not able to resolve the path. - //------------------------------------------------------------------ static bool ResolveExecutableInBundle(FileSpec &file); static uint32_t FindProcesses(const ProcessInstanceInfoMatch &match_info, @@ -204,13 +188,11 @@ /// terminates. static Status LaunchProcess(ProcessLaunchInfo &launch_info); - //------------------------------------------------------------------ /// Perform expansion of the command-line for this launch info This can /// potentially involve wildcard expansion /// environment variable replacement, and whatever other /// argument magic the platform defines as part of its typical /// user experience - //------------------------------------------------------------------ static Status ShellExpandArguments(ProcessLaunchInfo &launch_info); // TODO: Convert this function to take a StringRef. Index: include/lldb/Host/HostInfo.h =================================================================== --- include/lldb/Host/HostInfo.h +++ include/lldb/Host/HostInfo.h @@ -9,7 +9,6 @@ #ifndef lldb_Host_HostInfo_h_ #define lldb_Host_HostInfo_h_ -//---------------------------------------------------------------------- /// \class HostInfo HostInfo.h "lldb/Host/HostInfo.h" /// A class that provides host computer information. /// @@ -32,7 +31,6 @@ /// method and if used in a context where the method doesn't make sense, will /// generate a compiler error. /// -//---------------------------------------------------------------------- #if defined(_WIN32) #include "lldb/Host/windows/HostInfoWindows.h" Index: include/lldb/Host/HostInfoBase.h =================================================================== --- include/lldb/Host/HostInfoBase.h +++ include/lldb/Host/HostInfoBase.h @@ -33,21 +33,17 @@ static void Initialize(); static void Terminate(); - //------------------------------------------------------------------ /// Gets the host target triple as a const string. /// /// \return /// A const string object containing the host target triple. - //------------------------------------------------------------------ static llvm::StringRef GetTargetTriple(); - //------------------------------------------------------------------ /// Gets the host architecture. /// /// \return /// A const architecture object that represents the host /// architecture. - //------------------------------------------------------------------ enum ArchitectureKind { eArchKindDefault, // The overall default architecture that applications will // run on this host @@ -92,11 +88,9 @@ /// FileSpec is filled in. static FileSpec GetGlobalTempDir(); - //--------------------------------------------------------------------------- /// If the triple does not specify the vendor, os, and environment parts, we /// "augment" these using information from the host and return the resulting /// ArchSpec object. - //--------------------------------------------------------------------------- static ArchSpec GetAugmentedArchSpec(llvm::StringRef triple); static bool ComputePathRelativeToLibrary(FileSpec &file_spec, Index: include/lldb/Host/HostProcess.h =================================================================== --- include/lldb/Host/HostProcess.h +++ include/lldb/Host/HostProcess.h @@ -12,7 +12,6 @@ #include "lldb/Host/Host.h" #include "lldb/lldb-types.h" -//---------------------------------------------------------------------- /// \class HostInfo HostInfo.h "lldb/Host/HostProcess.h" /// A class that represents a running process on the host machine. /// @@ -26,7 +25,6 @@ /// statically to the concrete Process implementation for that platform. See /// HostInfo for more details. /// -//---------------------------------------------------------------------- namespace lldb_private { Index: include/lldb/Host/HostThread.h =================================================================== --- include/lldb/Host/HostThread.h +++ include/lldb/Host/HostThread.h @@ -19,7 +19,6 @@ class HostNativeThreadBase; -//---------------------------------------------------------------------- /// \class HostInfo HostInfo.h "lldb/Host/HostThread.h" /// A class that represents a thread running inside of a process on the /// local machine. @@ -27,7 +26,6 @@ /// HostThread allows querying and manipulation of threads running on the host /// machine. /// -//---------------------------------------------------------------------- class HostThread { public: HostThread(); Index: include/lldb/Host/ProcessLaunchInfo.h =================================================================== --- include/lldb/Host/ProcessLaunchInfo.h +++ include/lldb/Host/ProcessLaunchInfo.h @@ -23,11 +23,9 @@ namespace lldb_private { -//---------------------------------------------------------------------- // ProcessLaunchInfo // // Describes any information that is required to launch a process. -//---------------------------------------------------------------------- class ProcessLaunchInfo : public ProcessInfo { public: Index: include/lldb/Host/ProcessRunLock.h =================================================================== --- include/lldb/Host/ProcessRunLock.h +++ include/lldb/Host/ProcessRunLock.h @@ -14,17 +14,13 @@ #include "lldb/lldb-defines.h" -//---------------------------------------------------------------------- /// Enumerations for broadcasting. -//---------------------------------------------------------------------- namespace lldb_private { -//---------------------------------------------------------------------- /// \class ProcessRunLock ProcessRunLock.h "lldb/Host/ProcessRunLock.h" /// A class used to prevent the process from starting while other /// threads are accessing its data, and prevent access to its data while it is /// running. -//---------------------------------------------------------------------- class ProcessRunLock { public: Index: include/lldb/Host/PseudoTerminal.h =================================================================== --- include/lldb/Host/PseudoTerminal.h +++ include/lldb/Host/PseudoTerminal.h @@ -16,47 +16,36 @@ namespace lldb_private { -//---------------------------------------------------------------------- /// \class PseudoTerminal PseudoTerminal.h "lldb/Host/PseudoTerminal.h" /// A pseudo terminal helper class. /// /// The pseudo terminal class abstracts the use of pseudo terminals on the /// host system. -//---------------------------------------------------------------------- class PseudoTerminal { public: enum { invalid_fd = -1 ///< Invalid file descriptor value }; - //------------------------------------------------------------------ /// Default constructor /// /// Constructs this object with invalid master and slave file descriptors. - //------------------------------------------------------------------ PseudoTerminal(); - //------------------------------------------------------------------ /// Destructor /// /// The destructor will close the master and slave file descriptors if they /// are valid and ownership has not been released using one of: @li /// PseudoTerminal::ReleaseMasterFileDescriptor() @li /// PseudoTerminal::ReleaseSaveFileDescriptor() - //------------------------------------------------------------------ ~PseudoTerminal(); - //------------------------------------------------------------------ /// Close the master file descriptor if it is valid. - //------------------------------------------------------------------ void CloseMasterFileDescriptor(); - //------------------------------------------------------------------ /// Close the slave file descriptor if it is valid. - //------------------------------------------------------------------ void CloseSlaveFileDescriptor(); - //------------------------------------------------------------------ /// Fork a child process that uses pseudo terminals for its stdio. /// /// In the parent process, a call to this function results in a pid being @@ -80,10 +69,8 @@ /// \li \b Parent process: a child process ID that is greater /// than zero, or -1 if the fork fails. /// \li \b Child process: zero. - //------------------------------------------------------------------ lldb::pid_t Fork(char *error_str, size_t error_len); - //------------------------------------------------------------------ /// The master file descriptor accessor. /// /// This object retains ownership of the master file descriptor when this @@ -96,10 +83,8 @@ /// if the master file descriptor is not currently valid. /// /// \see PseudoTerminal::ReleaseMasterFileDescriptor() - //------------------------------------------------------------------ int GetMasterFileDescriptor() const; - //------------------------------------------------------------------ /// The slave file descriptor accessor. /// /// This object retains ownership of the slave file descriptor when this @@ -112,10 +97,8 @@ /// if the slave file descriptor is not currently valid. /// /// \see PseudoTerminal::ReleaseSlaveFileDescriptor() - //------------------------------------------------------------------ int GetSlaveFileDescriptor() const; - //------------------------------------------------------------------ /// Get the name of the slave pseudo terminal. /// /// A master pseudo terminal should already be valid prior to @@ -134,10 +117,8 @@ /// \c ptsname() fails. /// /// \see PseudoTerminal::OpenFirstAvailableMaster() - //------------------------------------------------------------------ const char *GetSlaveName(char *error_str, size_t error_len) const; - //------------------------------------------------------------------ /// Open the first available pseudo terminal. /// /// Opens the first available pseudo terminal with \a oflag as the @@ -166,10 +147,8 @@ /// /// \see PseudoTerminal::GetMasterFileDescriptor() @see /// PseudoTerminal::ReleaseMasterFileDescriptor() - //------------------------------------------------------------------ bool OpenFirstAvailableMaster(int oflag, char *error_str, size_t error_len); - //------------------------------------------------------------------ /// Open the slave for the current master pseudo terminal. /// /// A master pseudo terminal should already be valid prior to @@ -198,10 +177,8 @@ /// \see PseudoTerminal::OpenFirstAvailableMaster() @see /// PseudoTerminal::GetSlaveFileDescriptor() @see /// PseudoTerminal::ReleaseSlaveFileDescriptor() - //------------------------------------------------------------------ bool OpenSlave(int oflag, char *error_str, size_t error_len); - //------------------------------------------------------------------ /// Release the master file descriptor. /// /// Releases ownership of the master pseudo terminal file descriptor without @@ -212,10 +189,8 @@ /// \return /// The master file descriptor, or PseudoTerminal::invalid_fd /// if the mast file descriptor is not currently valid. - //------------------------------------------------------------------ int ReleaseMasterFileDescriptor(); - //------------------------------------------------------------------ /// Release the slave file descriptor. /// /// Release ownership of the slave pseudo terminal file descriptor without @@ -226,13 +201,10 @@ /// \return /// The slave file descriptor, or PseudoTerminal::invalid_fd /// if the slave file descriptor is not currently valid. - //------------------------------------------------------------------ int ReleaseSlaveFileDescriptor(); protected: - //------------------------------------------------------------------ // Member variables - //------------------------------------------------------------------ int m_master_fd; ///< The file descriptor for the master. int m_slave_fd; ///< The file descriptor for the slave. Index: include/lldb/Host/SocketAddress.h =================================================================== --- include/lldb/Host/SocketAddress.h +++ include/lldb/Host/SocketAddress.h @@ -33,16 +33,12 @@ class SocketAddress { public: - //---------------------------------------------------------------------------- // Static method to get all address information for a host and/or service - //---------------------------------------------------------------------------- static std::vector GetAddressInfo(const char *hostname, const char *servname, int ai_family, int ai_socktype, int ai_protocol, int ai_flags = 0); - //------------------------------------------------------------------ // Constructors and Destructors - //------------------------------------------------------------------ SocketAddress(); SocketAddress(const struct addrinfo *addr_info); SocketAddress(const struct sockaddr &s); @@ -52,9 +48,7 @@ SocketAddress(const SocketAddress &rhs); ~SocketAddress(); - //------------------------------------------------------------------ // Operators - //------------------------------------------------------------------ const SocketAddress &operator=(const SocketAddress &rhs); const SocketAddress &operator=(const struct addrinfo *addr_info); @@ -70,53 +64,35 @@ bool operator==(const SocketAddress &rhs) const; bool operator!=(const SocketAddress &rhs) const; - //------------------------------------------------------------------ // Clear the contents of this socket address - //------------------------------------------------------------------ void Clear(); - //------------------------------------------------------------------ // Get the length for the current socket address family - //------------------------------------------------------------------ socklen_t GetLength() const; - //------------------------------------------------------------------ // Get the max length for the largest socket address supported. - //------------------------------------------------------------------ static socklen_t GetMaxLength(); - //------------------------------------------------------------------ // Get the socket address family - //------------------------------------------------------------------ sa_family_t GetFamily() const; - //------------------------------------------------------------------ // Set the socket address family - //------------------------------------------------------------------ void SetFamily(sa_family_t family); - //------------------------------------------------------------------ // Get the address - //------------------------------------------------------------------ std::string GetIPAddress() const; - //------------------------------------------------------------------ // Get the port if the socket address for the family has a port - //------------------------------------------------------------------ uint16_t GetPort() const; - //------------------------------------------------------------------ // Set the port if the socket address for the family has a port. The family // must be set correctly prior to calling this function. - //------------------------------------------------------------------ bool SetPort(uint16_t port); - //------------------------------------------------------------------ // Set the socket address according to the first match from a call to // getaddrinfo() (or equivalent functions for systems that don't have // getaddrinfo(). If "addr_info_ptr" is not NULL, it will get filled in with // the match that was used to populate this socket address. - //------------------------------------------------------------------ bool getaddrinfo(const char *host, // Hostname ("foo.bar.com" or "foo" or IP // address string ("123.234.12.1" or @@ -126,33 +102,23 @@ int ai_family = PF_UNSPEC, int ai_socktype = 0, int ai_protocol = 0, int ai_flags = 0); - //------------------------------------------------------------------ // Quick way to set the SocketAddress to localhost given the family. Returns // true if successful, false if "family" doesn't support localhost or if // "family" is not supported by this class. - //------------------------------------------------------------------ bool SetToLocalhost(sa_family_t family, uint16_t port); bool SetToAnyAddress(sa_family_t family, uint16_t port); - //------------------------------------------------------------------ // Returns true if there is a valid socket address in this object. - //------------------------------------------------------------------ bool IsValid() const; - //------------------------------------------------------------------ // Returns true if the socket is INADDR_ANY - //------------------------------------------------------------------ bool IsAnyAddr() const; - //------------------------------------------------------------------ // Returns true if the socket is INADDR_LOOPBACK - //------------------------------------------------------------------ bool IsLocalhost() const; - //------------------------------------------------------------------ // Direct access to all of the sockaddr structures - //------------------------------------------------------------------ struct sockaddr &sockaddr() { return m_socket_addr.sa; } @@ -183,12 +149,10 @@ return m_socket_addr.sa_storage; } - //------------------------------------------------------------------ // Conversion operators to allow getting the contents of this class as a // pointer to the appropriate structure. This allows an instance of this // class to be used in calls that take one of the sockaddr structure variants // without having to manually use the correct accessor function. - //------------------------------------------------------------------ operator struct sockaddr *() { return &m_socket_addr.sa; } @@ -218,9 +182,7 @@ struct sockaddr_storage sa_storage; } sockaddr_t; - //------------------------------------------------------------------ // Classes that inherit from SocketAddress can see and modify these - //------------------------------------------------------------------ sockaddr_t m_socket_addr; }; Index: include/lldb/Host/StringConvert.h =================================================================== --- include/lldb/Host/StringConvert.h +++ include/lldb/Host/StringConvert.h @@ -17,10 +17,8 @@ namespace StringConvert { -//---------------------------------------------------------------------- /// \namespace StringConvert StringConvert.h "lldb/Host/StringConvert.h" /// Utility classes for converting strings into Integers -//---------------------------------------------------------------------- int32_t ToSInt32(const char *s, int32_t fail_value = 0, int base = 0, bool *success_ptr = nullptr); Index: include/lldb/Host/Terminal.h =================================================================== --- include/lldb/Host/Terminal.h +++ include/lldb/Host/Terminal.h @@ -41,26 +41,19 @@ int m_fd; // This may or may not be a terminal file descriptor }; -//---------------------------------------------------------------------- /// \class State Terminal.h "lldb/Host/Terminal.h" /// A terminal state saving/restoring class. /// /// This class can be used to remember the terminal state for a file /// descriptor and later restore that state as it originally was. -//---------------------------------------------------------------------- class TerminalState { public: - //------------------------------------------------------------------ /// Default constructor - //------------------------------------------------------------------ TerminalState(); - //------------------------------------------------------------------ /// Destructor - //------------------------------------------------------------------ ~TerminalState(); - //------------------------------------------------------------------ /// Save the TTY state for \a fd. /// /// Save the current state of the TTY for the file descriptor "fd" and if @@ -77,10 +70,8 @@ /// \return /// Returns \b true if \a fd describes a TTY and if the state /// was able to be saved, \b false otherwise. - //------------------------------------------------------------------ bool Save(int fd, bool save_process_group); - //------------------------------------------------------------------ /// Restore the TTY state to the cached state. /// /// Restore the state of the TTY using the cached values from a previous @@ -89,52 +80,41 @@ /// \return /// Returns \b true if the TTY state was successfully restored, /// \b false otherwise. - //------------------------------------------------------------------ bool Restore() const; - //------------------------------------------------------------------ /// Test for valid cached TTY state information. /// /// \return /// Returns \b true if this object has valid saved TTY state /// settings that can be used to restore a previous state, /// \b false otherwise. - //------------------------------------------------------------------ bool IsValid() const; void Clear(); protected: - //------------------------------------------------------------------ /// Test if tflags is valid. /// /// \return /// Returns \b true if \a m_tflags is valid and can be restored, /// \b false otherwise. - //------------------------------------------------------------------ bool TFlagsIsValid() const; - //------------------------------------------------------------------ /// Test if ttystate is valid. /// /// \return /// Returns \b true if \a m_ttystate is valid and can be /// restored, \b false otherwise. - //------------------------------------------------------------------ bool TTYStateIsValid() const; - //------------------------------------------------------------------ /// Test if the process group information is valid. /// /// \return /// Returns \b true if \a m_process_group is valid and can be /// restored, \b false otherwise. - //------------------------------------------------------------------ bool ProcessGroupIsValid() const; - //------------------------------------------------------------------ // Member variables - //------------------------------------------------------------------ Terminal m_tty; ///< A terminal int m_tflags; ///< Cached tflags information. #ifdef LLDB_CONFIG_TERMIOS_SUPPORTED @@ -144,43 +124,32 @@ lldb::pid_t m_process_group; ///< Cached process group information. }; -//---------------------------------------------------------------------- /// \class TerminalStateSwitcher Terminal.h "lldb/Host/Terminal.h" /// A TTY state switching class. /// /// This class can be used to remember 2 TTY states for a given file /// descriptor and switch between the two states. -//---------------------------------------------------------------------- class TerminalStateSwitcher { public: - //------------------------------------------------------------------ /// Constructor - //------------------------------------------------------------------ TerminalStateSwitcher(); - //------------------------------------------------------------------ /// Destructor - //------------------------------------------------------------------ ~TerminalStateSwitcher(); - //------------------------------------------------------------------ /// Get the number of possible states to save. /// /// \return /// The number of states that this TTY switcher object contains. - //------------------------------------------------------------------ uint32_t GetNumberOfStates() const; - //------------------------------------------------------------------ /// Restore the TTY state for state at index \a idx. /// /// \return /// Returns \b true if the TTY state was successfully restored, /// \b false otherwise. - //------------------------------------------------------------------ bool Restore(uint32_t idx) const; - //------------------------------------------------------------------ /// Save the TTY state information for the state at index \a idx. The TTY /// state is saved for the file descriptor \a fd and the process group /// information will also be saved if requested by \a save_process_group. @@ -198,13 +167,10 @@ /// \return /// Returns \b true if the save was successful, \b false /// otherwise. - //------------------------------------------------------------------ bool Save(uint32_t idx, int fd, bool save_process_group); protected: - //------------------------------------------------------------------ // Member variables - //------------------------------------------------------------------ mutable uint32_t m_currentState; ///< The currently active TTY state index. TerminalState m_ttystates[2]; ///< The array of TTY states that holds saved TTY info. Index: include/lldb/Host/XML.h =================================================================== --- include/lldb/Host/XML.h +++ include/lldb/Host/XML.h @@ -84,20 +84,14 @@ XMLNode GetElementForPath(const NamePath &path); - //---------------------------------------------------------------------- // Iterate through all sibling nodes of any type - //---------------------------------------------------------------------- void ForEachSiblingNode(NodeCallback const &callback) const; - //---------------------------------------------------------------------- // Iterate through only the sibling nodes that are elements - //---------------------------------------------------------------------- void ForEachSiblingElement(NodeCallback const &callback) const; - //---------------------------------------------------------------------- // Iterate through only the sibling nodes that are elements and whose name // matches \a name. - //---------------------------------------------------------------------- void ForEachSiblingElementWithName(const char *name, NodeCallback const &callback) const; @@ -131,10 +125,8 @@ bool ParseMemory(const char *xml, size_t xml_length, const char *url = "untitled.xml"); - //---------------------------------------------------------------------- // If \a name is nullptr, just get the root element node, else only return a // value XMLNode if the name of the root element matches \a name. - //---------------------------------------------------------------------- XMLNode GetRootElement(const char *required_name = nullptr); llvm::StringRef GetErrors() const; Index: include/lldb/Host/common/NativeProcessProtocol.h =================================================================== --- include/lldb/Host/common/NativeProcessProtocol.h +++ include/lldb/Host/common/NativeProcessProtocol.h @@ -32,9 +32,7 @@ class MemoryRegionInfo; class ResumeActionList; -//------------------------------------------------------------------ // NativeProcessProtocol -//------------------------------------------------------------------ class NativeProcessProtocol { public: virtual ~NativeProcessProtocol() {} @@ -45,15 +43,12 @@ virtual Status Detach() = 0; - //------------------------------------------------------------------ /// Sends a process a UNIX signal \a signal. /// /// \return /// Returns an error object. - //------------------------------------------------------------------ virtual Status Signal(int signo) = 0; - //------------------------------------------------------------------ /// Tells a process to interrupt all operations as if by a Ctrl-C. /// /// The default implementation will send a local host's equivalent of @@ -62,20 +57,15 @@ /// /// \return /// Returns an error object. - //------------------------------------------------------------------ virtual Status Interrupt(); virtual Status Kill() = 0; - //------------------------------------------------------------------ // Tells a process not to stop the inferior on given signals and just // reinject them back. - //------------------------------------------------------------------ virtual Status IgnoreSignals(llvm::ArrayRef signals); - //---------------------------------------------------------------------- // Memory and memory region functions - //---------------------------------------------------------------------- virtual Status GetMemoryRegionInfo(lldb::addr_t load_addr, MemoryRegionInfo &range_info); @@ -102,26 +92,20 @@ virtual const ArchSpec &GetArchitecture() const = 0; - //---------------------------------------------------------------------- // Breakpoint functions - //---------------------------------------------------------------------- virtual Status SetBreakpoint(lldb::addr_t addr, uint32_t size, bool hardware) = 0; virtual Status RemoveBreakpoint(lldb::addr_t addr, bool hardware = false); - //---------------------------------------------------------------------- // Hardware Breakpoint functions - //---------------------------------------------------------------------- virtual const HardwareBreakpointMap &GetHardwareBreakpointMap() const; virtual Status SetHardwareBreakpoint(lldb::addr_t addr, size_t size); virtual Status RemoveHardwareBreakpoint(lldb::addr_t addr); - //---------------------------------------------------------------------- // Watchpoint functions - //---------------------------------------------------------------------- virtual const NativeWatchpointList::WatchpointMap &GetWatchpointMap() const; virtual llvm::Optional> @@ -132,9 +116,7 @@ virtual Status RemoveWatchpoint(lldb::addr_t addr); - //---------------------------------------------------------------------- // Accessors - //---------------------------------------------------------------------- lldb::pid_t GetID() const { return m_pid; } lldb::StateType GetState() const; @@ -154,16 +136,12 @@ virtual llvm::ErrorOr> GetAuxvData() const = 0; - //---------------------------------------------------------------------- // Exit Status - //---------------------------------------------------------------------- virtual llvm::Optional GetExitStatus(); virtual bool SetExitStatus(WaitStatus status, bool bNotifyStateChange); - //---------------------------------------------------------------------- // Access to threads - //---------------------------------------------------------------------- NativeThreadProtocol *GetThreadAtIndex(uint32_t idx); NativeThreadProtocol *GetThreadByID(lldb::tid_t tid); @@ -176,20 +154,14 @@ return GetThreadByID(m_current_thread_id); } - //---------------------------------------------------------------------- // Access to inferior stdio - //---------------------------------------------------------------------- virtual int GetTerminalFileDescriptor() { return m_terminal_fd; } - //---------------------------------------------------------------------- // Stop id interface - //---------------------------------------------------------------------- uint32_t GetStopID() const; - // --------------------------------------------------------------------- // Callbacks for low-level process state changes - // --------------------------------------------------------------------- class NativeDelegate { public: virtual ~NativeDelegate() {} @@ -202,7 +174,6 @@ virtual void DidExec(NativeProcessProtocol *process) = 0; }; - //------------------------------------------------------------------ /// Register a native delegate. /// /// Clients can register nofication callbacks by passing in a @@ -220,10 +191,8 @@ /// false if the delegate was already registered. /// /// \see NativeProcessProtocol::NativeDelegate. - //------------------------------------------------------------------ bool RegisterNativeDelegate(NativeDelegate &native_delegate); - //------------------------------------------------------------------ /// Unregister a native delegate previously registered. /// /// \param[in] native_delegate @@ -233,7 +202,6 @@ /// successfully removed from the process, \b false otherwise. /// /// \see NativeProcessProtocol::NativeDelegate - //------------------------------------------------------------------ bool UnregisterNativeDelegate(NativeDelegate &native_delegate); virtual Status GetLoadedModuleFileSpec(const char *module_path, @@ -245,7 +213,6 @@ class Factory { public: virtual ~Factory(); - //------------------------------------------------------------------ /// Launch a process for debugging. /// /// \param[in] launch_info @@ -264,12 +231,10 @@ /// \return /// A NativeProcessProtocol shared pointer if the operation succeeded or /// an error object if it failed. - //------------------------------------------------------------------ virtual llvm::Expected> Launch(ProcessLaunchInfo &launch_info, NativeDelegate &native_delegate, MainLoop &mainloop) const = 0; - //------------------------------------------------------------------ /// Attach to an existing process. /// /// \param[in] pid @@ -288,13 +253,11 @@ /// \return /// A NativeProcessProtocol shared pointer if the operation succeeded or /// an error object if it failed. - //------------------------------------------------------------------ virtual llvm::Expected> Attach(lldb::pid_t pid, NativeDelegate &native_delegate, MainLoop &mainloop) const = 0; }; - //------------------------------------------------------------------ /// StartTracing API for starting a tracing instance with the /// TraceOptions on a specific thread or process. /// @@ -310,14 +273,12 @@ /// The user_id is a key to identify and operate with a tracing /// instance. It may refer to the complete process or a single /// thread. - //------------------------------------------------------------------ virtual lldb::user_id_t StartTrace(const TraceOptions &config, Status &error) { error.SetErrorString("Not implemented"); return LLDB_INVALID_UID; } - //------------------------------------------------------------------ /// StopTracing API as the name suggests stops a tracing instance. /// /// \param[in] traceid @@ -332,13 +293,11 @@ /// /// \return /// Status indicating what went wrong. - //------------------------------------------------------------------ virtual Status StopTrace(lldb::user_id_t traceid, lldb::tid_t thread = LLDB_INVALID_THREAD_ID) { return Status("Not implemented"); } - //------------------------------------------------------------------ /// This API provides the trace data collected in the form of raw /// data. /// @@ -358,24 +317,20 @@ /// /// \return /// The size of the data actually read. - //------------------------------------------------------------------ virtual Status GetData(lldb::user_id_t traceid, lldb::tid_t thread, llvm::MutableArrayRef &buffer, size_t offset = 0) { return Status("Not implemented"); } - //------------------------------------------------------------------ /// Similar API as above except it aims to provide any extra data /// useful for decoding the actual trace data. - //------------------------------------------------------------------ virtual Status GetMetaData(lldb::user_id_t traceid, lldb::tid_t thread, llvm::MutableArrayRef &buffer, size_t offset = 0) { return Status("Not implemented"); } - //------------------------------------------------------------------ /// API to query the TraceOptions for a given user id /// /// \param[in] traceid @@ -391,7 +346,6 @@ /// /// \param[out] config /// The actual configuration being used for tracing. - //------------------------------------------------------------------ virtual Status GetTraceConfig(lldb::user_id_t traceid, TraceOptions &config) { return Status("Not implemented"); } @@ -433,9 +387,7 @@ NativeProcessProtocol(lldb::pid_t pid, int terminal_fd, NativeDelegate &delegate); - // ----------------------------------------------------------- Internal // interface for state handling - // ----------------------------------------------------------- void SetState(lldb::StateType state, bool notify_delegates = true); // Derived classes need not implement this. It can be used as a hook to @@ -444,9 +396,7 @@ // Note this function is called with the state mutex obtained by the caller. virtual void DoStopIDBumped(uint32_t newBumpId); - // ----------------------------------------------------------- Internal // interface for software breakpoints - // ----------------------------------------------------------- Status SetSoftwareBreakpoint(lldb::addr_t addr, uint32_t size_hint); Status RemoveSoftwareBreakpoint(lldb::addr_t addr); @@ -465,12 +415,10 @@ // resets it to point to the breakpoint itself. void FixupBreakpointPCAsNeeded(NativeThreadProtocol &thread); - // ----------------------------------------------------------- /// Notify the delegate that an exec occurred. /// /// Provide a mechanism for a delegate to clear out any exec- /// sensitive data. - // ----------------------------------------------------------- void NotifyDidExec(); NativeThreadProtocol *GetThreadByIDUnlocked(lldb::tid_t tid); Index: include/lldb/Host/common/NativeRegisterContext.h =================================================================== --- include/lldb/Host/common/NativeRegisterContext.h +++ include/lldb/Host/common/NativeRegisterContext.h @@ -19,9 +19,7 @@ class NativeRegisterContext : public std::enable_shared_from_this { public: - //------------------------------------------------------------------ // Constructors and Destructors - //------------------------------------------------------------------ NativeRegisterContext(NativeThreadProtocol &thread); virtual ~NativeRegisterContext(); @@ -29,9 +27,7 @@ // void // InvalidateIfNeeded (bool force); - //------------------------------------------------------------------ // Subclasses must override these functions - //------------------------------------------------------------------ // virtual void // InvalidateAllRegisters () = 0; @@ -60,9 +56,7 @@ uint32_t ConvertRegisterKindToRegisterNumber(uint32_t kind, uint32_t num) const; - //------------------------------------------------------------------ // Subclasses can override these functions if desired - //------------------------------------------------------------------ virtual uint32_t NumSupportedHardwareBreakpoints(); virtual uint32_t SetHardwareBreakpoint(lldb::addr_t addr, size_t size); @@ -115,9 +109,7 @@ lldb::addr_t dst_addr, size_t dst_len, const RegisterValue ®_value); - //------------------------------------------------------------------ // Subclasses should not override these - //------------------------------------------------------------------ virtual lldb::tid_t GetThreadID() const; virtual NativeThreadProtocol &GetThread() { return m_thread; } @@ -170,18 +162,14 @@ // } protected: - //------------------------------------------------------------------ // Classes that inherit from RegisterContext can see and modify these - //------------------------------------------------------------------ NativeThreadProtocol &m_thread; // The thread that this register context belongs to. // uint32_t m_stop_id; // The stop ID that any data in this // context is valid for private: - //------------------------------------------------------------------ // For RegisterContext only - //------------------------------------------------------------------ DISALLOW_COPY_AND_ASSIGN(NativeRegisterContext); }; Index: include/lldb/Host/common/NativeThreadProtocol.h =================================================================== --- include/lldb/Host/common/NativeThreadProtocol.h +++ include/lldb/Host/common/NativeThreadProtocol.h @@ -16,9 +16,7 @@ #include "lldb/lldb-types.h" namespace lldb_private { -//------------------------------------------------------------------ // NativeThreadProtocol -//------------------------------------------------------------------ class NativeThreadProtocol { public: NativeThreadProtocol(NativeProcessProtocol &process, lldb::tid_t tid); @@ -38,17 +36,13 @@ NativeProcessProtocol &GetProcess() { return m_process; } - // --------------------------------------------------------------------- // Thread-specific watchpoints - // --------------------------------------------------------------------- virtual Status SetWatchpoint(lldb::addr_t addr, size_t size, uint32_t watch_flags, bool hardware) = 0; virtual Status RemoveWatchpoint(lldb::addr_t addr) = 0; - // --------------------------------------------------------------------- // Thread-specific Hardware Breakpoint routines - // --------------------------------------------------------------------- virtual Status SetHardwareBreakpoint(lldb::addr_t addr, size_t size) = 0; virtual Status RemoveHardwareBreakpoint(lldb::addr_t addr) = 0; Index: include/lldb/Host/posix/PipePosix.h =================================================================== --- include/lldb/Host/posix/PipePosix.h +++ include/lldb/Host/posix/PipePosix.h @@ -14,13 +14,11 @@ namespace lldb_private { -//---------------------------------------------------------------------- /// \class PipePosix PipePosix.h "lldb/Host/posix/PipePosix.h" /// A posix-based implementation of Pipe, a class that abtracts /// unix style pipes. /// /// A class that abstracts the LLDB core from host pipe functionality. -//---------------------------------------------------------------------- class PipePosix : public PipeBase { public: static int kInvalidDescriptor; Index: include/lldb/Host/windows/PipeWindows.h =================================================================== --- include/lldb/Host/windows/PipeWindows.h +++ include/lldb/Host/windows/PipeWindows.h @@ -14,13 +14,11 @@ namespace lldb_private { -//---------------------------------------------------------------------- /// \class Pipe PipeWindows.h "lldb/Host/windows/PipeWindows.h" /// A windows-based implementation of Pipe, a class that abtracts /// unix style pipes. /// /// A class that abstracts the LLDB core from host pipe functionality. -//---------------------------------------------------------------------- class PipeWindows : public PipeBase { public: static const int kInvalidDescriptor = -1; Index: include/lldb/Initialization/SystemInitializerCommon.h =================================================================== --- include/lldb/Initialization/SystemInitializerCommon.h +++ include/lldb/Initialization/SystemInitializerCommon.h @@ -12,7 +12,6 @@ #include "SystemInitializer.h" namespace lldb_private { -//------------------------------------------------------------------ /// Initializes common lldb functionality. /// /// This class is responsible for initializing a subset of lldb @@ -21,7 +20,6 @@ /// functionality is separate. This class is used by constructing /// an instance of SystemLifetimeManager with this class passed to /// the constructor. -//------------------------------------------------------------------ class SystemInitializerCommon : public SystemInitializer { public: SystemInitializerCommon(); Index: include/lldb/Interpreter/CommandCompletions.h =================================================================== --- include/lldb/Interpreter/CommandCompletions.h +++ include/lldb/Interpreter/CommandCompletions.h @@ -23,11 +23,9 @@ class TildeExpressionResolver; class CommandCompletions { public: - //---------------------------------------------------------------------- // This is the command completion callback that is used to complete the // argument of the option it is bound to (in the OptionDefinition table // below). Return the total number of matches. - //---------------------------------------------------------------------- typedef int (*CompletionCallback)(CommandInterpreter &interpreter, CompletionRequest &request, // A search filter to limit the search... @@ -58,9 +56,7 @@ CommandInterpreter &interpreter, uint32_t completion_mask, lldb_private::CompletionRequest &request, SearchFilter *searcher); - //---------------------------------------------------------------------- // These are the generic completer functions: - //---------------------------------------------------------------------- static int DiskFiles(CommandInterpreter &interpreter, CompletionRequest &request, SearchFilter *searcher); @@ -98,10 +94,8 @@ static int VariablePath(CommandInterpreter &interpreter, CompletionRequest &request, SearchFilter *searcher); - //---------------------------------------------------------------------- // The Completer class is a convenient base class for building searchers that // go along with the SearchFilter passed to the standard Completer functions. - //---------------------------------------------------------------------- class Completer : public Searcher { public: Completer(CommandInterpreter &interpreter, CompletionRequest &request); @@ -123,9 +117,7 @@ DISALLOW_COPY_AND_ASSIGN(Completer); }; - //---------------------------------------------------------------------- // SourceFileCompleter implements the source file completer - //---------------------------------------------------------------------- class SourceFileCompleter : public Completer { public: SourceFileCompleter(CommandInterpreter &interpreter, @@ -149,9 +141,7 @@ DISALLOW_COPY_AND_ASSIGN(SourceFileCompleter); }; - //---------------------------------------------------------------------- // ModuleCompleter implements the module completer - //---------------------------------------------------------------------- class ModuleCompleter : public Completer { public: ModuleCompleter(CommandInterpreter &interpreter, @@ -173,9 +163,7 @@ DISALLOW_COPY_AND_ASSIGN(ModuleCompleter); }; - //---------------------------------------------------------------------- // SymbolCompleter implements the symbol completer - //---------------------------------------------------------------------- class SymbolCompleter : public Completer { public: SymbolCompleter(CommandInterpreter &interpreter, Index: include/lldb/Interpreter/CommandInterpreter.h =================================================================== --- include/lldb/Interpreter/CommandInterpreter.h +++ include/lldb/Interpreter/CommandInterpreter.h @@ -29,7 +29,6 @@ class CommandInterpreterRunOptions { public: - //------------------------------------------------------------------ /// Construct a CommandInterpreterRunOptions object. This class is used to /// control all the instances where we run multiple commands, e.g. /// HandleCommands, HandleCommandsFromFile, RunCommandInterpreter. @@ -59,7 +58,6 @@ /// \param[in] add_to_history /// If \b true add the commands to the command history. If \b false, don't /// add them. - //------------------------------------------------------------------ CommandInterpreterRunOptions(LazyBool stop_on_continue, LazyBool stop_on_error, LazyBool stop_on_crash, LazyBool echo_commands, LazyBool echo_comments, @@ -254,7 +252,6 @@ bool WasInterrupted() const; - //------------------------------------------------------------------ /// Execute a list of commands in sequence. /// /// \param[in] commands @@ -272,12 +269,10 @@ /// safely, /// and failed with some explanation if we aborted executing the commands /// at some point. - //------------------------------------------------------------------ void HandleCommands(const StringList &commands, ExecutionContext *context, CommandInterpreterRunOptions &options, CommandReturnObject &result); - //------------------------------------------------------------------ /// Execute a list of commands from a file. /// /// \param[in] file @@ -295,7 +290,6 @@ /// safely, /// and failed with some explanation if we aborted executing the commands /// at some point. - //------------------------------------------------------------------ void HandleCommandsFromFile(FileSpec &file, ExecutionContext *context, CommandInterpreterRunOptions &options, CommandReturnObject &result); @@ -459,9 +453,7 @@ const char *GetCommandPrefix(); - //------------------------------------------------------------------ // Properties - //------------------------------------------------------------------ bool GetExpandRegexAliases() const; bool GetPromptOnQuit() const; @@ -474,28 +466,22 @@ bool GetEchoCommentCommands() const; void SetEchoCommentCommands(bool b); - //------------------------------------------------------------------ /// Specify if the command interpreter should allow that the user can /// specify a custom exit code when calling 'quit'. - //------------------------------------------------------------------ void AllowExitCodeOnQuit(bool allow); - //------------------------------------------------------------------ /// Sets the exit code for the quit command. /// \param[in] exit_code /// The exit code that the driver should return on exit. /// \return True if the exit code was successfully set; false if the /// interpreter doesn't allow custom exit codes. /// \see AllowExitCodeOnQuit - //------------------------------------------------------------------ LLVM_NODISCARD bool SetQuitExitCode(int exit_code); - //------------------------------------------------------------------ /// Returns the exit code that the user has specified when running the /// 'quit' command. /// \param[out] exited /// Set to true if the user has called quit with a custom exit code. - //------------------------------------------------------------------ int GetQuitExitCode(bool &exited) const; void ResolveCommand(const char *command_line, CommandReturnObject &result); @@ -517,9 +503,7 @@ protected: friend class Debugger; - //------------------------------------------------------------------ // IOHandlerDelegate functions - //------------------------------------------------------------------ void IOHandlerInputComplete(IOHandler &io_handler, std::string &line) override; Index: include/lldb/Interpreter/CommandObject.h =================================================================== --- include/lldb/Interpreter/CommandObject.h +++ include/lldb/Interpreter/CommandObject.h @@ -220,7 +220,6 @@ void SetCommandName(llvm::StringRef name); - //------------------------------------------------------------------ /// This default version handles calling option argument completions and then /// calls HandleArgumentCompletion if the cursor is on an argument, not an /// option. Don't override this method, override HandleArgumentCompletion @@ -235,10 +234,8 @@ /// /// \return /// \btrue if we were in an option, \bfalse otherwise. - //------------------------------------------------------------------ virtual int HandleCompletion(CompletionRequest &request); - //------------------------------------------------------------------ /// The input array contains a parsed version of the line. The insertion /// point is given by cursor_index (the index in input of the word containing /// the cursor) and cursor_char_position (the position of the cursor in that @@ -255,7 +252,6 @@ /// /// \return /// The number of completions. - //------------------------------------------------------------------ virtual int HandleArgumentCompletion(CompletionRequest &request, OptionElementVector &opt_element_vector) { @@ -268,23 +264,18 @@ bool search_syntax = true, bool search_options = true); - //------------------------------------------------------------------ /// The flags accessor. /// /// \return /// A reference to the Flags member variable. - //------------------------------------------------------------------ Flags &GetFlags() { return m_flags; } - //------------------------------------------------------------------ /// The flags const accessor. /// /// \return /// A const reference to the Flags member variable. - //------------------------------------------------------------------ const Flags &GetFlags() const { return m_flags; } - //------------------------------------------------------------------ /// Get the command that appropriate for a "repeat" of the current command. /// /// \param[in] current_command_line @@ -296,7 +287,6 @@ /// Otherwise a pointer to the command to be repeated. /// If the returned string is the empty string, the command won't be /// repeated. - //------------------------------------------------------------------ virtual const char *GetRepeatCommand(Args ¤t_command_args, uint32_t index) { return nullptr; @@ -367,7 +357,6 @@ // insulates you from the details of this calculation. Thread *GetDefaultThread(); - //------------------------------------------------------------------ /// Check the command to make sure anything required by this /// command is available. /// @@ -377,7 +366,6 @@ /// /// \return /// \b true if it is okay to run this command, \b false otherwise. - //------------------------------------------------------------------ bool CheckRequirements(CommandReturnObject &result); void Cleanup(); Index: include/lldb/Interpreter/CommandObjectMultiword.h =================================================================== --- include/lldb/Interpreter/CommandObjectMultiword.h +++ include/lldb/Interpreter/CommandObjectMultiword.h @@ -14,9 +14,7 @@ namespace lldb_private { -//------------------------------------------------------------------------- // CommandObjectMultiword -//------------------------------------------------------------------------- class CommandObjectMultiword : public CommandObject { // These two want to iterate over the subcommand dictionary. Index: include/lldb/Interpreter/CommandObjectRegexCommand.h =================================================================== --- include/lldb/Interpreter/CommandObjectRegexCommand.h +++ include/lldb/Interpreter/CommandObjectRegexCommand.h @@ -17,9 +17,7 @@ namespace lldb_private { -//------------------------------------------------------------------------- // CommandObjectRegexCommand -//------------------------------------------------------------------------- class CommandObjectRegexCommand : public CommandObjectRaw { public: Index: include/lldb/Interpreter/OptionGroupArchitecture.h =================================================================== --- include/lldb/Interpreter/OptionGroupArchitecture.h +++ include/lldb/Interpreter/OptionGroupArchitecture.h @@ -14,9 +14,7 @@ namespace lldb_private { -//------------------------------------------------------------------------- // OptionGroupArchitecture -//------------------------------------------------------------------------- class OptionGroupArchitecture : public OptionGroup { public: Index: include/lldb/Interpreter/OptionGroupBoolean.h =================================================================== --- include/lldb/Interpreter/OptionGroupBoolean.h +++ include/lldb/Interpreter/OptionGroupBoolean.h @@ -13,9 +13,7 @@ #include "lldb/Interpreter/Options.h" namespace lldb_private { -//------------------------------------------------------------------------- // OptionGroupBoolean -//------------------------------------------------------------------------- class OptionGroupBoolean : public OptionGroup { public: Index: include/lldb/Interpreter/OptionGroupFile.h =================================================================== --- include/lldb/Interpreter/OptionGroupFile.h +++ include/lldb/Interpreter/OptionGroupFile.h @@ -15,9 +15,7 @@ namespace lldb_private { -//------------------------------------------------------------------------- // OptionGroupFile -//------------------------------------------------------------------------- class OptionGroupFile : public OptionGroup { public: @@ -47,9 +45,7 @@ OptionDefinition m_option_definition; }; -//------------------------------------------------------------------------- // OptionGroupFileList -//------------------------------------------------------------------------- class OptionGroupFileList : public OptionGroup { public: Index: include/lldb/Interpreter/OptionGroupFormat.h =================================================================== --- include/lldb/Interpreter/OptionGroupFormat.h +++ include/lldb/Interpreter/OptionGroupFormat.h @@ -16,9 +16,7 @@ namespace lldb_private { -//------------------------------------------------------------------------- // OptionGroupFormat -//------------------------------------------------------------------------- class OptionGroupFormat : public OptionGroup { public: Index: include/lldb/Interpreter/OptionGroupOutputFile.h =================================================================== --- include/lldb/Interpreter/OptionGroupOutputFile.h +++ include/lldb/Interpreter/OptionGroupOutputFile.h @@ -14,9 +14,7 @@ #include "lldb/Interpreter/Options.h" namespace lldb_private { -//------------------------------------------------------------------------- // OptionGroupOutputFile -//------------------------------------------------------------------------- class OptionGroupOutputFile : public OptionGroup { public: Index: include/lldb/Interpreter/OptionGroupPlatform.h =================================================================== --- include/lldb/Interpreter/OptionGroupPlatform.h +++ include/lldb/Interpreter/OptionGroupPlatform.h @@ -15,11 +15,9 @@ namespace lldb_private { -//------------------------------------------------------------------------- // PlatformOptionGroup // // Make platform options available to any commands that need the settings. -//------------------------------------------------------------------------- class OptionGroupPlatform : public OptionGroup { public: OptionGroupPlatform(bool include_platform_option) Index: include/lldb/Interpreter/OptionGroupString.h =================================================================== --- include/lldb/Interpreter/OptionGroupString.h +++ include/lldb/Interpreter/OptionGroupString.h @@ -13,9 +13,7 @@ #include "lldb/Interpreter/Options.h" namespace lldb_private { -//------------------------------------------------------------------------- // OptionGroupString -//------------------------------------------------------------------------- class OptionGroupString : public OptionGroup { public: Index: include/lldb/Interpreter/OptionGroupUInt64.h =================================================================== --- include/lldb/Interpreter/OptionGroupUInt64.h +++ include/lldb/Interpreter/OptionGroupUInt64.h @@ -14,9 +14,7 @@ namespace lldb_private { -//------------------------------------------------------------------------- // OptionGroupUInt64 -//------------------------------------------------------------------------- class OptionGroupUInt64 : public OptionGroup { public: Index: include/lldb/Interpreter/OptionGroupUUID.h =================================================================== --- include/lldb/Interpreter/OptionGroupUUID.h +++ include/lldb/Interpreter/OptionGroupUUID.h @@ -14,9 +14,7 @@ namespace lldb_private { -//------------------------------------------------------------------------- // OptionGroupUUID -//------------------------------------------------------------------------- class OptionGroupUUID : public OptionGroup { public: Index: include/lldb/Interpreter/OptionGroupValueObjectDisplay.h =================================================================== --- include/lldb/Interpreter/OptionGroupValueObjectDisplay.h +++ include/lldb/Interpreter/OptionGroupValueObjectDisplay.h @@ -14,9 +14,7 @@ namespace lldb_private { -//------------------------------------------------------------------------- // OptionGroupValueObjectDisplay -//------------------------------------------------------------------------- class OptionGroupValueObjectDisplay : public OptionGroup { public: Index: include/lldb/Interpreter/OptionGroupVariable.h =================================================================== --- include/lldb/Interpreter/OptionGroupVariable.h +++ include/lldb/Interpreter/OptionGroupVariable.h @@ -14,9 +14,7 @@ namespace lldb_private { -//------------------------------------------------------------------------- // OptionGroupVariable -//------------------------------------------------------------------------- class OptionGroupVariable : public OptionGroup { public: Index: include/lldb/Interpreter/OptionGroupWatchpoint.h =================================================================== --- include/lldb/Interpreter/OptionGroupWatchpoint.h +++ include/lldb/Interpreter/OptionGroupWatchpoint.h @@ -13,9 +13,7 @@ namespace lldb_private { -//------------------------------------------------------------------------- // OptionGroupWatchpoint -//------------------------------------------------------------------------- class OptionGroupWatchpoint : public OptionGroup { public: Index: include/lldb/Interpreter/OptionValue.h =================================================================== --- include/lldb/Interpreter/OptionValue.h +++ include/lldb/Interpreter/OptionValue.h @@ -19,9 +19,7 @@ namespace lldb_private { -//--------------------------------------------------------------------- // OptionValue -//--------------------------------------------------------------------- class OptionValue { public: typedef enum { @@ -69,9 +67,7 @@ virtual ~OptionValue() = default; - //----------------------------------------------------------------- // Subclasses should override these functions - //----------------------------------------------------------------- virtual Type GetType() const = 0; // If this value is always hidden, the avoid showing any info on this value, @@ -100,9 +96,7 @@ virtual size_t AutoComplete(CommandInterpreter &interpreter, CompletionRequest &request); - //----------------------------------------------------------------- // Subclasses can override these functions - //----------------------------------------------------------------- virtual lldb::OptionValueSP GetSubValue(const ExecutionContext *exe_ctx, llvm::StringRef name, bool will_modify, @@ -121,10 +115,8 @@ virtual bool DumpQualifiedName(Stream &strm) const; - //----------------------------------------------------------------- // Subclasses should NOT override these functions as they use the above // functions to implement functionality - //----------------------------------------------------------------- uint32_t GetTypeAsMask() { return 1u << GetType(); } static uint32_t ConvertTypeToMask(OptionValue::Type type) { Index: include/lldb/Interpreter/OptionValueArch.h =================================================================== --- include/lldb/Interpreter/OptionValueArch.h +++ include/lldb/Interpreter/OptionValueArch.h @@ -33,9 +33,7 @@ ~OptionValueArch() override {} - //--------------------------------------------------------------------- // Virtual subclass pure virtual overrides - //--------------------------------------------------------------------- OptionValue::Type GetType() const override { return eTypeArch; } @@ -60,9 +58,7 @@ size_t AutoComplete(CommandInterpreter &interpreter, lldb_private::CompletionRequest &request) override; - //--------------------------------------------------------------------- // Subclass specific functions - //--------------------------------------------------------------------- ArchSpec &GetCurrentValue() { return m_current_value; } Index: include/lldb/Interpreter/OptionValueArray.h =================================================================== --- include/lldb/Interpreter/OptionValueArray.h +++ include/lldb/Interpreter/OptionValueArray.h @@ -22,9 +22,7 @@ ~OptionValueArray() override {} - //--------------------------------------------------------------------- // Virtual subclass pure virtual overrides - //--------------------------------------------------------------------- OptionValue::Type GetType() const override { return eTypeArray; } @@ -52,9 +50,7 @@ llvm::StringRef name, bool will_modify, Status &error) const override; - //--------------------------------------------------------------------- // Subclass specific functions - //--------------------------------------------------------------------- size_t GetSize() const { return m_values.size(); } Index: include/lldb/Interpreter/OptionValueBoolean.h =================================================================== --- include/lldb/Interpreter/OptionValueBoolean.h +++ include/lldb/Interpreter/OptionValueBoolean.h @@ -23,9 +23,7 @@ ~OptionValueBoolean() override {} - //--------------------------------------------------------------------- // Virtual subclass pure virtual overrides - //--------------------------------------------------------------------- OptionValue::Type GetType() const override { return eTypeBoolean; } @@ -48,11 +46,8 @@ size_t AutoComplete(CommandInterpreter &interpreter, CompletionRequest &request) override; - //--------------------------------------------------------------------- // Subclass specific functions - //--------------------------------------------------------------------- - //------------------------------------------------------------------ /// Convert to bool operator. /// /// This allows code to check a OptionValueBoolean in conditions. @@ -66,7 +61,6 @@ /// \return /// /b True this object contains a valid namespace decl, \b /// false otherwise. - //------------------------------------------------------------------ explicit operator bool() const { return m_current_value; } const bool &operator=(bool b) { Index: include/lldb/Interpreter/OptionValueChar.h =================================================================== --- include/lldb/Interpreter/OptionValueChar.h +++ include/lldb/Interpreter/OptionValueChar.h @@ -24,9 +24,7 @@ ~OptionValueChar() override {} - //--------------------------------------------------------------------- // Virtual subclass pure virtual overrides - //--------------------------------------------------------------------- OptionValue::Type GetType() const override { return eTypeChar; } @@ -46,9 +44,7 @@ return true; } - //--------------------------------------------------------------------- // Subclass specific functions - //--------------------------------------------------------------------- const char &operator=(char c) { m_current_value = c; Index: include/lldb/Interpreter/OptionValueDictionary.h =================================================================== --- include/lldb/Interpreter/OptionValueDictionary.h +++ include/lldb/Interpreter/OptionValueDictionary.h @@ -24,9 +24,7 @@ ~OptionValueDictionary() override {} - //--------------------------------------------------------------------- // Virtual subclass pure virtual overrides - //--------------------------------------------------------------------- OptionValue::Type GetType() const override { return eTypeDictionary; } @@ -51,9 +49,7 @@ return ConvertTypeMaskToType(m_type_mask) != eTypeInvalid; } - //--------------------------------------------------------------------- // Subclass specific functions - //--------------------------------------------------------------------- size_t GetNumValues() const { return m_values.size(); } Index: include/lldb/Interpreter/OptionValueEnumeration.h =================================================================== --- include/lldb/Interpreter/OptionValueEnumeration.h +++ include/lldb/Interpreter/OptionValueEnumeration.h @@ -33,9 +33,7 @@ ~OptionValueEnumeration() override; - //--------------------------------------------------------------------- // Virtual subclass pure virtual overrides - //--------------------------------------------------------------------- OptionValue::Type GetType() const override { return eTypeEnum; } @@ -60,9 +58,7 @@ size_t AutoComplete(CommandInterpreter &interpreter, CompletionRequest &request) override; - //--------------------------------------------------------------------- // Subclass specific functions - //--------------------------------------------------------------------- enum_type operator=(enum_type value) { m_current_value = value; Index: include/lldb/Interpreter/OptionValueFileSpec.h =================================================================== --- include/lldb/Interpreter/OptionValueFileSpec.h +++ include/lldb/Interpreter/OptionValueFileSpec.h @@ -27,9 +27,7 @@ ~OptionValueFileSpec() override {} - //--------------------------------------------------------------------- // Virtual subclass pure virtual overrides - //--------------------------------------------------------------------- OptionValue::Type GetType() const override { return eTypeFileSpec; } @@ -56,9 +54,7 @@ size_t AutoComplete(CommandInterpreter &interpreter, CompletionRequest &request) override; - //--------------------------------------------------------------------- // Subclass specific functions - //--------------------------------------------------------------------- FileSpec &GetCurrentValue() { return m_current_value; } Index: include/lldb/Interpreter/OptionValueFileSpecList.h =================================================================== --- include/lldb/Interpreter/OptionValueFileSpecList.h +++ include/lldb/Interpreter/OptionValueFileSpecList.h @@ -23,9 +23,7 @@ ~OptionValueFileSpecList() override {} - //--------------------------------------------------------------------- // Virtual subclass pure virtual overrides - //--------------------------------------------------------------------- OptionValue::Type GetType() const override { return eTypeFileSpecList; } @@ -49,9 +47,7 @@ bool IsAggregateValue() const override { return true; } - //--------------------------------------------------------------------- // Subclass specific functions - //--------------------------------------------------------------------- FileSpecList &GetCurrentValue() { return m_current_value; } Index: include/lldb/Interpreter/OptionValueFormat.h =================================================================== --- include/lldb/Interpreter/OptionValueFormat.h +++ include/lldb/Interpreter/OptionValueFormat.h @@ -24,9 +24,7 @@ ~OptionValueFormat() override {} - //--------------------------------------------------------------------- // Virtual subclass pure virtual overrides - //--------------------------------------------------------------------- OptionValue::Type GetType() const override { return eTypeFormat; } @@ -48,9 +46,7 @@ lldb::OptionValueSP DeepCopy() const override; - //--------------------------------------------------------------------- // Subclass specific functions - //--------------------------------------------------------------------- lldb::Format GetCurrentValue() const { return m_current_value; } Index: include/lldb/Interpreter/OptionValueFormatEntity.h =================================================================== --- include/lldb/Interpreter/OptionValueFormatEntity.h +++ include/lldb/Interpreter/OptionValueFormatEntity.h @@ -20,9 +20,7 @@ ~OptionValueFormatEntity() override {} - //--------------------------------------------------------------------- // Virtual subclass pure virtual overrides - //--------------------------------------------------------------------- OptionValue::Type GetType() const override { return eTypeFormatEntity; } @@ -43,9 +41,7 @@ size_t AutoComplete(CommandInterpreter &interpreter, CompletionRequest &request) override; - //--------------------------------------------------------------------- // Subclass specific functions - //--------------------------------------------------------------------- FormatEntity::Entry &GetCurrentValue() { return m_current_entry; } Index: include/lldb/Interpreter/OptionValueLanguage.h =================================================================== --- include/lldb/Interpreter/OptionValueLanguage.h +++ include/lldb/Interpreter/OptionValueLanguage.h @@ -27,9 +27,7 @@ ~OptionValueLanguage() override {} - //--------------------------------------------------------------------- // Virtual subclass pure virtual overrides - //--------------------------------------------------------------------- OptionValue::Type GetType() const override { return eTypeLanguage; } @@ -51,9 +49,7 @@ lldb::OptionValueSP DeepCopy() const override; - //--------------------------------------------------------------------- // Subclass specific functions - //--------------------------------------------------------------------- lldb::LanguageType GetCurrentValue() const { return m_current_value; } Index: include/lldb/Interpreter/OptionValuePathMappings.h =================================================================== --- include/lldb/Interpreter/OptionValuePathMappings.h +++ include/lldb/Interpreter/OptionValuePathMappings.h @@ -21,9 +21,7 @@ ~OptionValuePathMappings() override {} - //--------------------------------------------------------------------- // Virtual subclass pure virtual overrides - //--------------------------------------------------------------------- OptionValue::Type GetType() const override { return eTypePathMap; } @@ -47,9 +45,7 @@ bool IsAggregateValue() const override { return true; } - //--------------------------------------------------------------------- // Subclass specific functions - //--------------------------------------------------------------------- PathMappingList &GetCurrentValue() { return m_path_mappings; } Index: include/lldb/Interpreter/OptionValueProperties.h =================================================================== --- include/lldb/Interpreter/OptionValueProperties.h +++ include/lldb/Interpreter/OptionValueProperties.h @@ -62,24 +62,18 @@ // bool // GetQualifiedName (Stream &strm); - //--------------------------------------------------------------------- // Subclass specific functions - //--------------------------------------------------------------------- virtual size_t GetNumProperties() const; - //--------------------------------------------------------------------- // Get the index of a property given its exact name in this property // collection, "name" can't be a path to a property path that refers to a // property within a property - //--------------------------------------------------------------------- virtual uint32_t GetPropertyIndex(ConstString name) const; - //--------------------------------------------------------------------- // Get a property by exact name exists in this property collection, name can // not be a path to a property path that refers to a property within a // property - //--------------------------------------------------------------------- virtual const Property *GetProperty(const ExecutionContext *exe_ctx, bool will_modify, ConstString name) const; @@ -88,10 +82,8 @@ bool will_modify, uint32_t idx) const; - //--------------------------------------------------------------------- // Property can be be a property path like // "target.process.extra-startup-command" - //--------------------------------------------------------------------- virtual const Property *GetPropertyAtPath(const ExecutionContext *exe_ctx, bool will_modify, llvm::StringRef property_path) const; Index: include/lldb/Interpreter/OptionValueRegex.h =================================================================== --- include/lldb/Interpreter/OptionValueRegex.h +++ include/lldb/Interpreter/OptionValueRegex.h @@ -21,9 +21,7 @@ ~OptionValueRegex() override = default; - //--------------------------------------------------------------------- // Virtual subclass pure virtual overrides - //--------------------------------------------------------------------- OptionValue::Type GetType() const override { return eTypeRegex; } @@ -45,9 +43,7 @@ lldb::OptionValueSP DeepCopy() const override; - //--------------------------------------------------------------------- // Subclass specific functions - //--------------------------------------------------------------------- const RegularExpression *GetCurrentValue() const { return (m_regex.IsValid() ? &m_regex : nullptr); } Index: include/lldb/Interpreter/OptionValueSInt64.h =================================================================== --- include/lldb/Interpreter/OptionValueSInt64.h +++ include/lldb/Interpreter/OptionValueSInt64.h @@ -36,9 +36,7 @@ ~OptionValueSInt64() override {} - //--------------------------------------------------------------------- // Virtual subclass pure virtual overrides - //--------------------------------------------------------------------- OptionValue::Type GetType() const override { return eTypeSInt64; } @@ -60,9 +58,7 @@ lldb::OptionValueSP DeepCopy() const override; - //--------------------------------------------------------------------- // Subclass specific functions - //--------------------------------------------------------------------- const int64_t &operator=(int64_t value) { m_current_value = value; Index: include/lldb/Interpreter/OptionValueString.h =================================================================== --- include/lldb/Interpreter/OptionValueString.h +++ include/lldb/Interpreter/OptionValueString.h @@ -71,9 +71,7 @@ ~OptionValueString() override = default; - //--------------------------------------------------------------------- // Virtual subclass pure virtual overrides - //--------------------------------------------------------------------- OptionValue::Type GetType() const override { return eTypeString; } @@ -95,9 +93,7 @@ lldb::OptionValueSP DeepCopy() const override; - //--------------------------------------------------------------------- // Subclass specific functions - //--------------------------------------------------------------------- Flags &GetOptions() { return m_options; } Index: include/lldb/Interpreter/OptionValueUInt64.h =================================================================== --- include/lldb/Interpreter/OptionValueUInt64.h +++ include/lldb/Interpreter/OptionValueUInt64.h @@ -27,17 +27,13 @@ ~OptionValueUInt64() override {} - //--------------------------------------------------------------------- // Decode a uint64_t from "value_cstr" return a OptionValueUInt64 object // inside of a lldb::OptionValueSP object if all goes well. If the string // isn't a uint64_t value or any other error occurs, return an empty // lldb::OptionValueSP and fill error in with the correct stuff. - //--------------------------------------------------------------------- static lldb::OptionValueSP Create(const char *, Status &) = delete; static lldb::OptionValueSP Create(llvm::StringRef value_str, Status &error); - //--------------------------------------------------------------------- // Virtual subclass pure virtual overrides - //--------------------------------------------------------------------- OptionValue::Type GetType() const override { return eTypeUInt64; } @@ -59,9 +55,7 @@ lldb::OptionValueSP DeepCopy() const override; - //--------------------------------------------------------------------- // Subclass specific functions - //--------------------------------------------------------------------- const uint64_t &operator=(uint64_t value) { m_current_value = value; Index: include/lldb/Interpreter/OptionValueUUID.h =================================================================== --- include/lldb/Interpreter/OptionValueUUID.h +++ include/lldb/Interpreter/OptionValueUUID.h @@ -22,9 +22,7 @@ ~OptionValueUUID() override {} - //--------------------------------------------------------------------- // Virtual subclass pure virtual overrides - //--------------------------------------------------------------------- OptionValue::Type GetType() const override { return eTypeUUID; } @@ -46,9 +44,7 @@ lldb::OptionValueSP DeepCopy() const override; - //--------------------------------------------------------------------- // Subclass specific functions - //--------------------------------------------------------------------- UUID &GetCurrentValue() { return m_uuid; } Index: include/lldb/Interpreter/Options.h =================================================================== --- include/lldb/Interpreter/Options.h +++ include/lldb/Interpreter/Options.h @@ -46,7 +46,6 @@ return isprint(ch); } -//---------------------------------------------------------------------- /// \class Options Options.h "lldb/Interpreter/Options.h" /// A command line option parsing protocol class. /// @@ -60,7 +59,6 @@ /// *optstring, const struct option *longopts, int *longindex); /// \endcode /// -//---------------------------------------------------------------------- class Options { public: Options(); @@ -73,12 +71,10 @@ uint32_t NumCommandOptions(); - //------------------------------------------------------------------ /// Get the option definitions to use when parsing Args options. /// /// \see Args::ParseOptions (Options&) /// \see man getopt_long_only - //------------------------------------------------------------------ Option *GetLongOptions(); // This gets passed the short option as an integer... @@ -114,7 +110,6 @@ // and subclasses shouldn't have to do it. void NotifyOptionParsingStarting(ExecutionContext *execution_context); - //------------------------------------------------------------------ /// Parse the provided arguments. /// /// The parsed options are set via calls to SetOptionValue. In case of a @@ -131,7 +126,6 @@ /// param[in] require_validation /// When true, it will fail option parsing if validation could /// not occur due to not having a platform. - //------------------------------------------------------------------ llvm::Expected Parse(const Args &args, ExecutionContext *execution_context, lldb::PlatformSP platform_sp, @@ -146,7 +140,6 @@ Status NotifyOptionParsingFinished(ExecutionContext *execution_context); - //------------------------------------------------------------------ /// Set the value of an option. /// /// \param[in] option_idx @@ -164,11 +157,9 @@ /// /// \see Args::ParseOptions (Options&) /// \see man getopt_long_only - //------------------------------------------------------------------ virtual Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) = 0; - //------------------------------------------------------------------ /// Handles the generic bits of figuring out whether we are in an option, /// and if so completing it. /// @@ -184,12 +175,10 @@ /// /// \return /// \btrue if we were in an option, \bfalse otherwise. - //------------------------------------------------------------------ bool HandleOptionCompletion(lldb_private::CompletionRequest &request, OptionElementVector &option_map, CommandInterpreter &interpreter); - //------------------------------------------------------------------ /// Handles the generic bits of figuring out whether we are in an option, /// and if so completing it. /// @@ -205,7 +194,6 @@ /// /// \return /// \btrue if we were in an option, \bfalse otherwise. - //------------------------------------------------------------------ virtual bool HandleOptionArgumentCompletion(lldb_private::CompletionRequest &request, OptionElementVector &opt_element_vector, @@ -283,7 +271,6 @@ ~OptionGroupOptions() override = default; - //---------------------------------------------------------------------- /// Append options from a OptionGroup class. /// /// Append all options from \a group using the exact same option groups that @@ -292,10 +279,8 @@ /// \param[in] group /// A group of options to take option values from and copy their /// definitions into this class. - //---------------------------------------------------------------------- void Append(OptionGroup *group); - //---------------------------------------------------------------------- /// Append options from a OptionGroup class. /// /// Append options from \a group that have a usage mask that has any bits in @@ -316,7 +301,6 @@ /// \param[in] dst_mask /// Set the usage mask for any copied options to \a dst_mask after /// copying the option definition. - //---------------------------------------------------------------------- void Append(OptionGroup *group, uint32_t src_mask, uint32_t dst_mask); void Finalize(); Index: include/lldb/Symbol/Block.h =================================================================== --- include/lldb/Symbol/Block.h +++ include/lldb/Symbol/Block.h @@ -22,7 +22,6 @@ namespace lldb_private { -//---------------------------------------------------------------------- /// \class Block Block.h "lldb/Symbol/Block.h" /// A class that describes a single lexical block. /// @@ -39,13 +38,11 @@ /// Inlined functions are represented by attaching a InlineFunctionInfo shared /// pointer object to a block. Inlined functions are represented as named /// blocks. -//---------------------------------------------------------------------- class Block : public UserID, public SymbolContextScope { public: typedef RangeArray RangeList; typedef RangeList::Entry Range; - //------------------------------------------------------------------ /// Construct with a User ID \a uid, \a depth. /// /// Initialize this block with the specified UID \a uid. The \a depth in the @@ -67,24 +64,18 @@ /// The block list that this object belongs to. /// /// \see BlockList - //------------------------------------------------------------------ Block(lldb::user_id_t uid); - //------------------------------------------------------------------ /// Destructor. - //------------------------------------------------------------------ ~Block() override; - //------------------------------------------------------------------ /// Add a child to this object. /// /// \param[in] child_block_sp /// A shared pointer to a child block that will get added to /// this block. - //------------------------------------------------------------------ void AddChild(const lldb::BlockSP &child_block_sp); - //------------------------------------------------------------------ /// Add a new offset range to this block. /// /// \param[in] start_offset @@ -94,16 +85,13 @@ /// \param[in] end_offset /// An offset into this Function's address range that /// describes the end address of a range for this block. - //------------------------------------------------------------------ void AddRange(const Range &range); void FinalizeRanges(); - //------------------------------------------------------------------ /// \copydoc SymbolContextScope::CalculateSymbolContext(SymbolContext*) /// /// \see SymbolContextScope - //------------------------------------------------------------------ void CalculateSymbolContext(SymbolContext *sc) override; lldb::ModuleSP CalculateSymbolContextModule() override; @@ -114,7 +102,6 @@ Block *CalculateSymbolContextBlock() override; - //------------------------------------------------------------------ /// Check if an offset is in one of the block offset ranges. /// /// \param[in] range_offset @@ -123,10 +110,8 @@ /// \return /// Returns \b true if \a range_offset falls in one of this /// block's ranges, \b false otherwise. - //------------------------------------------------------------------ bool Contains(lldb::addr_t range_offset) const; - //------------------------------------------------------------------ /// Check if a offset range is in one of the block offset ranges. /// /// \param[in] range @@ -135,10 +120,8 @@ /// \return /// Returns \b true if \a range falls in one of this /// block's ranges, \b false otherwise. - //------------------------------------------------------------------ bool Contains(const Range &range) const; - //------------------------------------------------------------------ /// Check if this object contains "block" as a child block at any depth. /// /// \param[in] block @@ -147,10 +130,8 @@ /// \return /// Returns \b true if \a block is a child of this block, \b /// false otherwise. - //------------------------------------------------------------------ bool Contains(const Block *block) const; - //------------------------------------------------------------------ /// Dump the block contents. /// /// \param[in] s @@ -168,15 +149,12 @@ /// /// \param[in] show_context /// If \b true, variables will dump their context information. - //------------------------------------------------------------------ void Dump(Stream *s, lldb::addr_t base_addr, int32_t depth, bool show_context) const; - //------------------------------------------------------------------ /// \copydoc SymbolContextScope::DumpSymbolContext(Stream*) /// /// \see SymbolContextScope - //------------------------------------------------------------------ void DumpSymbolContext(Stream *s) override; void DumpAddressRanges(Stream *s, lldb::addr_t base_addr); @@ -184,16 +162,13 @@ void GetDescription(Stream *s, Function *function, lldb::DescriptionLevel level, Target *target) const; - //------------------------------------------------------------------ /// Get the parent block. /// /// \return /// The parent block pointer, or nullptr if this block has no /// parent. - //------------------------------------------------------------------ Block *GetParent() const; - //------------------------------------------------------------------ /// Get the inlined block that contains this block. /// /// \return @@ -201,39 +176,31 @@ /// this block, else parent blocks will be searched to see if /// any contain this block. nullptr will be returned if this block /// nor any parent blocks are inlined function blocks. - //------------------------------------------------------------------ Block *GetContainingInlinedBlock(); - //------------------------------------------------------------------ /// Get the inlined parent block for this block. /// /// \return /// The parent block pointer, or nullptr if this block has no /// parent. - //------------------------------------------------------------------ Block *GetInlinedParent(); - //------------------------------------------------------------------ /// Get the sibling block for this block. /// /// \return /// The sibling block pointer, or nullptr if this block has no /// sibling. - //------------------------------------------------------------------ Block *GetSibling() const; - //------------------------------------------------------------------ /// Get the first child block. /// /// \return /// The first child block pointer, or nullptr if this block has no /// children. - //------------------------------------------------------------------ Block *GetFirstChild() const { return (m_children.empty() ? nullptr : m_children.front().get()); } - //------------------------------------------------------------------ /// Get the variable list for this block only. /// /// \param[in] can_create @@ -244,10 +211,8 @@ /// \return /// A variable list shared pointer that contains all variables /// for this block. - //------------------------------------------------------------------ lldb::VariableListSP GetBlockVariableList(bool can_create); - //------------------------------------------------------------------ /// Get the variable list for this block and optionally all child blocks if /// \a get_child_variables is \b true. /// @@ -271,13 +236,11 @@ /// \return /// A variable list shared pointer that contains all variables /// for this block. - //------------------------------------------------------------------ uint32_t AppendBlockVariables(bool can_create, bool get_child_block_variables, bool stop_if_child_block_is_inlined_function, const std::function &filter, VariableList *variable_list); - //------------------------------------------------------------------ /// Appends the variables from this block, and optionally from all parent /// blocks, to \a variable_list. /// @@ -304,34 +267,28 @@ /// \return /// The number of variable that were appended to \a /// variable_list. - //------------------------------------------------------------------ uint32_t AppendVariables(bool can_create, bool get_parent_variables, bool stop_if_block_is_inlined_function, const std::function &filter, VariableList *variable_list); - //------------------------------------------------------------------ /// Get const accessor for any inlined function information. /// /// \return /// A const pointer to any inlined function information, or nullptr /// if this is a regular block. - //------------------------------------------------------------------ const InlineFunctionInfo *GetInlinedFunctionInfo() const { return m_inlineInfoSP.get(); } - //------------------------------------------------------------------ /// Get the symbol file which contains debug info for this block's /// symbol context module. /// /// \return A pointer to the symbol file or nullptr. - //------------------------------------------------------------------ SymbolFile *GetSymbolFile(); CompilerDeclContext GetDeclContext(); - //------------------------------------------------------------------ /// Get the memory cost of this object. /// /// Returns the cost of this object plus any owned objects from the ranges, @@ -339,10 +296,8 @@ /// /// \return /// The number of bytes that this object occupies in memory. - //------------------------------------------------------------------ size_t MemorySize() const; - //------------------------------------------------------------------ /// Set accessor for any inlined function information. /// /// \param[in] name @@ -362,7 +317,6 @@ /// \param[in] call_decl_ptr /// Optional calling location declaration information that /// describes from where this inlined function was called. - //------------------------------------------------------------------ void SetInlinedFunctionInfo(const char *name, const char *mangled, const Declaration *decl_ptr, const Declaration *call_decl_ptr); @@ -371,7 +325,6 @@ m_parent_scope = parent_scope; } - //------------------------------------------------------------------ /// Set accessor for the variable list. /// /// Called by the SymbolFile plug-ins after they have parsed the variable @@ -379,7 +332,6 @@ /// /// \param[in] variable_list_sp /// A shared pointer to a VariableList. - //------------------------------------------------------------------ void SetVariableList(lldb::VariableListSP &variable_list_sp) { m_variable_list_sp = variable_list_sp; } @@ -401,10 +353,8 @@ uint32_t GetRangeIndexContainingAddress(const Address &addr); - //------------------------------------------------------------------ // Since blocks might have multiple discontiguous address ranges, we need to // be able to get at any of the address ranges in a block. - //------------------------------------------------------------------ bool GetRangeAtIndex(uint32_t range_idx, AddressRange &range); bool GetStartAddress(Address &addr); @@ -413,9 +363,7 @@ protected: typedef std::vector collection; - //------------------------------------------------------------------ // Member variables. - //------------------------------------------------------------------ SymbolContextScope *m_parent_scope; collection m_children; RangeList m_ranges; Index: include/lldb/Symbol/ClangASTContext.h =================================================================== --- include/lldb/Symbol/ClangASTContext.h +++ include/lldb/Symbol/ClangASTContext.h @@ -46,25 +46,19 @@ typedef void (*CompleteObjCInterfaceDeclCallback)(void *baton, clang::ObjCInterfaceDecl *); - //------------------------------------------------------------------ // llvm casting support - //------------------------------------------------------------------ static bool classof(const TypeSystem *ts) { return ts->getKind() == TypeSystem::eKindClang; } - //------------------------------------------------------------------ // Constructors and Destructors - //------------------------------------------------------------------ ClangASTContext(const char *triple = nullptr); ~ClangASTContext() override; void Finalize() override; - //------------------------------------------------------------------ // PluginInterface functions - //------------------------------------------------------------------ ConstString GetPluginName() override; uint32_t GetPluginVersion() override; @@ -153,9 +147,7 @@ static ClangASTMetadata *GetMetadata(clang::ASTContext *ast, const void *object); - //------------------------------------------------------------------ // Basic Types - //------------------------------------------------------------------ CompilerType GetBuiltinTypeForEncodingAndBitSize(lldb::Encoding encoding, size_t bit_size) override; @@ -257,9 +249,7 @@ static bool IsOperator(const char *name, clang::OverloadedOperatorKind &op_kind); - //------------------------------------------------------------------ // Structure, Unions, Classes - //------------------------------------------------------------------ static clang::AccessSpecifier ConvertAccessTypeToAccessSpecifier(lldb::AccessType access); @@ -349,9 +339,7 @@ // Returns a mask containing bits from the ClangASTContext::eTypeXXX // enumerations - //------------------------------------------------------------------ // Namespace Declarations - //------------------------------------------------------------------ clang::NamespaceDecl * GetUniqueNamespaceDeclaration(const char *name, clang::DeclContext *decl_ctx, @@ -362,9 +350,7 @@ clang::DeclContext *decl_ctx, bool is_inline = false); - //------------------------------------------------------------------ // Function Types - //------------------------------------------------------------------ clang::FunctionDecl * CreateFunctionDeclaration(clang::DeclContext *decl_ctx, const char *name, @@ -413,25 +399,19 @@ CompilerType CreateBlockPointerType(const CompilerType &function_type); - //------------------------------------------------------------------ // Array Types - //------------------------------------------------------------------ CompilerType CreateArrayType(const CompilerType &element_type, size_t element_count, bool is_vector); - //------------------------------------------------------------------ // Enumeration Types - //------------------------------------------------------------------ CompilerType CreateEnumerationType(const char *name, clang::DeclContext *decl_ctx, const Declaration &decl, const CompilerType &integer_qual_type, bool is_scoped); - //------------------------------------------------------------------ // Integer type functions - //------------------------------------------------------------------ static CompilerType GetIntTypeFromBitSize(clang::ASTContext *ast, size_t bit_size, bool is_signed); @@ -443,22 +423,16 @@ static CompilerType GetPointerSizedIntType(clang::ASTContext *ast, bool is_signed); - //------------------------------------------------------------------ // Floating point functions - //------------------------------------------------------------------ static CompilerType GetFloatTypeFromBitSize(clang::ASTContext *ast, size_t bit_size); - //------------------------------------------------------------------ // TypeSystem methods - //------------------------------------------------------------------ DWARFASTParser *GetDWARFParser() override; PDBASTParser *GetPDBParser() override; - //------------------------------------------------------------------ // ClangASTContext callbacks for external source lookups. - //------------------------------------------------------------------ static void CompleteTagDecl(void *baton, clang::TagDecl *); static void CompleteObjCInterfaceDecl(void *baton, @@ -473,9 +447,7 @@ llvm::DenseMap &vbase_offsets); - //---------------------------------------------------------------------- // CompilerDecl override functions - //---------------------------------------------------------------------- ConstString DeclGetName(void *opaque_decl) override; ConstString DeclGetMangledName(void *opaque_decl) override; @@ -489,9 +461,7 @@ CompilerType DeclGetFunctionArgumentType(void *opaque_decl, size_t arg_idx) override; - //---------------------------------------------------------------------- // CompilerDeclContext override functions - //---------------------------------------------------------------------- std::vector DeclContextFindDeclByName(void *opaque_decl_ctx, ConstString name, @@ -511,9 +481,7 @@ bool DeclContextIsContainedInLookup(void *opaque_decl_ctx, void *other_opaque_decl_ctx) override; - //---------------------------------------------------------------------- // Clang specific clang::DeclContext functions - //---------------------------------------------------------------------- static clang::DeclContext * DeclContextGetAsDeclContext(const CompilerDeclContext &dc); @@ -536,9 +504,7 @@ static clang::ASTContext * DeclContextGetClangASTContext(const CompilerDeclContext &dc); - //---------------------------------------------------------------------- // Tests - //---------------------------------------------------------------------- bool IsArrayType(lldb::opaque_compiler_type_t type, CompilerType *element_type, uint64_t *size, @@ -637,15 +603,11 @@ static bool GetObjCClassName(const CompilerType &type, std::string &class_name); - //---------------------------------------------------------------------- // Type Completion - //---------------------------------------------------------------------- bool GetCompleteType(lldb::opaque_compiler_type_t type) override; - //---------------------------------------------------------------------- // Accessors - //---------------------------------------------------------------------- ConstString GetTypeName(lldb::opaque_compiler_type_t type) override; @@ -659,9 +621,7 @@ unsigned GetTypeQualifiers(lldb::opaque_compiler_type_t type) override; - //---------------------------------------------------------------------- // Creating related types - //---------------------------------------------------------------------- // Using the current type, create a new typedef to that type using // "typedef_name" as the name and "decl_ctx" as the decl context. @@ -721,14 +681,10 @@ // If the current object represents a typedef type, get the underlying type CompilerType GetTypedefedType(lldb::opaque_compiler_type_t type) override; - //---------------------------------------------------------------------- // Create related types using the current type's AST - //---------------------------------------------------------------------- CompilerType GetBasicTypeFromAST(lldb::BasicType basic_type) override; - //---------------------------------------------------------------------- // Exploring the type - //---------------------------------------------------------------------- llvm::Optional GetByteSize(lldb::opaque_compiler_type_t type, ExecutionContextScope *exe_scope) { @@ -835,9 +791,7 @@ ConstString *child_name = nullptr, CompilerType *child_type = nullptr); - //---------------------------------------------------------------------- // Modifying RecordType - //---------------------------------------------------------------------- static clang::FieldDecl *AddFieldToRecordType(const CompilerType &type, llvm::StringRef name, const CompilerType &field_type, @@ -897,16 +851,12 @@ bool has_extern); static bool GetHasExternalStorage(const CompilerType &type); - //------------------------------------------------------------------ // Tag Declarations - //------------------------------------------------------------------ static bool StartTagDeclarationDefinition(const CompilerType &type); static bool CompleteTagDeclarationDefinition(const CompilerType &type); - //---------------------------------------------------------------------- // Modifying Enumeration types - //---------------------------------------------------------------------- clang::EnumConstantDecl *AddEnumerationValueToEnumerationType( const CompilerType &enum_type, const Declaration &decl, const char *name, int64_t enum_value, uint32_t enum_value_bit_size); @@ -916,9 +866,7 @@ CompilerType GetEnumerationIntegerType(lldb::opaque_compiler_type_t type); - //------------------------------------------------------------------ // Pointers & References - //------------------------------------------------------------------ // Call this function using the class type when you want to make a member // pointer type to pointee_type. @@ -931,9 +879,7 @@ const char *s, uint8_t *dst, size_t dst_size) override; - //---------------------------------------------------------------------- // Dumping types - //---------------------------------------------------------------------- #ifndef NDEBUG /// Convenience LLVM-style dump method for use in the debugger only. /// In contrast to the other \p Dump() methods this directly invokes @@ -1025,9 +971,7 @@ const clang::ClassTemplateSpecializationDecl * GetAsTemplateSpecialization(lldb::opaque_compiler_type_t type); - //------------------------------------------------------------------ // Classes that inherit from ClangASTContext can see and modify these - //------------------------------------------------------------------ // clang-format off std::string m_target_triple; std::unique_ptr m_ast_up; @@ -1055,9 +999,7 @@ bool m_can_evaluate_expressions; // clang-format on private: - //------------------------------------------------------------------ // For ClangASTContext only - //------------------------------------------------------------------ ClangASTContext(const ClangASTContext &); const ClangASTContext &operator=(const ClangASTContext &); }; Index: include/lldb/Symbol/ClangExternalASTSourceCallbacks.h =================================================================== --- include/lldb/Symbol/ClangExternalASTSourceCallbacks.h +++ include/lldb/Symbol/ClangExternalASTSourceCallbacks.h @@ -50,9 +50,7 @@ m_callback_layout_record_type(layout_record_type_callback), m_callback_baton(callback_baton) {} - //------------------------------------------------------------------ // clang::ExternalASTSource - //------------------------------------------------------------------ clang::Decl *GetExternalDecl(uint32_t ID) override { // This method only needs to be implemented if the AST source ever passes @@ -126,10 +124,8 @@ } protected: - //------------------------------------------------------------------ // Classes that inherit from ClangExternalASTSourceCallbacks can see and // modify these - //------------------------------------------------------------------ CompleteTagDeclCallback m_callback_tag_decl; CompleteObjCInterfaceDeclCallback m_callback_objc_decl; FindExternalVisibleDeclsByNameCallback m_callback_find_by_name; Index: include/lldb/Symbol/CompileUnit.h =================================================================== --- include/lldb/Symbol/CompileUnit.h +++ include/lldb/Symbol/CompileUnit.h @@ -21,7 +21,6 @@ #include "llvm/ADT/DenseMap.h" namespace lldb_private { -//---------------------------------------------------------------------- /// \class CompileUnit CompileUnit.h "lldb/Symbol/CompileUnit.h" /// A class that describes a compilation unit. /// @@ -33,14 +32,12 @@ /// Each compile unit has a list of functions, global and static variables, /// support file list (include files and inlined source files), and a line /// table. -//---------------------------------------------------------------------- class CompileUnit : public std::enable_shared_from_this, public ModuleChild, public FileSpec, public UserID, public SymbolContextScope { public: - //------------------------------------------------------------------ /// Construct with a module, path, UID and language. /// /// Initialize the compile unit given the owning \a module, a path to @@ -75,12 +72,10 @@ /// CompileUnit::GetIsOptimized() is called. /// /// \see lldb::LanguageType - //------------------------------------------------------------------ CompileUnit(const lldb::ModuleSP &module_sp, void *user_data, const char *pathname, lldb::user_id_t uid, lldb::LanguageType language, lldb_private::LazyBool is_optimized); - //------------------------------------------------------------------ /// Construct with a module, file spec, UID and language. /// /// Initialize the compile unit given the owning \a module, a path to @@ -116,17 +111,13 @@ /// CompileUnit::GetIsOptimized() is called. /// /// \see lldb::LanguageType - //------------------------------------------------------------------ CompileUnit(const lldb::ModuleSP &module_sp, void *user_data, const FileSpec &file_spec, lldb::user_id_t uid, lldb::LanguageType language, lldb_private::LazyBool is_optimized); - //------------------------------------------------------------------ /// Destructor - //------------------------------------------------------------------ ~CompileUnit() override; - //------------------------------------------------------------------ /// Add a function to this compile unit. /// /// Typically called by the SymbolFile plug-ins as they partially parse the @@ -134,25 +125,20 @@ /// /// \param[in] function_sp /// A shared pointer to the Function object. - //------------------------------------------------------------------ void AddFunction(lldb::FunctionSP &function_sp); - //------------------------------------------------------------------ /// \copydoc SymbolContextScope::CalculateSymbolContext(SymbolContext*) /// /// \see SymbolContextScope - //------------------------------------------------------------------ void CalculateSymbolContext(SymbolContext *sc) override; lldb::ModuleSP CalculateSymbolContextModule() override; CompileUnit *CalculateSymbolContextCompileUnit() override; - //------------------------------------------------------------------ /// \copydoc SymbolContextScope::DumpSymbolContext(Stream*) /// /// \see SymbolContextScope - //------------------------------------------------------------------ void DumpSymbolContext(Stream *s) override; lldb::LanguageType GetLanguage(); @@ -164,7 +150,6 @@ void GetDescription(Stream *s, lldb::DescriptionLevel level) const; - //------------------------------------------------------------------ /// Apply a lambda to each function in this compile unit. /// /// This provides raw access to the function shared pointer list and will not @@ -175,11 +160,9 @@ /// \param[in] lambda /// The lambda that should be applied to every function. The lambda can /// return true if the iteration should be aborted earlier. - //------------------------------------------------------------------ void ForeachFunction( llvm::function_ref lambda) const; - //------------------------------------------------------------------ /// Dump the compile unit contents to the stream \a s. /// /// \param[in] s @@ -188,10 +171,8 @@ /// \param[in] show_context /// If \b true, variables will dump their symbol context /// information. - //------------------------------------------------------------------ void Dump(Stream *s, bool show_context) const; - //------------------------------------------------------------------ /// Find the line entry by line and optional inlined file spec. /// /// Finds the first line entry that has an index greater than \a start_idx @@ -227,12 +208,10 @@ /// \return /// The zero based index of a matching line entry, or UINT32_MAX /// if no matching line entry is found. - //------------------------------------------------------------------ uint32_t FindLineEntry(uint32_t start_idx, uint32_t line, const FileSpec *file_spec_ptr, bool exact, LineEntry *line_entry); - //------------------------------------------------------------------ /// Get the line table for the compile unit. /// /// Called by clients and the SymbolFile plug-in. The SymbolFile plug-ins @@ -242,12 +221,10 @@ /// \return /// The line table object pointer, or NULL if this line table /// hasn't been parsed yet. - //------------------------------------------------------------------ LineTable *GetLineTable(); DebugMacros *GetDebugMacros(); - //------------------------------------------------------------------ /// Get the compile unit's support file list. /// /// The support file list is used by the line table, and any objects that @@ -255,10 +232,8 @@ /// /// \return /// A support file list object. - //------------------------------------------------------------------ FileSpecList &GetSupportFiles(); - //------------------------------------------------------------------ /// Get the compile unit's imported module list. /// /// This reports all the imports that the compile unit made, including the @@ -266,10 +241,8 @@ /// /// \return /// A list of imported module names. - //------------------------------------------------------------------ const std::vector &GetImportedModules(); - //------------------------------------------------------------------ /// Get the SymbolFile plug-in user data. /// /// SymbolFile plug-ins can store user data to internal state or objects to @@ -278,10 +251,8 @@ /// \return /// The user data stored with the CompileUnit when it was /// constructed. - //------------------------------------------------------------------ void *GetUserData() const; - //------------------------------------------------------------------ /// Get the variable list for a compile unit. /// /// Called by clients to get the variable list for a compile unit. The @@ -299,10 +270,8 @@ /// A shared pointer to a variable list, that can contain NULL /// VariableList pointer if there are no global or static /// variables. - //------------------------------------------------------------------ lldb::VariableListSP GetVariableList(bool can_create); - //------------------------------------------------------------------ /// Finds a function by user ID. /// /// Typically used by SymbolFile plug-ins when partially parsing the debug @@ -317,10 +286,8 @@ /// \return /// A shared pointer to the function object that might contain /// a NULL Function pointer. - //------------------------------------------------------------------ lldb::FunctionSP FindFunctionByUID(lldb::user_id_t uid); - //------------------------------------------------------------------ /// Set the line table for the compile unit. /// /// Called by the SymbolFile plug-in when if first parses the line table and @@ -329,12 +296,10 @@ /// /// \param[in] line_table /// A line table object pointer that this object now owns. - //------------------------------------------------------------------ void SetLineTable(LineTable *line_table); void SetDebugMacros(const DebugMacrosSP &debug_macros); - //------------------------------------------------------------------ /// Set accessor for the variable list. /// /// Called by the SymbolFile plug-ins after they have parsed the variable @@ -342,10 +307,8 @@ /// /// \param[in] variable_list_sp /// A shared pointer to a VariableList. - //------------------------------------------------------------------ void SetVariableList(lldb::VariableListSP &variable_list_sp); - //------------------------------------------------------------------ /// Resolve symbol contexts by file and line. /// /// Given a file in \a file_spec, and a line number, find all instances and @@ -388,13 +351,11 @@ /// The number of new matches that were added to \a sc_list. /// /// \see enum SymbolContext::Scope - //------------------------------------------------------------------ uint32_t ResolveSymbolContext(const FileSpec &file_spec, uint32_t line, bool check_inlines, bool exact, lldb::SymbolContextItem resolve_scope, SymbolContextList &sc_list); - //------------------------------------------------------------------ /// Get whether compiler optimizations were enabled for this compile unit /// /// "optimized" means that the debug experience may be difficult for the @@ -406,12 +367,9 @@ /// Returns 'true' if this compile unit was compiled with /// optimization. 'false' indicates that either the optimization /// is unknown, or this compile unit was built without optimization. - //------------------------------------------------------------------ bool GetIsOptimized(); - //------------------------------------------------------------------ /// Returns the number of functions in this compile unit - //------------------------------------------------------------------ size_t GetNumFunctions() const { return m_functions_by_uid.size(); } protected: Index: include/lldb/Symbol/CompilerDecl.h =================================================================== --- include/lldb/Symbol/CompilerDecl.h +++ include/lldb/Symbol/CompilerDecl.h @@ -17,9 +17,7 @@ class CompilerDecl { public: - //---------------------------------------------------------------------- // Constructors and Destructors - //---------------------------------------------------------------------- CompilerDecl() : m_type_system(nullptr), m_opaque_decl(nullptr) {} CompilerDecl(TypeSystem *type_system, void *decl) @@ -27,9 +25,7 @@ ~CompilerDecl() {} - //---------------------------------------------------------------------- // Tests - //---------------------------------------------------------------------- explicit operator bool() const { return IsValid(); } @@ -45,9 +41,7 @@ bool IsClang() const; - //---------------------------------------------------------------------- // Accessors - //---------------------------------------------------------------------- TypeSystem *GetTypeSystem() const { return m_type_system; } Index: include/lldb/Symbol/CompilerDeclContext.h =================================================================== --- include/lldb/Symbol/CompilerDeclContext.h +++ include/lldb/Symbol/CompilerDeclContext.h @@ -18,9 +18,7 @@ class CompilerDeclContext { public: - //---------------------------------------------------------------------- // Constructors and Destructors - //---------------------------------------------------------------------- CompilerDeclContext() : m_type_system(nullptr), m_opaque_decl_ctx(nullptr) {} CompilerDeclContext(TypeSystem *type_system, void *decl_ctx) @@ -28,9 +26,7 @@ ~CompilerDeclContext() {} - //---------------------------------------------------------------------- // Tests - //---------------------------------------------------------------------- explicit operator bool() const { return IsValid(); } @@ -49,7 +45,6 @@ std::vector FindDeclByName(ConstString name, const bool ignore_using_decls); - //---------------------------------------------------------------------- /// Checks if this decl context represents a method of a class. /// /// \param[out] language_ptr @@ -70,12 +65,10 @@ /// \return /// Returns true if this is a decl context that represents a method /// in a struct, union or class. - //---------------------------------------------------------------------- bool IsClassMethod(lldb::LanguageType *language_ptr, bool *is_instance_method_ptr, ConstString *language_object_name_ptr); - //---------------------------------------------------------------------- /// Check if the given other decl context is contained in the lookup /// of this decl context (for example because the other context is a nested /// inline namespace). @@ -87,12 +80,9 @@ /// @return /// Returns true iff the other decl context is contained in the lookup /// of this decl context. - //---------------------------------------------------------------------- bool IsContainedInLookup(CompilerDeclContext other) const; - //---------------------------------------------------------------------- // Accessors - //---------------------------------------------------------------------- TypeSystem *GetTypeSystem() const { return m_type_system; } Index: include/lldb/Symbol/CompilerType.h =================================================================== --- include/lldb/Symbol/CompilerType.h +++ include/lldb/Symbol/CompilerType.h @@ -21,7 +21,6 @@ class DataExtractor; -//---------------------------------------------------------------------- // A class that can carry around a clang ASTContext and a opaque clang // QualType. A clang::QualType can be easily reconstructed from an opaque clang // type and often the ASTContext is needed when doing various type related @@ -29,12 +28,9 @@ // lightweight class that can be used. There are many static equivalents of the // member functions that allow the ASTContext and the opaque clang QualType to // be specified for ease of use and to avoid code duplication. -//---------------------------------------------------------------------- class CompilerType { public: - //---------------------------------------------------------------------- // Constructors and Destructors - //---------------------------------------------------------------------- CompilerType(TypeSystem *type_system, lldb::opaque_compiler_type_t type); CompilerType(clang::ASTContext *ast_context, clang::QualType qual_type); @@ -45,9 +41,7 @@ ~CompilerType(); - //---------------------------------------------------------------------- // Operators - //---------------------------------------------------------------------- const CompilerType &operator=(const CompilerType &rhs) { m_type = rhs.m_type; @@ -55,9 +49,7 @@ return *this; } - //---------------------------------------------------------------------- // Tests - //---------------------------------------------------------------------- explicit operator bool() const { return m_type != nullptr && m_type_system != nullptr; @@ -145,21 +137,15 @@ bool IsVoidType() const; - //---------------------------------------------------------------------- // Type Completion - //---------------------------------------------------------------------- bool GetCompleteType() const; - //---------------------------------------------------------------------- // AST related queries - //---------------------------------------------------------------------- size_t GetPointerByteSize() const; - //---------------------------------------------------------------------- // Accessors - //---------------------------------------------------------------------- TypeSystem *GetTypeSystem() const { return m_type_system; } @@ -187,9 +173,7 @@ unsigned GetTypeQualifiers() const; - //---------------------------------------------------------------------- // Creating related types - //---------------------------------------------------------------------- CompilerType GetArrayElementType(uint64_t *stride = nullptr) const; @@ -211,78 +195,56 @@ TypeMemberFunctionImpl GetMemberFunctionAtIndex(size_t idx); - //---------------------------------------------------------------------- // If this type is a reference to a type (L value or R value reference), // return a new type with the reference removed, else return the current type // itself. - //---------------------------------------------------------------------- CompilerType GetNonReferenceType() const; - //---------------------------------------------------------------------- // If this type is a pointer type, return the type that the pointer points // to, else return an invalid type. - //---------------------------------------------------------------------- CompilerType GetPointeeType() const; - //---------------------------------------------------------------------- // Return a new CompilerType that is a pointer to this type - //---------------------------------------------------------------------- CompilerType GetPointerType() const; - //---------------------------------------------------------------------- // Return a new CompilerType that is a L value reference to this type if this // type is valid and the type system supports L value references, else return // an invalid type. - //---------------------------------------------------------------------- CompilerType GetLValueReferenceType() const; - //---------------------------------------------------------------------- // Return a new CompilerType that is a R value reference to this type if this // type is valid and the type system supports R value references, else return // an invalid type. - //---------------------------------------------------------------------- CompilerType GetRValueReferenceType() const; - //---------------------------------------------------------------------- // Return a new CompilerType adds a const modifier to this type if this type // is valid and the type system supports const modifiers, else return an // invalid type. - //---------------------------------------------------------------------- CompilerType AddConstModifier() const; - //---------------------------------------------------------------------- // Return a new CompilerType adds a volatile modifier to this type if this // type is valid and the type system supports volatile modifiers, else return // an invalid type. - //---------------------------------------------------------------------- CompilerType AddVolatileModifier() const; - //---------------------------------------------------------------------- // Return a new CompilerType adds a restrict modifier to this type if this // type is valid and the type system supports restrict modifiers, else return // an invalid type. - //---------------------------------------------------------------------- CompilerType AddRestrictModifier() const; - //---------------------------------------------------------------------- // Create a typedef to this type using "name" as the name of the typedef this // type is valid and the type system supports typedefs, else return an // invalid type. - //---------------------------------------------------------------------- CompilerType CreateTypedef(const char *name, const CompilerDeclContext &decl_ctx) const; // If the current object represents a typedef type, get the underlying type CompilerType GetTypedefedType() const; - //---------------------------------------------------------------------- // Create related types using the current type's AST - //---------------------------------------------------------------------- CompilerType GetBasicTypeFromAST(lldb::BasicType basic_type) const; - //---------------------------------------------------------------------- // Exploring the type - //---------------------------------------------------------------------- struct IntegralTemplateArgument; @@ -304,11 +266,9 @@ static lldb::BasicType GetBasicTypeEnumeration(ConstString name); - //---------------------------------------------------------------------- // If this type is an enumeration, iterate through all of its enumerators // using a callback. If the callback returns true, keep iterating, else abort // the iteration. - //---------------------------------------------------------------------- void ForEachEnumerator( std::function FunctionAddressAndSizeVector; - //------------------------------------------------------------------ // Build a vector of file address and size for all functions in this Module // based on the eh_frame FDE entries. // Index: include/lldb/Symbol/DeclVendor.h =================================================================== --- include/lldb/Symbol/DeclVendor.h +++ include/lldb/Symbol/DeclVendor.h @@ -18,20 +18,15 @@ namespace lldb_private { -//---------------------------------------------------------------------- // The Decl vendor class is intended as a generic interface to search for named // declarations that are not necessarily backed by a specific symbol file. -//---------------------------------------------------------------------- class DeclVendor { public: - //------------------------------------------------------------------ // Constructors and Destructors - //------------------------------------------------------------------ DeclVendor() {} virtual ~DeclVendor() {} - //------------------------------------------------------------------ /// Look up the set of Decls that the DeclVendor currently knows about /// matching a given name. /// @@ -48,24 +43,19 @@ /// \return /// The number of Decls added to decls; will not exceed /// max_matches. - //------------------------------------------------------------------ virtual uint32_t FindDecls(ConstString name, bool append, uint32_t max_matches, std::vector &decls) = 0; - //------------------------------------------------------------------ /// Interface for ExternalASTMerger. Returns an ImporterSource /// allowing type completion. /// /// \return /// An ImporterSource for this DeclVendor. - //------------------------------------------------------------------ virtual clang::ExternalASTMerger::ImporterSource GetImporterSource() = 0; private: - //------------------------------------------------------------------ // For DeclVendor only - //------------------------------------------------------------------ DISALLOW_COPY_AND_ASSIGN(DeclVendor); }; Index: include/lldb/Symbol/Declaration.h =================================================================== --- include/lldb/Symbol/Declaration.h +++ include/lldb/Symbol/Declaration.h @@ -14,7 +14,6 @@ namespace lldb_private { -//---------------------------------------------------------------------- /// \class Declaration Declaration.h "lldb/Symbol/Declaration.h" /// A class that describes the declaration location of a /// lldb object. @@ -22,12 +21,9 @@ /// The declarations include the file specification, line number, and the /// column info and can help track where functions, blocks, inlined functions, /// types, variables, any many other debug core objects were declared. -//---------------------------------------------------------------------- class Declaration { public: - //------------------------------------------------------------------ /// Default constructor. - //------------------------------------------------------------------ Declaration() : m_file(), m_line(0) #ifdef LLDB_ENABLE_DECLARATION_COLUMNS @@ -37,7 +33,6 @@ { } - //------------------------------------------------------------------ /// Construct with file specification, and optional line and column. /// /// \param[in] file_spec @@ -51,7 +46,6 @@ /// \param[in] column /// The column number that describes where this was declared. /// Set to zero if there is no column number information. - //------------------------------------------------------------------ Declaration(const FileSpec &file_spec, uint32_t line = 0, uint32_t column = 0) : m_file(file_spec), m_line(line) #ifdef LLDB_ENABLE_DECLARATION_COLUMNS @@ -61,9 +55,7 @@ { } - //------------------------------------------------------------------ /// Construct with a reference to another Declaration object. - //------------------------------------------------------------------ Declaration(const Declaration &rhs) : m_file(rhs.m_file), m_line(rhs.m_line) #ifdef LLDB_ENABLE_DECLARATION_COLUMNS @@ -73,9 +65,7 @@ { } - //------------------------------------------------------------------ /// Construct with a pointer to another Declaration object. - //------------------------------------------------------------------ Declaration(const Declaration *decl_ptr) : m_file(), m_line(0) #ifdef LLDB_ENABLE_DECLARATION_COLUMNS @@ -87,12 +77,10 @@ *this = *decl_ptr; } - //------------------------------------------------------------------ /// Clear the object's state. /// /// Sets the file specification to be empty, and the line and column to /// zero. - //------------------------------------------------------------------ void Clear() { m_file.Clear(); m_line = 0; @@ -101,7 +89,6 @@ #endif } - //------------------------------------------------------------------ /// Compare two declaration objects. /// /// Compares the two file specifications from \a lhs and \a rhs. If the file @@ -118,10 +105,8 @@ /// \li -1 if lhs < rhs /// \li 0 if lhs == rhs /// \li 1 if lhs > rhs - //------------------------------------------------------------------ static int Compare(const Declaration &lhs, const Declaration &rhs); - //------------------------------------------------------------------ /// Dump a description of this object to a Stream. /// /// Dump a description of the contents of this object to the supplied stream @@ -129,17 +114,14 @@ /// /// \param[in] s /// The stream to which to dump the object description. - //------------------------------------------------------------------ void Dump(Stream *s, bool show_fullpaths) const; bool DumpStopContext(Stream *s, bool show_fullpaths) const; - //------------------------------------------------------------------ /// Get accessor for the declaration column number. /// /// \return /// Non-zero indicates a valid column number, zero indicates no /// column information is available. - //------------------------------------------------------------------ uint32_t GetColumn() const { #ifdef LLDB_ENABLE_DECLARATION_COLUMNS return m_column; @@ -148,34 +130,27 @@ #endif } - //------------------------------------------------------------------ /// Get accessor for file specification. /// /// \return /// A reference to the file specification object. - //------------------------------------------------------------------ FileSpec &GetFile() { return m_file; } - //------------------------------------------------------------------ /// Get const accessor for file specification. /// /// \return /// A const reference to the file specification object. - //------------------------------------------------------------------ const FileSpec &GetFile() const { return m_file; } - //------------------------------------------------------------------ /// Get accessor for the declaration line number. /// /// \return /// Non-zero indicates a valid line number, zero indicates no /// line information is available. - //------------------------------------------------------------------ uint32_t GetLine() const { return m_line; } bool IsValid() const { return m_file && m_line != 0; } - //------------------------------------------------------------------ /// Get the memory cost of this object. /// /// \return @@ -184,43 +159,34 @@ /// shared string values. /// /// \see ConstString::StaticMemorySize () - //------------------------------------------------------------------ size_t MemorySize() const; - //------------------------------------------------------------------ /// Set accessor for the declaration column number. /// /// \param[in] column /// Non-zero indicates a valid column number, zero indicates no /// column information is available. - //------------------------------------------------------------------ void SetColumn(uint32_t column) { #ifdef LLDB_ENABLE_DECLARATION_COLUMNS m_column = col; #endif } - //------------------------------------------------------------------ /// Set accessor for the declaration file specification. /// /// \param[in] file_spec /// The new declaration file specification. - //------------------------------------------------------------------ void SetFile(const FileSpec &file_spec) { m_file = file_spec; } - //------------------------------------------------------------------ /// Set accessor for the declaration line number. /// /// \param[in] line /// Non-zero indicates a valid line number, zero indicates no /// line information is available. - //------------------------------------------------------------------ void SetLine(uint32_t line) { m_line = line; } protected: - //------------------------------------------------------------------ /// Member variables. - //------------------------------------------------------------------ FileSpec m_file; ///< The file specification that points to the ///< source file where the declaration occurred. uint32_t m_line; ///< Non-zero values indicates a valid line number, Index: include/lldb/Symbol/Function.h =================================================================== --- include/lldb/Symbol/Function.h +++ include/lldb/Symbol/Function.h @@ -19,16 +19,13 @@ namespace lldb_private { -//---------------------------------------------------------------------- /// \class FunctionInfo Function.h "lldb/Symbol/Function.h" /// A class that contains generic function information. /// /// This provides generic function information that gets reused between inline /// functions and function types. -//---------------------------------------------------------------------- class FunctionInfo { public: - //------------------------------------------------------------------ /// Construct with the function method name and optional declaration /// information. /// @@ -40,10 +37,8 @@ /// \param[in] decl_ptr /// Optional declaration information that describes where the /// function was declared. This can be NULL. - //------------------------------------------------------------------ FunctionInfo(const char *name, const Declaration *decl_ptr); - //------------------------------------------------------------------ /// Construct with the function method name and optional declaration /// information. /// @@ -54,17 +49,13 @@ /// \param[in] decl_ptr /// Optional declaration information that describes where the /// function was declared. This can be NULL. - //------------------------------------------------------------------ FunctionInfo(ConstString name, const Declaration *decl_ptr); - //------------------------------------------------------------------ /// Destructor. /// /// The destructor is virtual since classes inherit from this class. - //------------------------------------------------------------------ virtual ~FunctionInfo(); - //------------------------------------------------------------------ /// Compare two function information objects. /// /// First compares the method names, and if equal, then compares the @@ -80,10 +71,8 @@ /// \li -1 if lhs < rhs /// \li 0 if lhs == rhs /// \li 1 if lhs > rhs - //------------------------------------------------------------------ static int Compare(const FunctionInfo &lhs, const FunctionInfo &rhs); - //------------------------------------------------------------------ /// Dump a description of this object to a Stream. /// /// Dump a description of the contents of this object to the supplied stream @@ -91,34 +80,26 @@ /// /// \param[in] s /// The stream to which to dump the object description. - //------------------------------------------------------------------ void Dump(Stream *s, bool show_fullpaths) const; - //------------------------------------------------------------------ /// Get accessor for the declaration information. /// /// \return /// A reference to the declaration object. - //------------------------------------------------------------------ Declaration &GetDeclaration(); - //------------------------------------------------------------------ /// Get const accessor for the declaration information. /// /// \return /// A const reference to the declaration object. - //------------------------------------------------------------------ const Declaration &GetDeclaration() const; - //------------------------------------------------------------------ /// Get accessor for the method name. /// /// \return /// A const reference to the method name object. - //------------------------------------------------------------------ ConstString GetName() const; - //------------------------------------------------------------------ /// Get the memory cost of this object. /// /// \return @@ -127,25 +108,19 @@ /// shared string values. /// /// \see ConstString::StaticMemorySize () - //------------------------------------------------------------------ virtual size_t MemorySize() const; protected: - //------------------------------------------------------------------ // Member variables. - //------------------------------------------------------------------ ConstString m_name; ///< Function method name (not a mangled name). Declaration m_declaration; ///< Information describing where this function ///information was defined. }; -//---------------------------------------------------------------------- /// \class InlineFunctionInfo Function.h "lldb/Symbol/Function.h" /// A class that describes information for an inlined function. -//---------------------------------------------------------------------- class InlineFunctionInfo : public FunctionInfo { public: - //------------------------------------------------------------------ /// Construct with the function method name, mangled name, and optional /// declaration information. /// @@ -165,12 +140,10 @@ /// \param[in] call_decl_ptr /// Optional calling location declaration information that /// describes from where this inlined function was called. - //------------------------------------------------------------------ InlineFunctionInfo(const char *name, const char *mangled, const Declaration *decl_ptr, const Declaration *call_decl_ptr); - //------------------------------------------------------------------ /// Construct with the function method name, mangled name, and optional /// declaration information. /// @@ -189,17 +162,13 @@ /// \param[in] call_decl_ptr /// Optional calling location declaration information that /// describes from where this inlined function was called. - //------------------------------------------------------------------ InlineFunctionInfo(ConstString name, const Mangled &mangled, const Declaration *decl_ptr, const Declaration *call_decl_ptr); - //------------------------------------------------------------------ /// Destructor. - //------------------------------------------------------------------ ~InlineFunctionInfo() override; - //------------------------------------------------------------------ /// Compare two inlined function information objects. /// /// First compares the FunctionInfo objects, and if equal, compares the @@ -217,10 +186,8 @@ /// \li -1 if lhs < rhs /// \li 0 if lhs == rhs /// \li 1 if lhs > rhs - //------------------------------------------------------------------ int Compare(const InlineFunctionInfo &lhs, const InlineFunctionInfo &rhs); - //------------------------------------------------------------------ /// Dump a description of this object to a Stream. /// /// Dump a description of the contents of this object to the supplied stream @@ -228,7 +195,6 @@ /// /// \param[in] s /// The stream to which to dump the object description. - //------------------------------------------------------------------ void Dump(Stream *s, bool show_fullpaths) const; void DumpStopContext(Stream *s, lldb::LanguageType language) const; @@ -237,39 +203,30 @@ ConstString GetDisplayName(lldb::LanguageType language) const; - //------------------------------------------------------------------ /// Get accessor for the call site declaration information. /// /// \return /// A reference to the declaration object. - //------------------------------------------------------------------ Declaration &GetCallSite(); - //------------------------------------------------------------------ /// Get const accessor for the call site declaration information. /// /// \return /// A const reference to the declaration object. - //------------------------------------------------------------------ const Declaration &GetCallSite() const; - //------------------------------------------------------------------ /// Get accessor for the mangled name object. /// /// \return /// A reference to the mangled name object. - //------------------------------------------------------------------ Mangled &GetMangled(); - //------------------------------------------------------------------ /// Get const accessor for the mangled name object. /// /// \return /// A const reference to the mangled name object. - //------------------------------------------------------------------ const Mangled &GetMangled() const; - //------------------------------------------------------------------ /// Get the memory cost of this object. /// /// \return @@ -278,13 +235,10 @@ /// shared string values. /// /// \see ConstString::StaticMemorySize () - //------------------------------------------------------------------ size_t MemorySize() const override; private: - //------------------------------------------------------------------ // Member variables. - //------------------------------------------------------------------ Mangled m_mangled; ///< Mangled inlined function name (can be empty if there ///is no mangled information). Declaration m_call_decl; @@ -292,12 +246,10 @@ class Function; -//---------------------------------------------------------------------- /// \class CallEdge Function.h "lldb/Symbol/Function.h" /// /// Represent a call made within a Function. This can be used to find a path /// in the call graph between two functions. -//---------------------------------------------------------------------- class CallEdge { public: /// Construct a call edge using a symbol name to identify the calling @@ -348,7 +300,6 @@ DISALLOW_COPY_AND_ASSIGN(CallEdge); }; -//---------------------------------------------------------------------- /// \class Function Function.h "lldb/Symbol/Function.h" /// A class that describes a function. /// @@ -369,10 +320,8 @@ /// /// The concrete information is the address range information and specific /// locations for an instance of this function. -//---------------------------------------------------------------------- class Function : public UserID, public SymbolContextScope { public: - //------------------------------------------------------------------ /// Construct with a compile unit, function UID, function type UID, optional /// mangled name, function type, and a section offset based address range. /// @@ -401,21 +350,16 @@ /// /// \param[in] range /// The section offset based address for this function. - //------------------------------------------------------------------ Function(CompileUnit *comp_unit, lldb::user_id_t func_uid, lldb::user_id_t func_type_uid, const Mangled &mangled, Type *func_type, const AddressRange &range); - //------------------------------------------------------------------ /// Destructor. - //------------------------------------------------------------------ ~Function() override; - //------------------------------------------------------------------ /// \copydoc SymbolContextScope::CalculateSymbolContext(SymbolContext*) /// /// \see SymbolContextScope - //------------------------------------------------------------------ void CalculateSymbolContext(SymbolContext *sc) override; lldb::ModuleSP CalculateSymbolContextModule() override; @@ -427,7 +371,6 @@ const AddressRange &GetAddressRange() { return m_range; } lldb::LanguageType GetLanguage() const; - //------------------------------------------------------------------ /// Find the file and line number of the source location of the start of the /// function. This will use the declaration if present and fall back on the /// line table if that fails. So there may NOT be a line table entry for @@ -438,10 +381,8 @@ /// /// \param[out] line_no /// The line number. - //------------------------------------------------------------------ void GetStartLineSourceInfo(FileSpec &source_file, uint32_t &line_no); - //------------------------------------------------------------------ /// Find the file and line number of the source location of the end of the /// function. /// @@ -451,22 +392,16 @@ /// /// \param[out] line_no /// The line number. - //------------------------------------------------------------------ void GetEndLineSourceInfo(FileSpec &source_file, uint32_t &line_no); - //------------------------------------------------------------------ /// Get the outgoing call edges from this function, sorted by their return /// PC addresses (in increasing order). - //------------------------------------------------------------------ llvm::MutableArrayRef GetCallEdges(); - //------------------------------------------------------------------ /// Get the outgoing tail-calling edges from this function. If none exist, /// return None. - //------------------------------------------------------------------ llvm::MutableArrayRef GetTailCallingEdges(); - //------------------------------------------------------------------ /// Get accessor for the block list. /// /// \return @@ -474,42 +409,33 @@ /// in the function. /// /// \see BlockList - //------------------------------------------------------------------ Block &GetBlock(bool can_create); - //------------------------------------------------------------------ /// Get accessor for the compile unit that owns this function. /// /// \return /// A compile unit object pointer. - //------------------------------------------------------------------ CompileUnit *GetCompileUnit(); - //------------------------------------------------------------------ /// Get const accessor for the compile unit that owns this function. /// /// \return /// A const compile unit object pointer. - //------------------------------------------------------------------ const CompileUnit *GetCompileUnit() const; void GetDescription(Stream *s, lldb::DescriptionLevel level, Target *target); - //------------------------------------------------------------------ /// Get accessor for the frame base location. /// /// \return /// A location expression that describes the function frame /// base. - //------------------------------------------------------------------ DWARFExpression &GetFrameBaseExpression() { return m_frame_base; } - //------------------------------------------------------------------ /// Get const accessor for the frame base location. /// /// \return /// A const compile unit object pointer. - //------------------------------------------------------------------ const DWARFExpression &GetFrameBaseExpression() const { return m_frame_base; } ConstString GetName() const; @@ -520,45 +446,36 @@ const Mangled &GetMangled() const { return m_mangled; } - //------------------------------------------------------------------ /// Get the DeclContext for this function, if available. /// /// \return /// The DeclContext, or NULL if none exists. - //------------------------------------------------------------------ CompilerDeclContext GetDeclContext(); - //------------------------------------------------------------------ /// Get accessor for the type that describes the function return value type, /// and parameter types. /// /// \return /// A type object pointer. - //------------------------------------------------------------------ Type *GetType(); - //------------------------------------------------------------------ /// Get const accessor for the type that describes the function return value /// type, and parameter types. /// /// \return /// A const type object pointer. - //------------------------------------------------------------------ const Type *GetType() const; CompilerType GetCompilerType(); - //------------------------------------------------------------------ /// Get the size of the prologue instructions for this function. The /// "prologue" instructions include any instructions given line number 0 /// immediately following the prologue end. /// /// \return /// The size of the prologue. - //------------------------------------------------------------------ uint32_t GetPrologueByteSize(); - //------------------------------------------------------------------ /// Dump a description of this object to a Stream. /// /// Dump a description of the contents of this object to the supplied stream @@ -570,17 +487,13 @@ /// \param[in] show_context /// If \b true, variables will dump their symbol context /// information. - //------------------------------------------------------------------ void Dump(Stream *s, bool show_context) const; - //------------------------------------------------------------------ /// \copydoc SymbolContextScope::DumpSymbolContext(Stream*) /// /// \see SymbolContextScope - //------------------------------------------------------------------ void DumpSymbolContext(Stream *s) override; - //------------------------------------------------------------------ /// Get the memory cost of this object. /// /// \return @@ -589,10 +502,8 @@ /// shared string values. /// /// \see ConstString::StaticMemorySize () - //------------------------------------------------------------------ size_t MemorySize() const; - //------------------------------------------------------------------ /// Get whether compiler optimizations were enabled for this function /// /// The debug information may provide information about whether this @@ -606,10 +517,8 @@ /// Returns 'true' if this function was compiled with /// optimization. 'false' indicates that either the optimization /// is unknown, or this function was built without optimization. - //------------------------------------------------------------------ bool GetIsOptimized(); - //------------------------------------------------------------------ /// Get whether this function represents a 'top-level' function /// /// The concept of a top-level function is language-specific, mostly meant @@ -623,7 +532,6 @@ /// \return /// Returns 'true' if this function is a top-level function, /// 'false' otherwise. - //------------------------------------------------------------------ bool IsTopLevelFunction(); lldb::DisassemblerSP GetInstructions(const ExecutionContext &exe_ctx, @@ -639,9 +547,7 @@ (1 << 0) ///< Have we already tried to calculate the prologue size? }; - //------------------------------------------------------------------ // Member variables. - //------------------------------------------------------------------ CompileUnit *m_comp_unit; ///< The compile unit that owns this function. lldb::user_id_t m_type_uid; ///< The user ID of for the prototype Type for this function. Index: include/lldb/Symbol/LineEntry.h =================================================================== --- include/lldb/Symbol/LineEntry.h +++ include/lldb/Symbol/LineEntry.h @@ -15,16 +15,12 @@ namespace lldb_private { -//---------------------------------------------------------------------- /// \class LineEntry LineEntry.h "lldb/Symbol/LineEntry.h" /// A line table entry class. -//---------------------------------------------------------------------- struct LineEntry { - //------------------------------------------------------------------ /// Default constructor. /// /// Initialize all member variables to invalid values. - //------------------------------------------------------------------ LineEntry(); LineEntry(const lldb::SectionSP §ion_sp, lldb::addr_t section_offset, @@ -33,14 +29,11 @@ bool _is_start_of_basic_block, bool _is_prologue_end, bool _is_epilogue_begin, bool _is_terminal_entry); - //------------------------------------------------------------------ /// Clear the object's state. /// /// Clears all member variables to invalid values. - //------------------------------------------------------------------ void Clear(); - //------------------------------------------------------------------ /// Dump a description of this object to a Stream. /// /// Dump a description of the contents of this object to the supplied stream @@ -70,14 +63,12 @@ /// dumped. /// /// \see Address::DumpStyle - //------------------------------------------------------------------ bool Dump(Stream *s, Target *target, bool show_file, Address::DumpStyle style, Address::DumpStyle fallback_style, bool show_range) const; bool GetDescription(Stream *s, lldb::DescriptionLevel level, CompileUnit *cu, Target *target, bool show_address_only) const; - //------------------------------------------------------------------ /// Dumps information specific to a process that stops at this line entry to /// the supplied stream \a s. /// @@ -92,20 +83,16 @@ /// \return /// Returns \b true if the file and line were properly dumped, /// \b false otherwise. - //------------------------------------------------------------------ bool DumpStopContext(Stream *s, bool show_fullpaths) const; - //------------------------------------------------------------------ /// Check if a line entry object is valid. /// /// \return /// Returns \b true if the line entry contains a valid section /// offset address, file index, and line number, \b false /// otherwise. - //------------------------------------------------------------------ bool IsValid() const; - //------------------------------------------------------------------ /// Compare two LineEntry objects. /// /// \param[in] lhs @@ -118,10 +105,8 @@ /// \li -1 if lhs < rhs /// \li 0 if lhs == rhs /// \li 1 if lhs > rhs - //------------------------------------------------------------------ static int Compare(const LineEntry &lhs, const LineEntry &rhs); - //------------------------------------------------------------------ /// Give the range for this LineEntry + any additional LineEntries for this /// same source line that are contiguous. /// @@ -144,21 +129,16 @@ /// /// \return /// The contiguous AddressRange for this source line. - //------------------------------------------------------------------ AddressRange GetSameLineContiguousAddressRange() const; - //------------------------------------------------------------------ /// Apply file mappings from target.source-map to the LineEntry's file. /// /// \param[in] target_sp /// Shared pointer to the target this LineEntry belongs to. - //------------------------------------------------------------------ void ApplyFileMappings(lldb::TargetSP target_sp); - //------------------------------------------------------------------ // Member variables. - //------------------------------------------------------------------ AddressRange range; ///< The section offset address range for this line entry. FileSpec file; ///< The source file, possibly mapped by the target.source-map ///setting @@ -182,7 +162,6 @@ ///instructions. }; -//------------------------------------------------------------------ /// Less than operator. /// /// \param[in] lhs @@ -193,7 +172,6 @@ /// /// \return /// Returns \b true if lhs < rhs, false otherwise. -//------------------------------------------------------------------ bool operator<(const LineEntry &lhs, const LineEntry &rhs); } // namespace lldb_private Index: include/lldb/Symbol/LineTable.h =================================================================== --- include/lldb/Symbol/LineTable.h +++ include/lldb/Symbol/LineTable.h @@ -18,10 +18,8 @@ namespace lldb_private { -//---------------------------------------------------------------------- /// \class LineSequence LineTable.h "lldb/Symbol/LineTable.h" An abstract base /// class used during symbol table creation. -//---------------------------------------------------------------------- class LineSequence { public: LineSequence(); @@ -34,26 +32,19 @@ DISALLOW_COPY_AND_ASSIGN(LineSequence); }; -//---------------------------------------------------------------------- /// \class LineTable LineTable.h "lldb/Symbol/LineTable.h" /// A line table class. -//---------------------------------------------------------------------- class LineTable { public: - //------------------------------------------------------------------ /// Construct with compile unit. /// /// \param[in] comp_unit /// The compile unit to which this line table belongs. - //------------------------------------------------------------------ LineTable(CompileUnit *comp_unit); - //------------------------------------------------------------------ /// Destructor. - //------------------------------------------------------------------ ~LineTable(); - //------------------------------------------------------------------ /// Adds a new line entry to this line table. /// /// All line entries are maintained in file address order. @@ -63,7 +54,6 @@ /// table. /// /// \see Address::DumpStyle - //------------------------------------------------------------------ // void // AddLineEntry (const LineEntry& line_entry); @@ -88,7 +78,6 @@ // Insert a sequence of entries into this line table. void InsertSequence(LineSequence *sequence); - //------------------------------------------------------------------ /// Dump all line entries in this line table to the stream \a s. /// /// \param[in] s @@ -98,13 +87,11 @@ /// The display style for the address. /// /// \see Address::DumpStyle - //------------------------------------------------------------------ void Dump(Stream *s, Target *target, Address::DumpStyle style, Address::DumpStyle fallback_style, bool show_line_ranges); void GetDescription(Stream *s, Target *target, lldb::DescriptionLevel level); - //------------------------------------------------------------------ /// Find a line entry that contains the section offset address \a so_addr. /// /// \param[in] so_addr @@ -122,11 +109,9 @@ /// \return /// Returns \b true if \a so_addr is contained in a line entry /// in this line table, \b false otherwise. - //------------------------------------------------------------------ bool FindLineEntryByAddress(const Address &so_addr, LineEntry &line_entry, uint32_t *index_ptr = nullptr); - //------------------------------------------------------------------ /// Find a line entry index that has a matching file index and source line /// number. /// @@ -161,7 +146,6 @@ /// /// \see CompileUnit::GetSupportFiles() /// \see FileSpecList::FindFileIndex (uint32_t, const FileSpec &) const - //------------------------------------------------------------------ uint32_t FindLineEntryIndexByFileIndex(uint32_t start_idx, uint32_t file_idx, uint32_t line, bool exact, LineEntry *line_entry_ptr); @@ -173,7 +157,6 @@ size_t FineLineEntriesForFileIndex(uint32_t file_idx, bool append, SymbolContextList &sc_list); - //------------------------------------------------------------------ /// Get the line entry from the line table at index \a idx. /// /// \param[in] idx @@ -185,21 +168,17 @@ /// /// \see LineTable::GetSize() /// \see LineEntry::IsValid() const - //------------------------------------------------------------------ bool GetLineEntryAtIndex(uint32_t idx, LineEntry &line_entry); - //------------------------------------------------------------------ /// Gets the size of the line table in number of line table entries. /// /// \return /// The number of line table entries in this line table. - //------------------------------------------------------------------ uint32_t GetSize() const; typedef lldb_private::RangeArray FileAddressRanges; - //------------------------------------------------------------------ /// Gets all contiguous file address ranges for the entire line table. /// /// \param[out] file_ranges @@ -212,11 +191,9 @@ /// /// \return /// The number of address ranges added to \a file_ranges - //------------------------------------------------------------------ size_t GetContiguousFileAddressRanges(FileAddressRanges &file_ranges, bool append); - //------------------------------------------------------------------ /// Given a file range link map, relink the current line table and return a /// fixed up line table. /// @@ -227,7 +204,6 @@ /// \return /// A new line table if at least one line table entry was able /// to be mapped. - //------------------------------------------------------------------ typedef RangeDataVector FileRangeMap; @@ -302,9 +278,7 @@ return lhs.file_addr < rhs.file_addr; } - //------------------------------------------------------------------ // Member variables. - //------------------------------------------------------------------ /// The file address for this line entry. lldb::addr_t file_addr; /// The source line number, or zero if there is no line number @@ -337,24 +311,18 @@ Entry *a_entry; }; - //------------------------------------------------------------------ // Types - //------------------------------------------------------------------ typedef std::vector section_collection; ///< The collection type for the sections. typedef std::vector entry_collection; ///< The collection type for the line entries. - //------------------------------------------------------------------ // Member variables. - //------------------------------------------------------------------ CompileUnit *m_comp_unit; ///< The compile unit that this line table belongs to. entry_collection m_entries; ///< The collection of line entries in this line table. - //------------------------------------------------------------------ // Helper class - //------------------------------------------------------------------ class LineSequenceImpl : public LineSequence { public: LineSequenceImpl() = default; Index: include/lldb/Symbol/LocateSymbolFile.h =================================================================== --- include/lldb/Symbol/LocateSymbolFile.h +++ include/lldb/Symbol/LocateSymbolFile.h @@ -22,20 +22,16 @@ class Symbols { public: - //---------------------------------------------------------------------- // Locate the executable file given a module specification. // // Locating the file should happen only on the local computer or using the // current computers global settings. - //---------------------------------------------------------------------- static ModuleSpec LocateExecutableObjectFile(const ModuleSpec &module_spec); - //---------------------------------------------------------------------- // Locate the symbol file given a module specification. // // Locating the file should happen only on the local computer or using the // current computers global settings. - //---------------------------------------------------------------------- static FileSpec LocateExecutableSymbolFile(const ModuleSpec &module_spec, const FileSpecList &default_search_paths); @@ -44,7 +40,6 @@ const lldb_private::UUID *uuid, const ArchSpec *arch); - //---------------------------------------------------------------------- // Locate the object and symbol file given a module specification. // // Locating the file can try to download the file from a corporate build @@ -54,7 +49,6 @@ // the symbol file, or if the user's settings are checked to see if they've // enabled the external program before calling. // - //---------------------------------------------------------------------- static bool DownloadObjectAndSymbolFile(ModuleSpec &module_spec, bool force_lookup = true); }; Index: include/lldb/Symbol/ObjectContainer.h =================================================================== --- include/lldb/Symbol/ObjectContainer.h +++ include/lldb/Symbol/ObjectContainer.h @@ -18,7 +18,6 @@ namespace lldb_private { -//---------------------------------------------------------------------- /// \class ObjectContainer ObjectContainer.h "lldb/Symbol/ObjectContainer.h" /// A plug-in interface definition class for object containers. /// @@ -28,16 +27,13 @@ /// Typical object containers are static libraries (.a files) that contain /// multiple named object files, and universal files that contain multiple /// architectures. -//---------------------------------------------------------------------- class ObjectContainer : public PluginInterface, public ModuleChild { public: - //------------------------------------------------------------------ /// Construct with a parent module, offset, and header data. /// /// Object files belong to modules and a valid module must be supplied upon /// construction. The at an offset within a file for objects that contain /// more than one architecture or object. - //------------------------------------------------------------------ ObjectContainer(const lldb::ModuleSP &module_sp, const FileSpec *file, lldb::offset_t file_offset, lldb::offset_t length, lldb::DataBufferSP &data_sp, lldb::offset_t data_offset) @@ -50,15 +46,12 @@ m_data.SetData(data_sp, data_offset, length); } - //------------------------------------------------------------------ /// Destructor. /// /// The destructor is virtual since this class is designed to be inherited /// from by the plug-in instance. - //------------------------------------------------------------------ ~ObjectContainer() override = default; - //------------------------------------------------------------------ /// Dump a description of this object to a Stream. /// /// Dump a description of the current contents of this object to the @@ -67,10 +60,8 @@ /// /// \param[in] s /// The stream to which to dump the object description. - //------------------------------------------------------------------ virtual void Dump(Stream *s) const = 0; - //------------------------------------------------------------------ /// Gets the architecture given an index. /// /// Copies the architecture specification for index \a idx. @@ -87,12 +78,10 @@ /// filled in, \b false otherwise. /// /// \see ObjectContainer::GetNumArchitectures() const - //------------------------------------------------------------------ virtual bool GetArchitectureAtIndex(uint32_t idx, ArchSpec &arch) const { return false; } - //------------------------------------------------------------------ /// Returns the offset into a file at which this object resides. /// /// Some files contain many object files, and this function allows access to @@ -101,21 +90,17 @@ /// \return /// The offset in bytes into the file. Defaults to zero for /// simple object files that a represented by an entire file. - //------------------------------------------------------------------ virtual lldb::addr_t GetOffset() const { return m_offset; } virtual lldb::addr_t GetByteSize() const { return m_length; } - //------------------------------------------------------------------ /// Get the number of objects within this object file (archives). /// /// \return /// Zero for object files that are not archives, or the number /// of objects contained in the archive. - //------------------------------------------------------------------ virtual size_t GetNumObjects() const { return 0; } - //------------------------------------------------------------------ /// Get the number of architectures in this object file. /// /// The default implementation returns 1 as for object files that contain a @@ -125,10 +110,8 @@ /// /// \return /// The number of architectures contained in this object file. - //------------------------------------------------------------------ virtual size_t GetNumArchitectures() const { return 0; } - //------------------------------------------------------------------ /// Attempts to parse the object header. /// /// This function is used as a test to see if a given plug-in instance can @@ -140,10 +123,8 @@ /// \return /// Returns \b true if the header was parsed successfully, \b /// false otherwise. - //------------------------------------------------------------------ virtual bool ParseHeader() = 0; - //------------------------------------------------------------------ /// Selects an architecture in an object file. /// /// Object files that contain a single architecture should verify that the @@ -159,7 +140,6 @@ /// Returns a pointer to the object file of the requested \a /// arch and optional \a name. Returns nullptr of no such object /// file exists in the container. - //------------------------------------------------------------------ virtual lldb::ObjectFileSP GetObjectFile(const FileSpec *file) = 0; virtual bool ObjectAtIndexIsContainer(uint32_t object_idx) { return false; } @@ -177,9 +157,7 @@ } protected: - //------------------------------------------------------------------ // Member variables. - //------------------------------------------------------------------ FileSpec m_file; ///< The file that represents this container objects (which ///can be different from the module's file). lldb::addr_t Index: include/lldb/Symbol/ObjectFile.h =================================================================== --- include/lldb/Symbol/ObjectFile.h +++ include/lldb/Symbol/ObjectFile.h @@ -42,7 +42,6 @@ virtual ArchSpec GetArchitecture() = 0; }; -//---------------------------------------------------------------------- /// \class ObjectFile ObjectFile.h "lldb/Symbol/ObjectFile.h" /// A plug-in interface definition class for object file parsers. /// @@ -56,7 +55,6 @@ /// /// Once an architecture is selected the object file information can be /// extracted from this abstract class. -//---------------------------------------------------------------------- class ObjectFile : public std::enable_shared_from_this, public PluginInterface, public ModuleChild { @@ -92,13 +90,11 @@ llvm::ArrayRef Contents; }; - //------------------------------------------------------------------ /// Construct with a parent module, offset, and header data. /// /// Object files belong to modules and a valid module must be supplied upon /// construction. The at an offset within a file for objects that contain /// more than one architecture or object. - //------------------------------------------------------------------ ObjectFile(const lldb::ModuleSP &module_sp, const FileSpec *file_spec_ptr, lldb::offset_t file_offset, lldb::offset_t length, const lldb::DataBufferSP &data_sp, lldb::offset_t data_offset); @@ -106,15 +102,12 @@ ObjectFile(const lldb::ModuleSP &module_sp, const lldb::ProcessSP &process_sp, lldb::addr_t header_addr, lldb::DataBufferSP &data_sp); - //------------------------------------------------------------------ /// Destructor. /// /// The destructor is virtual since this class is designed to be inherited /// from by the plug-in instance. - //------------------------------------------------------------------ ~ObjectFile() override; - //------------------------------------------------------------------ /// Dump a description of this object to a Stream. /// /// Dump a description of the current contents of this object to the @@ -123,10 +116,8 @@ /// /// \param[in] s /// The stream to which to dump the object description. - //------------------------------------------------------------------ virtual void Dump(Stream *s) = 0; - //------------------------------------------------------------------ /// Find a ObjectFile plug-in that can parse \a file_spec. /// /// Scans all loaded plug-in interfaces that implement versions of the @@ -150,13 +141,11 @@ /// or if it is known. This can be zero. /// /// \see ObjectFile::ParseHeader() - //------------------------------------------------------------------ static lldb::ObjectFileSP FindPlugin(const lldb::ModuleSP &module_sp, const FileSpec *file_spec, lldb::offset_t file_offset, lldb::offset_t file_size, lldb::DataBufferSP &data_sp, lldb::offset_t &data_offset); - //------------------------------------------------------------------ /// Find a ObjectFile plug-in that can parse a file in memory. /// /// Scans all loaded plug-in interfaces that implement versions of the @@ -172,7 +161,6 @@ /// /// \param[in] header_addr /// The address of the header for the object file in memory. - //------------------------------------------------------------------ static lldb::ObjectFileSP FindPlugin(const lldb::ModuleSP &module_sp, const lldb::ProcessSP &process_sp, lldb::addr_t header_addr, @@ -189,7 +177,6 @@ lldb::offset_t file_offset, lldb::offset_t file_size, lldb_private::ModuleSpecList &specs); - //------------------------------------------------------------------ /// Split a path into a file path with object name. /// /// For paths like "/tmp/foo.a(bar.o)" we often need to split a path up into @@ -213,22 +200,18 @@ /// and \a archive_file and \a archive_object are modified, /// \b false otherwise and \a archive_file and \a archive_object /// are guaranteed to be remain unchanged. - //------------------------------------------------------------------ static bool SplitArchivePathWithObject( const char *path_with_object, lldb_private::FileSpec &archive_file, lldb_private::ConstString &archive_object, bool must_exist); - //------------------------------------------------------------------ /// Gets the address size in bytes for the current object file. /// /// \return /// The size of an address in bytes for the currently selected /// architecture (and object for archives). Returns zero if no /// architecture or object has been selected. - //------------------------------------------------------------------ virtual uint32_t GetAddressByteSize() const = 0; - //------------------------------------------------------------------ /// Get the address type given a file address in an object file. /// /// Many binary file formats know what kinds This is primarily for ARM @@ -239,10 +222,8 @@ /// The size of an address in bytes for the currently selected /// architecture (and object for archives). Returns zero if no /// architecture or object has been selected. - //------------------------------------------------------------------ virtual AddressClass GetAddressClass(lldb::addr_t file_addr); - //------------------------------------------------------------------ /// Extract the dependent modules from an object file. /// /// If an object file has information about which other images it depends on @@ -259,19 +240,15 @@ /// The number of new files that were appended to \a file_list. /// /// \see FileSpecList::AppendIfUnique(const FileSpec &) - //------------------------------------------------------------------ virtual uint32_t GetDependentModules(FileSpecList &file_list) = 0; - //------------------------------------------------------------------ /// Tells whether this object file is capable of being the main executable /// for a process. /// /// \return /// \b true if it is, \b false otherwise. - //------------------------------------------------------------------ virtual bool IsExecutable() const = 0; - //------------------------------------------------------------------ /// Returns the offset into a file at which this object resides. /// /// Some files contain many object files, and this function allows access to @@ -280,39 +257,31 @@ /// \return /// The offset in bytes into the file. Defaults to zero for /// simple object files that a represented by an entire file. - //------------------------------------------------------------------ virtual lldb::addr_t GetFileOffset() const { return m_file_offset; } virtual lldb::addr_t GetByteSize() const { return m_length; } - //------------------------------------------------------------------ /// Get accessor to the object file specification. /// /// \return /// The file specification object pointer if there is one, or /// NULL if this object is only from memory. - //------------------------------------------------------------------ virtual FileSpec &GetFileSpec() { return m_file; } - //------------------------------------------------------------------ /// Get const accessor to the object file specification. /// /// \return /// The const file specification object pointer if there is one, /// or NULL if this object is only from memory. - //------------------------------------------------------------------ virtual const FileSpec &GetFileSpec() const { return m_file; } - //------------------------------------------------------------------ /// Get the ArchSpec for this object file. /// /// \return /// The ArchSpec of this object file. In case of error, an invalid /// ArchSpec object is returned. - //------------------------------------------------------------------ virtual ArchSpec GetArchitecture() = 0; - //------------------------------------------------------------------ /// Gets the section list for the currently selected architecture (and /// object for archives). /// @@ -321,18 +290,14 @@ /// /// \return /// The list of sections contained in this object file. - //------------------------------------------------------------------ virtual SectionList *GetSectionList(bool update_module_section_list = true); virtual void CreateSections(SectionList &unified_section_list) = 0; - //------------------------------------------------------------------ /// Notify the ObjectFile that the file addresses in the Sections for this /// module have been changed. - //------------------------------------------------------------------ virtual void SectionFileAddressesChanged() {} - //------------------------------------------------------------------ /// Gets the symbol table for the currently selected architecture (and /// object for archives). /// @@ -341,16 +306,12 @@ /// /// \return /// The symbol table for this object file. - //------------------------------------------------------------------ virtual Symtab *GetSymtab() = 0; - //------------------------------------------------------------------ /// Perform relocations on the section if necessary. /// - //------------------------------------------------------------------ virtual void RelocateSection(lldb_private::Section *section); - //------------------------------------------------------------------ /// Appends a Symbol for the specified so_addr to the symbol table. /// /// If verify_unique is false, the symbol table is not searched to determine @@ -362,7 +323,6 @@ /// \return /// The resolved symbol or nullptr. Returns nullptr if a /// a Symbol could not be found for the specified so_addr. - //------------------------------------------------------------------ virtual Symbol *ResolveSymbolForAddress(const Address &so_addr, bool verify_unique) { // Typically overridden to lazily add stripped symbols recoverable from the @@ -375,18 +335,14 @@ return nullptr; } - //------------------------------------------------------------------ /// Detect if this object file has been stripped of local symbols. - //------------------------------------------------------------------ /// Detect if this object file has been stripped of local symbols. /// /// \return /// Return \b true if the object file has been stripped of local /// symbols. - //------------------------------------------------------------------ virtual bool IsStripped() = 0; - //------------------------------------------------------------------ /// Frees the symbol table. /// /// This function should only be used when an object file is @@ -397,10 +353,8 @@ /// /// \return /// The symbol table for this object file. - //------------------------------------------------------------------ virtual void ClearSymtab(); - //------------------------------------------------------------------ /// Gets the UUID for this object file. /// /// If the object file format contains a UUID, the value should be returned. @@ -410,10 +364,8 @@ /// \return /// The object file's UUID. In case of an error, an empty UUID is /// returned. - //------------------------------------------------------------------ virtual UUID GetUUID() = 0; - //------------------------------------------------------------------ /// Gets the symbol file spec list for this object file. /// /// If the object file format contains a debug symbol file link, the values @@ -421,12 +373,10 @@ /// /// \return /// Returns filespeclist. - //------------------------------------------------------------------ virtual lldb_private::FileSpecList GetDebugSymbolFilePaths() { return FileSpecList(); } - //------------------------------------------------------------------ /// Gets the file spec list of libraries re-exported by this object file. /// /// If the object file format has the notion of one library re-exporting the @@ -435,34 +385,28 @@ /// /// \return /// Returns filespeclist. - //------------------------------------------------------------------ virtual lldb_private::FileSpecList GetReExportedLibraries() { return FileSpecList(); } - //------------------------------------------------------------------ /// Sets the load address for an entire module, assuming a rigid slide of /// sections, if possible in the implementation. /// /// \return /// Returns true iff any section's load address changed. - //------------------------------------------------------------------ virtual bool SetLoadAddress(Target &target, lldb::addr_t value, bool value_is_offset) { return false; } - //------------------------------------------------------------------ /// Gets whether endian swapping should occur when extracting data from this /// object file. /// /// \return /// Returns \b true if endian swapping is needed, \b false /// otherwise. - //------------------------------------------------------------------ virtual lldb::ByteOrder GetByteOrder() const = 0; - //------------------------------------------------------------------ /// Attempts to parse the object header. /// /// This function is used as a test to see if a given plug-in instance can @@ -474,10 +418,8 @@ /// \return /// Returns \b true if the header was parsed successfully, \b /// false otherwise. - //------------------------------------------------------------------ virtual bool ParseHeader() = 0; - //------------------------------------------------------------------ /// Returns if the function bounds for symbols in this symbol file are /// likely accurate. /// @@ -499,10 +441,8 @@ /// module. /// Only returns false if the ObjectFile is sure that symbol /// addresses are insufficient for accurate assembly emulation. - //------------------------------------------------------------------ virtual bool AllowAssemblyEmulationUnwindPlans() { return true; } - //------------------------------------------------------------------ /// Similar to Process::GetImageInfoAddress(). /// /// Some platforms embed auxiliary structures useful to debuggers in the @@ -519,17 +459,14 @@ return Address(); } - //------------------------------------------------------------------ /// Returns the address of the Entry Point in this object file - if the /// object file doesn't have an entry point (because it is not an executable /// file) then an invalid address is returned. /// /// \return /// Returns the entry address for this module. - //------------------------------------------------------------------ virtual lldb_private::Address GetEntryPointAddress() { return Address(); } - //------------------------------------------------------------------ /// Returns base address of this object file. /// /// This also sometimes referred to as the "preferred load address" or the @@ -538,14 +475,12 @@ /// (usually the first byte of the first section) then the returned address /// will have this section set. Otherwise, the address will just have the /// offset member filled in, indicating that this represents a file address. - //------------------------------------------------------------------ virtual lldb_private::Address GetBaseAddress() { return Address(m_memory_addr); } virtual uint32_t GetNumThreadContexts() { return 0; } - //------------------------------------------------------------------ /// Some object files may have an identifier string embedded in them, e.g. /// in a Mach-O core file using the LC_IDENT load command (which is /// obsolete, but can still be found in some old files) @@ -553,12 +488,10 @@ /// \return /// Returns the identifier string if one exists, else an empty /// string. - //------------------------------------------------------------------ virtual std::string GetIdentifierString () { return std::string(); } - //------------------------------------------------------------------ /// When the ObjectFile is a core file, lldb needs to locate the "binary" in /// the core file. lldb can iterate over the pages looking for a valid /// binary, but some core files may have metadata describing where the main @@ -577,7 +510,6 @@ /// /// \return /// Returns true if either address or uuid has been set. - //------------------------------------------------------------------ virtual bool GetCorefileMainBinaryInfo (lldb::addr_t &address, UUID &uuid) { address = LLDB_INVALID_ADDRESS; uuid.Clear(); @@ -589,7 +521,6 @@ return lldb::RegisterContextSP(); } - //------------------------------------------------------------------ /// The object file should be able to calculate its type by looking at its /// file header and possibly the sections or other data in the object file. /// The file type is used in the debugger to help select the correct plug- @@ -599,16 +530,13 @@ /// /// \return /// The calculated file type for the current object file. - //------------------------------------------------------------------ virtual Type CalculateType() = 0; - //------------------------------------------------------------------ /// In cases where the type can't be calculated (elf files), this routine /// allows someone to explicitly set it. As an example, SymbolVendorELF uses /// this routine to set eTypeDebugInfo when loading debug link files. virtual void SetType(Type type) { m_type = type; } - //------------------------------------------------------------------ /// The object file should be able to calculate the strata of the object /// file. /// @@ -620,10 +548,8 @@ /// \return /// The calculated object file strata for the current object /// file. - //------------------------------------------------------------------ virtual Strata CalculateStrata() = 0; - //------------------------------------------------------------------ /// Get the object file version numbers. /// /// Many object files have a set of version numbers that describe the @@ -635,10 +561,8 @@ /// This function returns extracted version numbers as a /// llvm::VersionTuple. In case of error an empty VersionTuple is /// returned. - //------------------------------------------------------------------ virtual llvm::VersionTuple GetVersion() { return llvm::VersionTuple(); } - //------------------------------------------------------------------ /// Get the minimum OS version this object file can run on. /// /// Some object files have information that specifies the minimum OS version @@ -648,17 +572,14 @@ /// This function returns extracted version numbers as a /// llvm::VersionTuple. In case of error an empty VersionTuple is /// returned. - //------------------------------------------------------------------ virtual llvm::VersionTuple GetMinimumOSVersion() { return llvm::VersionTuple(); } - //------------------------------------------------------------------ /// Get the SDK OS version this object file was built with. /// /// The versions arguments and returns values are the same as the /// GetMinimumOSVersion() - //------------------------------------------------------------------ virtual uint32_t GetSDKVersion(uint32_t *versions, uint32_t num_versions) { if (versions && num_versions) { for (uint32_t i = 0; i < num_versions; ++i) @@ -667,7 +588,6 @@ return 0; } - //------------------------------------------------------------------ /// Return true if this file is a dynamic link editor (dyld) /// /// Often times dyld has symbols that mirror symbols in libc and other @@ -675,12 +595,9 @@ /// to stop in these shared libraries by default. We can ask the ObjectFile /// if it is such a file and should be avoided for things like settings /// breakpoints and doing function lookups for expressions. - //------------------------------------------------------------------ virtual bool GetIsDynamicLinkEditor() { return false; } - //------------------------------------------------------------------ // Member Functions - //------------------------------------------------------------------ Type GetType() { if (m_type == eTypeInvalid) m_type = CalculateType(); @@ -732,7 +649,6 @@ llvm::StringRef name, lldb::SymbolType symbol_type_hint = lldb::eSymbolTypeUndefined); - //------------------------------------------------------------------ /// Loads this objfile to memory. /// /// Loads the bits needed to create an executable image to the memory. It is @@ -743,13 +659,10 @@ /// Target where to load. /// /// \return - //------------------------------------------------------------------ virtual std::vector GetLoadableData(Target &target); protected: - //------------------------------------------------------------------ // Member variables. - //------------------------------------------------------------------ FileSpec m_file; Type m_type; Strata m_strata; @@ -766,7 +679,6 @@ std::unique_ptr m_symtab_up; uint32_t m_synthetic_symbol_idx; - //------------------------------------------------------------------ /// Sets the architecture for a module. At present the architecture can /// only be set if it is invalid. It is not allowed to switch from one /// concrete architecture to another. @@ -777,7 +689,6 @@ /// \return /// Returns \b true if the architecture was changed, \b /// false otherwise. - //------------------------------------------------------------------ bool SetModulesArchitecture(const ArchSpec &new_arch); ConstString GetNextSyntheticSymbolName(); Index: include/lldb/Symbol/Symbol.h =================================================================== --- include/lldb/Symbol/Symbol.h +++ include/lldb/Symbol/Symbol.h @@ -48,35 +48,27 @@ bool ValueIsAddress() const; - //------------------------------------------------------------------ // The GetAddressRef() accessor functions should only be called if you // previously call ValueIsAddress() otherwise you might get an reference to // an Address object that contains an constant integer value in // m_addr_range.m_base_addr.m_offset which could be incorrectly used to // represent an absolute address since it has no section. - //------------------------------------------------------------------ Address &GetAddressRef() { return m_addr_range.GetBaseAddress(); } const Address &GetAddressRef() const { return m_addr_range.GetBaseAddress(); } - //------------------------------------------------------------------ // Makes sure the symbol's value is an address and returns the file address. // Returns LLDB_INVALID_ADDRESS if the symbol's value isn't an address. - //------------------------------------------------------------------ lldb::addr_t GetFileAddress() const; - //------------------------------------------------------------------ // Makes sure the symbol's value is an address and gets the load address // using \a target if it is. Returns LLDB_INVALID_ADDRESS if the symbol's // value isn't an address or if the section isn't loaded in \a target. - //------------------------------------------------------------------ lldb::addr_t GetLoadAddress(Target *target) const; - //------------------------------------------------------------------ // Access the address value. Do NOT hand out the AddressRange as an object as // the byte size of the address range may not be filled in and it should be // accessed via GetByteSize(). - //------------------------------------------------------------------ Address GetAddress() const { // Make sure the our value is an address before we hand a copy out. We use // the Address inside m_addr_range to contain the value for symbols that @@ -203,22 +195,18 @@ void SetContainsLinkerAnnotations(bool b) { m_contains_linker_annotations = b; } - //------------------------------------------------------------------ /// \copydoc SymbolContextScope::CalculateSymbolContext(SymbolContext*) /// /// \see SymbolContextScope - //------------------------------------------------------------------ void CalculateSymbolContext(SymbolContext *sc) override; lldb::ModuleSP CalculateSymbolContextModule() override; Symbol *CalculateSymbolContextSymbol() override; - //------------------------------------------------------------------ /// \copydoc SymbolContextScope::DumpSymbolContext(Stream*) /// /// \see SymbolContextScope - //------------------------------------------------------------------ void DumpSymbolContext(Stream *s) override; lldb::DisassemblerSP GetInstructions(const ExecutionContext &exe_ctx, Index: include/lldb/Symbol/SymbolContext.h =================================================================== --- include/lldb/Symbol/SymbolContext.h +++ include/lldb/Symbol/SymbolContext.h @@ -23,7 +23,6 @@ class SymbolContextScope; -//---------------------------------------------------------------------- /// \class SymbolContext SymbolContext.h "lldb/Symbol/SymbolContext.h" Defines /// a symbol context baton that can be handed other debug core functions. /// @@ -31,28 +30,22 @@ /// provides a common structure that can be used as the result of a query that /// can contain a single result. Examples of such queries include /// \li Looking up a load address. -//---------------------------------------------------------------------- class SymbolContext { public: - //------------------------------------------------------------------ /// Default constructor. /// /// Initialize all pointer members to nullptr and all struct members to /// their default state. - //------------------------------------------------------------------ SymbolContext(); - //------------------------------------------------------------------ /// Construct with an object that knows how to reconstruct its symbol /// context. /// /// \param[in] sc_scope /// A symbol context scope object that knows how to reconstruct /// it's context. - //------------------------------------------------------------------ explicit SymbolContext(SymbolContextScope *sc_scope); - //------------------------------------------------------------------ /// Construct with module, and optional compile unit, function, block, line /// table, line entry and symbol. /// @@ -75,7 +68,6 @@ /// /// \param[in] symbol /// A Symbol pointer to the symbol for this context. - //------------------------------------------------------------------ explicit SymbolContext(const lldb::TargetSP &target_sp, const lldb::ModuleSP &module_sp, CompileUnit *comp_unit = nullptr, @@ -90,19 +82,16 @@ LineEntry *line_entry = nullptr, Symbol *symbol = nullptr); - //------------------------------------------------------------------ /// Copy constructor /// /// Makes a copy of the another SymbolContext object \a rhs. /// /// \param[in] rhs /// A const SymbolContext object reference to copy. - //------------------------------------------------------------------ SymbolContext(const SymbolContext &rhs); ~SymbolContext(); - //------------------------------------------------------------------ /// Assignment operator. /// /// Copies the address value from another SymbolContext object \a rhs into @@ -113,18 +102,14 @@ /// /// \return /// A const SymbolContext object reference to \a this. - //------------------------------------------------------------------ const SymbolContext &operator=(const SymbolContext &rhs); - //------------------------------------------------------------------ /// Clear the object's state. /// /// Resets all pointer members to nullptr, and clears any class objects to /// their default state. - //------------------------------------------------------------------ void Clear(bool clear_target); - //------------------------------------------------------------------ /// Dump a description of this object to a Stream. /// /// Dump a description of the contents of this object to the supplied stream @@ -132,10 +117,8 @@ /// /// \param[in] s /// The stream to which to dump the object description. - //------------------------------------------------------------------ void Dump(Stream *s, Target *target) const; - //------------------------------------------------------------------ /// Dump the stop context in this object to a Stream. /// /// Dump the best description of this object to the stream. The information @@ -176,14 +159,12 @@ /// be printed. In disassembly formatting, where we want a format /// like "<*+36>", this should be false and "*" will be printed /// instead. - //------------------------------------------------------------------ bool DumpStopContext(Stream *s, ExecutionContextScope *exe_scope, const Address &so_addr, bool show_fullpaths, bool show_module, bool show_inlined_frames, bool show_function_arguments, bool show_function_name) const; - //------------------------------------------------------------------ /// Get the address range contained within a symbol context. /// /// Address range priority is as follows: @@ -221,14 +202,12 @@ /// \return /// \b True if this symbol context contains items that describe /// an address range, \b false otherwise. - //------------------------------------------------------------------ bool GetAddressRange(uint32_t scope, uint32_t range_idx, bool use_inline_block_range, AddressRange &range) const; bool GetAddressRangeFromHereToEndLine(uint32_t end_line, AddressRange &range, Status &error); - //------------------------------------------------------------------ /// Find the best global data symbol visible from this context. /// /// Symbol priority is: @@ -248,7 +227,6 @@ /// /// \return /// The symbol that was found, or \b nullptr if none was found. - //------------------------------------------------------------------ const Symbol *FindBestGlobalDataSymbol(ConstString name, Status &error); void GetDescription(Stream *s, lldb::DescriptionLevel level, @@ -258,7 +236,6 @@ lldb::LanguageType GetLanguage() const; - //------------------------------------------------------------------ /// Find a block that defines the function represented by this symbol /// context. /// @@ -278,10 +255,8 @@ /// \return /// The block object pointer that defines the function that is /// represented by this symbol context object, nullptr otherwise. - //------------------------------------------------------------------ Block *GetFunctionBlock(); - //------------------------------------------------------------------ /// If this symbol context represents a function that is a method, return /// true and provide information about the method. /// @@ -299,18 +274,14 @@ /// \return /// \b True if this symbol context represents a function that /// is a method of a class, \b false otherwise. - //------------------------------------------------------------------ bool GetFunctionMethodInfo(lldb::LanguageType &language, bool &is_instance_method, ConstString &language_object_name); - //------------------------------------------------------------------ /// Sorts the types in TypeMap according to SymbolContext to TypeList /// - //------------------------------------------------------------------ void SortTypeList(TypeMap &type_map, TypeList &type_list) const; - //------------------------------------------------------------------ /// Find a name of the innermost function for the symbol context. /// /// For instance, if the symbol context contains an inlined block, it will @@ -323,11 +294,9 @@ /// /// \return /// The name of the function represented by this symbol context. - //------------------------------------------------------------------ ConstString GetFunctionName( Mangled::NamePreference preference = Mangled::ePreferDemangled) const; - //------------------------------------------------------------------ /// Get the line entry that corresponds to the function. /// /// If the symbol context contains an inlined block, the line entry for the @@ -345,10 +314,8 @@ /// /// \return /// The name of the function represented by this symbol context. - //------------------------------------------------------------------ LineEntry GetFunctionStartLineEntry() const; - //------------------------------------------------------------------ /// Find the block containing the inlined block that contains this block. /// /// For instance, if the symbol context contains an inlined block, it will @@ -367,14 +334,11 @@ /// \b true if this SymbolContext specifies a block contained in an /// inlined block. If this returns \b true, \a next_frame_sc and /// \a next_frame_addr will be filled in correctly. - //------------------------------------------------------------------ bool GetParentOfInlinedScope(const Address &curr_frame_pc, SymbolContext &next_frame_sc, Address &inlined_frame_addr) const; - //------------------------------------------------------------------ // Member variables - //------------------------------------------------------------------ lldb::TargetSP target_sp; ///< The Target for a given query lldb::ModuleSP module_sp; ///< The Module for a given query CompileUnit *comp_unit; ///< The CompileUnit for a given query @@ -428,7 +392,6 @@ uint32_t m_type; // Or'ed bits from SpecificationType }; -//---------------------------------------------------------------------- /// \class SymbolContextList SymbolContext.h "lldb/Symbol/SymbolContext.h" /// Defines a list of symbol context objects. /// @@ -437,27 +400,20 @@ /// queries include: /// \li Looking up a function by name. /// \li Finding all addresses for a specified file and line number. -//---------------------------------------------------------------------- class SymbolContextList { public: - //------------------------------------------------------------------ /// Default constructor. /// /// Initialize with an empty list. - //------------------------------------------------------------------ SymbolContextList(); - //------------------------------------------------------------------ /// Destructor. - //------------------------------------------------------------------ ~SymbolContextList(); - //------------------------------------------------------------------ /// Append a new symbol context to the list. /// /// \param[in] sc /// A symbol context to append to the list. - //------------------------------------------------------------------ void Append(const SymbolContext &sc); void Append(const SymbolContextList &sc_list); @@ -467,14 +423,11 @@ uint32_t AppendIfUnique(const SymbolContextList &sc_list, bool merge_symbol_into_function); - //------------------------------------------------------------------ /// Clear the object's state. /// /// Clears the symbol context list. - //------------------------------------------------------------------ void Clear(); - //------------------------------------------------------------------ /// Dump a description of this object to a Stream. /// /// Dump a description of the contents of each symbol context in the list to @@ -482,10 +435,8 @@ /// /// \param[in] s /// The stream to which to dump the object description. - //------------------------------------------------------------------ void Dump(Stream *s, Target *target) const; - //------------------------------------------------------------------ /// Get accessor for a symbol context at index \a idx. /// /// Dump a description of the contents of each symbol context in the list to @@ -501,10 +452,8 @@ /// Returns \b true if \a idx was a valid index into this /// symbol context list and \a sc was filled in, \b false /// otherwise. - //------------------------------------------------------------------ bool GetContextAtIndex(size_t idx, SymbolContext &sc) const; - //------------------------------------------------------------------ /// Direct reference accessor for a symbol context at index \a idx. /// /// The index \a idx must be a valid index, no error checking will be done @@ -515,7 +464,6 @@ /// /// \return /// A const reference to the symbol context to fill in. - //------------------------------------------------------------------ SymbolContext &operator[](size_t idx) { return m_symbol_contexts[idx]; } const SymbolContext &operator[](size_t idx) const { @@ -524,12 +472,10 @@ bool RemoveContextAtIndex(size_t idx); - //------------------------------------------------------------------ /// Get accessor for a symbol context list size. /// /// \return /// Returns the number of symbol context objects in the list. - //------------------------------------------------------------------ uint32_t GetSize() const; uint32_t NumLineEntriesWithLine(uint32_t line) const; @@ -541,9 +487,7 @@ typedef std::vector collection; ///< The collection type for the list. - //------------------------------------------------------------------ // Member variables. - //------------------------------------------------------------------ collection m_symbol_contexts; ///< The list of symbol contexts. public: Index: include/lldb/Symbol/SymbolContextScope.h =================================================================== --- include/lldb/Symbol/SymbolContextScope.h +++ include/lldb/Symbol/SymbolContextScope.h @@ -13,7 +13,6 @@ namespace lldb_private { -//---------------------------------------------------------------------- /// \class SymbolContextScope SymbolContextScope.h /// "lldb/Symbol/SymbolContextScope.h" Inherit from this if your object is /// part of a symbol context @@ -62,12 +61,10 @@ /// can also be created using a SymbolContextScope* and and object pairs that /// allow large collections of objects to be passed around with minimal /// overhead. -//---------------------------------------------------------------------- class SymbolContextScope { public: virtual ~SymbolContextScope() = default; - //------------------------------------------------------------------ /// Reconstruct the object's symbol context into \a sc. /// /// The object should fill in as much of the SymbolContext as it can so @@ -76,7 +73,6 @@ /// /// \param[out] sc /// A symbol context object pointer that gets filled in. - //------------------------------------------------------------------ virtual void CalculateSymbolContext(SymbolContext *sc) = 0; virtual lldb::ModuleSP CalculateSymbolContextModule() { @@ -91,7 +87,6 @@ virtual Symbol *CalculateSymbolContextSymbol() { return nullptr; } - //------------------------------------------------------------------ /// Dump the object's symbol context to the stream \a s. /// /// The object should dump its symbol context to the stream \a s. This @@ -100,7 +95,6 @@ /// /// \param[in] s /// The stream to which to dump the object's symbol context. - //------------------------------------------------------------------ virtual void DumpSymbolContext(Stream *s) = 0; }; Index: include/lldb/Symbol/SymbolFile.h =================================================================== --- include/lldb/Symbol/SymbolFile.h +++ include/lldb/Symbol/SymbolFile.h @@ -32,14 +32,12 @@ class SymbolFile : public PluginInterface { public: - //------------------------------------------------------------------ // Symbol file ability bits. // // Each symbol file can claim to support one or more symbol file abilities. // These get returned from SymbolFile::GetAbilities(). These help us to // determine which plug-in will be best to load the debug information found // in files. - //------------------------------------------------------------------ enum Abilities { CompileUnits = (1u << 0), LineTables = (1u << 1), @@ -53,15 +51,12 @@ static SymbolFile *FindPlugin(ObjectFile *obj_file); - //------------------------------------------------------------------ // Constructors and Destructors - //------------------------------------------------------------------ SymbolFile(ObjectFile *obj_file) : m_obj_file(obj_file), m_abilities(0), m_calculated_abilities(false) {} ~SymbolFile() override {} - //------------------------------------------------------------------ /// Get a mask of what this symbol file supports for the object file /// that it was constructed with. /// @@ -89,7 +84,6 @@ /// A uint32_t mask containing bits from the SymbolFile::Abilities /// enumeration. Any bits that are set represent an ability that /// this symbol plug-in can parse from the object file. - ///------------------------------------------------------------------ uint32_t GetAbilities() { if (!m_calculated_abilities) { m_abilities = CalculateAbilities(); @@ -101,13 +95,10 @@ virtual uint32_t CalculateAbilities() = 0; - //------------------------------------------------------------------ /// Symbols file subclasses should override this to return the Module that /// owns the TypeSystem that this symbol file modifies type information in. - //------------------------------------------------------------------ virtual std::recursive_mutex &GetModuleMutex() const; - //------------------------------------------------------------------ /// Initialize the SymbolFile object. /// /// The SymbolFile object with the best set of abilities (detected @@ -115,12 +106,9 @@ /// called if it is chosen to parse an object file. More complete /// initialization can happen in this function which will get called /// prior to any other functions in the SymbolFile protocol. - //------------------------------------------------------------------ virtual void InitializeObject() {} - //------------------------------------------------------------------ // Compile Unit function calls - //------------------------------------------------------------------ // Approach 1 - iterator virtual uint32_t GetNumCompileUnits() = 0; virtual lldb::CompUnitSP ParseCompileUnitAtIndex(uint32_t index) = 0; @@ -231,10 +219,8 @@ virtual void AddSymbols(Symtab &symtab) {} - //------------------------------------------------------------------ /// Notify the SymbolFile that the file addresses in the Sections /// for this module have been changed. - //------------------------------------------------------------------ virtual void SectionFileAddressesChanged() {} virtual void Dump(Stream &s) {} Index: include/lldb/Symbol/SymbolVendor.h =================================================================== --- include/lldb/Symbol/SymbolVendor.h +++ include/lldb/Symbol/SymbolVendor.h @@ -21,7 +21,6 @@ namespace lldb_private { -//---------------------------------------------------------------------- // The symbol vendor class is designed to abstract the process of searching for // debug information for a given module. Platforms can subclass this class and // provide extra ways to find debug information. Examples would be a subclass @@ -29,15 +28,12 @@ // or runtime data in the object files. A symbol vendor can use multiple // sources (SymbolFile objects) to provide the information and only parse as // deep as needed in order to provide the information that is requested. -//---------------------------------------------------------------------- class SymbolVendor : public ModuleChild, public PluginInterface { public: static SymbolVendor *FindPlugin(const lldb::ModuleSP &module_sp, Stream *feedback_strm); - //------------------------------------------------------------------ // Constructors and Destructors - //------------------------------------------------------------------ SymbolVendor(const lldb::ModuleSP &module_sp); ~SymbolVendor() override; @@ -136,23 +132,17 @@ // Clear module unified section list symbol table. virtual void ClearSymtab(); - //------------------------------------------------------------------ /// Notify the SymbolVendor that the file addresses in the Sections /// for this module have been changed. - //------------------------------------------------------------------ virtual void SectionFileAddressesChanged(); - //------------------------------------------------------------------ // PluginInterface protocol - //------------------------------------------------------------------ ConstString GetPluginName() override; uint32_t GetPluginVersion() override; protected: - //------------------------------------------------------------------ // Classes that inherit from SymbolVendor can see and modify these - //------------------------------------------------------------------ typedef std::vector CompileUnits; typedef CompileUnits::iterator CompileUnitIter; typedef CompileUnits::const_iterator CompileUnitConstIter; @@ -169,9 +159,7 @@ // the symbol file each time when it is needed private: - //------------------------------------------------------------------ // For SymbolVendor only - //------------------------------------------------------------------ DISALLOW_COPY_AND_ASSIGN(SymbolVendor); }; Index: include/lldb/Symbol/Symtab.h =================================================================== --- include/lldb/Symbol/Symtab.h +++ include/lldb/Symbol/Symtab.h @@ -54,13 +54,11 @@ Symbol *FindSymbolWithType(lldb::SymbolType symbol_type, Debug symbol_debug_type, Visibility symbol_visibility, uint32_t &start_idx); - //---------------------------------------------------------------------- /// Get the parent symbol for the given symbol. /// /// Many symbols in symbol tables are scoped by other symbols that /// contain one or more symbol. This function will look for such a /// containing symbol and return it if there is one. - //---------------------------------------------------------------------- const Symbol *GetParent(Symbol *symbol) const; uint32_t AppendSymbolIndexesWithType(lldb::SymbolType symbol_type, std::vector &indexes, Index: include/lldb/Symbol/Type.h =================================================================== --- include/lldb/Symbol/Type.h +++ include/lldb/Symbol/Type.h @@ -22,10 +22,8 @@ #include namespace lldb_private { -//---------------------------------------------------------------------- // CompilerContext allows an array of these items to be passed to perform // detailed lookups in SymbolVendor and SymbolFile functions. -//---------------------------------------------------------------------- struct CompilerContext { CompilerContext(CompilerContextKind t, ConstString n) : type(t), name(n) {} Index: include/lldb/Symbol/TypeList.h =================================================================== --- include/lldb/Symbol/TypeList.h +++ include/lldb/Symbol/TypeList.h @@ -19,9 +19,7 @@ class TypeList { public: - //------------------------------------------------------------------ // Constructors and Destructors - //------------------------------------------------------------------ TypeList(); virtual ~TypeList(); Index: include/lldb/Symbol/TypeMap.h =================================================================== --- include/lldb/Symbol/TypeMap.h +++ include/lldb/Symbol/TypeMap.h @@ -19,9 +19,7 @@ class TypeMap { public: - //------------------------------------------------------------------ // Constructors and Destructors - //------------------------------------------------------------------ TypeMap(); virtual ~TypeMap(); Index: include/lldb/Symbol/TypeSystem.h =================================================================== --- include/lldb/Symbol/TypeSystem.h +++ include/lldb/Symbol/TypeSystem.h @@ -29,12 +29,9 @@ namespace lldb_private { -//---------------------------------------------------------------------- // Interface for representing the Type Systems in different languages. -//---------------------------------------------------------------------- class TypeSystem : public PluginInterface { public: - //---------------------------------------------------------------------- // Intrusive type system that allows us to use llvm casting. // // To add a new type system: @@ -64,7 +61,6 @@ // // Then you can use the llvm casting on any "TypeSystem *" to get an instance // of your subclass. - //---------------------------------------------------------------------- enum LLVMCastKind { eKindClang, eKindSwift, @@ -72,9 +68,7 @@ kNumKinds }; - //---------------------------------------------------------------------- // Constructors and Destructors - //---------------------------------------------------------------------- TypeSystem(LLVMCastKind kind); ~TypeSystem() override; @@ -99,9 +93,7 @@ // Returns true if the symbol file changed during the set accessor. virtual void SetSymbolFile(SymbolFile *sym_file) { m_sym_file = sym_file; } - //---------------------------------------------------------------------- // CompilerDecl functions - //---------------------------------------------------------------------- virtual ConstString DeclGetName(void *opaque_decl) = 0; virtual ConstString DeclGetMangledName(void *opaque_decl); @@ -115,9 +107,7 @@ virtual CompilerType DeclGetFunctionArgumentType(void *opaque_decl, size_t arg_idx); - //---------------------------------------------------------------------- // CompilerDeclContext functions - //---------------------------------------------------------------------- virtual std::vector DeclContextFindDeclByName(void *opaque_decl_ctx, ConstString name, @@ -137,9 +127,7 @@ virtual bool DeclContextIsContainedInLookup(void *opaque_decl_ctx, void *other_opaque_decl_ctx) = 0; - //---------------------------------------------------------------------- // Tests - //---------------------------------------------------------------------- virtual bool IsArrayType(lldb::opaque_compiler_type_t type, CompilerType *element_type, uint64_t *size, @@ -196,21 +184,15 @@ // TypeSystems can support more than one language virtual bool SupportsLanguage(lldb::LanguageType language) = 0; - //---------------------------------------------------------------------- // Type Completion - //---------------------------------------------------------------------- virtual bool GetCompleteType(lldb::opaque_compiler_type_t type) = 0; - //---------------------------------------------------------------------- // AST related queries - //---------------------------------------------------------------------- virtual uint32_t GetPointerByteSize() = 0; - //---------------------------------------------------------------------- // Accessors - //---------------------------------------------------------------------- virtual ConstString GetTypeName(lldb::opaque_compiler_type_t type) = 0; @@ -223,9 +205,7 @@ virtual lldb::TypeClass GetTypeClass(lldb::opaque_compiler_type_t type) = 0; - //---------------------------------------------------------------------- // Creating related types - //---------------------------------------------------------------------- virtual CompilerType GetArrayElementType(lldb::opaque_compiler_type_t type, uint64_t *stride) = 0; @@ -271,9 +251,7 @@ const char *name, const CompilerDeclContext &decl_ctx); - //---------------------------------------------------------------------- // Exploring the type - //---------------------------------------------------------------------- virtual llvm::Optional GetBitSize(lldb::opaque_compiler_type_t type, @@ -356,9 +334,7 @@ virtual llvm::Optional GetIntegralTemplateArgument(lldb::opaque_compiler_type_t type, size_t idx); - //---------------------------------------------------------------------- // Dumping types - //---------------------------------------------------------------------- #ifndef NDEBUG /// Convenience LLVM-style dump method for use in the debugger only. @@ -387,9 +363,7 @@ virtual void DumpTypeDescription(lldb::opaque_compiler_type_t type, Stream *s) = 0; - //---------------------------------------------------------------------- // TODO: These methods appear unused. Should they be removed? - //---------------------------------------------------------------------- virtual bool IsRuntimeGeneratedType(lldb::opaque_compiler_type_t type) = 0; @@ -405,9 +379,7 @@ const char *s, uint8_t *dst, size_t dst_size) = 0; - //---------------------------------------------------------------------- // TODO: Determine if these methods should move to ClangASTContext. - //---------------------------------------------------------------------- virtual bool IsPointerOrReferenceType(lldb::opaque_compiler_type_t type, CompilerType *pointee_type) = 0; Index: include/lldb/Symbol/Variable.h =================================================================== --- include/lldb/Symbol/Variable.h +++ include/lldb/Symbol/Variable.h @@ -26,9 +26,7 @@ public: typedef RangeVector RangeList; - //------------------------------------------------------------------ // Constructors and Destructors - //------------------------------------------------------------------ Variable(lldb::user_id_t uid, const char *name, const char *mangled, // The mangled or fully qualified name of the variable. Index: include/lldb/Symbol/VariableList.h =================================================================== --- include/lldb/Symbol/VariableList.h +++ include/lldb/Symbol/VariableList.h @@ -17,9 +17,7 @@ class VariableList { public: - //------------------------------------------------------------------ // Constructors and Destructors - //------------------------------------------------------------------ // VariableList(const SymbolContext &symbol_context); VariableList(); virtual ~VariableList(); @@ -75,9 +73,7 @@ collection m_variables; private: - //------------------------------------------------------------------ // For VariableList only - //------------------------------------------------------------------ DISALLOW_COPY_AND_ASSIGN(VariableList); }; Index: include/lldb/Target/ABI.h =================================================================== --- include/lldb/Target/ABI.h +++ include/lldb/Target/ABI.h @@ -86,14 +86,12 @@ virtual lldb::ValueObjectSP GetReturnValueObjectImpl(Thread &thread, llvm::Type &ir_type) const; - //------------------------------------------------------------------ /// Request to get a Process shared pointer. /// /// This ABI object may not have been created with a Process object, /// or the Process object may no longer be alive. Be sure to handle /// the case where the shared pointer returned does not have an /// object inside it. - //------------------------------------------------------------------ lldb::ProcessSP GetProcessSP() const { return m_process_wp.lock(); } public: @@ -138,9 +136,7 @@ static lldb::ABISP FindPlugin(lldb::ProcessSP process_sp, const ArchSpec &arch); protected: - //------------------------------------------------------------------ // Classes that inherit from ABI can see and modify these - //------------------------------------------------------------------ ABI(lldb::ProcessSP process_sp) { if (process_sp.get()) m_process_wp = process_sp; Index: include/lldb/Target/CPPLanguageRuntime.h =================================================================== --- include/lldb/Target/CPPLanguageRuntime.h +++ include/lldb/Target/CPPLanguageRuntime.h @@ -1,5 +1,4 @@ //===-- CPPLanguageRuntime.h -//---------------------------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -65,9 +64,7 @@ bool stop_others); protected: - //------------------------------------------------------------------ // Classes that inherit from CPPLanguageRuntime can see and modify these - //------------------------------------------------------------------ CPPLanguageRuntime(Process *process); private: Index: include/lldb/Target/DynamicLoader.h =================================================================== --- include/lldb/Target/DynamicLoader.h +++ include/lldb/Target/DynamicLoader.h @@ -44,7 +44,6 @@ namespace lldb_private { -//---------------------------------------------------------------------- /// \class DynamicLoader DynamicLoader.h "lldb/Target/DynamicLoader.h" /// A plug-in interface definition class for dynamic loaders. /// @@ -62,10 +61,8 @@ /// boolean value that indicates if the process should continue or halt and /// should return the global setting for this using: /// DynamicLoader::StopWhenImagesChange() const. -//---------------------------------------------------------------------- class DynamicLoader : public PluginInterface { public: - //------------------------------------------------------------------ /// Find a dynamic loader plugin for a given process. /// /// Scans the installed DynamicLoader plug-ins and tries to find an instance @@ -78,48 +75,36 @@ /// \param[in] plugin_name /// An optional name of a specific dynamic loader plug-in that /// should be used. If NULL, pick the best plug-in. - //------------------------------------------------------------------ static DynamicLoader *FindPlugin(Process *process, const char *plugin_name); - //------------------------------------------------------------------ /// Construct with a process. - //------------------------------------------------------------------ DynamicLoader(Process *process); - //------------------------------------------------------------------ /// Destructor. /// /// The destructor is virtual since this class is designed to be inherited /// from by the plug-in instance. - //------------------------------------------------------------------ virtual ~DynamicLoader() override; - //------------------------------------------------------------------ /// Called after attaching a process. /// /// Allow DynamicLoader plug-ins to execute some code after attaching to a /// process. - //------------------------------------------------------------------ virtual void DidAttach() = 0; - //------------------------------------------------------------------ /// Called after launching a process. /// /// Allow DynamicLoader plug-ins to execute some code after the process has /// stopped for the first time on launch. - //------------------------------------------------------------------ virtual void DidLaunch() = 0; - //------------------------------------------------------------------ /// Helper function that can be used to detect when a process has called /// exec and is now a new and different process. This can be called when /// necessary to try and detect the exec. The process might be able to /// answer this question, but sometimes it might not be able and the dynamic /// loader often knows what the program entry point is. So the process and /// the dynamic loader can work together to detect this. - //------------------------------------------------------------------ virtual bool ProcessDidExec() { return false; } - //------------------------------------------------------------------ /// Get whether the process should stop when images change. /// /// When images (executables and shared libraries) get loaded or unloaded, @@ -131,10 +116,8 @@ /// \return /// Returns \b true if the process should stop when images /// change, \b false if the process should resume. - //------------------------------------------------------------------ bool GetStopWhenImagesChange() const; - //------------------------------------------------------------------ /// Set whether the process should stop when images change. /// /// When images (executables and shared libraries) get loaded or unloaded, @@ -146,10 +129,8 @@ /// \param[in] stop /// Boolean value that indicates whether the process should stop /// when images change. - //------------------------------------------------------------------ void SetStopWhenImagesChange(bool stop); - //------------------------------------------------------------------ /// Provides a plan to step through the dynamic loader trampoline for the /// current state of \a thread. /// @@ -160,11 +141,9 @@ /// \return /// A pointer to the plan (caller owned) or NULL if we are not at such /// a trampoline. - //------------------------------------------------------------------ virtual lldb::ThreadPlanSP GetStepThroughTrampolinePlan(Thread &thread, bool stop_others) = 0; - //------------------------------------------------------------------ /// Some dynamic loaders provide features where there are a group of symbols /// "equivalent to" a given symbol one of which will be chosen when the /// symbol is bound. If you want to set a breakpoint on one of these @@ -183,14 +162,12 @@ /// /// \return /// Number of equivalent symbols found. - //------------------------------------------------------------------ virtual size_t FindEquivalentSymbols(Symbol *original_symbol, ModuleList &module_list, SymbolContextList &equivalent_symbols) { return 0; } - //------------------------------------------------------------------ /// Ask if it is ok to try and load or unload an shared library (image). /// /// The dynamic loader often knows when it would be ok to try and load or @@ -201,10 +178,8 @@ /// \return /// \b true if it is currently ok to try and load a shared /// library into the process, \b false otherwise. - //------------------------------------------------------------------ virtual Status CanLoadImage() = 0; - //------------------------------------------------------------------ /// Ask if the eh_frame information for the given SymbolContext should be /// relied on even when it's the first frame in a stack unwind. /// @@ -225,12 +200,10 @@ /// unconditionally when unwinding from this frame. Else \b false, /// the normal lldb unwind behavior of only using eh_frame when the /// function appears in the middle of the stack. - //------------------------------------------------------------------ virtual bool AlwaysRelyOnEHUnwindInfo(SymbolContext &sym_ctx) { return false; } - //------------------------------------------------------------------ /// Retrieves the per-module TLS block for a given thread. /// /// \param[in] module @@ -243,7 +216,6 @@ /// If the given thread has TLS data allocated for the /// module, the address of the TLS block. Otherwise /// LLDB_INVALID_ADDRESS is returned. - //------------------------------------------------------------------ virtual lldb::addr_t GetThreadLocalData(const lldb::ModuleSP module, const lldb::ThreadSP thread, lldb::addr_t tls_file_addr) { @@ -257,7 +229,6 @@ lldb::addr_t base_addr, bool base_addr_is_offset); - //------------------------------------------------------------------ /// Get information about the shared cache for a process, if possible. /// /// On some systems (e.g. Darwin based systems), a set of libraries that are @@ -292,7 +263,6 @@ /// \return /// Returns false if this DynamicLoader cannot gather information /// about the shared cache / has no concept of a shared cache. - //------------------------------------------------------------------ virtual bool GetSharedCacheInformation(lldb::addr_t &base_address, UUID &uuid, LazyBool &using_shared_cache, LazyBool &private_shared_cache) { @@ -304,9 +274,7 @@ } protected: - //------------------------------------------------------------------ // Utility methods for derived classes - //------------------------------------------------------------------ /// Checks to see if the target module has changed, updates the target /// accordingly and returns the target executable module. @@ -353,9 +321,7 @@ void LoadOperatingSystemPlugin(bool flush); - //------------------------------------------------------------------ // Member variables. - //------------------------------------------------------------------ Process *m_process; ///< The process that this dynamic loader plug-in is tracking. Index: include/lldb/Target/ExecutionContext.h =================================================================== --- include/lldb/Target/ExecutionContext.h +++ include/lldb/Target/ExecutionContext.h @@ -40,7 +40,6 @@ /// a wide variety of functions that require execution contexts. //===----------------------------------------------------------------------===// -//---------------------------------------------------------------------- /// \class ExecutionContextRef ExecutionContext.h /// "lldb/Target/ExecutionContext.h" /// A class that holds a weak reference to an execution context. @@ -70,44 +69,32 @@ /// exist during a function that requires the objects. ExecutionContext /// objects should NOT be used for long term storage since they will keep /// objects alive with extra shared pointer references to these objects. -//---------------------------------------------------------------------- class ExecutionContextRef { public: - //------------------------------------------------------------------ /// Default Constructor. - //------------------------------------------------------------------ ExecutionContextRef(); - //------------------------------------------------------------------ /// Copy Constructor. - //------------------------------------------------------------------ ExecutionContextRef(const ExecutionContextRef &rhs); - //------------------------------------------------------------------ /// Construct using an ExecutionContext object that might be nullptr. /// /// If \a exe_ctx_ptr is valid, then make weak references to any valid /// objects in the ExecutionContext, otherwise no weak references to any /// execution context objects will be made. - //------------------------------------------------------------------ ExecutionContextRef(const ExecutionContext *exe_ctx_ptr); - //------------------------------------------------------------------ /// Construct using an ExecutionContext object. /// /// Make weak references to any valid objects in the ExecutionContext. - //------------------------------------------------------------------ ExecutionContextRef(const ExecutionContext &exe_ctx); - //------------------------------------------------------------------ /// Construct using the target and all the selected items inside of it (the /// process and its selected thread, and the thread's selected frame). If /// there is no selected thread, default to the first thread If there is no /// selected frame, default to the first frame. - //------------------------------------------------------------------ ExecutionContextRef(Target *target, bool adopt_selected); - //------------------------------------------------------------------ /// Construct using an execution context scope. /// /// If the ExecutionContextScope object is valid and refers to a frame, make @@ -118,10 +105,8 @@ /// references too the process and target. If the ExecutionContextScope /// object is valid and refers to a target, make weak references too the /// target. - //------------------------------------------------------------------ ExecutionContextRef(ExecutionContextScope *exe_scope); - //------------------------------------------------------------------ /// Construct using an execution context scope. /// /// If the ExecutionContextScope object refers to a frame, make weak @@ -131,34 +116,26 @@ /// refers to a process, make weak references too the process and target. If /// the ExecutionContextScope object refers to a target, make weak /// references too the target. - //------------------------------------------------------------------ ExecutionContextRef(ExecutionContextScope &exe_scope); ~ExecutionContextRef(); - //------------------------------------------------------------------ /// Assignment operator /// /// Copy all weak references in \a rhs. - //------------------------------------------------------------------ ExecutionContextRef &operator=(const ExecutionContextRef &rhs); - //------------------------------------------------------------------ /// Assignment operator from a ExecutionContext /// /// Make weak references to any strongly referenced objects in \a exe_ctx. - //------------------------------------------------------------------ ExecutionContextRef &operator=(const ExecutionContext &exe_ctx); - //------------------------------------------------------------------ /// Clear the object's state. /// /// Sets the process and thread to nullptr, and the frame index to an /// invalid value. - //------------------------------------------------------------------ void Clear(); - //------------------------------------------------------------------ /// Set accessor that creates a weak reference to the target referenced in /// \a target_sp. /// @@ -172,10 +149,8 @@ /// ExecutionContextRef::SetContext() functions. /// /// \see ExecutionContextRef::SetContext(const lldb::TargetSP &, bool) - //------------------------------------------------------------------ void SetTargetSP(const lldb::TargetSP &target_sp); - //------------------------------------------------------------------ /// Set accessor that creates a weak reference to the process referenced in /// \a process_sp. /// @@ -189,10 +164,8 @@ /// ExecutionContextRef::SetContext() functions. /// /// \see ExecutionContextRef::SetContext(const lldb::ProcessSP &) - //------------------------------------------------------------------ void SetProcessSP(const lldb::ProcessSP &process_sp); - //------------------------------------------------------------------ /// Set accessor that creates a weak reference to the thread referenced in /// \a thread_sp. /// @@ -206,10 +179,8 @@ /// ExecutionContextRef::SetContext() functions. /// /// \see ExecutionContextRef::SetContext(const lldb::ThreadSP &) - //------------------------------------------------------------------ void SetThreadSP(const lldb::ThreadSP &thread_sp); - //------------------------------------------------------------------ /// Set accessor that creates a weak reference to the frame referenced in \a /// frame_sp. /// @@ -223,7 +194,6 @@ /// ExecutionContextRef::SetContext() functions. /// /// \see ExecutionContextRef::SetContext(const lldb::StackFrameSP &) - //------------------------------------------------------------------ void SetFrameSP(const lldb::StackFrameSP &frame_sp); void SetTargetPtr(Target *target, bool adopt_selected); @@ -234,43 +204,34 @@ void SetFramePtr(StackFrame *frame); - //------------------------------------------------------------------ /// Get accessor that creates a strong reference from the weak target /// reference contained in this object. /// /// \returns /// A shared pointer to a target that is not guaranteed to be valid. - //------------------------------------------------------------------ lldb::TargetSP GetTargetSP() const; - //------------------------------------------------------------------ /// Get accessor that creates a strong reference from the weak process /// reference contained in this object. /// /// \returns /// A shared pointer to a process that is not guaranteed to be valid. - //------------------------------------------------------------------ lldb::ProcessSP GetProcessSP() const; - //------------------------------------------------------------------ /// Get accessor that creates a strong reference from the weak thread /// reference contained in this object. /// /// \returns /// A shared pointer to a thread that is not guaranteed to be valid. - //------------------------------------------------------------------ lldb::ThreadSP GetThreadSP() const; - //------------------------------------------------------------------ /// Get accessor that creates a strong reference from the weak frame /// reference contained in this object. /// /// \returns /// A shared pointer to a frame that is not guaranteed to be valid. - //------------------------------------------------------------------ lldb::StackFrameSP GetFrameSP() const; - //------------------------------------------------------------------ /// Create an ExecutionContext object from this object. /// /// Create strong references to any execution context objects that are still @@ -278,21 +239,16 @@ /// objects is not guaranteed to be valid. \returns /// An execution context object that has strong references to /// any valid weak references in this object. - //------------------------------------------------------------------ ExecutionContext Lock(bool thread_and_frame_only_if_stopped) const; - //------------------------------------------------------------------ /// Returns true if this object has a weak reference to a thread. The return /// value is only an indication of whether this object has a weak reference /// and does not indicate whether the weak reference is valid or not. - //------------------------------------------------------------------ bool HasThreadRef() const { return m_tid != LLDB_INVALID_THREAD_ID; } - //------------------------------------------------------------------ /// Returns true if this object has a weak reference to a frame. The return /// value is only an indication of whether this object has a weak reference /// and does not indicate whether the weak reference is valid or not. - //------------------------------------------------------------------ bool HasFrameRef() const { return m_stack_id.IsValid(); } void ClearThread() { @@ -303,9 +259,7 @@ void ClearFrame() { m_stack_id.Clear(); } protected: - //------------------------------------------------------------------ // Member variables - //------------------------------------------------------------------ lldb::TargetWP m_target_wp; ///< A weak reference to a target lldb::ProcessWP m_process_wp; ///< A weak reference to a process mutable lldb::ThreadWP m_thread_wp; ///< A weak reference to a thread @@ -315,7 +269,6 @@ ///backing object changes }; -//---------------------------------------------------------------------- /// \class ExecutionContext ExecutionContext.h /// "lldb/Target/ExecutionContext.h" /// A class that contains an execution context. @@ -335,35 +288,24 @@ /// for passing down to other functions that also require specific contexts. /// They should NOT be used for long term storage, for long term storage use /// ExecutionContextRef objects. -//---------------------------------------------------------------------- class ExecutionContext { public: - //------------------------------------------------------------------ /// Default Constructor. - //------------------------------------------------------------------ ExecutionContext(); - //------------------------------------------------------------------ // Copy constructor - //------------------------------------------------------------------ ExecutionContext(const ExecutionContext &rhs); - //------------------------------------------------------------------ // Adopt the target and optionally its current context. - //------------------------------------------------------------------ ExecutionContext(Target *t, bool fill_current_process_thread_frame = true); - //------------------------------------------------------------------ // Create execution contexts from shared pointers - //------------------------------------------------------------------ ExecutionContext(const lldb::TargetSP &target_sp, bool get_process); ExecutionContext(const lldb::ProcessSP &process_sp); ExecutionContext(const lldb::ThreadSP &thread_sp); ExecutionContext(const lldb::StackFrameSP &frame_sp); - //------------------------------------------------------------------ // Create execution contexts from weak pointers - //------------------------------------------------------------------ ExecutionContext(const lldb::TargetWP &target_wp, bool get_process); ExecutionContext(const lldb::ProcessWP &process_wp); ExecutionContext(const lldb::ThreadWP &thread_wp); @@ -378,13 +320,10 @@ std::unique_lock &locker); ExecutionContext(const ExecutionContextRef *exe_ctx_ref, std::unique_lock &locker); - //------------------------------------------------------------------ // Create execution contexts from execution context scopes - //------------------------------------------------------------------ ExecutionContext(ExecutionContextScope *exe_scope); ExecutionContext(ExecutionContextScope &exe_scope); - //------------------------------------------------------------------ /// Construct with process, thread, and frame index. /// /// Initialize with process \a p, thread \a t, and frame index \a f. @@ -397,7 +336,6 @@ /// /// \param[in] frame /// The frame index for this execution context. - //------------------------------------------------------------------ ExecutionContext(Process *process, Thread *thread = nullptr, StackFrame *frame = nullptr); @@ -409,12 +347,10 @@ bool operator!=(const ExecutionContext &rhs) const; - //------------------------------------------------------------------ /// Clear the object's state. /// /// Sets the process and thread to nullptr, and the frame index to an /// invalid value. - //------------------------------------------------------------------ void Clear(); RegisterContext *GetRegisterContext() const; @@ -425,7 +361,6 @@ lldb::ByteOrder GetByteOrder() const; - //------------------------------------------------------------------ /// Returns a pointer to the target object. /// /// The returned pointer might be nullptr. Calling HasTargetScope(), @@ -437,10 +372,8 @@ /// ExecutionContext::HasProcessScope() const @see /// ExecutionContext::HasThreadScope() const @see /// ExecutionContext::HasFrameScope() const - //------------------------------------------------------------------ Target *GetTargetPtr() const; - //------------------------------------------------------------------ /// Returns a pointer to the process object. /// /// The returned pointer might be nullptr. Calling HasProcessScope(), @@ -451,10 +384,8 @@ /// \see ExecutionContext::HasProcessScope() const @see /// ExecutionContext::HasThreadScope() const @see /// ExecutionContext::HasFrameScope() const - //------------------------------------------------------------------ Process *GetProcessPtr() const; - //------------------------------------------------------------------ /// Returns a pointer to the thread object. /// /// The returned pointer might be nullptr. Calling HasThreadScope() or @@ -464,10 +395,8 @@ /// /// \see ExecutionContext::HasThreadScope() const @see /// ExecutionContext::HasFrameScope() const - //------------------------------------------------------------------ Thread *GetThreadPtr() const { return m_thread_sp.get(); } - //------------------------------------------------------------------ /// Returns a pointer to the frame object. /// /// The returned pointer might be nullptr. Calling HasFrameScope(), can help @@ -475,10 +404,8 @@ /// without having to check for nullptr each time. /// /// \see ExecutionContext::HasFrameScope() const - //------------------------------------------------------------------ StackFrame *GetFramePtr() const { return m_frame_sp.get(); } - //------------------------------------------------------------------ /// Returns a reference to the target object. /// /// Clients should call HasTargetScope(), HasProcessScope(), @@ -489,10 +416,8 @@ /// ExecutionContext::HasProcessScope() const @see /// ExecutionContext::HasThreadScope() const @see /// ExecutionContext::HasFrameScope() const - //------------------------------------------------------------------ Target &GetTargetRef() const; - //------------------------------------------------------------------ /// Returns a reference to the process object. /// /// Clients should call HasProcessScope(), HasThreadScope(), or @@ -502,10 +427,8 @@ /// \see ExecutionContext::HasProcessScope() const @see /// ExecutionContext::HasThreadScope() const @see /// ExecutionContext::HasFrameScope() const - //------------------------------------------------------------------ Process &GetProcessRef() const; - //------------------------------------------------------------------ /// Returns a reference to the thread object. /// /// Clients should call HasThreadScope(), or HasFrameScope() prior to @@ -514,135 +437,97 @@ /// /// \see ExecutionContext::HasThreadScope() const @see /// ExecutionContext::HasFrameScope() const - //------------------------------------------------------------------ Thread &GetThreadRef() const; - //------------------------------------------------------------------ /// Returns a reference to the thread object. /// /// Clients should call HasFrameScope() prior to calling this function to /// ensure that this ExecutionContext object contains a valid target. /// /// \see ExecutionContext::HasFrameScope() const - //------------------------------------------------------------------ StackFrame &GetFrameRef() const; - //------------------------------------------------------------------ /// Get accessor to get the target shared pointer. /// /// The returned shared pointer is not guaranteed to be valid. - //------------------------------------------------------------------ const lldb::TargetSP &GetTargetSP() const { return m_target_sp; } - //------------------------------------------------------------------ /// Get accessor to get the process shared pointer. /// /// The returned shared pointer is not guaranteed to be valid. - //------------------------------------------------------------------ const lldb::ProcessSP &GetProcessSP() const { return m_process_sp; } - //------------------------------------------------------------------ /// Get accessor to get the thread shared pointer. /// /// The returned shared pointer is not guaranteed to be valid. - //------------------------------------------------------------------ const lldb::ThreadSP &GetThreadSP() const { return m_thread_sp; } - //------------------------------------------------------------------ /// Get accessor to get the frame shared pointer. /// /// The returned shared pointer is not guaranteed to be valid. - //------------------------------------------------------------------ const lldb::StackFrameSP &GetFrameSP() const { return m_frame_sp; } - //------------------------------------------------------------------ /// Set accessor to set only the target shared pointer. - //------------------------------------------------------------------ void SetTargetSP(const lldb::TargetSP &target_sp); - //------------------------------------------------------------------ /// Set accessor to set only the process shared pointer. - //------------------------------------------------------------------ void SetProcessSP(const lldb::ProcessSP &process_sp); - //------------------------------------------------------------------ /// Set accessor to set only the thread shared pointer. - //------------------------------------------------------------------ void SetThreadSP(const lldb::ThreadSP &thread_sp); - //------------------------------------------------------------------ /// Set accessor to set only the frame shared pointer. - //------------------------------------------------------------------ void SetFrameSP(const lldb::StackFrameSP &frame_sp); - //------------------------------------------------------------------ /// Set accessor to set only the target shared pointer from a target /// pointer. - //------------------------------------------------------------------ void SetTargetPtr(Target *target); - //------------------------------------------------------------------ /// Set accessor to set only the process shared pointer from a process /// pointer. - //------------------------------------------------------------------ void SetProcessPtr(Process *process); - //------------------------------------------------------------------ /// Set accessor to set only the thread shared pointer from a thread /// pointer. - //------------------------------------------------------------------ void SetThreadPtr(Thread *thread); - //------------------------------------------------------------------ /// Set accessor to set only the frame shared pointer from a frame pointer. - //------------------------------------------------------------------ void SetFramePtr(StackFrame *frame); - //------------------------------------------------------------------ // Set the execution context using a target shared pointer. // // If "target_sp" is valid, sets the target context to match and if // "get_process" is true, sets the process shared pointer if the target // currently has a process. - //------------------------------------------------------------------ void SetContext(const lldb::TargetSP &target_sp, bool get_process); - //------------------------------------------------------------------ // Set the execution context using a process shared pointer. // // If "process_sp" is valid, then set the process and target in this context. // Thread and frame contexts will be cleared. If "process_sp" is not valid, // all shared pointers are reset. - //------------------------------------------------------------------ void SetContext(const lldb::ProcessSP &process_sp); - //------------------------------------------------------------------ // Set the execution context using a thread shared pointer. // // If "thread_sp" is valid, then set the thread, process and target in this // context. The frame context will be cleared. If "thread_sp" is not valid, // all shared pointers are reset. - //------------------------------------------------------------------ void SetContext(const lldb::ThreadSP &thread_sp); - //------------------------------------------------------------------ // Set the execution context using a frame shared pointer. // // If "frame_sp" is valid, then set the frame, thread, process and target in // this context If "frame_sp" is not valid, all shared pointers are reset. - //------------------------------------------------------------------ void SetContext(const lldb::StackFrameSP &frame_sp); - //------------------------------------------------------------------ /// Returns true the ExecutionContext object contains a valid target. /// /// This function can be called after initializing an ExecutionContext /// object, and if it returns true, calls to GetTargetPtr() and /// GetTargetRef() do not need to be checked for validity. - //------------------------------------------------------------------ bool HasTargetScope() const; - //------------------------------------------------------------------ /// Returns true the ExecutionContext object contains a valid target and /// process. /// @@ -650,10 +535,8 @@ /// object, and if it returns true, calls to GetTargetPtr() and /// GetTargetRef(), GetProcessPtr(), and GetProcessRef(), do not need to be /// checked for validity. - //------------------------------------------------------------------ bool HasProcessScope() const; - //------------------------------------------------------------------ /// Returns true the ExecutionContext object contains a valid target, /// process, and thread. /// @@ -661,10 +544,8 @@ /// object, and if it returns true, calls to GetTargetPtr(), GetTargetRef(), /// GetProcessPtr(), GetProcessRef(), GetThreadPtr(), and GetThreadRef() do /// not need to be checked for validity. - //------------------------------------------------------------------ bool HasThreadScope() const; - //------------------------------------------------------------------ /// Returns true the ExecutionContext object contains a valid target, /// process, thread and frame. /// @@ -672,13 +553,10 @@ /// object, and if it returns true, calls to GetTargetPtr(), GetTargetRef(), /// GetProcessPtr(), GetProcessRef(), GetThreadPtr(), GetThreadRef(), /// GetFramePtr(), and GetFrameRef() do not need to be checked for validity. - //------------------------------------------------------------------ bool HasFrameScope() const; protected: - //------------------------------------------------------------------ // Member variables - //------------------------------------------------------------------ lldb::TargetSP m_target_sp; ///< The target that owns the process/thread/frame lldb::ProcessSP m_process_sp; ///< The process that owns the thread/frame lldb::ThreadSP m_thread_sp; ///< The thread that owns the frame Index: include/lldb/Target/ExecutionContextScope.h =================================================================== --- include/lldb/Target/ExecutionContextScope.h +++ include/lldb/Target/ExecutionContextScope.h @@ -13,7 +13,6 @@ namespace lldb_private { -//---------------------------------------------------------------------- /// @class ExecutionContextScope ExecutionContextScope.h /// "lldb/Target/ExecutionContextScope.h" Inherit from this if your object can /// reconstruct its @@ -30,7 +29,6 @@ /// /// Objects that adhere to this protocol can reconstruct enough of a execution /// context to allow functions that take a execution contexts to be called. -//---------------------------------------------------------------------- class ExecutionContextScope { public: virtual ~ExecutionContextScope() {} @@ -43,7 +41,6 @@ virtual lldb::StackFrameSP CalculateStackFrame() = 0; - //------------------------------------------------------------------ /// Reconstruct the object's execution context into \a sc. /// /// The object should fill in as much of the ExecutionContextScope as it can @@ -53,7 +50,6 @@ /// \param[out] exe_ctx /// A reference to an execution context object that gets filled /// in. - //------------------------------------------------------------------ virtual void CalculateExecutionContext(ExecutionContext &exe_ctx) = 0; }; Index: include/lldb/Target/JITLoader.h =================================================================== --- include/lldb/Target/JITLoader.h +++ include/lldb/Target/JITLoader.h @@ -16,7 +16,6 @@ namespace lldb_private { -//---------------------------------------------------------------------- /// \class JITLoader JITLoader.h "lldb/Target/JITLoader.h" /// A plug-in interface definition class for JIT loaders. /// @@ -25,10 +24,8 @@ /// not have information about the target's dyld and that there may be /// multiple JITLoader plugins per process, while there is at most one /// DynamicLoader. -//---------------------------------------------------------------------- class JITLoader : public PluginInterface { public: - //------------------------------------------------------------------ /// Find a JIT loader plugin for a given process. /// /// Scans the installed DynamicLoader plug-ins and tries to find all @@ -38,42 +35,31 @@ /// The process for which to try and locate a JIT loader /// plug-in instance. /// - //------------------------------------------------------------------ static void LoadPlugins(Process *process, lldb_private::JITLoaderList &list); - //------------------------------------------------------------------ /// Construct with a process. - //------------------------------------------------------------------ JITLoader(Process *process); ~JITLoader() override; - //------------------------------------------------------------------ /// Called after attaching a process. /// /// Allow JITLoader plug-ins to execute some code after attaching to a /// process. - //------------------------------------------------------------------ virtual void DidAttach() = 0; - //------------------------------------------------------------------ /// Called after launching a process. /// /// Allow JITLoader plug-ins to execute some code after the process has /// stopped for the first time on launch. - //------------------------------------------------------------------ virtual void DidLaunch() = 0; - //------------------------------------------------------------------ /// Called after a new shared object has been loaded so that it can be /// probed for JIT entry point hooks. - //------------------------------------------------------------------ virtual void ModulesDidLoad(lldb_private::ModuleList &module_list) = 0; protected: - //------------------------------------------------------------------ // Member variables. - //------------------------------------------------------------------ Process *m_process; }; Index: include/lldb/Target/JITLoaderList.h =================================================================== --- include/lldb/Target/JITLoaderList.h +++ include/lldb/Target/JITLoaderList.h @@ -16,11 +16,9 @@ namespace lldb_private { -//---------------------------------------------------------------------- /// \class JITLoaderList JITLoaderList.h "lldb/Target/JITLoaderList.h" /// /// Class used by the Process to hold a list of its JITLoaders. -//---------------------------------------------------------------------- class JITLoaderList { public: JITLoaderList(); Index: include/lldb/Target/Language.h =================================================================== --- include/lldb/Target/Language.h +++ include/lldb/Target/Language.h @@ -261,9 +261,7 @@ GetLanguagesSupportingREPLs(std::set &languages); protected: - //------------------------------------------------------------------ // Classes that inherit from Language can see and modify these - //------------------------------------------------------------------ Language(); Index: include/lldb/Target/LanguageRuntime.h =================================================================== --- include/lldb/Target/LanguageRuntime.h +++ include/lldb/Target/LanguageRuntime.h @@ -162,9 +162,7 @@ } protected: - //------------------------------------------------------------------ // Classes that inherit from LanguageRuntime can see and modify these - //------------------------------------------------------------------ LanguageRuntime(Process *process); Process *m_process; Index: include/lldb/Target/Memory.h =================================================================== --- include/lldb/Target/Memory.h +++ include/lldb/Target/Memory.h @@ -16,15 +16,11 @@ #include namespace lldb_private { -//---------------------------------------------------------------------- // A class to track memory that was read from a live process between // runs. -//---------------------------------------------------------------------- class MemoryCache { public: - //------------------------------------------------------------------ // Constructors and Destructors - //------------------------------------------------------------------ MemoryCache(Process &process); ~MemoryCache(); @@ -51,9 +47,7 @@ typedef std::map BlockMap; typedef RangeArray InvalidRanges; typedef Range AddrRange; - //------------------------------------------------------------------ // Classes that inherit from MemoryCache can see and modify these - //------------------------------------------------------------------ std::recursive_mutex m_mutex; BlockMap m_L1_cache; // A first level memory cache whose chunk sizes vary that // will be used only if the memory read fits entirely in @@ -111,16 +105,12 @@ RangeVector m_reserved_blocks; }; -//---------------------------------------------------------------------- // A class that can track allocated memory and give out allocated memory // without us having to make an allocate/deallocate call every time we need // some memory in a process that is being debugged. -//---------------------------------------------------------------------- class AllocatedMemoryCache { public: - //------------------------------------------------------------------ // Constructors and Destructors - //------------------------------------------------------------------ AllocatedMemoryCache(Process &process); ~AllocatedMemoryCache(); @@ -138,9 +128,7 @@ AllocatedBlockSP AllocatePage(uint32_t byte_size, uint32_t permissions, uint32_t chunk_size, Status &error); - //------------------------------------------------------------------ // Classes that inherit from MemoryCache can see and modify these - //------------------------------------------------------------------ Process &m_process; std::recursive_mutex m_mutex; typedef std::multimap PermissionsToBlockMap; Index: include/lldb/Target/MemoryRegionInfo.h =================================================================== --- include/lldb/Target/MemoryRegionInfo.h +++ include/lldb/Target/MemoryRegionInfo.h @@ -64,10 +64,8 @@ void SetBlocksize(lldb::offset_t blocksize) { m_blocksize = blocksize; } - //---------------------------------------------------------------------- // Get permissions as a uint32_t that is a mask of one or more bits from the // lldb::Permissions - //---------------------------------------------------------------------- uint32_t GetLLDBPermissions() const { uint32_t permissions = 0; if (m_read) @@ -79,10 +77,8 @@ return permissions; } - //---------------------------------------------------------------------- // Set permissions from a uint32_t that contains one or more bits from the // lldb::Permissions - //---------------------------------------------------------------------- void SetLLDBPermissions(uint32_t permissions) { m_read = (permissions & lldb::ePermissionsReadable) ? eYes : eNo; m_write = (permissions & lldb::ePermissionsWritable) ? eYes : eNo; Index: include/lldb/Target/ModuleCache.h =================================================================== --- include/lldb/Target/ModuleCache.h +++ include/lldb/Target/ModuleCache.h @@ -25,7 +25,6 @@ class Module; class UUID; -//---------------------------------------------------------------------- /// \class ModuleCache ModuleCache.h "lldb/Target/ModuleCache.h" /// A module cache class. /// @@ -44,7 +43,6 @@ /// /tmp/lldb/remote- /// linux/.cache/30C94DC6-6A1F-E951-80C3-D68D2B89E576-D5AE213C/libc.so.6 /// Sysroot view: /tmp/lldb/remote-linux/ubuntu/lib/x86_64-linux-gnu/libc.so.6 -//---------------------------------------------------------------------- class ModuleCache { public: Index: include/lldb/Target/ObjCLanguageRuntime.h =================================================================== --- include/lldb/Target/ObjCLanguageRuntime.h +++ include/lldb/Target/ObjCLanguageRuntime.h @@ -293,9 +293,7 @@ uint64_t &size) override; protected: - //------------------------------------------------------------------ // Classes that inherit from ObjCLanguageRuntime can see and modify these - //------------------------------------------------------------------ ObjCLanguageRuntime(Process *process); virtual bool CalculateHasNewLiteralsAndIndexing() { return false; } Index: include/lldb/Target/OperatingSystem.h =================================================================== --- include/lldb/Target/OperatingSystem.h +++ include/lldb/Target/OperatingSystem.h @@ -16,7 +16,6 @@ namespace lldb_private { -//---------------------------------------------------------------------- /// \class OperatingSystem OperatingSystem.h "lldb/Target/OperatingSystem.h" /// A plug-in interface definition class for halted OS helpers. /// @@ -25,11 +24,9 @@ /// This is commonly used when attaching to an operating system that is /// halted, such as when debugging over JTAG or connecting to low level kernel /// debug services. -//---------------------------------------------------------------------- class OperatingSystem : public PluginInterface { public: - //------------------------------------------------------------------ /// Find a halted OS plugin for a given process. /// /// Scans the installed OperatingSystem plug-ins and tries to find an @@ -42,19 +39,14 @@ /// \param[in] plugin_name /// An optional name of a specific halted OS plug-in that /// should be used. If NULL, pick the best plug-in. - //------------------------------------------------------------------ static OperatingSystem *FindPlugin(Process *process, const char *plugin_name); - //------------------------------------------------------------------ // Class Methods - //------------------------------------------------------------------ OperatingSystem(Process *process); ~OperatingSystem() override; - //------------------------------------------------------------------ // Plug-in Methods - //------------------------------------------------------------------ virtual bool UpdateThreadList(ThreadList &old_thread_list, ThreadList &real_thread_list, ThreadList &new_thread_list) = 0; @@ -74,9 +66,7 @@ virtual bool IsOperatingSystemPluginThread(const lldb::ThreadSP &thread_sp); protected: - //------------------------------------------------------------------ // Member variables. - //------------------------------------------------------------------ Process *m_process; ///< The process that this dynamic loader plug-in is tracking. private: Index: include/lldb/Target/PathMappingList.h =================================================================== --- include/lldb/Target/PathMappingList.h +++ include/lldb/Target/PathMappingList.h @@ -21,9 +21,7 @@ typedef void (*ChangedCallback)(const PathMappingList &path_list, void *baton); - //------------------------------------------------------------------ // Constructors and Destructors - //------------------------------------------------------------------ PathMappingList(); PathMappingList(ChangedCallback callback, void *callback_baton); @@ -65,7 +63,6 @@ uint32_t index, bool notify); bool RemapPath(ConstString path, ConstString &new_path) const; - //------------------------------------------------------------------ /// Remaps a source file given \a path into \a new_path. /// /// Remaps \a path if any source remappings match. This function @@ -81,13 +78,11 @@ /// \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 RemapPath(llvm::StringRef path, std::string &new_path) const; bool RemapPath(const char *, std::string &) const = delete; bool ReverseRemapPath(const FileSpec &file, FileSpec &fixed) const; - //------------------------------------------------------------------ /// Finds a source file given a file spec using the path remappings. /// /// Tries to resolve \a orig_spec by checking the path remappings. @@ -106,7 +101,6 @@ /// /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 FindFile(const FileSpec &orig_spec, FileSpec &new_spec) const; uint32_t FindIndexForPath(ConstString path) const; Index: include/lldb/Target/Platform.h =================================================================== --- include/lldb/Target/Platform.h +++ include/lldb/Target/Platform.h @@ -53,7 +53,6 @@ typedef std::shared_ptr PlatformPropertiesSP; typedef llvm::SmallVector MmapArgList; -//---------------------------------------------------------------------- /// \class Platform Platform.h "lldb/Target/Platform.h" /// A plug-in interface definition class for debug platform that /// includes many platform abilities such as: @@ -65,20 +64,15 @@ /// \li execute shell commands /// \li listing and getting info for existing processes /// \li attaching and possibly debugging the platform's kernel -//---------------------------------------------------------------------- class Platform : public PluginInterface { public: - //------------------------------------------------------------------ /// Default Constructor - //------------------------------------------------------------------ Platform(bool is_host_platform); - //------------------------------------------------------------------ /// Destructor. /// /// The destructor is virtual since this class is designed to be inherited /// from by the plug-in instance. - //------------------------------------------------------------------ ~Platform() override; static void Initialize(); @@ -87,7 +81,6 @@ static const PlatformPropertiesSP &GetGlobalPlatformProperties(); - //------------------------------------------------------------------ /// Get the native host platform plug-in. /// /// There should only be one of these for each host that LLDB runs upon that @@ -97,7 +90,6 @@ /// /// This platform will be used as the default platform when launching or /// attaching to processes unless another platform is specified. - //------------------------------------------------------------------ static lldb::PlatformSP GetHostPlatform(); static lldb::PlatformSP @@ -115,14 +107,11 @@ static lldb::PlatformSP Create(const ArchSpec &arch, ArchSpec *platform_arch_ptr, Status &error); - //------------------------------------------------------------------------ /// Augments the triple either with information from platform or the host /// system (if platform is null). - //------------------------------------------------------------------------ static ArchSpec GetAugmentedArchSpec(Platform *platform, llvm::StringRef triple); - //------------------------------------------------------------------ /// Find a platform plugin for a given process. /// /// Scans the installed Platform plug-ins and tries to find an instance that @@ -135,11 +124,9 @@ /// \param[in] plugin_name /// An optional name of a specific platform plug-in that /// should be used. If nullptr, pick the best plug-in. - //------------------------------------------------------------------ // static lldb::PlatformSP // FindPlugin (Process *process, ConstString plugin_name); - //------------------------------------------------------------------ /// Set the target's executable based off of the existing architecture /// information in \a target given a path to an executable \a exe_file. /// @@ -155,12 +142,10 @@ /// \return /// Returns \b true if this Platform plug-in was able to find /// a suitable executable, \b false otherwise. - //------------------------------------------------------------------ virtual Status ResolveExecutable(const ModuleSpec &module_spec, lldb::ModuleSP &module_sp, const FileSpecList *module_search_paths_ptr); - //------------------------------------------------------------------ /// Find a symbol file given a symbol file module specification. /// /// Each platform might have tricks to find symbol files for an executable @@ -206,18 +191,14 @@ /// /// \return /// Returns an error that describes success or failure. - //------------------------------------------------------------------ virtual Status ResolveSymbolFile(Target &target, const ModuleSpec &sym_spec, FileSpec &sym_file); - //------------------------------------------------------------------ /// Resolves the FileSpec to a (possibly) remote path. Remote platforms must /// override this to resolve to a path on the remote side. - //------------------------------------------------------------------ virtual bool ResolveRemotePath(const FileSpec &platform_path, FileSpec &resolved_platform_path); - //------------------------------------------------------------------ /// Get the OS version from a connected platform. /// /// Some platforms might not be connected to a remote platform, but can @@ -225,7 +206,6 @@ /// platforms that will run native programs on the current host, but the /// simulator might be simulating a different OS. The \a process parameter /// might be specified to help to determine the OS version. - //------------------------------------------------------------------ virtual llvm::VersionTuple GetOSVersion(Process *process = nullptr); bool SetOSVersion(llvm::VersionTuple os_version); @@ -243,23 +223,19 @@ virtual const char *GetDescription() = 0; - //------------------------------------------------------------------ /// Report the current status for this platform. /// /// The returned string usually involves returning the OS version (if /// available), and any SDK directory that might be being used for local /// file caching, and if connected a quick blurb about what this platform is /// connected to. - //------------------------------------------------------------------ virtual void GetStatus(Stream &strm); - //------------------------------------------------------------------ // Subclasses must be able to fetch the current OS version // // Remote classes must be connected for this to succeed. Local subclasses // don't need to override this function as it will just call the // HostInfo::GetOSVersion(). - //------------------------------------------------------------------ virtual bool GetRemoteOSVersion() { return false; } virtual bool GetRemoteOSBuildString(std::string &s) { @@ -281,7 +257,6 @@ virtual bool SetRemoteWorkingDirectory(const FileSpec &working_dir); - //------------------------------------------------------------------ /// Retrieve the system include directories on this platform for the /// given language. /// @@ -290,7 +265,6 @@ /// /// \param[out] directories /// The include directories for this system. - //------------------------------------------------------------------ virtual std::vector GetSystemIncludeDirectories(lldb::LanguageType lang) { return {}; @@ -298,7 +272,6 @@ virtual UserIDResolver &GetUserIDResolver() = 0; - //------------------------------------------------------------------ /// Locate a file for a platform. /// /// The default implementation of this function will return the same file @@ -325,16 +298,13 @@ /// /// \return /// An error object. - //------------------------------------------------------------------ virtual Status GetFileWithUUID(const FileSpec &platform_file, const UUID *uuid_ptr, FileSpec &local_file); - //---------------------------------------------------------------------- // Locate the scripting resource given a module specification. // // Locating the file should happen only on the local computer or using the // current computers global settings. - //---------------------------------------------------------------------- virtual FileSpecList LocateExecutableScriptingResources(Target *target, Module &module, Stream *feedback_stream); @@ -352,7 +322,6 @@ virtual Status DisconnectRemote(); - //------------------------------------------------------------------ /// Get the platform's supported architectures in the order in which they /// should be searched. /// @@ -366,56 +335,43 @@ /// \return /// \b true if \a arch was filled in and is valid, \b false /// otherwise. - //------------------------------------------------------------------ virtual bool GetSupportedArchitectureAtIndex(uint32_t idx, ArchSpec &arch) = 0; virtual size_t GetSoftwareBreakpointTrapOpcode(Target &target, BreakpointSite *bp_site); - //------------------------------------------------------------------ /// Launch a new process on a platform, not necessarily for debugging, it /// could be just for running the process. - //------------------------------------------------------------------ virtual Status LaunchProcess(ProcessLaunchInfo &launch_info); - //------------------------------------------------------------------ /// Perform expansion of the command-line for this launch info This can /// potentially involve wildcard expansion /// environment variable replacement, and whatever other /// argument magic the platform defines as part of its typical /// user experience - //------------------------------------------------------------------ virtual Status ShellExpandArguments(ProcessLaunchInfo &launch_info); - //------------------------------------------------------------------ /// Kill process on a platform. - //------------------------------------------------------------------ virtual Status KillProcess(const lldb::pid_t pid); - //------------------------------------------------------------------ /// Lets a platform answer if it is compatible with a given architecture and /// the target triple contained within. - //------------------------------------------------------------------ virtual bool IsCompatibleArchitecture(const ArchSpec &arch, bool exact_arch_match, ArchSpec *compatible_arch_ptr); - //------------------------------------------------------------------ /// Not all platforms will support debugging a process by spawning somehow /// halted for a debugger (specified using the "eLaunchFlagDebug" launch /// flag) and then attaching. If your platform doesn't support this, /// override this function and return false. - //------------------------------------------------------------------ virtual bool CanDebugProcess() { return true; } - //------------------------------------------------------------------ /// Subclasses do not need to implement this function as it uses the /// Platform::LaunchProcess() followed by Platform::Attach (). Remote /// platforms will want to subclass this function in order to be able to /// intercept STDIO and possibly launch a separate process that will debug /// the debuggee. - //------------------------------------------------------------------ virtual lldb::ProcessSP DebugProcess(ProcessLaunchInfo &launch_info, Debugger &debugger, Target *target, // Can be nullptr, if nullptr create a new @@ -428,7 +384,6 @@ lldb_private::Target *target, lldb_private::Status &error); - //------------------------------------------------------------------ /// Attach to an existing process using a process ID. /// /// Each platform subclass needs to implement this function and attempt to @@ -445,7 +400,6 @@ /// to the default Process subclass for the platform that is /// attached to the process, or an empty shared pointer with an /// appropriate error fill into the \a error object. - //------------------------------------------------------------------ virtual lldb::ProcessSP Attach(ProcessAttachInfo &attach_info, Debugger &debugger, Target *target, // Can be nullptr, if nullptr @@ -453,7 +407,6 @@ // use existing one Status &error) = 0; - //------------------------------------------------------------------ /// Attach to an existing process by process name. /// /// This function is not meant to be overridden by Process subclasses. It @@ -468,32 +421,25 @@ /// \return /// Returns \a pid if attaching was successful, or /// LLDB_INVALID_PROCESS_ID if attaching fails. - //------------------------------------------------------------------ // virtual lldb::ProcessSP // Attach (const char *process_name, // bool wait_for_launch, // Status &error) = 0; - //------------------------------------------------------------------ // The base class Platform will take care of the host platform. Subclasses // will need to fill in the remote case. - //------------------------------------------------------------------ virtual uint32_t FindProcesses(const ProcessInstanceInfoMatch &match_info, ProcessInstanceInfoList &proc_infos); virtual bool GetProcessInfo(lldb::pid_t pid, ProcessInstanceInfo &proc_info); - //------------------------------------------------------------------ // Set a breakpoint on all functions that can end up creating a thread for // this platform. This is needed when running expressions and also for // process control. - //------------------------------------------------------------------ virtual lldb::BreakpointSP SetThreadCreationBreakpoint(Target &target); - //------------------------------------------------------------------ // Given a target, find the local SDK directory if one exists on the current // host. - //------------------------------------------------------------------ virtual lldb_private::ConstString GetSDKDirectory(lldb_private::Target &target) { return lldb_private::ConstString(); @@ -520,11 +466,9 @@ m_os_version_set_while_connected = m_system_arch.IsValid(); } - //--------------------------------------------------------------------------- /// If the triple contains not specify the vendor, os, and environment /// parts, we "augment" these using information from the platform and return /// the resulting ArchSpec object. - //--------------------------------------------------------------------------- ArchSpec GetAugmentedArchSpec(llvm::StringRef triple); // Used for column widths @@ -610,7 +554,6 @@ CreateSymlink(const FileSpec &src, // The name of the link is in src const FileSpec &dst); // The symlink points to dst - //---------------------------------------------------------------------- /// Install a file or directory to the remote system. /// /// Install is similar to Platform::PutFile(), but it differs in that if an @@ -633,7 +576,6 @@ /// /// \return /// An error object that describes anything that went wrong. - //---------------------------------------------------------------------- virtual Status Install(const FileSpec &src, const FileSpec &dst); virtual Environment GetEnvironment(); @@ -709,7 +651,6 @@ lldb::UnixSignalsSP GetUnixSignals(); - //------------------------------------------------------------------ /// Locate a queue name given a thread's qaddr /// /// On a system using libdispatch ("Grand Central Dispatch") style queues, a @@ -729,13 +670,11 @@ /// The name of the queue, if there is one. An empty string /// means that this thread is not associated with a dispatch /// queue. - //------------------------------------------------------------------ virtual std::string GetQueueNameForThreadQAddress(Process *process, lldb::addr_t dispatch_qaddr) { return ""; } - //------------------------------------------------------------------ /// Locate a queue ID given a thread's qaddr /// /// On a system using libdispatch ("Grand Central Dispatch") style queues, a @@ -754,13 +693,11 @@ /// \return /// The queue_id for this thread, if this thread is associated /// with a dispatch queue. Else LLDB_INVALID_QUEUE_ID is returned. - //------------------------------------------------------------------ virtual lldb::queue_id_t GetQueueIDForThreadQAddress(Process *process, lldb::addr_t dispatch_qaddr) { return LLDB_INVALID_QUEUE_ID; } - //------------------------------------------------------------------ /// Provide a list of trap handler function names for this platform /// /// The unwinder needs to treat trap handlers specially -- the stack frame @@ -780,10 +717,8 @@ /// /// \return /// A list of symbol names. The list may be empty. - //------------------------------------------------------------------ virtual const std::vector &GetTrapHandlerSymbolNames(); - //------------------------------------------------------------------ /// Find a support executable that may not live within in the standard /// locations related to LLDB. /// @@ -797,17 +732,13 @@ /// \return /// A FileSpec pointing to the executable on disk, or an invalid /// FileSpec if the executable cannot be found. - //------------------------------------------------------------------ virtual FileSpec LocateExecutable(const char *basename) { return FileSpec(); } - //------------------------------------------------------------------ /// Allow the platform to set preferred memory cache line size. If non-zero /// (and the user has not set cache line size explicitly), this value will /// be used as the cache line size for memory reads. - //------------------------------------------------------------------ virtual uint32_t GetDefaultMemoryCacheLineSize() { return 0; } - //------------------------------------------------------------------ /// Load a shared library into this process. /// /// Try and load a shared library into the current process. This call might @@ -839,13 +770,11 @@ /// 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_private::Process *process, const lldb_private::FileSpec &local_file, const lldb_private::FileSpec &remote_file, lldb_private::Status &error); - //------------------------------------------------------------------ /// Load a shared library specified by base name into this process, /// looking by hand along a set of paths. /// @@ -876,7 +805,6 @@ /// passed to UnloadImage. A value of /// LLDB_INVALID_IMAGE_TOKEN will be returned if the shared /// library can't be opened. - //------------------------------------------------------------------ uint32_t LoadImageUsingPaths(lldb_private::Process *process, const lldb_private::FileSpec &library_name, const std::vector &paths, @@ -892,7 +820,6 @@ virtual Status UnloadImage(lldb_private::Process *process, uint32_t image_token); - //------------------------------------------------------------------ /// Connect to all processes waiting for a debugger to attach /// /// If the platform have a list of processes waiting for a debugger to @@ -907,7 +834,6 @@ /// /// \return /// The number of processes we are successfully connected to. - //------------------------------------------------------------------ virtual size_t ConnectToWaitingProcesses(lldb_private::Debugger &debugger, lldb_private::Status &error); @@ -947,7 +873,6 @@ bool m_calculated_trap_handlers; const std::unique_ptr m_module_cache; - //------------------------------------------------------------------ /// Ask the Platform subclass to fill in the list of trap handler names /// /// For most Unix user process environments, this will be a single function @@ -959,7 +884,6 @@ /// The base class Platform ivar m_trap_handlers should be updated by the /// Platform subclass when this method is called. If there are no /// predefined trap handlers, this method may be a no-op. - //------------------------------------------------------------------ virtual void CalculateTrapHandlerSymbolNames() = 0; Status GetCachedExecutable(ModuleSpec &module_spec, lldb::ModuleSP &module_sp, @@ -1025,14 +949,12 @@ return platform_sp; } - //------------------------------------------------------------------ /// Select the active platform. /// /// In order to debug remotely, other platform's can be remotely connected /// to and set as the selected platform for any subsequent debugging. This /// allows connection to remote targets and allows the ability to discover /// process info, launch and attach to remote processes. - //------------------------------------------------------------------ lldb::PlatformSP GetSelectedPlatform() { std::lock_guard guard(m_mutex); if (!m_selected_platform_sp && !m_platforms.empty()) Index: include/lldb/Target/Process.h =================================================================== --- include/lldb/Target/Process.h +++ include/lldb/Target/Process.h @@ -56,9 +56,7 @@ template struct Range; -//---------------------------------------------------------------------- // ProcessProperties -//---------------------------------------------------------------------- class ProcessProperties : public Properties { public: // Pass nullptr for "process" if the ProcessProperties are to be the global @@ -94,11 +92,9 @@ typedef std::shared_ptr ProcessPropertiesSP; -//---------------------------------------------------------------------- // ProcessAttachInfo // // Describes any information that is required to attach to a process. -//---------------------------------------------------------------------- class ProcessAttachInfo : public ProcessInstanceInfo { public: @@ -352,10 +348,8 @@ return (!lhs.StopIDEqual(rhs) || !lhs.MemoryIDEqual(rhs)); } -//---------------------------------------------------------------------- /// \class Process Process.h "lldb/Target/Process.h" /// A plug-in interface definition class for debugging a process. -//---------------------------------------------------------------------- class Process : public std::enable_shared_from_this, public ProcessProperties, public UserID, @@ -371,9 +365,7 @@ friend class ThreadList; public: - //------------------------------------------------------------------ /// Broadcaster event bits definitions. - //------------------------------------------------------------------ enum { eBroadcastBitStateChanged = (1 << 0), eBroadcastBitInterrupt = (1 << 1), @@ -389,9 +381,7 @@ eBroadcastInternalStateControlResume = (1 << 2) }; - //------------------------------------------------------------------ /// Process warning types. - //------------------------------------------------------------------ enum Warnings { eWarningsOptimization = 1 }; typedef Range LoadRange; @@ -411,13 +401,11 @@ return GetStaticBroadcasterClass(); } -//------------------------------------------------------------------ /// A notification structure that can be used by clients to listen /// for changes in a process's lifetime. /// /// \see RegisterNotificationCallbacks (const Notifications&) @see /// UnregisterNotificationCallbacks (const Notifications&) -//------------------------------------------------------------------ typedef struct { void *baton; void (*initialize)(void *baton, Process *process); @@ -503,25 +491,19 @@ DISALLOW_COPY_AND_ASSIGN(ProcessEventData); }; - //------------------------------------------------------------------ /// Construct with a shared pointer to a target, and the Process listener. /// Uses the Host UnixSignalsSP by default. - //------------------------------------------------------------------ Process(lldb::TargetSP target_sp, lldb::ListenerSP listener_sp); - //------------------------------------------------------------------ /// Construct with a shared pointer to a target, the Process listener, and /// the appropriate UnixSignalsSP for the process. - //------------------------------------------------------------------ Process(lldb::TargetSP target_sp, lldb::ListenerSP listener_sp, const lldb::UnixSignalsSP &unix_signals_sp); - //------------------------------------------------------------------ /// Destructor. /// /// The destructor is virtual since this class is designed to be inherited /// from by the plug-in instance. - //------------------------------------------------------------------ ~Process() override; static void SettingsInitialize(); @@ -530,7 +512,6 @@ static const ProcessPropertiesSP &GetGlobalProperties(); - //------------------------------------------------------------------ /// Find a Process plug-in that can debug \a module using the currently /// selected architecture. /// @@ -547,13 +528,11 @@ /// this string. /// /// \see Process::CanDebug () - //------------------------------------------------------------------ static lldb::ProcessSP FindPlugin(lldb::TargetSP target_sp, llvm::StringRef plugin_name, lldb::ListenerSP listener_sp, const FileSpec *crash_file_path); - //------------------------------------------------------------------ /// Static function that can be used with the \b host function /// Host::StartMonitoringChildProcess (). /// @@ -564,7 +543,6 @@ /// callback = Process::SetHostProcessExitStatus /// pid = Process::GetID() /// monitor_signals = false - //------------------------------------------------------------------ static bool SetProcessExitStatus(lldb::pid_t pid, // The process ID we want to monitor bool exited, @@ -577,7 +555,6 @@ uint32_t GetUniqueID() const { return m_process_unique_id; } - //------------------------------------------------------------------ /// Check if a plug-in instance can debug the file in \a module. /// /// Each plug-in is given a chance to say whether it can debug the file in @@ -587,28 +564,22 @@ /// \return /// Returns \b true if this Process plug-in instance can /// debug the executable, \b false otherwise. - //------------------------------------------------------------------ virtual bool CanDebug(lldb::TargetSP target, bool plugin_specified_by_name) = 0; - //------------------------------------------------------------------ /// This object is about to be destroyed, do any necessary cleanup. /// /// Subclasses that override this method should always call this superclass /// method. - //------------------------------------------------------------------ virtual void Finalize(); - //------------------------------------------------------------------ /// Return whether this object is valid (i.e. has not been finalized.) /// /// \return /// Returns \b true if this Process has not been finalized /// and \b false otherwise. - //------------------------------------------------------------------ bool IsValid() const { return !m_finalize_called; } - //------------------------------------------------------------------ /// Return a multi-word command object that can be used to expose plug-in /// specific commands. /// @@ -621,10 +592,8 @@ /// A CommandObject which can be one of the concrete subclasses /// of CommandObject like CommandObjectRaw, CommandObjectParsed, /// or CommandObjectMultiword. - //------------------------------------------------------------------ virtual CommandObject *GetPluginCommandObject() { return nullptr; } - //------------------------------------------------------------------ /// Launch a new process. /// /// Launch a new process by spawning a new process using the target object's @@ -644,7 +613,6 @@ /// \return /// An error object. Call GetID() to get the process ID if /// the error object is success. - //------------------------------------------------------------------ virtual Status Launch(ProcessLaunchInfo &launch_info); virtual Status LoadCore(); @@ -657,7 +625,6 @@ return error; } - //------------------------------------------------------------------ // FUTURE WORK: GetLoadImageUtilityFunction are the first use we've // had of having other plugins cache data in the Process. This is handy for // long-living plugins - like the Platform - which manage interactions whose @@ -672,8 +639,6 @@ // whether the registree should be notified of the Process' demise. // // We are postponing designing this till we have at least a second use case. - //------------------------------------------------------------------ - //------------------------------------------------------------------ /// Get the cached UtilityFunction that assists in loading binary images /// into the process. /// @@ -687,12 +652,10 @@ /// \return /// The cached utility function or null if the platform is not the /// same as the target's platform. - //------------------------------------------------------------------ UtilityFunction *GetLoadImageUtilityFunction( Platform *platform, llvm::function_ref()> factory); - //------------------------------------------------------------------ /// Get the dynamic loader plug-in for this process. /// /// The default action is to let the DynamicLoader plug-ins check the main @@ -700,20 +663,16 @@ /// Subclasses can override this if inspecting the executable is not /// desired, or if Process subclasses can only use a specific DynamicLoader /// plug-in. - //------------------------------------------------------------------ virtual DynamicLoader *GetDynamicLoader(); - //------------------------------------------------------------------ // Returns AUXV structure found in many ELF-based environments. // // The default action is to return an empty data buffer. // // \return // A data buffer containing the contents of the AUXV data. - //------------------------------------------------------------------ virtual const lldb::DataBufferSP GetAuxvData(); - //------------------------------------------------------------------ /// Sometimes processes know how to retrieve and load shared libraries. This /// is normally done by DynamicLoader plug-ins, but sometimes the connection /// to the process allows retrieving this information. The dynamic loader @@ -722,7 +681,6 @@ /// /// \return /// The number of shared libraries that were loaded - //------------------------------------------------------------------ virtual size_t LoadModules() { return 0; } virtual size_t LoadModules(LoadedModuleInfoList &) { return 0; } @@ -731,16 +689,13 @@ virtual JITLoaderList &GetJITLoaders(); public: - //------------------------------------------------------------------ /// Get the system runtime plug-in for this process. /// /// \return /// Returns a pointer to the SystemRuntime plugin for this Process /// if one is available. Else returns nullptr. - //------------------------------------------------------------------ virtual SystemRuntime *GetSystemRuntime(); - //------------------------------------------------------------------ /// Attach to an existing process using the process attach info. /// /// This function is not meant to be overridden by Process subclasses. It @@ -755,10 +710,8 @@ /// \return /// Returns \a pid if attaching was successful, or /// LLDB_INVALID_PROCESS_ID if attaching fails. - //------------------------------------------------------------------ virtual Status Attach(ProcessAttachInfo &attach_info); - //------------------------------------------------------------------ /// Attach to a remote system via a URL /// /// \param[in] strm @@ -771,14 +724,12 @@ /// /// \return /// Returns an error object. - //------------------------------------------------------------------ virtual Status ConnectRemote(Stream *strm, llvm::StringRef remote_url); bool GetShouldDetach() const { return m_should_detach; } void SetShouldDetach(bool b) { m_should_detach = b; } - //------------------------------------------------------------------ /// Get the image information address for the current process. /// /// Some runtimes have system functions that can help dynamic loaders locate @@ -791,10 +742,8 @@ /// The address of the dynamic loader information, or /// LLDB_INVALID_ADDRESS if this is not supported by this /// interface. - //------------------------------------------------------------------ virtual lldb::addr_t GetImageInfoAddress(); - //------------------------------------------------------------------ /// Called when the process is about to broadcast a public stop. /// /// There are public and private stops. Private stops are when the process @@ -807,10 +756,8 @@ /// more). This function can be overriden and allows process subclasses to /// do something before the eBroadcastBitStateChanged event is sent to /// public clients. - //------------------------------------------------------------------ virtual void WillPublicStop() {} -//------------------------------------------------------------------ /// Register for process and thread notifications. /// /// Clients can register notification callbacks by filling out a @@ -821,10 +768,8 @@ /// callback functions. /// /// \see Process::Notifications -//------------------------------------------------------------------ void RegisterNotificationCallbacks(const Process::Notifications &callbacks); -//------------------------------------------------------------------ /// Unregister for process and thread notifications. /// /// Clients can unregister notification callbacks by passing a copy of the @@ -839,13 +784,11 @@ /// successfully removed from the process, \b false otherwise. /// /// \see Process::Notifications -//------------------------------------------------------------------ bool UnregisterNotificationCallbacks(const Process::Notifications &callbacks); //================================================================== // Built in Process Control functions //================================================================== - //------------------------------------------------------------------ /// Resumes all of a process's threads as configured using the Thread run /// control functions. /// @@ -871,12 +814,10 @@ /// \see Thread:Resume() /// \see Thread:Step() /// \see Thread:Suspend() - //------------------------------------------------------------------ Status Resume(); Status ResumeSynchronous(Stream *stream); - //------------------------------------------------------------------ /// Halts a running process. /// /// This function is not meant to be overridden by Process subclasses. If @@ -894,10 +835,8 @@ /// Returns an error object. If the error is empty, the process is /// halted. /// otherwise the halt has failed. - //------------------------------------------------------------------ Status Halt(bool clear_thread_plans = false, bool use_run_lock = true); - //------------------------------------------------------------------ /// Detaches from a running or stopped process. /// /// This function is not meant to be overridden by Process subclasses. @@ -907,10 +846,8 @@ /// /// \return /// Returns an error object. - //------------------------------------------------------------------ Status Detach(bool keep_stopped); - //------------------------------------------------------------------ /// Kills the process and shuts down all threads that were spawned to track /// and monitor the process. /// @@ -926,17 +863,14 @@ /// /// \return /// Returns an error object. - //------------------------------------------------------------------ Status Destroy(bool force_kill); - //------------------------------------------------------------------ /// Sends a process a UNIX signal \a signal. /// /// This function is not meant to be overridden by Process subclasses. /// /// \return /// Returns an error object. - //------------------------------------------------------------------ Status Signal(int signal); void SetUnixSignals(lldb::UnixSignalsSP &&signals_sp); @@ -947,30 +881,25 @@ // Plug-in Process Control Overrides //================================================================== - //------------------------------------------------------------------ /// Called before attaching to a process. /// /// Allow Process plug-ins to execute some code before attaching a process. /// /// \return /// Returns an error object. - //------------------------------------------------------------------ virtual Status WillAttachToProcessWithID(lldb::pid_t pid) { return Status(); } - //------------------------------------------------------------------ /// Called before attaching to a process. /// /// Allow Process plug-ins to execute some code before attaching a process. /// /// \return /// Returns an error object. - //------------------------------------------------------------------ virtual Status WillAttachToProcessWithName(const char *process_name, bool wait_for_launch) { return Status(); } - //------------------------------------------------------------------ /// Attach to a remote system via a URL /// /// \param[in] strm @@ -983,14 +912,12 @@ /// /// \return /// Returns an error object. - //------------------------------------------------------------------ virtual Status DoConnectRemote(Stream *strm, llvm::StringRef remote_url) { Status error; error.SetErrorString("remote connections are not supported"); return error; } - //------------------------------------------------------------------ /// Attach to an existing process using a process ID. /// /// \param[in] pid @@ -1005,7 +932,6 @@ /// an appropriate (possibly platform-specific) error code if /// attaching fails. /// hanming : need flag - //------------------------------------------------------------------ virtual Status DoAttachToProcessWithID(lldb::pid_t pid, const ProcessAttachInfo &attach_info) { Status error; @@ -1015,7 +941,6 @@ return error; } - //------------------------------------------------------------------ /// Attach to an existing process using a partial process name. /// /// \param[in] process_name @@ -1029,7 +954,6 @@ /// Returns a successful Status attaching was successful, or /// an appropriate (possibly platform-specific) error code if /// attaching fails. - //------------------------------------------------------------------ virtual Status DoAttachToProcessWithName(const char *process_name, const ProcessAttachInfo &attach_info) { @@ -1038,7 +962,6 @@ return error; } - //------------------------------------------------------------------ /// Called after attaching a process. /// /// \param[in] process_arch @@ -1047,36 +970,28 @@ /// /// Allow Process plug-ins to execute some code after attaching to a /// process. - //------------------------------------------------------------------ virtual void DidAttach(ArchSpec &process_arch) { process_arch.Clear(); } - //------------------------------------------------------------------ /// Called after a process re-execs itself. /// /// Allow Process plug-ins to execute some code after a process has exec'ed /// itself. Subclasses typically should override DoDidExec() as the /// lldb_private::Process class needs to remove its dynamic loader, runtime, /// ABI and other plug-ins, as well as unload all shared libraries. - //------------------------------------------------------------------ virtual void DidExec(); - //------------------------------------------------------------------ /// Subclasses of Process should implement this function if they need to do /// anything after a process exec's itself. - //------------------------------------------------------------------ virtual void DoDidExec() {} - //------------------------------------------------------------------ /// Called before launching to a process. /// /// Allow Process plug-ins to execute some code before launching a process. /// /// \return /// Returns an error object. - //------------------------------------------------------------------ virtual Status WillLaunch(Module *module) { return Status(); } - //------------------------------------------------------------------ /// Launch a new process. /// /// Launch a new process by spawning a new process using \a exe_module's @@ -1094,7 +1009,6 @@ /// \return /// An Status instance indicating success or failure of the /// operation. - //------------------------------------------------------------------ virtual Status DoLaunch(Module *exe_module, ProcessLaunchInfo &launch_info) { Status error; error.SetErrorStringWithFormat( @@ -1103,24 +1017,19 @@ return error; } - //------------------------------------------------------------------ /// Called after launching a process. /// /// Allow Process plug-ins to execute some code after launching a process. - //------------------------------------------------------------------ virtual void DidLaunch() {} - //------------------------------------------------------------------ /// Called before resuming to a process. /// /// Allow Process plug-ins to execute some code before resuming a process. /// /// \return /// Returns an error object. - //------------------------------------------------------------------ virtual Status WillResume() { return Status(); } - //------------------------------------------------------------------ /// Resumes all of a process's threads as configured using the Thread run /// control functions. /// @@ -1136,7 +1045,6 @@ /// \see Thread:Resume() /// \see Thread:Step() /// \see Thread:Suspend() - //------------------------------------------------------------------ virtual Status DoResume() { Status error; error.SetErrorStringWithFormat( @@ -1145,24 +1053,19 @@ return error; } - //------------------------------------------------------------------ /// Called after resuming a process. /// /// Allow Process plug-ins to execute some code after resuming a process. - //------------------------------------------------------------------ virtual void DidResume() {} - //------------------------------------------------------------------ /// Called before halting to a process. /// /// Allow Process plug-ins to execute some code before halting a process. /// /// \return /// Returns an error object. - //------------------------------------------------------------------ virtual Status WillHalt() { return Status(); } - //------------------------------------------------------------------ /// Halts a running process. /// /// DoHalt must produce one and only one stop StateChanged event if it @@ -1178,7 +1081,6 @@ /// \return /// Returns \b true if the process successfully halts, \b false /// otherwise. - //------------------------------------------------------------------ virtual Status DoHalt(bool &caused_stop) { Status error; error.SetErrorStringWithFormat( @@ -1187,14 +1089,11 @@ return error; } - //------------------------------------------------------------------ /// Called after halting a process. /// /// Allow Process plug-ins to execute some code after halting a process. - //------------------------------------------------------------------ virtual void DidHalt() {} - //------------------------------------------------------------------ /// Called before detaching from a process. /// /// Allow Process plug-ins to execute some code before detaching from a @@ -1202,16 +1101,13 @@ /// /// \return /// Returns an error object. - //------------------------------------------------------------------ virtual Status WillDetach() { return Status(); } - //------------------------------------------------------------------ /// Detaches from a running or stopped process. /// /// \return /// Returns \b true if the process successfully detaches, \b /// false otherwise. - //------------------------------------------------------------------ virtual Status DoDetach(bool keep_stopped) { Status error; error.SetErrorStringWithFormat( @@ -1220,17 +1116,14 @@ return error; } - //------------------------------------------------------------------ /// Called after detaching from a process. /// /// Allow Process plug-ins to execute some code after detaching from a /// process. - //------------------------------------------------------------------ virtual void DidDetach() {} virtual bool DetachRequiresHalt() { return false; } - //------------------------------------------------------------------ /// Called before sending a signal to a process. /// /// Allow Process plug-ins to execute some code before sending a signal to a @@ -1240,15 +1133,12 @@ /// Returns no error if it is safe to proceed with a call to /// Process::DoSignal(int), otherwise an error describing what /// prevents the signal from being sent. - //------------------------------------------------------------------ virtual Status WillSignal() { return Status(); } - //------------------------------------------------------------------ /// Sends a process a UNIX signal \a signal. /// /// \return /// Returns an error object. - //------------------------------------------------------------------ virtual Status DoSignal(int signal) { Status error; error.SetErrorStringWithFormat( @@ -1265,15 +1155,12 @@ virtual bool DestroyRequiresHalt() { return true; } - //------------------------------------------------------------------ /// Called after sending a signal to a process. /// /// Allow Process plug-ins to execute some code after sending a signal to a /// process. - //------------------------------------------------------------------ virtual void DidSignal() {} - //------------------------------------------------------------------ /// Currently called as part of ShouldStop. /// FIXME: Should really happen when the target stops before the /// event is taken from the queue... @@ -1284,10 +1171,8 @@ /// operations include updating the thread list, invalidating any thread /// state (registers, stack, etc) prior to letting the notification go out. /// - //------------------------------------------------------------------ virtual void RefreshStateAfterStop() = 0; - //------------------------------------------------------------------ /// Sometimes the connection to a process can detect the host OS version /// that the process is running on. The current platform should be checked /// first in case the platform is connected, but clients can fall back onto @@ -1299,28 +1184,22 @@ /// \return /// Returns the version tuple of the host OS. In case of failure an empty /// VersionTuple is returner. - //------------------------------------------------------------------ virtual llvm::VersionTuple GetHostOSVersion() { return llvm::VersionTuple(); } - //------------------------------------------------------------------ /// Get the target object pointer for this module. /// /// \return /// A Target object pointer to the target that owns this /// module. - //------------------------------------------------------------------ Target &GetTarget() { return *m_target_wp.lock(); } - //------------------------------------------------------------------ /// Get the const target object pointer for this module. /// /// \return /// A const Target object pointer to the target that owns this /// module. - //------------------------------------------------------------------ const Target &GetTarget() const { return *m_target_wp.lock(); } - //------------------------------------------------------------------ /// Flush all data in the process. /// /// Flush the memory caches, all threads, and any other cached data in the @@ -1329,17 +1208,14 @@ /// This function can be called after a world changing event like adding a /// new symbol file, or after the process makes a large context switch (from /// boot ROM to booted into an OS). - //------------------------------------------------------------------ void Flush(); - //------------------------------------------------------------------ /// Get accessor for the current process state. /// /// \return /// The current state of the process. /// /// \see lldb::StateType - //------------------------------------------------------------------ lldb::StateType GetState(); lldb::ExpressionResults @@ -1358,15 +1234,12 @@ void SendAsyncInterrupt(); - //------------------------------------------------------------------ // Notify this process class that modules got loaded. // // If subclasses override this method, they must call this version before // doing anything in the subclass version of the function. - //------------------------------------------------------------------ virtual void ModulesDidLoad(ModuleList &module_list); - //------------------------------------------------------------------ /// Retrieve the list of shared libraries that are loaded for this process /// This method is used on pre-macOS 10.12, pre-iOS 10, pre-tvOS 10, pre- /// watchOS 3 systems. The following two methods are for newer versions of @@ -1393,7 +1266,6 @@ /// A StructureDataSP object which, if non-empty, will contain the /// information the DynamicLoader needs to get the initial scan of /// solibs resolved. - //------------------------------------------------------------------ virtual lldb_private::StructuredData::ObjectSP GetLoadedDynamicLibrariesInfos(lldb::addr_t image_list_address, lldb::addr_t image_count) { @@ -1414,19 +1286,16 @@ return StructuredData::ObjectSP(); } - //------------------------------------------------------------------ // Get information about the library shared cache, if that exists // // On macOS 10.12, tvOS 10, iOS 10, watchOS 3 and newer, debugserver can // return information about the library shared cache (a set of standard // libraries that are loaded at the same location for all processes on a // system) in use. - //------------------------------------------------------------------ virtual lldb_private::StructuredData::ObjectSP GetSharedCacheInfo() { return StructuredData::ObjectSP(); } - //------------------------------------------------------------------ /// Print a user-visible warning about a module being built with /// optimization /// @@ -1436,38 +1305,31 @@ /// \param [in] sc /// A SymbolContext with eSymbolContextFunction and eSymbolContextModule /// pre-computed. - //------------------------------------------------------------------ void PrintWarningOptimization(const SymbolContext &sc); virtual bool GetProcessInfo(ProcessInstanceInfo &info); public: - //------------------------------------------------------------------ /// Get the exit status for a process. /// /// \return /// The process's return code, or -1 if the current process /// state is not eStateExited. - //------------------------------------------------------------------ int GetExitStatus(); - //------------------------------------------------------------------ /// Get a textual description of what the process exited. /// /// \return /// The textual description of why the process exited, or nullptr /// if there is no description available. - //------------------------------------------------------------------ const char *GetExitDescription(); virtual void DidExit() {} - //------------------------------------------------------------------ /// Get the Modification ID of the process. /// /// \return /// The modification ID of the process. - //------------------------------------------------------------------ ProcessModID GetModID() const { return m_mod_id; } const ProcessModID &GetModIDRef() const { return m_mod_id; } @@ -1488,7 +1350,6 @@ return m_mod_id.GetStopEventForStopID(stop_id); } - //------------------------------------------------------------------ /// Set accessor for the process exit status (return code). /// /// Sometimes a child exits and the exit can be detected by global functions @@ -1502,19 +1363,15 @@ /// The value for the process's return code. /// /// \see lldb::StateType - //------------------------------------------------------------------ virtual bool SetExitStatus(int exit_status, const char *cstr); - //------------------------------------------------------------------ /// Check if a process is still alive. /// /// \return /// Returns \b true if the process is still valid, \b false /// otherwise. - //------------------------------------------------------------------ virtual bool IsAlive(); - //------------------------------------------------------------------ /// Before lldb detaches from a process, it warns the user that they are /// about to lose their debug session. In some cases, this warning doesn't /// need to be emitted -- for instance, with core file debugging where the @@ -1523,10 +1380,8 @@ /// /// \return // true if the user should be warned about detaching from this process. - //------------------------------------------------------------------ virtual bool WarnBeforeDetach() const { return true; } - //------------------------------------------------------------------ /// Actually do the reading of memory from a process. /// /// Subclasses must override this function and can return fewer bytes than @@ -1553,11 +1408,9 @@ /// \return /// The number of bytes that were actually read into \a buf. /// Zero is returned in the case of an error. - //------------------------------------------------------------------ virtual size_t DoReadMemory(lldb::addr_t vm_addr, void *buf, size_t size, Status &error) = 0; - //------------------------------------------------------------------ /// Read of memory from a process. /// /// This function will read memory from the current process's address space @@ -1590,11 +1443,9 @@ /// size, then this function will get called again with \a /// vm_addr, \a buf, and \a size updated appropriately. Zero is /// returned in the case of an error. - //------------------------------------------------------------------ virtual size_t ReadMemory(lldb::addr_t vm_addr, void *buf, size_t size, Status &error); - //------------------------------------------------------------------ /// Read of memory from a process. /// /// This function has the same semantics of ReadMemory except that it @@ -1623,11 +1474,9 @@ /// size, then this function will get called again with \a /// vm_addr, \a buf, and \a size updated appropriately. Zero is /// returned in the case of an error. - //------------------------------------------------------------------ size_t ReadMemoryFromInferior(lldb::addr_t vm_addr, void *buf, size_t size, Status &error); - //------------------------------------------------------------------ /// Read a NULL terminated string from memory /// /// This function will read a cache page at a time until a NULL string @@ -1655,11 +1504,9 @@ /// /// \return /// The error status or the number of bytes prior to the null terminator. - //------------------------------------------------------------------ size_t ReadStringFromMemory(lldb::addr_t vm_addr, char *str, size_t max_bytes, Status &error, size_t type_width = 1); - //------------------------------------------------------------------ /// Read a NULL terminated C string from memory /// /// This function will read a cache page at a time until the NULL @@ -1667,14 +1514,12 @@ /// termination byte isn't found before reading \a cstr_max_len bytes, and /// the results are always guaranteed to be NULL terminated (at most /// cstr_max_len - 1 bytes will be read). - //------------------------------------------------------------------ size_t ReadCStringFromMemory(lldb::addr_t vm_addr, char *cstr, size_t cstr_max_len, Status &error); size_t ReadCStringFromMemory(lldb::addr_t vm_addr, std::string &out_str, Status &error); - //------------------------------------------------------------------ /// Reads an unsigned integer of the specified byte size from process /// memory. /// @@ -1700,7 +1545,6 @@ /// byte order differs from the host byte order, the integer /// value will be appropriately byte swapped into host byte /// order. - //------------------------------------------------------------------ uint64_t ReadUnsignedIntegerFromMemory(lldb::addr_t load_addr, size_t byte_size, uint64_t fail_value, Status &error); @@ -1713,7 +1557,6 @@ bool WritePointerToMemory(lldb::addr_t vm_addr, lldb::addr_t ptr_value, Status &error); - //------------------------------------------------------------------ /// Actually do the writing of memory to a process. /// /// \param[in] vm_addr @@ -1732,7 +1575,6 @@ /// /// \return /// The number of bytes that were actually written. - //------------------------------------------------------------------ virtual size_t DoWriteMemory(lldb::addr_t vm_addr, const void *buf, size_t size, Status &error) { error.SetErrorStringWithFormat( @@ -1741,7 +1583,6 @@ return 0; } - //------------------------------------------------------------------ /// Write all or part of a scalar value to memory. /// /// The value contained in \a scalar will be swapped to match the byte order @@ -1771,7 +1612,6 @@ /// /// \return /// The number of bytes that were actually written. - //------------------------------------------------------------------ size_t WriteScalarToMemory(lldb::addr_t vm_addr, const Scalar &scalar, size_t size, Status &error); @@ -1779,7 +1619,6 @@ bool is_signed, Scalar &scalar, Status &error); - //------------------------------------------------------------------ /// Write memory to a process. /// /// This function will write memory to the current process's address space @@ -1803,12 +1642,10 @@ /// /// \return /// The number of bytes that were actually written. - //------------------------------------------------------------------ // TODO: change this to take an ArrayRef size_t WriteMemory(lldb::addr_t vm_addr, const void *buf, size_t size, Status &error); - //------------------------------------------------------------------ /// Actually allocate memory in the process. /// /// This function will allocate memory in the process's address space. This @@ -1821,7 +1658,6 @@ /// \return /// The address of the allocated buffer in the process, or /// LLDB_INVALID_ADDRESS if the allocation failed. - //------------------------------------------------------------------ virtual lldb::addr_t DoAllocateMemory(size_t size, uint32_t permissions, Status &error) { @@ -1833,7 +1669,6 @@ virtual Status WriteObjectFile(std::vector entries); - //------------------------------------------------------------------ /// The public interface to allocating memory in the process. /// /// This function will allocate memory in the process's address space. This @@ -1855,10 +1690,8 @@ /// \return /// The address of the allocated buffer in the process, or /// LLDB_INVALID_ADDRESS if the allocation failed. - //------------------------------------------------------------------ lldb::addr_t AllocateMemory(size_t size, uint32_t permissions, Status &error); - //------------------------------------------------------------------ /// The public interface to allocating memory in the process, this also /// clears the allocated memory. /// @@ -1881,12 +1714,10 @@ /// \return /// The address of the allocated buffer in the process, or /// LLDB_INVALID_ADDRESS if the allocation failed. - //------------------------------------------------------------------ lldb::addr_t CallocateMemory(size_t size, uint32_t permissions, Status &error); - //------------------------------------------------------------------ /// Resolve dynamically loaded indirect functions. /// /// \param[in] address @@ -1898,11 +1729,9 @@ /// \return /// The address of the resolved function. /// LLDB_INVALID_ADDRESS if the resolution failed. - //------------------------------------------------------------------ virtual lldb::addr_t ResolveIndirectFunction(const Address *address, Status &error); - //------------------------------------------------------------------ /// Locate the memory region that contains load_addr. /// /// If load_addr is within the address space the process has mapped @@ -1927,7 +1756,6 @@ /// /// \return /// An error value. - //------------------------------------------------------------------ virtual Status GetMemoryRegionInfo(lldb::addr_t load_addr, MemoryRegionInfo &range_info) { Status error; @@ -1935,7 +1763,6 @@ return error; } - //------------------------------------------------------------------ /// Obtain all the mapped memory regions within this process. /// /// \param[out] region_list @@ -1944,7 +1771,6 @@ /// /// \return /// An error value. - //------------------------------------------------------------------ virtual Status GetMemoryRegions(lldb_private::MemoryRegionInfos ®ion_list); @@ -1967,7 +1793,6 @@ lldb::addr_t header_addr, size_t size_to_read = 512); - //------------------------------------------------------------------ /// Attempt to get the attributes for a region of memory in the process. /// /// It may be possible for the remote debug server to inspect attributes for @@ -1987,57 +1812,45 @@ /// \return /// Returns true if it was able to determine the attributes of the /// memory region. False if not. - //------------------------------------------------------------------ virtual bool GetLoadAddressPermissions(lldb::addr_t load_addr, uint32_t &permissions); - //------------------------------------------------------------------ /// Determines whether executing JIT-compiled code in this process is /// possible. /// /// \return /// True if execution of JIT code is possible; false otherwise. - //------------------------------------------------------------------ bool CanJIT(); - //------------------------------------------------------------------ /// Sets whether executing JIT-compiled code in this process is possible. /// /// \param[in] can_jit /// True if execution of JIT code is possible; false otherwise. - //------------------------------------------------------------------ void SetCanJIT(bool can_jit); - //------------------------------------------------------------------ /// Determines whether executing function calls using the interpreter is /// possible for this process. /// /// \return /// True if possible; false otherwise. - //------------------------------------------------------------------ bool CanInterpretFunctionCalls() { return m_can_interpret_function_calls; } - //------------------------------------------------------------------ /// Sets whether executing function calls using the interpreter is possible /// for this process. /// /// \param[in] can_interpret_function_calls /// True if possible; false otherwise. - //------------------------------------------------------------------ void SetCanInterpretFunctionCalls(bool can_interpret_function_calls) { m_can_interpret_function_calls = can_interpret_function_calls; } - //------------------------------------------------------------------ /// Sets whether executing code in this process is possible. This could be /// either through JIT or interpreting. /// /// \param[in] can_run_code /// True if execution of code is possible; false otherwise. - //------------------------------------------------------------------ void SetCanRunCode(bool can_run_code); - //------------------------------------------------------------------ /// Actually deallocate memory in the process. /// /// This function will deallocate memory in the process's address space that @@ -2049,7 +1862,6 @@ /// /// \return /// \btrue if the memory was deallocated, \bfalse otherwise. - //------------------------------------------------------------------ virtual Status DoDeallocateMemory(lldb::addr_t ptr) { Status error; error.SetErrorStringWithFormat( @@ -2058,7 +1870,6 @@ return error; } - //------------------------------------------------------------------ /// The public interface to deallocating memory in the process. /// /// This function will deallocate memory in the process's address space that @@ -2070,10 +1881,8 @@ /// /// \return /// \btrue if the memory was deallocated, \bfalse otherwise. - //------------------------------------------------------------------ Status DeallocateMemory(lldb::addr_t ptr); - //------------------------------------------------------------------ /// Get any available STDOUT. /// /// Calling this method is a valid operation only if all of the following @@ -2101,10 +1910,8 @@ /// The number of bytes written into \a buf. If this value is /// equal to \a buf_size, another call to this function should /// be made to retrieve more STDOUT data. - //------------------------------------------------------------------ virtual size_t GetSTDOUT(char *buf, size_t buf_size, Status &error); - //------------------------------------------------------------------ /// Get any available STDERR. /// /// Calling this method is a valid operation only if all of the following @@ -2132,10 +1939,8 @@ /// The number of bytes written into \a buf. If this value is /// equal to \a buf_size, another call to this function should /// be made to retrieve more STDERR data. - //------------------------------------------------------------------ virtual size_t GetSTDERR(char *buf, size_t buf_size, Status &error); - //------------------------------------------------------------------ /// Puts data into this process's STDIN. /// /// Calling this method is a valid operation only if all of the following @@ -2154,13 +1959,11 @@ /// The number of bytes written into \a buf. If this value is /// less than \a buf_size, another call to this function should /// be made to write the rest of the data. - //------------------------------------------------------------------ virtual size_t PutSTDIN(const char *buf, size_t buf_size, Status &error) { error.SetErrorString("stdin unsupported"); return 0; } - //------------------------------------------------------------------ /// Get any available profile data. /// /// \param[out] buf @@ -2174,12 +1977,9 @@ /// The number of bytes written into \a buf. If this value is /// equal to \a buf_size, another call to this function should /// be made to retrieve more profile data. - //------------------------------------------------------------------ virtual size_t GetAsyncProfileData(char *buf, size_t buf_size, Status &error); - //---------------------------------------------------------------------- // Process Breakpoints - //---------------------------------------------------------------------- size_t GetSoftwareBreakpointTrapOpcode(BreakpointSite *bp_site); virtual Status EnableBreakpointSite(BreakpointSite *bp_site) { @@ -2231,16 +2031,12 @@ lldb::user_id_t owner_loc_id, lldb::BreakpointSiteSP &bp_site_sp); - //---------------------------------------------------------------------- // Process Watchpoints (optional) - //---------------------------------------------------------------------- virtual Status EnableWatchpoint(Watchpoint *wp, bool notify = true); virtual Status DisableWatchpoint(Watchpoint *wp, bool notify = true); - //------------------------------------------------------------------ // Thread Queries - //------------------------------------------------------------------ virtual bool UpdateThreadList(ThreadList &old_thread_list, ThreadList &new_thread_list) = 0; @@ -2268,9 +2064,7 @@ // id will be used. uint32_t AssignIndexIDToThread(uint64_t thread_id); - //------------------------------------------------------------------ // Queue Queries - //------------------------------------------------------------------ void UpdateQueueListIfNeeded(); @@ -2284,9 +2078,7 @@ return m_queue_list.Queues(); } - //------------------------------------------------------------------ // Event Handling - //------------------------------------------------------------------ lldb::StateType GetNextEvent(lldb::EventSP &event_sp); // Returns the process state when it is stopped. If specified, event_sp_ptr @@ -2304,7 +2096,6 @@ uint32_t GetIOHandlerID() const { return m_iohandler_sync.GetValue(); } - //-------------------------------------------------------------------------------------- /// Waits for the process state to be running within a given msec timeout. /// /// The main purpose of this is to implement an interlock waiting for @@ -2313,7 +2104,6 @@ /// \param[in] timeout /// The maximum time length to wait for the process to transition to the /// eStateRunning state. - //-------------------------------------------------------------------------------------- void SyncIOHandler(uint32_t iohandler_id, const Timeout &timeout); lldb::StateType GetStateChangedEvents( @@ -2321,7 +2111,6 @@ lldb::ListenerSP hijack_listener); // Pass an empty ListenerSP to use builtin listener - //-------------------------------------------------------------------------------------- /// Centralize the code that handles and prints descriptions for process /// state changes. /// @@ -2341,7 +2130,6 @@ /// \return /// \b true if the event describes a process state changed event, \b false /// otherwise. - //-------------------------------------------------------------------------------------- static bool HandleProcessStateChangedEvent(const lldb::EventSP &event_sp, Stream *stream, bool &pop_process_io_handler); @@ -2363,7 +2151,6 @@ friend class ProcessEventHijacker; friend class ProcessProperties; - //------------------------------------------------------------------ /// If you need to ensure that you and only you will hear about some public /// event, then make a new listener, set to listen to process events, and /// then call this with that listener. Then you will have to wait on that @@ -2377,13 +2164,10 @@ /// \return /// Returns \b true if the new listener could be installed, /// \b false otherwise. - //------------------------------------------------------------------ bool HijackProcessEvents(lldb::ListenerSP listener_sp); - //------------------------------------------------------------------ /// Restores the process event broadcasting to its normal state. /// - //------------------------------------------------------------------ void RestoreProcessEvents(); bool StateChangedIsHijackedForSynchronousResume(); @@ -2412,7 +2196,6 @@ void SetDynamicCheckers(DynamicCheckerFunctions *dynamic_checkers); - //------------------------------------------------------------------ /// Call this to set the lldb in the mode where it breaks on new thread /// creations, and then auto-restarts. This is useful when you are trying /// to run only one thread, but either that thread or the kernel is creating @@ -2423,24 +2206,19 @@ /// \return /// Returns \b true if we were able to start up the notification /// \b false otherwise. - //------------------------------------------------------------------ virtual bool StartNoticingNewThreads() { return true; } - //------------------------------------------------------------------ /// Call this to turn off the stop & notice new threads mode. /// /// \return /// Returns \b true if we were able to start up the notification /// \b false otherwise. - //------------------------------------------------------------------ virtual bool StopNoticingNewThreads() { return true; } void SetRunningUserExpression(bool on); void SetRunningUtilityFunction(bool on); - //------------------------------------------------------------------ // lldb::ExecutionContextScope pure virtual functions - //------------------------------------------------------------------ lldb::TargetSP CalculateTarget() override; lldb::ProcessSP CalculateProcess() override { return shared_from_this(); } @@ -2455,28 +2233,22 @@ void SetSTDIOFileDescriptor(int file_descriptor); - //------------------------------------------------------------------ // Add a permanent region of memory that should never be read or written to. // This can be used to ensure that memory reads or writes to certain areas of // memory never end up being sent to the DoReadMemory or DoWriteMemory // functions which can improve performance. - //------------------------------------------------------------------ void AddInvalidMemoryRegion(const LoadRange ®ion); - //------------------------------------------------------------------ // Remove a permanent region of memory that should never be read or written // to that was previously added with AddInvalidMemoryRegion. - //------------------------------------------------------------------ bool RemoveInvalidMemoryRange(const LoadRange ®ion); - //------------------------------------------------------------------ // If the setup code of a thread plan needs to do work that might involve // calling a function in the target, it should not do that work directly in // one of the thread plan functions (DidPush/WillResume) because such work // needs to be handled carefully. Instead, put that work in a // PreResumeAction callback, and register it with the process. It will get // done before the actual "DoResume" gets called. - //------------------------------------------------------------------ typedef bool(PreResumeActionCallback)(void *); @@ -2500,7 +2272,6 @@ lldb::InstrumentationRuntimeSP GetInstrumentationRuntime(lldb::InstrumentationRuntimeType type); - //------------------------------------------------------------------ /// Try to fetch the module specification for a module with the given file /// name and architecture. Process sub-classes have to override this method /// if they support platforms where the Platform object can't get the module @@ -2519,14 +2290,12 @@ /// \return /// Returns \b true if the module spec fetched successfully, /// \b false otherwise. - //------------------------------------------------------------------ virtual bool GetModuleSpec(const FileSpec &module_file_spec, const ArchSpec &arch, ModuleSpec &module_spec); virtual void PrefetchModuleSpecs(llvm::ArrayRef module_file_specs, const llvm::Triple &triple) {} - //------------------------------------------------------------------ /// Try to find the load address of a file. /// The load address is defined as the address of the first memory region /// what contains data mapped from the specified file. @@ -2541,7 +2310,6 @@ /// \param[out] load_addr /// The load address of the file if it is loaded into the /// processes address space, LLDB_INVALID_ADDRESS otherwise. - //------------------------------------------------------------------ virtual Status GetFileLoadAddress(const FileSpec &file, bool &is_loaded, lldb::addr_t &load_addr) { return Status("Not supported"); @@ -2553,7 +2321,6 @@ void ResetImageToken(size_t token); - //------------------------------------------------------------------ /// Find the next branch instruction to set a breakpoint on /// /// When instruction stepping through a source line, instead of stepping @@ -2575,11 +2342,9 @@ /// the range provided in range_bounds. If there are any /// problems with the disassembly or getting the instructions, /// the original default_stop_addr will be returned. - //------------------------------------------------------------------ Address AdvanceAddressToNextBranchInstruction(Address default_stop_addr, AddressRange range_bounds); - //------------------------------------------------------------------ /// Configure asynchronous structured data feature. /// /// Each Process type that supports using an asynchronous StructuredData @@ -2604,12 +2369,10 @@ /// /// \return /// Returns the result of attempting to configure the feature. - //------------------------------------------------------------------ virtual Status ConfigureStructuredData(ConstString type_name, const StructuredData::ObjectSP &config_sp); - //------------------------------------------------------------------ /// Broadcasts the given structured data object from the given plugin. /// /// StructuredDataPlugin instances can use this to optionally broadcast any @@ -2623,11 +2386,9 @@ /// \param[in] plugin_sp /// The plugin that will be reported in the event's plugin /// parameter. - //------------------------------------------------------------------ void BroadcastStructuredData(const StructuredData::ObjectSP &object_sp, const lldb::StructuredDataPluginSP &plugin_sp); - //------------------------------------------------------------------ /// Returns the StructuredDataPlugin associated with a given type name, if /// there is one. /// @@ -2638,11 +2399,9 @@ /// \return /// The plugin if one is available for the specified feature; /// otherwise, returns an empty shared pointer. - //------------------------------------------------------------------ lldb::StructuredDataPluginSP GetStructuredDataPlugin(ConstString type_name) const; - //------------------------------------------------------------------ /// Starts tracing with the configuration provided in options. To enable /// tracing on the complete process the thread_id in the options should be /// set to LLDB_INVALID_THREAD_ID. The API returns a user_id which is needed @@ -2651,48 +2410,40 @@ /// implementations in the server, as they could be returned as an error, or /// rounded to a valid configuration to start tracing. In the later case the /// GetTraceConfig should supply the actual used trace configuration. - //------------------------------------------------------------------ virtual lldb::user_id_t StartTrace(const TraceOptions &options, Status &error) { error.SetErrorString("Not implemented"); return LLDB_INVALID_UID; } - //------------------------------------------------------------------ /// Stops the tracing instance leading to deletion of the trace data. The /// tracing instance is identified by the user_id which is obtained when /// tracing was started from the StartTrace. In case tracing of the complete /// process needs to be stopped the thread_id should be set to /// LLDB_INVALID_THREAD_ID. In the other case that tracing on an individual /// thread needs to be stopped a thread_id can be supplied. - //------------------------------------------------------------------ virtual Status StopTrace(lldb::user_id_t uid, lldb::tid_t thread_id) { return Status("Not implemented"); } - //------------------------------------------------------------------ /// Provides the trace data as raw bytes. A buffer needs to be supplied to /// copy the trace data. The exact behavior of this API may vary across /// trace technology, as some may support partial reading of the trace data /// from a specified offset while some may not. The thread_id should be used /// to select a particular thread for trace extraction. - //------------------------------------------------------------------ virtual Status GetData(lldb::user_id_t uid, lldb::tid_t thread_id, llvm::MutableArrayRef &buffer, size_t offset = 0) { return Status("Not implemented"); } - //------------------------------------------------------------------ /// Similar API as above except for obtaining meta data - //------------------------------------------------------------------ virtual Status GetMetaData(lldb::user_id_t uid, lldb::tid_t thread_id, llvm::MutableArrayRef &buffer, size_t offset = 0) { return Status("Not implemented"); } - //------------------------------------------------------------------ /// API to obtain the trace configuration used by a trace instance. /// Configurations that may be specific to some trace technology should be /// stored in the custom parameters. The options are transported to the @@ -2700,7 +2451,6 @@ /// specified in the options to obtain the configuration used by a specific /// thread. The thread_id specified should also match the uid otherwise an /// error will be returned. - //------------------------------------------------------------------ virtual Status GetTraceConfig(lldb::user_id_t uid, TraceOptions &options) { return Status("Not implemented"); } @@ -2710,21 +2460,16 @@ lldb::StateType GetPrivateState(); - //------------------------------------------------------------------ /// The "private" side of resuming a process. This doesn't alter the state /// of m_run_lock, but just causes the process to resume. /// /// \return /// An Status object describing the success or failure of the resume. - //------------------------------------------------------------------ Status PrivateResume(); - //------------------------------------------------------------------ // Called internally - //------------------------------------------------------------------ void CompleteAttach(); - //------------------------------------------------------------------ /// Print a user-visible warning one time per Process /// /// A facility for printing a warning to the user once per repeat_key. @@ -2751,11 +2496,9 @@ /// /// \param [in] fmt /// printf style format string - //------------------------------------------------------------------ void PrintWarning(uint64_t warning_type, const void *repeat_key, const char *fmt, ...) __attribute__((format(printf, 4, 5))); - //------------------------------------------------------------------ // NextEventAction provides a way to register an action on the next event // that is delivered to this process. There is currently only one next event // action allowed in the process at one time. If a new "NextEventAction" is @@ -2764,7 +2507,6 @@ // // If you want to resume the process as a result of a resume action, call // RequestResume, don't call Resume directly. - //------------------------------------------------------------------ class NextEventAction { public: typedef enum EventActionResult { @@ -2818,7 +2560,6 @@ void ForceNextEventDelivery() { m_force_next_event_delivery = true; } - //------------------------------------------------------------------ /// Loads any plugins associated with asynchronous structured data and maps /// the relevant supported type name to the plugin. /// @@ -2835,11 +2576,9 @@ /// An array of zero or more type names. Each must be unique. /// For each entry in the list, a StructuredDataPlugin will be /// searched for that supports the structured data type name. - //------------------------------------------------------------------ void MapSupportedStructuredDataPlugins( const StructuredData::Array &supported_type_names); - //------------------------------------------------------------------ /// Route the incoming structured data dictionary to the right plugin. /// /// The incoming structured data must be a dictionary, and it must have a @@ -2862,12 +2601,9 @@ /// \return /// True if the structured data was routed to a plugin; otherwise, /// false. - //------------------------------------------------------------------ bool RouteAsyncStructuredData(const StructuredData::ObjectSP object_sp); - //------------------------------------------------------------------ // Type definitions - //------------------------------------------------------------------ typedef std::map LanguageRuntimeCollection; typedef std::unordered_set WarningsPointerSet; @@ -2887,9 +2623,7 @@ using StructuredDataPluginMap = std::map; - //------------------------------------------------------------------ // Member variables - //------------------------------------------------------------------ std::weak_ptr m_target_wp; ///< The target that owns this process. ThreadSafeValue m_public_state; ThreadSafeValue @@ -3084,7 +2818,6 @@ void LoadOperatingSystemPlugin(bool flush); private: - //------------------------------------------------------------------ /// This is the part of the event handling that for a process event. It /// decides what to do with the event and returns true if the event needs to /// be propagated to the user, and false otherwise. If the event is not @@ -3098,7 +2831,6 @@ /// \return /// Returns \b true if the event should be reported to the /// user, \b false otherwise. - //------------------------------------------------------------------ bool ShouldBroadcastEvent(Event *event_ptr); void ControlPrivateStateThread(uint32_t signal); @@ -3106,10 +2838,8 @@ DISALLOW_COPY_AND_ASSIGN(Process); }; -//------------------------------------------------------------------ /// RAII guard that should be aquired when an utility function is called within /// a given process. -//------------------------------------------------------------------ class UtilityFunctionScope { Process *m_process; Index: include/lldb/Target/Queue.h =================================================================== --- include/lldb/Target/Queue.h +++ include/lldb/Target/Queue.h @@ -19,7 +19,6 @@ namespace lldb_private { -//------------------------------------------------------------------ // Queue: // This class represents a libdispatch aka Grand Central Dispatch queue in the // process. @@ -29,7 +28,6 @@ // pthreads to execute the work items for the queues. A serial queue will be // associated with a single thread (or possibly no thread, if it is not doing // any work). A concurrent queue may be associated with multiple threads. -//------------------------------------------------------------------ class Queue : public std::enable_shared_from_this { public: @@ -38,7 +36,6 @@ ~Queue(); - //------------------------------------------------------------------ /// Get the QueueID for this Queue /// /// A 64-bit ID number that uniquely identifies a queue at this particular @@ -49,19 +46,15 @@ /// /// \return /// The QueueID for this Queue. - //------------------------------------------------------------------ lldb::queue_id_t GetID(); - //------------------------------------------------------------------ /// Get the name of this Queue /// /// \return /// The name of the queue, if one is available. /// A NULL pointer is returned if none is available. - //------------------------------------------------------------------ const char *GetName(); - //------------------------------------------------------------------ /// Get the IndexID for this Queue /// /// This is currently the same as GetID(). If it changes in the future, @@ -74,10 +67,8 @@ /// /// \return /// The IndexID for this queue. - //------------------------------------------------------------------ uint32_t GetIndexID(); - //------------------------------------------------------------------ /// Return the threads currently associated with this queue /// /// Zero, one, or many threads may be executing code for a queue at @@ -86,10 +77,8 @@ /// /// \return /// The threads currently performing work for this queue - //------------------------------------------------------------------ std::vector GetThreads(); - //------------------------------------------------------------------ /// Return the items that are currently enqueued /// /// "Enqueued" means that the item has been added to the queue to @@ -98,31 +87,25 @@ /// /// \return /// The vector of enqueued items for this queue - //------------------------------------------------------------------ const std::vector &GetPendingItems(); lldb::ProcessSP GetProcess() const { return m_process_wp.lock(); } - //------------------------------------------------------------------ /// Get the number of work items that this queue is currently running /// /// \return /// The number of work items currently executing. For a serial /// queue, this will be 0 or 1. For a concurrent queue, this /// may be any number. - //------------------------------------------------------------------ uint32_t GetNumRunningWorkItems() const; - //------------------------------------------------------------------ /// Get the number of work items enqueued on this queue /// /// \return /// The number of work items currently enqueued, waiting to /// execute. - //------------------------------------------------------------------ uint32_t GetNumPendingWorkItems() const; - //------------------------------------------------------------------ /// Get the dispatch_queue_t structure address for this Queue /// /// Get the address in the inferior process' memory of this Queue's @@ -131,7 +114,6 @@ /// \return /// The address of the dispatch_queue_t structure, if known. /// LLDB_INVALID_ADDRESS will be returned if it is unavailable. - //------------------------------------------------------------------ lldb::addr_t GetLibdispatchQueueAddress() const; void SetNumRunningWorkItems(uint32_t count); @@ -144,20 +126,16 @@ m_pending_items.push_back(item); } - //------------------------------------------------------------------ /// Return the kind (serial, concurrent) of this queue /// /// \return // Whether this is a serial or a concurrent queue - //------------------------------------------------------------------ lldb::QueueKind GetKind(); void SetKind(lldb::QueueKind kind); private: - //------------------------------------------------------------------ // For Queue only - //------------------------------------------------------------------ lldb::ProcessWP m_process_wp; lldb::queue_id_t m_queue_id; Index: include/lldb/Target/QueueItem.h =================================================================== --- include/lldb/Target/QueueItem.h +++ include/lldb/Target/QueueItem.h @@ -22,14 +22,12 @@ namespace lldb_private { -//------------------------------------------------------------------ // QueueItem: // This class represents a work item enqueued on a libdispatch aka Grand // Central Dispatch (GCD) queue. Most often, this will be a function or block. // "enqueued" here means that the work item has been added to a queue but it // has not yet started executing. When it is "dequeued", execution of the item // begins. -//------------------------------------------------------------------ class QueueItem : public std::enable_shared_from_this { public: @@ -38,24 +36,19 @@ ~QueueItem(); - //------------------------------------------------------------------ /// Get the kind of work item this is /// /// \return /// The type of work item that this QueueItem object /// represents. eQueueItemKindUnknown may be returned. - //------------------------------------------------------------------ lldb::QueueItemKind GetKind(); - //------------------------------------------------------------------ /// Set the type of work item this is /// /// \param [in] item_kind /// Set the kind of this work item object. - //------------------------------------------------------------------ void SetKind(lldb::QueueItemKind item_kind); - //------------------------------------------------------------------ /// Get the code address that will be executed when this work item /// is executed. /// @@ -66,19 +59,15 @@ /// Address is valid, or check that the WorkItemKind is a /// kind that involves an address, such as eQueueItemKindFunction /// or eQueueItemKindBlock. - //------------------------------------------------------------------ lldb_private::Address &GetAddress(); - //------------------------------------------------------------------ /// Set the work item address for this object /// /// \param [in] addr /// The address that will be invoked when this work item /// is executed. - //------------------------------------------------------------------ void SetAddress(lldb_private::Address addr); - //------------------------------------------------------------------ /// Check if this QueueItem object is valid /// /// If the weak pointer to the parent Queue cannot be revivified, @@ -86,10 +75,8 @@ /// /// \return /// True if this object is valid. - //------------------------------------------------------------------ bool IsValid() { return m_queue_wp.lock() != nullptr; } - //------------------------------------------------------------------ /// Get an extended backtrace thread for this queue item, if available /// /// If the backtrace/thread information was collected when this item @@ -102,7 +89,6 @@ /// \return /// A thread shared pointer which will have a reference to an extended /// thread if one was available. - //------------------------------------------------------------------ lldb::ThreadSP GetExtendedBacktraceThread(ConstString type); void SetItemThatEnqueuedThis(lldb::addr_t address_of_item) { Index: include/lldb/Target/QueueList.h =================================================================== --- include/lldb/Target/QueueList.h +++ include/lldb/Target/QueueList.h @@ -18,14 +18,12 @@ namespace lldb_private { -//------------------------------------------------------------------ // QueueList: // This is the container for libdispatch aka Grand Central Dispatch Queue // objects. // // Each Process will have a QueueList. When the process execution is paused, // the QueueList may be populated with Queues by the SystemRuntime. -//------------------------------------------------------------------ class QueueList { friend class Process; @@ -35,22 +33,18 @@ ~QueueList(); - //------------------------------------------------------------------ /// Get the number of libdispatch queues that are available /// /// \return /// The number of queues that are stored in the QueueList. - //------------------------------------------------------------------ uint32_t GetSize(); - //------------------------------------------------------------------ /// Get the Queue at a given index number /// /// \param [in] idx /// The index number (0-based) of the queue. /// \return /// The Queue at that index number. - //------------------------------------------------------------------ lldb::QueueSP GetQueueAtIndex(uint32_t idx); typedef std::vector collection; @@ -58,29 +52,22 @@ std::mutex> QueueIterable; - //------------------------------------------------------------------ /// Iterate over the list of queues /// /// \return /// An Iterable object which can be used to loop over the queues /// that exist. - //------------------------------------------------------------------ QueueIterable Queues() { return QueueIterable(m_queues, m_mutex); } - //------------------------------------------------------------------ /// Clear out the list of queues from the QueueList - //------------------------------------------------------------------ void Clear(); - //------------------------------------------------------------------ /// Add a Queue to the QueueList /// /// \param [in] queue /// Used by the SystemRuntime to populate the QueueList - //------------------------------------------------------------------ void AddQueue(lldb::QueueSP queue); - //------------------------------------------------------------------ /// Find a queue in the QueueList by QueueID /// /// \param [in] qid @@ -89,10 +76,8 @@ /// \return /// A QueueSP to the queue requested, if it is present in the QueueList. /// An empty QueueSP will be returned if this queue was not found. - //------------------------------------------------------------------ lldb::QueueSP FindQueueByID(lldb::queue_id_t qid); - //------------------------------------------------------------------ /// Find a queue in the QueueList by IndexID /// /// \param [in] index_id @@ -104,15 +89,12 @@ /// \return /// A QueueSP to the queue requested, if it is present in the QueueList. /// An empty QueueSP will be returned if this queue was not found. - //------------------------------------------------------------------ lldb::QueueSP FindQueueByIndexID(uint32_t index_id); std::mutex &GetMutex(); protected: - //------------------------------------------------------------------ // Classes that inherit from Process can see and modify these - //------------------------------------------------------------------ Process *m_process; ///< The process that manages this queue list. uint32_t m_stop_id; ///< The process stop ID that this queue list is valid for. Index: include/lldb/Target/RegisterContext.h =================================================================== --- include/lldb/Target/RegisterContext.h +++ include/lldb/Target/RegisterContext.h @@ -17,18 +17,14 @@ class RegisterContext : public std::enable_shared_from_this, public ExecutionContextScope { public: - //------------------------------------------------------------------ // Constructors and Destructors - //------------------------------------------------------------------ RegisterContext(Thread &thread, uint32_t concrete_frame_idx); ~RegisterContext() override; void InvalidateIfNeeded(bool force); - //------------------------------------------------------------------ // Subclasses must override these functions - //------------------------------------------------------------------ virtual void InvalidateAllRegisters() = 0; virtual size_t GetRegisterCount() = 0; @@ -75,7 +71,6 @@ bool CopyFromRegisterContext(lldb::RegisterContextSP context); - //------------------------------------------------------------------ /// Convert from a given register numbering scheme to the lldb register /// numbering scheme /// @@ -109,13 +104,10 @@ /// \return /// The equivalent register number in the eRegisterKindLLDB /// numbering scheme, if possible, else LLDB_INVALID_REGNUM. - //------------------------------------------------------------------ virtual uint32_t ConvertRegisterKindToRegisterNumber(lldb::RegisterKind kind, uint32_t num) = 0; - //------------------------------------------------------------------ // Subclasses can override these functions if desired - //------------------------------------------------------------------ virtual uint32_t NumSupportedHardwareBreakpoints(); virtual uint32_t SetHardwareBreakpoint(lldb::addr_t addr, size_t size); @@ -141,9 +133,7 @@ lldb::addr_t dst_addr, uint32_t dst_len, const RegisterValue ®_value); - //------------------------------------------------------------------ // Subclasses should not override these - //------------------------------------------------------------------ virtual lldb::tid_t GetThreadID() const; virtual Thread &GetThread() { return m_thread; } @@ -188,9 +178,7 @@ lldb::RegisterKind target_rk, uint32_t &target_regnum); - //------------------------------------------------------------------ // lldb::ExecutionContextScope pure virtual functions - //------------------------------------------------------------------ lldb::TargetSP CalculateTarget() override; lldb::ProcessSP CalculateProcess() override; @@ -206,17 +194,13 @@ void SetStopID(uint32_t stop_id) { m_stop_id = stop_id; } protected: - //------------------------------------------------------------------ // Classes that inherit from RegisterContext can see and modify these - //------------------------------------------------------------------ Thread &m_thread; // The thread that this register context belongs to. uint32_t m_concrete_frame_idx; // The concrete frame index for this register // context uint32_t m_stop_id; // The stop ID that any data in this context is valid for private: - //------------------------------------------------------------------ // For RegisterContext only - //------------------------------------------------------------------ DISALLOW_COPY_AND_ASSIGN(RegisterContext); }; Index: include/lldb/Target/RegisterNumber.h =================================================================== --- include/lldb/Target/RegisterNumber.h +++ include/lldb/Target/RegisterNumber.h @@ -12,11 +12,9 @@ #include "lldb/lldb-private.h" #include -//-------------------------------------------------------------------- /// A class to represent register numbers, and able to convert between /// different register numbering schemes that may be used in a single /// debug session. -//-------------------------------------------------------------------- class RegisterNumber { public: Index: include/lldb/Target/SectionLoadHistory.h =================================================================== --- include/lldb/Target/SectionLoadHistory.h +++ include/lldb/Target/SectionLoadHistory.h @@ -23,9 +23,7 @@ // value. eStopIDNow = UINT32_MAX }; - //------------------------------------------------------------------ // Constructors and Destructors - //------------------------------------------------------------------ SectionLoadHistory() : m_stop_id_to_section_load_list(), m_mutex() {} ~SectionLoadHistory() { Index: include/lldb/Target/SectionLoadList.h =================================================================== --- include/lldb/Target/SectionLoadList.h +++ include/lldb/Target/SectionLoadList.h @@ -21,9 +21,7 @@ class SectionLoadList { public: - //------------------------------------------------------------------ // Constructors and Destructors - //------------------------------------------------------------------ SectionLoadList() : m_addr_to_sect(), m_sect_to_addr(), m_mutex() {} SectionLoadList(const SectionLoadList &rhs); Index: include/lldb/Target/StackFrame.h =================================================================== --- include/lldb/Target/StackFrame.h +++ include/lldb/Target/StackFrame.h @@ -63,7 +63,6 @@ Artificial }; - //------------------------------------------------------------------ /// Construct a StackFrame object without supplying a RegisterContextSP. /// /// This is the one constructor that doesn't take a RegisterContext @@ -106,7 +105,6 @@ /// Optionally seed the StackFrame with the SymbolContext information that /// has /// already been discovered. - //------------------------------------------------------------------ StackFrame(const lldb::ThreadSP &thread_sp, lldb::user_id_t frame_idx, lldb::user_id_t concrete_frame_idx, lldb::addr_t cfa, bool cfa_is_valid, lldb::addr_t pc, Kind frame_kind, @@ -128,17 +126,14 @@ StackID &GetStackID(); - //------------------------------------------------------------------ /// Get an Address for the current pc value in this StackFrame. /// /// May not be the same as the actual PC value for inlined stack frames. /// /// \return /// The Address object set to the current PC value. - //------------------------------------------------------------------ const Address &GetFrameCodeAddress(); - //------------------------------------------------------------------ /// Change the pc value for a given thread. /// /// Change the current pc value for the frame on this thread. @@ -149,10 +144,8 @@ /// \return /// true if the pc was changed. false if this failed -- possibly /// because this frame is not a live StackFrame. - //------------------------------------------------------------------ bool ChangePC(lldb::addr_t pc); - //------------------------------------------------------------------ /// Provide a SymbolContext for this StackFrame's current pc value. /// /// The StackFrame maintains this SymbolContext and adds additional @@ -167,10 +160,8 @@ /// \return /// A SymbolContext reference which includes the types of information /// requested by resolve_scope, if they are available. - //------------------------------------------------------------------ const SymbolContext &GetSymbolContext(lldb::SymbolContextItem resolve_scope); - //------------------------------------------------------------------ /// Return the Canonical Frame Address (DWARF term) for this frame. /// /// The CFA is typically the value of the stack pointer register before the @@ -191,10 +182,8 @@ /// \return /// Returns true if the CFA value was successfully set in value. Some /// frames may be unable to provide this value; they will return false. - //------------------------------------------------------------------ bool GetFrameBaseValue(Scalar &value, Status *error_ptr); - //------------------------------------------------------------------ /// Get the DWARFExpression corresponding to the Canonical Frame Address. /// /// Often a register (bp), but sometimes a register + offset. @@ -205,10 +194,8 @@ /// /// \return /// Returns the corresponding DWARF expression, or NULL. - //------------------------------------------------------------------ DWARFExpression *GetFrameBaseExpression(Status *error_ptr); - //------------------------------------------------------------------ /// Get the current lexical scope block for this StackFrame, if possible. /// /// If debug information is available for this stack frame, return a pointer @@ -217,10 +204,8 @@ /// \return /// A pointer to the current Block. nullptr is returned if this can /// not be provided. - //------------------------------------------------------------------ Block *GetFrameBlock(); - //------------------------------------------------------------------ /// Get the RegisterContext for this frame, if possible. /// /// Returns a shared pointer to the RegisterContext for this stack frame. @@ -233,14 +218,12 @@ /// /// \return /// The RegisterContext shared point for this frame. - //------------------------------------------------------------------ lldb::RegisterContextSP GetRegisterContext(); const lldb::RegisterContextSP &GetRegisterContextSP() const { return m_reg_context_sp; } - //------------------------------------------------------------------ /// Retrieve the list of variables that are in scope at this StackFrame's /// pc. /// @@ -255,10 +238,8 @@ /// /// \return /// A pointer to a list of variables. - //------------------------------------------------------------------ VariableList *GetVariableList(bool get_file_globals); - //------------------------------------------------------------------ /// Retrieve the list of variables that are in scope at this StackFrame's /// pc. /// @@ -273,12 +254,10 @@ /// /// \return /// A pointer to a list of variables. - //------------------------------------------------------------------ lldb::VariableListSP GetInScopeVariableList(bool get_file_globals, bool must_have_valid_location = false); - //------------------------------------------------------------------ /// Create a ValueObject for a variable name / pathname, possibly including /// simple dereference/child selection syntax. /// @@ -304,30 +283,24 @@ /// /// \return /// A shared pointer to the ValueObject described by var_expr. - //------------------------------------------------------------------ lldb::ValueObjectSP GetValueForVariableExpressionPath( llvm::StringRef var_expr, lldb::DynamicValueType use_dynamic, uint32_t options, lldb::VariableSP &var_sp, Status &error); - //------------------------------------------------------------------ /// Determine whether this StackFrame has debug information available or not /// /// \return // true if debug information is available for this frame (function, // compilation unit, block, etc.) - //------------------------------------------------------------------ bool HasDebugInformation(); - //------------------------------------------------------------------ /// Return the disassembly for the instructions of this StackFrame's /// function as a single C string. /// /// \return // C string with the assembly instructions for this function. - //------------------------------------------------------------------ const char *Disassemble(); - //------------------------------------------------------------------ /// Print a description for this frame using the frame-format formatter /// settings. /// @@ -339,11 +312,9 @@ /// /// \param [in] frame_marker /// Optional string that will be prepended to the frame output description. - //------------------------------------------------------------------ void DumpUsingSettingsFormat(Stream *strm, bool show_unique = false, const char *frame_marker = nullptr); - //------------------------------------------------------------------ /// Print a description for this frame using a default format. /// /// \param [in] strm @@ -354,10 +325,8 @@ /// /// \param [in] show_fullpaths /// Whether to print the full source paths or just the file base name. - //------------------------------------------------------------------ void Dump(Stream *strm, bool show_frame_index, bool show_fullpaths); - //------------------------------------------------------------------ /// Print a description of this stack frame and/or the source /// context/assembly for this stack frame. /// @@ -379,48 +348,36 @@ /// /// \return /// Returns true if successful. - //------------------------------------------------------------------ bool GetStatus(Stream &strm, bool show_frame_info, bool show_source, bool show_unique = false, const char *frame_marker = nullptr); - //------------------------------------------------------------------ /// Query whether this frame is a concrete frame on the call stack, or if it /// is an inlined frame derived from the debug information and presented by /// the debugger. /// /// \return /// true if this is an inlined frame. - //------------------------------------------------------------------ bool IsInlined(); - //------------------------------------------------------------------ /// Query whether this frame is part of a historical backtrace. - //------------------------------------------------------------------ bool IsHistorical() const; - //------------------------------------------------------------------ /// Query whether this frame is artificial (e.g a synthesized result of /// inferring missing tail call frames from a backtrace). Artificial frames /// may have limited support for inspecting variables. - //------------------------------------------------------------------ bool IsArtificial() const; - //------------------------------------------------------------------ /// Query this frame to find what frame it is in this Thread's /// StackFrameList. /// /// \return /// StackFrame index 0 indicates the currently-executing function. Inline /// frames are included in this frame index count. - //------------------------------------------------------------------ uint32_t GetFrameIndex() const; - //------------------------------------------------------------------ /// Set this frame's synthetic frame index. - //------------------------------------------------------------------ void SetFrameIndex(uint32_t index) { m_frame_index = index; } - //------------------------------------------------------------------ /// Query this frame to find what frame it is in this Thread's /// StackFrameList, not counting inlined frames. /// @@ -429,10 +386,8 @@ /// frames are not included in this frame index count; their concrete /// frame index will be the same as the concrete frame that they are /// derived from. - //------------------------------------------------------------------ uint32_t GetConcreteFrameIndex() const { return m_concrete_frame_index; } - //------------------------------------------------------------------ /// Create a ValueObject for a given Variable in this StackFrame. /// /// \params [in] variable_sp @@ -445,12 +400,10 @@ /// /// \return // A ValueObject for this variable. - //------------------------------------------------------------------ lldb::ValueObjectSP GetValueObjectForFrameVariable(const lldb::VariableSP &variable_sp, lldb::DynamicValueType use_dynamic); - //------------------------------------------------------------------ /// Add an arbitrary Variable object (e.g. one that specifics a global or /// static) to a StackFrame's list of ValueObjects. /// @@ -464,24 +417,20 @@ /// /// \return // A ValueObject for this variable. - //------------------------------------------------------------------ lldb::ValueObjectSP TrackGlobalVariable(const lldb::VariableSP &variable_sp, lldb::DynamicValueType use_dynamic); - //------------------------------------------------------------------ /// Query this frame to determine what the default language should be when /// parsing expressions given the execution context. /// /// \return /// The language of the frame if known, else lldb::eLanguageTypeUnknown. - //------------------------------------------------------------------ lldb::LanguageType GetLanguage(); // similar to GetLanguage(), but is allowed to take a potentially incorrect // guess if exact information is not available lldb::LanguageType GuessLanguage(); - //------------------------------------------------------------------ /// Attempt to econstruct the ValueObject for a given raw address touched by /// the current instruction. The ExpressionPath should indicate how to get /// to this value using "frame variable." @@ -491,10 +440,8 @@ /// /// \return /// The ValueObject if found. If valid, it has a valid ExpressionPath. - //------------------------------------------------------------------ lldb::ValueObjectSP GuessValueForAddress(lldb::addr_t addr); - //------------------------------------------------------------------ /// Attempt to reconstruct the ValueObject for the address contained in a /// given register plus an offset. The ExpressionPath should indicate how /// to get to this value using "frame variable." @@ -507,11 +454,9 @@ /// /// \return /// The ValueObject if found. If valid, it has a valid ExpressionPath. - //------------------------------------------------------------------ lldb::ValueObjectSP GuessValueForRegisterAndOffset(ConstString reg, int64_t offset); - //------------------------------------------------------------------ /// Attempt to reconstruct the ValueObject for a variable with a given \a name /// from within the current StackFrame, within the current block. The search /// for the variable starts in the deepest block corresponding to the current @@ -523,12 +468,9 @@ /// /// \return /// The ValueObject if found. - //------------------------------------------------------------------ lldb::ValueObjectSP FindVariable(ConstString name); - //------------------------------------------------------------------ // lldb::ExecutionContextScope pure virtual functions - //------------------------------------------------------------------ lldb::TargetSP CalculateTarget() override; lldb::ProcessSP CalculateProcess() override; @@ -553,9 +495,7 @@ bool HasCachedData() const; private: - //------------------------------------------------------------------ // For StackFrame only - //------------------------------------------------------------------ lldb::ThreadWP m_thread_wp; uint32_t m_frame_index; uint32_t m_concrete_frame_index; Index: include/lldb/Target/StackFrameList.h =================================================================== --- include/lldb/Target/StackFrameList.h +++ include/lldb/Target/StackFrameList.h @@ -19,9 +19,7 @@ class StackFrameList { public: - //------------------------------------------------------------------ // Constructors and Destructors - //------------------------------------------------------------------ StackFrameList(Thread &thread, const lldb::StackFrameListSP &prev_frames_sp, bool show_inline_frames); Index: include/lldb/Target/StackID.h =================================================================== --- include/lldb/Target/StackID.h +++ include/lldb/Target/StackID.h @@ -16,9 +16,7 @@ class StackID { public: - //------------------------------------------------------------------ // Constructors and Destructors - //------------------------------------------------------------------ StackID() : m_pc(LLDB_INVALID_ADDRESS), m_cfa(LLDB_INVALID_ADDRESS), m_symbol_scope(nullptr) {} @@ -54,9 +52,7 @@ void Dump(Stream *s); - //------------------------------------------------------------------ // Operators - //------------------------------------------------------------------ const StackID &operator=(const StackID &rhs) { if (this != &rhs) { m_pc = rhs.m_pc; Index: include/lldb/Target/StopInfo.h =================================================================== --- include/lldb/Target/StopInfo.h +++ include/lldb/Target/StopInfo.h @@ -22,9 +22,7 @@ friend class ThreadPlanBase; public: - //------------------------------------------------------------------ // Constructors and Destructors - //------------------------------------------------------------------ StopInfo(Thread &thread, uint64_t value); virtual ~StopInfo() {} @@ -156,9 +154,7 @@ // to consult this later on. virtual bool ShouldStop(Event *event_ptr) { return true; } - //------------------------------------------------------------------ // Classes that inherit from StackID can see and modify these - //------------------------------------------------------------------ lldb::ThreadWP m_thread_wp; // The thread corresponding to the stop reason. uint32_t m_stop_id; // The process stop ID for which this stop info is valid uint32_t m_resume_id; // This is the resume ID when we made this stop ID. Index: include/lldb/Target/StructuredDataPlugin.h =================================================================== --- include/lldb/Target/StructuredDataPlugin.h +++ include/lldb/Target/StructuredDataPlugin.h @@ -16,7 +16,6 @@ class CommandObjectMultiword; -// ----------------------------------------------------------------------------- /// Plugin that supports process-related structured data sent asynchronously /// from the debug monitor (e.g. debugserver, lldb-server, etc.) /// @@ -37,7 +36,6 @@ /// and error streams such that the plugin can display something about the /// event, at a time when the debugger ensures it is safe to write to the /// output or error streams. -// ----------------------------------------------------------------------------- class StructuredDataPlugin : public PluginInterface, @@ -47,11 +45,8 @@ lldb::ProcessSP GetProcess() const; - // ------------------------------------------------------------------------- // Public instance API - // ------------------------------------------------------------------------- - // ------------------------------------------------------------------------- /// Return whether this plugin supports the given StructuredData feature. /// /// When Process is informed of a list of process-monitor-supported @@ -69,10 +64,8 @@ /// /// \return /// true if the plugin supports the feature; otherwise, false. - // ------------------------------------------------------------------------- virtual bool SupportsStructuredDataType(ConstString type_name) = 0; - // ------------------------------------------------------------------------- /// Handle the arrival of asynchronous structured data from the process. /// /// When asynchronous structured data arrives from the process monitor, @@ -98,12 +91,10 @@ /// be a dictionary. The only key required is the aforementioned /// key named "type" that must be a string value containing the /// structured data type name. - // ------------------------------------------------------------------------- virtual void HandleArrivalOfStructuredData(Process &process, ConstString type_name, const StructuredData::ObjectSP &object_sp) = 0; - // ------------------------------------------------------------------------- /// Get a human-readable description of the contents of the data. /// /// In command-line LLDB, this method will be called by the Debugger @@ -121,11 +112,9 @@ /// \return /// The error if formatting the object contents failed; otherwise, /// success. - // ------------------------------------------------------------------------- virtual Status GetDescription(const StructuredData::ObjectSP &object_sp, lldb_private::Stream &stream) = 0; - // ------------------------------------------------------------------------- /// Returns whether the plugin's features are enabled. /// /// This is a convenience method for plugins that can enable or disable @@ -135,10 +124,8 @@ /// \param[in] type_name /// The name of the feature tag for the asynchronous structured data. /// This is needed for plugins that support more than one feature. - // ------------------------------------------------------------------------- virtual bool GetEnabled(ConstString type_name) const; - // ------------------------------------------------------------------------- /// Allow the plugin to do work related to modules that loaded in the /// the corresponding process. /// @@ -154,16 +141,12 @@ /// \param[in] module_list /// The list of modules that the process registered as having just /// loaded. See \b Process::ModulesDidLoad(...). - // ------------------------------------------------------------------------- virtual void ModulesDidLoad(Process &process, ModuleList &module_list); protected: - // ------------------------------------------------------------------------- // Derived-class API - // ------------------------------------------------------------------------- StructuredDataPlugin(const lldb::ProcessWP &process_wp); - // ------------------------------------------------------------------------- /// Derived classes must call this before attempting to hook up commands /// to the 'plugin structured-data' tree. /// @@ -174,7 +157,6 @@ /// \param[in] debugger /// The Debugger instance for which we're creating the required shared /// components for the StructuredDataPlugin derived classes. - // ------------------------------------------------------------------------- static void InitializeBasePluginForDebugger(Debugger &debugger); private: Index: include/lldb/Target/SystemRuntime.h =================================================================== --- include/lldb/Target/SystemRuntime.h +++ include/lldb/Target/SystemRuntime.h @@ -22,7 +22,6 @@ namespace lldb_private { -//---------------------------------------------------------------------- /// \class SystemRuntime SystemRuntime.h "lldb/Target/SystemRuntime.h" /// A plug-in interface definition class for system runtimes. /// @@ -39,11 +38,9 @@ /// collecting information. Later when it comes time to augment a Thread, it /// can be asked to provide that information. /// -//---------------------------------------------------------------------- class SystemRuntime : public PluginInterface { public: - //------------------------------------------------------------------ /// Find a system runtime plugin for a given process. /// /// Scans the installed SystemRuntime plugins and tries to find an instance @@ -52,55 +49,41 @@ /// \param[in] process /// The process for which to try and locate a system runtime /// plugin instance. - //------------------------------------------------------------------ static SystemRuntime *FindPlugin(Process *process); - //------------------------------------------------------------------ /// Construct with a process. - // ----------------------------------------------------------------- SystemRuntime(lldb_private::Process *process); - //------------------------------------------------------------------ /// Destructor. /// /// The destructor is virtual since this class is designed to be inherited /// by the plug-in instance. - //------------------------------------------------------------------ ~SystemRuntime() override; - //------------------------------------------------------------------ /// Called after attaching to a process. /// /// Allow the SystemRuntime plugin to execute some code after attaching to a /// process. - //------------------------------------------------------------------ virtual void DidAttach(); - //------------------------------------------------------------------ /// Called after launching a process. /// /// Allow the SystemRuntime plugin to execute some code after launching a /// process. - //------------------------------------------------------------------ virtual void DidLaunch(); - //------------------------------------------------------------------ /// Called when modules have been loaded in the process. /// /// Allow the SystemRuntime plugin to enable logging features in the system /// runtime libraries. - //------------------------------------------------------------------ virtual void ModulesDidLoad(lldb_private::ModuleList &module_list); - //------------------------------------------------------------------ /// Called before detaching from a process. /// /// This will give a SystemRuntime plugin a chance to free any resources in /// the inferior process before we detach. - //------------------------------------------------------------------ virtual void Detach(); - //------------------------------------------------------------------ /// Return a list of thread origin extended backtraces that may be /// available. /// @@ -122,10 +105,8 @@ /// A vector of ConstStrings with names like "pthread" or "libdispatch". /// An empty vector may be returned if no thread origin extended /// backtrace capabilities are available. - //------------------------------------------------------------------ virtual const std::vector &GetExtendedBacktraceTypes(); - //------------------------------------------------------------------ /// Return a Thread which shows the origin of this thread's creation. /// /// This likely returns a HistoryThread which shows how thread was @@ -150,11 +131,9 @@ /// view thread and may be only useful for showing a backtrace. /// /// An empty ThreadSP will be returned if no thread origin is available. - //------------------------------------------------------------------ virtual lldb::ThreadSP GetExtendedBacktraceThread(lldb::ThreadSP thread, ConstString type); - //------------------------------------------------------------------ /// Get the extended backtrace thread for a QueueItem /// /// A QueueItem represents a function/block that will be executed on @@ -174,14 +153,12 @@ /// \return /// If an extended backtrace is available, it is returned. Else /// an empty ThreadSP is returned. - //------------------------------------------------------------------ virtual lldb::ThreadSP GetExtendedBacktraceForQueueItem(lldb::QueueItemSP queue_item_sp, ConstString type) { return lldb::ThreadSP(); } - //------------------------------------------------------------------ /// Populate the Process' QueueList with libdispatch / GCD queues that /// exist. /// @@ -192,10 +169,8 @@ /// This QueueList will be cleared, and any queues that currently exist /// will be added. An empty QueueList will be returned if no queues /// exist or if this Systemruntime does not support libdispatch queues. - //------------------------------------------------------------------ virtual void PopulateQueueList(lldb_private::QueueList &queue_list) {} - //------------------------------------------------------------------ /// Get the queue name for a thread given a thread's dispatch_qaddr. /// /// On systems using libdispatch queues, a thread may be associated with a @@ -210,13 +185,11 @@ /// \return /// The string of this queue's name. An empty string is returned if the /// name could not be found. - //------------------------------------------------------------------ virtual std::string GetQueueNameFromThreadQAddress(lldb::addr_t dispatch_qaddr) { return ""; } - //------------------------------------------------------------------ /// Get the QueueID for the libdispatch queue given the thread's /// dispatch_qaddr. /// @@ -231,13 +204,11 @@ /// /// \return /// The queue ID, or if it could not be retrieved, LLDB_INVALID_QUEUE_ID. - //------------------------------------------------------------------ virtual lldb::queue_id_t GetQueueIDFromThreadQAddress(lldb::addr_t dispatch_qaddr) { return LLDB_INVALID_QUEUE_ID; } - //------------------------------------------------------------------ /// Get the libdispatch_queue_t address for the queue given the thread's /// dispatch_qaddr. /// @@ -252,13 +223,11 @@ /// \return /// The libdispatch_queue_t address, or LLDB_INVALID_ADDRESS if /// unavailable/not found. - //------------------------------------------------------------------ virtual lldb::addr_t GetLibdispatchQueueAddressFromThreadQAddress(lldb::addr_t dispatch_qaddr) { return LLDB_INVALID_ADDRESS; } - //------------------------------------------------------------------ /// Retrieve the Queue kind for the queue at a thread's dispatch_qaddr. /// /// Retrieve the Queue kind - either eQueueKindSerial or @@ -267,12 +236,10 @@ /// /// \return /// The Queue kind, if it could be read, else eQueueKindUnknown. - //------------------------------------------------------------------ virtual lldb::QueueKind GetQueueKind(lldb::addr_t dispatch_qaddr) { return lldb::eQueueKindUnknown; } - //------------------------------------------------------------------ /// Get the pending work items for a libdispatch Queue /// /// If this system/process is using libdispatch and the runtime can do so, @@ -281,10 +248,8 @@ /// /// \param [in] queue /// The queue of interest. - //------------------------------------------------------------------ virtual void PopulatePendingItemsForQueue(lldb_private::Queue *queue) {} - //------------------------------------------------------------------ /// Complete the fields in a QueueItem /// /// PopulatePendingItemsForQueue() may not fill in all of the QueueItem @@ -297,11 +262,9 @@ /// \param [in] item_ref /// The item_ref token that is needed to retrieve the rest of the /// information about the QueueItem. - //------------------------------------------------------------------ virtual void CompleteQueueItem(lldb_private::QueueItem *queue_item, lldb::addr_t item_ref) {} - //------------------------------------------------------------------ /// Add key-value pairs to the StructuredData dictionary object with /// information debugserver may need when constructing the /// jThreadExtendedInfo packet. @@ -310,7 +273,6 @@ /// Dictionary to which key-value pairs should be added; they will /// be sent to the remote gdb server stub as arguments in the /// jThreadExtendedInfo request. - //------------------------------------------------------------------ virtual void AddThreadExtendedInfoPacketHints( lldb_private::StructuredData::ObjectSP dict) {} @@ -327,15 +289,12 @@ /// True will be returned if there are no known problems with running an /// expression on this thread. False means that the inferior function /// call should not be made on this thread. - //------------------------------------------------------------------ virtual bool SafeToCallFunctionsOnThisThread(lldb::ThreadSP thread_sp) { return true; } protected: - //------------------------------------------------------------------ // Member variables. - //------------------------------------------------------------------ Process *m_process; std::vector m_types; Index: include/lldb/Target/Target.h =================================================================== --- include/lldb/Target/Target.h +++ include/lldb/Target/Target.h @@ -62,9 +62,7 @@ eLoadDependentsNo, } LoadDependentFiles; -//---------------------------------------------------------------------- // TargetProperties -//---------------------------------------------------------------------- class TargetExperimentalProperties : public Properties { public: TargetExperimentalProperties(); @@ -208,9 +206,7 @@ bool GetRequireHardwareBreakpoints() const; private: - //------------------------------------------------------------------ // Callbacks for m_launch_info. - //------------------------------------------------------------------ static void Arg0ValueChangedCallback(void *target_property_ptr, OptionValue *); static void RunArgsValueChangedCallback(void *target_property_ptr, @@ -232,9 +228,7 @@ static void DisableSTDIOValueChangedCallback(void *target_property_ptr, OptionValue *); - //------------------------------------------------------------------ // Member variables. - //------------------------------------------------------------------ ProcessLaunchInfo m_launch_info; std::unique_ptr m_experimental_properties_up; }; @@ -423,9 +417,7 @@ mutable uint32_t m_pound_line_line; }; -//---------------------------------------------------------------------- // Target -//---------------------------------------------------------------------- class Target : public std::enable_shared_from_this, public TargetProperties, public Broadcaster, @@ -434,9 +426,7 @@ public: friend class TargetList; - //------------------------------------------------------------------ /// Broadcaster event bits definitions. - //------------------------------------------------------------------ enum { eBroadcastBitBreakpointChanged = (1 << 0), eBroadcastBitModulesLoaded = (1 << 1), @@ -505,7 +495,6 @@ static void SetDefaultArchitecture(const ArchSpec &arch); - //------------------------------------------------------------------ /// Find a binary on the system and return its Module, /// or return an existing Module that is already in the Target. /// @@ -537,14 +526,11 @@ /// An empty ModuleSP will be returned if no matching file /// was found. If error_ptr was non-nullptr, an error message /// will likely be provided. - //------------------------------------------------------------------ lldb::ModuleSP GetOrCreateModule(const ModuleSpec &module_spec, bool notify, Status *error_ptr = nullptr); - //---------------------------------------------------------------------- // Settings accessors - //---------------------------------------------------------------------- static const lldb::TargetPropertiesSP &GetGlobalProperties(); @@ -554,7 +540,6 @@ void CleanupProcess(); - //------------------------------------------------------------------ /// Dump a description of this object to a Stream. /// /// Dump a description of the contents of this object to the @@ -565,7 +550,6 @@ /// /// \param[in] s /// The stream to which to dump the object description. - //------------------------------------------------------------------ void Dump(Stream *s, lldb::DescriptionLevel description_level); // If listener_sp is null, the listener of the owning Debugger object will be @@ -586,9 +570,7 @@ Status Attach(ProcessAttachInfo &attach_info, Stream *stream); // Optional stream to receive first stop info - //------------------------------------------------------------------ // This part handles the breakpoints. - //------------------------------------------------------------------ BreakpointList &GetBreakpointList(bool internal = false); @@ -787,7 +769,6 @@ std::vector &names, BreakpointIDList &new_bps); - //------------------------------------------------------------------ /// 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 @@ -797,12 +778,10 @@ /// 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. - //------------------------------------------------------------------ lldb::addr_t GetCallableLoadAddress( lldb::addr_t load_addr, AddressClass addr_class = AddressClass::eInvalid) const; - //------------------------------------------------------------------ /// Get \a load_addr as an opcode for this target. /// /// Take \a load_addr and potentially strip any address bits that are @@ -813,7 +792,6 @@ /// 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. - //------------------------------------------------------------------ lldb::addr_t GetOpcodeLoadAddress(lldb::addr_t load_addr, AddressClass addr_class = AddressClass::eInvalid) const; @@ -833,7 +811,6 @@ void ClearModules(bool delete_locations); - //------------------------------------------------------------------ /// Called as the last function in Process::DidExec(). /// /// Process::DidExec() will clear a lot of state in the process, @@ -843,10 +820,8 @@ /// has been figured out. It can remove breakpoints that no longer /// make sense as the exec might have changed the target /// architecture, and unloaded some modules that might get deleted. - //------------------------------------------------------------------ void DidExec(); - //------------------------------------------------------------------ /// Gets the module for the main executable. /// /// Each process has a notion of a main executable that is the file @@ -862,12 +837,10 @@ /// \see DynamicLoader /// \see ObjectFile::GetDependentModules (FileSpecList&) /// \see Process::SetExecutableModule(lldb::ModuleSP&) - //------------------------------------------------------------------ lldb::ModuleSP GetExecutableModule(); Module *GetExecutableModulePointer(); - //------------------------------------------------------------------ /// Set the main executable module. /// /// Each process has a notion of a main executable that is the file @@ -893,7 +866,6 @@ /// /// \see ObjectFile::GetDependentModules (FileSpecList&) /// \see Process::GetImages() - //------------------------------------------------------------------ void SetExecutableModule( lldb::ModuleSP &module_sp, LoadDependentFiles load_dependent_files = eLoadDependentsDefault); @@ -905,7 +877,6 @@ this, errors, feedback_stream, continue_on_error); } - //------------------------------------------------------------------ /// Get accessor for the images for this process. /// /// Each process has a notion of a main executable that is the file @@ -923,12 +894,10 @@ /// /// \return /// A list of Module objects in a module list. - //------------------------------------------------------------------ const ModuleList &GetImages() const { return m_images; } ModuleList &GetImages() { return m_images; } - //------------------------------------------------------------------ /// Return whether this FileSpec corresponds to a module that should be /// considered for general searches. /// @@ -944,10 +913,8 @@ /// A shared pointer reference to the module that checked. /// /// \return \b true if the module should be excluded, \b false otherwise. - //------------------------------------------------------------------ bool ModuleIsExcludedForUnconstrainedSearches(const FileSpec &module_spec); - //------------------------------------------------------------------ /// Return whether this module should be considered for general searches. /// /// This API will be consulted by the SearchFilterForUnconstrainedSearches @@ -966,13 +933,11 @@ /// A shared pointer reference to the module that checked. /// /// \return \b true if the module should be excluded, \b false otherwise. - //------------------------------------------------------------------ bool ModuleIsExcludedForUnconstrainedSearches(const lldb::ModuleSP &module_sp); const ArchSpec &GetArchitecture() const { return m_arch.GetSpec(); } - //------------------------------------------------------------------ /// Set the architecture for this target. /// /// If the current target has no Images read in, then this just sets the @@ -998,7 +963,6 @@ /// /// \return /// \b true if the architecture was successfully set, \bfalse otherwise. - //------------------------------------------------------------------ bool SetArchitecture(const ArchSpec &arch_spec, bool set_platform = false); bool MergeArchitecture(const ArchSpec &arch_spec); @@ -1050,9 +1014,7 @@ static Target *GetTargetFromContexts(const ExecutionContext *exe_ctx_ptr, const SymbolContext *sc_ptr); - //------------------------------------------------------------------ // lldb::ExecutionContextScope pure virtual functions - //------------------------------------------------------------------ lldb::TargetSP CalculateTarget() override; lldb::ProcessSP CalculateProcess() override; @@ -1109,10 +1071,8 @@ lldb::ClangASTImporterSP GetClangASTImporter(); - //---------------------------------------------------------------------- // Install any files through the platform that need be to installed prior to // launching or attaching. - //---------------------------------------------------------------------- Status Install(ProcessLaunchInfo *launch_info); bool ResolveFileAddress(lldb::addr_t load_addr, Address &so_addr); @@ -1156,9 +1116,7 @@ lldb::addr_t GetPersistentSymbol(ConstString name); - //------------------------------------------------------------------ // Target Stop Hooks - //------------------------------------------------------------------ class StopHook : public UserID { public: StopHook(const StopHook &rhs); @@ -1261,9 +1219,7 @@ ClangModulesDeclVendor *GetClangModulesDeclVendor(); - //------------------------------------------------------------------ // Methods. - //------------------------------------------------------------------ lldb::SearchFilterSP GetSearchFilterForModule(const FileSpec *containingModule); @@ -1280,9 +1236,7 @@ void SetREPL(lldb::LanguageType language, lldb::REPLSP repl_sp); protected: - //------------------------------------------------------------------ /// Implementing of ModuleList::Notifier. - //------------------------------------------------------------------ void NotifyModuleAdded(const ModuleList &module_list, const lldb::ModuleSP &module_sp) override; @@ -1310,9 +1264,7 @@ ArchSpec m_spec; std::unique_ptr m_plugin_up; }; - //------------------------------------------------------------------ // Member variables. - //------------------------------------------------------------------ Debugger &m_debugger; lldb::PlatformSP m_platform_sp; ///< The platform for this target. std::recursive_mutex m_mutex; ///< An API mutex that is used by the lldb::SB* @@ -1356,9 +1308,7 @@ static void ImageSearchPathsChanged(const PathMappingList &path_list, void *baton); - //------------------------------------------------------------------ // Utilities for `statistics` command. - //------------------------------------------------------------------ private: std::vector m_stats_storage; bool m_collecting_stats = false; @@ -1379,7 +1329,6 @@ std::vector GetStatistics() { return m_stats_storage; } private: - //------------------------------------------------------------------ /// Construct with optional file and arch. /// /// This member is private. Clients must use @@ -1387,7 +1336,6 @@ /// so all targets can be tracked from the central target list. /// /// \see TargetList::CreateTarget(const FileSpec*, const ArchSpec*) - //------------------------------------------------------------------ Target(Debugger &debugger, const ArchSpec &target_arch, const lldb::PlatformSP &platform_sp, bool is_dummy_target); Index: include/lldb/Target/TargetList.h =================================================================== --- include/lldb/Target/TargetList.h +++ include/lldb/Target/TargetList.h @@ -21,7 +21,6 @@ private: friend class Debugger; - //------------------------------------------------------------------ /// Constructor /// /// The constructor for the target list is private. Clients can @@ -29,13 +28,10 @@ /// lldb_private::Debugger::GetSharedInstance().GetTargetList(). /// /// \see static TargetList& lldb_private::Debugger::GetTargetList(). - //------------------------------------------------------------------ TargetList(Debugger &debugger); public: - //------------------------------------------------------------------ /// Broadcaster event bits definitions. - //------------------------------------------------------------------ enum { eBroadcastBitInterrupt = (1 << 0) }; // These two functions fill out the Broadcaster interface: @@ -48,7 +44,6 @@ ~TargetList() override; - //------------------------------------------------------------------ /// Create a new Target. /// /// Clients must use this function to create a Target. This allows @@ -85,25 +80,21 @@ /// /// \return /// An error object that indicates success or failure - //------------------------------------------------------------------ Status CreateTarget(Debugger &debugger, llvm::StringRef user_exe_path, llvm::StringRef triple_str, LoadDependentFiles get_dependent_modules, const OptionGroupPlatform *platform_options, lldb::TargetSP &target_sp); - //------------------------------------------------------------------ /// Create a new Target. /// /// Same as the function above, but used when you already know the /// platform you will be using - //------------------------------------------------------------------ Status CreateTarget(Debugger &debugger, llvm::StringRef user_exe_path, const ArchSpec &arch, LoadDependentFiles get_dependent_modules, lldb::PlatformSP &platform_sp, lldb::TargetSP &target_sp); - //------------------------------------------------------------------ /// Delete a Target object from the list. /// /// When clients are done with the Target objects, this function @@ -118,7 +109,6 @@ /// from this target list, \b false otherwise. The client will /// be left with the last remaining shared pointer to the target /// in \a target_sp which can then be properly released. - //------------------------------------------------------------------ bool DeleteTarget(lldb::TargetSP &target_sp); int GetNumTargets() const; @@ -127,7 +117,6 @@ uint32_t GetIndexOfTarget(lldb::TargetSP target_sp) const; - //------------------------------------------------------------------ /// Find the target that contains has an executable whose path /// matches \a exe_file_spec, and whose architecture matches /// \a arch_ptr if arch_ptr is not nullptr. @@ -149,12 +138,10 @@ /// pointer will contain nullptr if no target objects have a /// executable whose full or partial path matches /// with a matching process ID. - //------------------------------------------------------------------ lldb::TargetSP FindTargetWithExecutableAndArchitecture( const FileSpec &exe_file_spec, const ArchSpec *exe_arch_ptr = nullptr) const; - //------------------------------------------------------------------ /// Find the target that contains a process with process ID \a /// pid. /// @@ -165,14 +152,12 @@ /// A shared pointer to a target object. The returned shared /// pointer will contain nullptr if no target objects own a process /// with a matching process ID. - //------------------------------------------------------------------ lldb::TargetSP FindTargetWithProcessID(lldb::pid_t pid) const; lldb::TargetSP FindTargetWithProcess(lldb_private::Process *process) const; lldb::TargetSP GetTargetSP(Target *target) const; - //------------------------------------------------------------------ /// Send an async interrupt to one or all processes. /// /// Find the target that contains the process with process ID \a @@ -186,7 +171,6 @@ /// /// \return /// The number of async interrupts sent. - //------------------------------------------------------------------ uint32_t SendAsyncInterrupt(lldb::pid_t pid = LLDB_INVALID_PROCESS_ID); uint32_t SignalIfRunning(lldb::pid_t pid, int signo); @@ -197,9 +181,7 @@ protected: typedef std::vector collection; - //------------------------------------------------------------------ // Member variables. - //------------------------------------------------------------------ collection m_target_list; lldb::TargetSP m_dummy_target_sp; mutable std::recursive_mutex m_target_list_mutex; Index: include/lldb/Target/Thread.h =================================================================== --- include/lldb/Target/Thread.h +++ include/lldb/Target/Thread.h @@ -34,7 +34,6 @@ ~ThreadProperties() override; - //------------------------------------------------------------------ /// The regular expression returned determines symbols that this /// thread won't stop in during "step-in" operations. /// @@ -42,7 +41,6 @@ /// A pointer to a regular expression to compare against symbols, /// or nullptr if all symbols are allowed. /// - //------------------------------------------------------------------ const RegularExpression *GetSymbolsToAvoidRegexp(); FileSpecList &GetLibrariesToAvoid() const; @@ -64,9 +62,7 @@ public ExecutionContextScope, public Broadcaster { public: - //------------------------------------------------------------------ /// Broadcaster event bits definitions. - //------------------------------------------------------------------ enum { eBroadcastBitStackChanged = (1 << 0), eBroadcastBitThreadSuspended = (1 << 1), @@ -130,7 +126,6 @@ lldb::addr_t current_inlined_pc; }; - //------------------------------------------------------------------ /// Constructor /// /// \param [in] process @@ -146,7 +141,6 @@ /// to reuse the IndexID of that thread, or create a new one. If a /// client wants to know the original thread's IndexID, they should use /// Thread::GetExtendedBacktraceOriginatingIndexID(). - //------------------------------------------------------------------ Thread(Process &process, lldb::tid_t tid, bool use_invalid_index_id = false); ~Thread() override; @@ -167,7 +161,6 @@ void SetState(lldb::StateType state); - //------------------------------------------------------------------ /// Sets the USER resume state for this thread. If you set a thread to /// suspended with /// this API, it won't take part in any of the arbitration for ShouldResume, @@ -190,14 +183,12 @@ /// (e.g. in SBThread::Resume()), then pass true to override_suspend. /// \return /// The User resume state for this thread. - //------------------------------------------------------------------ void SetResumeState(lldb::StateType state, bool override_suspend = false) { if (m_resume_state == lldb::eStateSuspended && !override_suspend) return; m_resume_state = state; } - //------------------------------------------------------------------ /// Gets the USER resume state for this thread. This is not the same as what /// this thread is going to do for any particular step, however if this thread /// returns eStateSuspended, then the process control logic will never allow @@ -206,7 +197,6 @@ /// /// \return /// The User resume state for this thread. - //------------------------------------------------------------------ lldb::StateType GetResumeState() const { return m_resume_state; } // This function is called on all the threads before "ShouldResume" and @@ -266,7 +256,6 @@ virtual const char *GetInfo() { return nullptr; } - //------------------------------------------------------------------ /// Retrieve a dictionary of information about this thread /// /// On Mac OS X systems there may be voucher information. @@ -277,7 +266,6 @@ /// array /// being a dictionary (keys include "message" with the text of the trace /// message). - //------------------------------------------------------------------ StructuredData::ObjectSP GetExtendedInfo() { if (!m_extended_info_fetched) { m_extended_info = FetchThreadExtendedInfo(); @@ -290,7 +278,6 @@ virtual void SetName(const char *name) {} - //------------------------------------------------------------------ /// Whether this thread can be associated with a libdispatch queue /// /// The Thread may know if it is associated with a libdispatch queue, @@ -307,7 +294,6 @@ /// /// eLazyBoolCalculate this thread may be associated with a libdispatch /// queue but the thread doesn't know one way or the other. - //------------------------------------------------------------------ virtual lldb_private::LazyBool GetAssociatedWithLibdispatchQueue() { return eLazyBoolNo; } @@ -315,7 +301,6 @@ virtual void SetAssociatedWithLibdispatchQueue( lldb_private::LazyBool associated_with_libdispatch_queue) {} - //------------------------------------------------------------------ /// Retrieve the Queue ID for the queue currently using this Thread /// /// If this Thread is doing work on behalf of a libdispatch/GCD queue, @@ -329,12 +314,10 @@ /// \return /// A QueueID if the Thread subclass implements this, else /// LLDB_INVALID_QUEUE_ID. - //------------------------------------------------------------------ virtual lldb::queue_id_t GetQueueID() { return LLDB_INVALID_QUEUE_ID; } virtual void SetQueueID(lldb::queue_id_t new_val) {} - //------------------------------------------------------------------ /// Retrieve the Queue name for the queue currently using this Thread /// /// If this Thread is doing work on behalf of a libdispatch/GCD queue, @@ -343,12 +326,10 @@ /// \return /// The Queue name, if the Thread subclass implements this, else /// nullptr. - //------------------------------------------------------------------ virtual const char *GetQueueName() { return nullptr; } virtual void SetQueueName(const char *name) {} - //------------------------------------------------------------------ /// Retrieve the Queue kind for the queue currently using this Thread /// /// If this Thread is doing work on behalf of a libdispatch/GCD queue, @@ -359,12 +340,10 @@ /// \return /// The Queue kind, if the Thread subclass implements this, else /// eQueueKindUnknown. - //------------------------------------------------------------------ virtual lldb::QueueKind GetQueueKind() { return lldb::eQueueKindUnknown; } virtual void SetQueueKind(lldb::QueueKind kind) {} - //------------------------------------------------------------------ /// Retrieve the Queue for this thread, if any. /// /// \return @@ -373,10 +352,8 @@ /// An empty shared pointer indicates that this thread is not /// associated with a queue, or libdispatch queues are not /// supported on this target. - //------------------------------------------------------------------ virtual lldb::QueueSP GetQueue() { return lldb::QueueSP(); } - //------------------------------------------------------------------ /// Retrieve the address of the libdispatch_queue_t struct for queue /// currently using this Thread /// @@ -391,14 +368,12 @@ /// \return /// The Queue's libdispatch_queue_t address if the Thread subclass /// implements this, else LLDB_INVALID_ADDRESS. - //------------------------------------------------------------------ virtual lldb::addr_t GetQueueLibdispatchQueueAddress() { return LLDB_INVALID_ADDRESS; } virtual void SetQueueLibdispatchQueueAddress(lldb::addr_t dispatch_queue_t) {} - //------------------------------------------------------------------ /// Whether this Thread already has all the Queue information cached or not /// /// A Thread may be associated with a libdispatch work Queue at a given @@ -411,7 +386,6 @@ /// This method allows the SystemRuntime to discover if a thread has this /// information already, instead of calling the thread to get the information /// and having the thread call the SystemRuntime again. - //------------------------------------------------------------------ virtual bool ThreadHasQueueInformation() const { return false; } virtual uint32_t GetStackFrameCount() { @@ -499,7 +473,6 @@ bool GetDescription(Stream &s, lldb::DescriptionLevel level, bool print_json_thread, bool print_json_stopinfo); - //------------------------------------------------------------------ /// Default implementation for stepping into. /// /// This function is designed to be used by commands where the @@ -520,13 +493,11 @@ /// /// \return /// An error that describes anything that went wrong - //------------------------------------------------------------------ virtual Status StepIn(bool source_step, LazyBool step_in_avoids_code_without_debug_info = eLazyBoolCalculate, LazyBool step_out_avoids_code_without_debug_info = eLazyBoolCalculate); - //------------------------------------------------------------------ /// Default implementation for stepping over. /// /// This function is designed to be used by commands where the @@ -538,12 +509,10 @@ /// /// \return /// An error that describes anything that went wrong - //------------------------------------------------------------------ virtual Status StepOver( bool source_step, LazyBool step_out_avoids_code_without_debug_info = eLazyBoolCalculate); - //------------------------------------------------------------------ /// Default implementation for stepping out. /// /// This function is designed to be used by commands where the @@ -551,10 +520,8 @@ /// /// \return /// An error that describes anything that went wrong - //------------------------------------------------------------------ virtual Status StepOut(); - //------------------------------------------------------------------ /// Retrieves the per-thread data area. /// Most OSs maintain a per-thread pointer (e.g. the FS register on /// x64), which we return the value of here. @@ -562,10 +529,8 @@ /// \return /// LLDB_INVALID_ADDRESS if not supported, otherwise the thread /// pointer value. - //------------------------------------------------------------------ virtual lldb::addr_t GetThreadPointer(); - //------------------------------------------------------------------ /// Retrieves the per-module TLS block for a thread. /// /// \param[in] module @@ -577,11 +542,9 @@ /// If the thread has TLS data allocated for the /// module, the address of the TLS block. Otherwise /// LLDB_INVALID_ADDRESS is returned. - //------------------------------------------------------------------ virtual lldb::addr_t GetThreadLocalData(const lldb::ModuleSP module, lldb::addr_t tls_file_addr); - //------------------------------------------------------------------ /// Check whether this thread is safe to run functions /// /// The SystemRuntime may know of certain thread states (functions in @@ -591,10 +554,8 @@ /// \return /// True if it is safe to call functions on this thread. /// False if function calls should be avoided on this thread. - //------------------------------------------------------------------ virtual bool SafeToCallFunctions(); - //------------------------------------------------------------------ // Thread Plan Providers: // This section provides the basic thread plans that the Process control // machinery uses to run the target. ThreadPlan.h provides more details on @@ -617,9 +578,7 @@ // annoying to do because there's no elegant way to friend a method to all // sub-classes of a given class. // - //------------------------------------------------------------------ - //------------------------------------------------------------------ /// Queues the base plan for a thread. /// The version returned by Process does some things that are useful, /// like handle breakpoints and signals, so if you return a plugin specific @@ -634,10 +593,8 @@ /// \return /// A shared pointer to the newly queued thread plan, or nullptr if the /// plan could not be queued. - //------------------------------------------------------------------ virtual lldb::ThreadPlanSP QueueFundamentalPlan(bool abort_other_plans); - //------------------------------------------------------------------ /// Queues the plan used to step one instruction from the current PC of \a /// thread. /// @@ -658,12 +615,10 @@ /// \return /// A shared pointer to the newly queued thread plan, or nullptr if the /// plan could not be queued. - //------------------------------------------------------------------ virtual lldb::ThreadPlanSP QueueThreadPlanForStepSingleInstruction( bool step_over, bool abort_other_plans, bool stop_other_threads, Status &status); - //------------------------------------------------------------------ /// Queues the plan used to step through an address range, stepping over /// function calls. /// @@ -702,7 +657,6 @@ /// \return /// A shared pointer to the newly queued thread plan, or nullptr if the /// plan could not be queued. - //------------------------------------------------------------------ virtual lldb::ThreadPlanSP QueueThreadPlanForStepOverRange( bool abort_other_plans, const AddressRange &range, const SymbolContext &addr_context, lldb::RunMode stop_other_threads, @@ -718,7 +672,6 @@ Status &status, LazyBool step_out_avoids_code_without_debug_info = eLazyBoolCalculate); - //------------------------------------------------------------------ /// Queues the plan used to step through an address range, stepping into /// functions. /// @@ -766,7 +719,6 @@ /// \return /// A shared pointer to the newly queued thread plan, or nullptr if the /// plan could not be queued. - //------------------------------------------------------------------ virtual lldb::ThreadPlanSP QueueThreadPlanForStepInRange( bool abort_other_plans, const AddressRange &range, const SymbolContext &addr_context, const char *step_in_target, @@ -784,7 +736,6 @@ LazyBool step_in_avoids_code_without_debug_info = eLazyBoolCalculate, LazyBool step_out_avoids_code_without_debug_info = eLazyBoolCalculate); - //------------------------------------------------------------------ /// Queue the plan used to step out of the function at the current PC of /// \a thread. /// @@ -823,14 +774,12 @@ /// \return /// A shared pointer to the newly queued thread plan, or nullptr if the /// plan could not be queued. - //------------------------------------------------------------------ virtual lldb::ThreadPlanSP QueueThreadPlanForStepOut( bool abort_other_plans, SymbolContext *addr_context, bool first_insn, bool stop_other_threads, Vote stop_vote, Vote run_vote, uint32_t frame_idx, Status &status, LazyBool step_out_avoids_code_without_debug_info = eLazyBoolCalculate); - //------------------------------------------------------------------ /// Queue the plan used to step out of the function at the current PC of /// a thread. This version does not consult the should stop here callback, /// and should only @@ -887,13 +836,11 @@ /// \return /// A shared pointer to the newly queued thread plan, or nullptr if the /// plan could not be queued. - //------------------------------------------------------------------ virtual lldb::ThreadPlanSP QueueThreadPlanForStepOutNoShouldStop( bool abort_other_plans, SymbolContext *addr_context, bool first_insn, bool stop_other_threads, Vote stop_vote, Vote run_vote, uint32_t frame_idx, Status &status, bool continue_to_next_branch = false); - //------------------------------------------------------------------ /// Gets the plan used to step through the code that steps from a function /// call site at the current PC into the actual function call. /// @@ -916,13 +863,11 @@ /// \return /// A shared pointer to the newly queued thread plan, or nullptr if the /// plan could not be queued. - //------------------------------------------------------------------ virtual lldb::ThreadPlanSP QueueThreadPlanForStepThrough(StackID &return_stack_id, bool abort_other_plans, bool stop_other_threads, Status &status); - //------------------------------------------------------------------ /// Gets the plan used to continue from the current PC. /// This is a simple plan, mostly useful as a backstop when you are continuing /// for some particular purpose. @@ -944,7 +889,6 @@ /// \return /// A shared pointer to the newly queued thread plan, or nullptr if the /// plan could not be queued. - //------------------------------------------------------------------ virtual lldb::ThreadPlanSP QueueThreadPlanForRunToAddress(bool abort_other_plans, Address &target_addr, bool stop_other_threads, Status &status); @@ -957,57 +901,44 @@ QueueThreadPlanForStepScripted(bool abort_other_plans, const char *class_name, bool stop_other_threads, Status &status); - //------------------------------------------------------------------ // Thread Plan accessors: - //------------------------------------------------------------------ - //------------------------------------------------------------------ /// Gets the plan which will execute next on the plan stack. /// /// \return /// A pointer to the next executed plan. - //------------------------------------------------------------------ ThreadPlan *GetCurrentPlan(); - //------------------------------------------------------------------ /// Unwinds the thread stack for the innermost expression plan currently /// on the thread plan stack. /// /// \return /// An error if the thread plan could not be unwound. - //------------------------------------------------------------------ Status UnwindInnermostExpression(); - //------------------------------------------------------------------ /// Gets the outer-most plan that was popped off the plan stack in the /// most recent stop. Useful for printing the stop reason accurately. /// /// \return /// A pointer to the last completed plan. - //------------------------------------------------------------------ lldb::ThreadPlanSP GetCompletedPlan(); - //------------------------------------------------------------------ /// Gets the outer-most return value from the completed plans /// /// \return /// A ValueObjectSP, either empty if there is no return value, /// or containing the return value. - //------------------------------------------------------------------ lldb::ValueObjectSP GetReturnValueObject(); - //------------------------------------------------------------------ /// Gets the outer-most expression variable from the completed plans /// /// \return /// A ExpressionVariableSP, either empty if there is no /// plan completed an expression during the current stop /// or the expression variable that was made for the completed expression. - //------------------------------------------------------------------ lldb::ExpressionVariableSP GetExpressionVariable(); - //------------------------------------------------------------------ /// Checks whether the given plan is in the completed plans for this /// stop. /// @@ -1017,10 +948,8 @@ /// \return /// Returns true if the input plan is in the completed plan stack, /// false otherwise. - //------------------------------------------------------------------ bool IsThreadPlanDone(ThreadPlan *plan); - //------------------------------------------------------------------ /// Checks whether the given plan is in the discarded plans for this /// stop. /// @@ -1030,19 +959,15 @@ /// \return /// Returns true if the input plan is in the discarded plan stack, /// false otherwise. - //------------------------------------------------------------------ bool WasThreadPlanDiscarded(ThreadPlan *plan); - //------------------------------------------------------------------ /// Check if we have completed plan to override breakpoint stop reason /// /// \return /// Returns true if completed plan stack is not empty /// false otherwise. - //------------------------------------------------------------------ bool CompletedPlanOverridesBreakpoint(); - //------------------------------------------------------------------ /// Queues a generic thread plan. /// /// \param[in] plan_sp @@ -1055,30 +980,24 @@ /// /// \return /// A pointer to the last completed plan. - //------------------------------------------------------------------ Status QueueThreadPlan(lldb::ThreadPlanSP &plan_sp, bool abort_other_plans); - //------------------------------------------------------------------ /// Discards the plans queued on the plan stack of the current thread. This /// is /// arbitrated by the "Master" ThreadPlans, using the "OkayToDiscard" call. // But if \a force is true, all thread plans are discarded. - //------------------------------------------------------------------ void DiscardThreadPlans(bool force); - //------------------------------------------------------------------ /// Discards the plans queued on the plan stack of the current thread up to /// and /// including up_to_plan_sp. // // \param[in] up_to_plan_sp // Discard all plans up to and including this one. - //------------------------------------------------------------------ void DiscardThreadPlansUpToPlan(lldb::ThreadPlanSP &up_to_plan_sp); void DiscardThreadPlansUpToPlan(ThreadPlan *up_to_plan_ptr); - //------------------------------------------------------------------ /// Discards the plans queued on the plan stack of the current thread up to /// and /// including the plan in that matches \a thread_index counting only @@ -1091,16 +1010,13 @@ /// \return /// \b true if there was a thread plan with that user index, \b false /// otherwise. - //------------------------------------------------------------------ bool DiscardUserThreadPlansUpToIndex(uint32_t thread_index); - //------------------------------------------------------------------ /// Prints the current plan stack. /// /// \param[in] s /// The stream to which to dump the plan stack info. /// - //------------------------------------------------------------------ void DumpThreadPlans( Stream *s, lldb::DescriptionLevel desc_level = lldb::eDescriptionLevelVerbose, @@ -1118,15 +1034,12 @@ void SetTracer(lldb::ThreadPlanTracerSP &tracer_sp); - //------------------------------------------------------------------ // Get the thread index ID. The index ID that is guaranteed to not be re-used // by a process. They start at 1 and increase with each new thread. This // allows easy command line access by a unique ID that is easier to type than // the actual system thread ID. - //------------------------------------------------------------------ uint32_t GetIndexID() const; - //------------------------------------------------------------------ // Get the originating thread's index ID. // In the case of an "extended" thread -- a thread which represents the stack // that enqueued/spawned work that is currently executing -- we need to @@ -1136,22 +1049,17 @@ // is iterating over extended threads may ask for the OriginatingThreadID to // display that information to the user. // Normal threads will return the same thing as GetIndexID(); - //------------------------------------------------------------------ virtual uint32_t GetExtendedBacktraceOriginatingIndexID() { return GetIndexID(); } - //------------------------------------------------------------------ // The API ID is often the same as the Thread::GetID(), but not in all cases. // Thread::GetID() is the user visible thread ID that clients would want to // see. The API thread ID is the thread ID that is used when sending data // to/from the debugging protocol. - //------------------------------------------------------------------ virtual lldb::user_id_t GetProtocolID() const { return GetID(); } - //------------------------------------------------------------------ // lldb::ExecutionContextScope pure virtual functions - //------------------------------------------------------------------ lldb::TargetSP CalculateTarget() override; lldb::ProcessSP CalculateProcess() override; @@ -1194,7 +1102,6 @@ // with what you might have calculated. virtual lldb::StopInfoSP GetPrivateStopInfo(); - //---------------------------------------------------------------------- // Ask the thread subclass to set its stop info. // // Thread subclasses should call Thread::SetStopInfo(...) with the reason the @@ -1202,10 +1109,8 @@ // // \return // True if Thread::SetStopInfo(...) was called, false otherwise. - //---------------------------------------------------------------------- virtual bool CalculateStopInfo() = 0; - //---------------------------------------------------------------------- // Gets the temporary resume state for a thread. // // This value gets set in each thread by complex debugger logic in @@ -1219,7 +1124,6 @@ // is resumed // eStateSuspended - thread should not execute any instructions when // process is resumed - //---------------------------------------------------------------------- lldb::StateType GetTemporaryResumeState() const { return m_temporary_resume_state; } @@ -1230,17 +1134,14 @@ void SetShouldReportStop(Vote vote); - //---------------------------------------------------------------------- /// Sets the extended backtrace token for this thread /// /// Some Thread subclasses may maintain a token to help with providing /// an extended backtrace. The SystemRuntime plugin will set/request this. /// /// \param [in] token - //---------------------------------------------------------------------- virtual void SetExtendedBacktraceToken(uint64_t token) {} - //---------------------------------------------------------------------- /// Gets the extended backtrace token for this thread /// /// Some Thread subclasses may maintain a token to help with providing @@ -1249,7 +1150,6 @@ /// \return /// The token needed by the SystemRuntime to create an extended backtrace. /// LLDB_INVALID_ADDRESS is returned if no token is available. - //---------------------------------------------------------------------- virtual uint64_t GetExtendedBacktraceToken() { return LLDB_INVALID_ADDRESS; } lldb::ValueObjectSP GetCurrentException(); @@ -1305,9 +1205,7 @@ void FunctionOptimizationWarning(lldb_private::StackFrame *frame); - //------------------------------------------------------------------ // Classes that inherit from Process can see and modify these - //------------------------------------------------------------------ lldb::ProcessWP m_process_wp; ///< The process that owns this thread. lldb::StopInfoSP m_stop_info_sp; ///< The private stop reason for this thread uint32_t m_stop_info_stop_id; // This is the stop id for which the StopInfo is Index: include/lldb/Target/ThreadList.h =================================================================== --- include/lldb/Target/ThreadList.h +++ include/lldb/Target/ThreadList.h @@ -110,7 +110,6 @@ void RefreshStateAfterStop(); - //------------------------------------------------------------------ /// The thread list asks tells all the threads it is about to resume. /// If a thread can "resume" without having to resume the target, it /// will return false for WillResume, and then the process will not be @@ -122,7 +121,6 @@ /// the process will not actually run. The thread must then return /// the correct StopInfo when asked. /// - //------------------------------------------------------------------ bool WillResume(); void DidResume(); @@ -144,9 +142,7 @@ void NotifySelectedThreadChanged(lldb::tid_t tid); - //------------------------------------------------------------------ // Classes that inherit from Process can see and modify these - //------------------------------------------------------------------ Process *m_process; ///< The process that manages this thread list. uint32_t m_stop_id; ///< The process stop ID that this thread list is valid for. Index: include/lldb/Target/ThreadPlan.h =================================================================== --- include/lldb/Target/ThreadPlan.h +++ include/lldb/Target/ThreadPlan.h @@ -22,7 +22,6 @@ namespace lldb_private { -//------------------------------------------------------------------ // ThreadPlan: // This is the pure virtual base class for thread plans. // @@ -328,7 +327,6 @@ // for a plan to instruct a sub-plan // on how to respond to ShouldReportStop. // -//------------------------------------------------------------------ class ThreadPlan : public std::enable_shared_from_this, public UserID { @@ -355,28 +353,22 @@ } ThreadPlanKind; - //------------------------------------------------------------------ // Constructors and Destructors - //------------------------------------------------------------------ ThreadPlan(ThreadPlanKind kind, const char *name, Thread &thread, Vote stop_vote, Vote run_vote); virtual ~ThreadPlan(); - //------------------------------------------------------------------ /// Returns the name of this thread plan. /// /// \return /// A const char * pointer to the thread plan's name. - //------------------------------------------------------------------ const char *GetName() const { return m_name.c_str(); } - //------------------------------------------------------------------ /// Returns the Thread that is using this thread plan. /// /// \return /// A pointer to the thread plan's owning thread. - //------------------------------------------------------------------ Thread &GetThread() { return m_thread; } const Thread &GetThread() const { return m_thread; } @@ -385,7 +377,6 @@ const Target &GetTarget() const { return m_thread.GetProcess()->GetTarget(); } - //------------------------------------------------------------------ /// Print a description of this thread to the stream \a s. /// \a thread. /// @@ -395,10 +386,8 @@ /// \param[in] level /// The level of description desired. Note that eDescriptionLevelBrief /// will be used in the stop message printed when the plan is complete. - //------------------------------------------------------------------ virtual void GetDescription(Stream *s, lldb::DescriptionLevel level) = 0; - //------------------------------------------------------------------ /// Returns whether this plan could be successfully created. /// /// \param[in] error @@ -408,7 +397,6 @@ /// /// \return /// \b true if the plan should be queued, \b false otherwise. - //------------------------------------------------------------------ virtual bool ValidatePlan(Stream *error) = 0; bool TracerExplainsStop() { @@ -556,9 +544,7 @@ } protected: - //------------------------------------------------------------------ // Classes that inherit from ThreadPlan can see and modify these - //------------------------------------------------------------------ virtual bool DoWillResume(lldb::StateType resume_state, bool current_plan) { return true; @@ -604,9 +590,7 @@ int32_t m_iteration_count = 1; private: - //------------------------------------------------------------------ // For ThreadPlan only - //------------------------------------------------------------------ static lldb::user_id_t GetNextID(); ThreadPlanKind m_kind; @@ -625,13 +609,11 @@ DISALLOW_COPY_AND_ASSIGN(ThreadPlan); }; -//---------------------------------------------------------------------- // ThreadPlanNull: // Threads are assumed to always have at least one plan on the plan stack. This // is put on the plan stack when a thread is destroyed so that if you // accidentally access a thread after it is destroyed you won't crash. But // asking questions of the ThreadPlanNull is definitely an error. -//---------------------------------------------------------------------- class ThreadPlanNull : public ThreadPlan { public: Index: include/lldb/Target/ThreadPlanBase.h =================================================================== --- include/lldb/Target/ThreadPlanBase.h +++ include/lldb/Target/ThreadPlanBase.h @@ -15,12 +15,10 @@ namespace lldb_private { -//------------------------------------------------------------------ // Base thread plans: // This is the generic version of the bottom most plan on the plan stack. It // should // be able to handle generic breakpoint hitting, and signals and exceptions. -//------------------------------------------------------------------ class ThreadPlanBase : public ThreadPlan { friend class Process; // RunThreadPlan manages "stopper" base plans. Index: include/lldb/Target/ThreadPlanCallOnFunctionExit.h =================================================================== --- include/lldb/Target/ThreadPlanCallOnFunctionExit.h +++ include/lldb/Target/ThreadPlanCallOnFunctionExit.h @@ -29,9 +29,7 @@ void DidPush() override; - // ------------------------------------------------------------------------- // ThreadPlan API - // ------------------------------------------------------------------------- void GetDescription(Stream *s, lldb::DescriptionLevel level) override; Index: include/lldb/Target/ThreadPlanPython.h =================================================================== --- include/lldb/Target/ThreadPlanPython.h +++ include/lldb/Target/ThreadPlanPython.h @@ -24,10 +24,8 @@ namespace lldb_private { -//------------------------------------------------------------------ // ThreadPlanPython: // -//------------------------------------------------------------------ class ThreadPlanPython : public ThreadPlan { public: Index: include/lldb/Target/ThreadPlanShouldStopHere.h =================================================================== --- include/lldb/Target/ThreadPlanShouldStopHere.h +++ include/lldb/Target/ThreadPlanShouldStopHere.h @@ -62,9 +62,7 @@ eStepOutAvoidNoDebug = (1 << 2) }; - //------------------------------------------------------------------ // Constructors and Destructors - //------------------------------------------------------------------ ThreadPlanShouldStopHere(ThreadPlan *owner); ThreadPlanShouldStopHere(ThreadPlan *owner, Index: include/lldb/Target/UnixSignals.h =================================================================== --- include/lldb/Target/UnixSignals.h +++ include/lldb/Target/UnixSignals.h @@ -24,9 +24,7 @@ static lldb::UnixSignalsSP Create(const ArchSpec &arch); static lldb::UnixSignalsSP CreateForHost(); - //------------------------------------------------------------------ // Constructors and Destructors - //------------------------------------------------------------------ UnixSignals(); virtual ~UnixSignals(); @@ -95,9 +93,7 @@ llvm::Optional should_notify); protected: - //------------------------------------------------------------------ // Classes that inherit from UnixSignals can see and modify these - //------------------------------------------------------------------ struct Signal { ConstString m_name; Index: include/lldb/Target/Unwind.h =================================================================== --- include/lldb/Target/Unwind.h +++ include/lldb/Target/Unwind.h @@ -17,9 +17,7 @@ class Unwind { protected: - //------------------------------------------------------------------ // Classes that inherit from Unwind can see and modify these - //------------------------------------------------------------------ Unwind(Thread &thread) : m_thread(thread), m_unwind_mutex() {} public: @@ -62,9 +60,7 @@ Thread &GetThread() { return m_thread; } protected: - //------------------------------------------------------------------ // Classes that inherit from Unwind can see and modify these - //------------------------------------------------------------------ virtual void DoClear() = 0; virtual uint32_t DoGetFrameCount() = 0; Index: include/lldb/Utility/ArchSpec.h =================================================================== --- include/lldb/Utility/ArchSpec.h +++ include/lldb/Utility/ArchSpec.h @@ -22,7 +22,6 @@ namespace lldb_private { -//---------------------------------------------------------------------- /// \class ArchSpec ArchSpec.h "lldb/Utility/ArchSpec.h" An architecture /// specification class. /// @@ -30,7 +29,6 @@ /// string representation, or an llvm::Triple. Keeping all of the conversions /// of strings to architecture enumeration values confined to this class /// allows new architecture support to be added easily. -//---------------------------------------------------------------------- class ArchSpec { public: enum MIPSSubType { @@ -235,131 +233,99 @@ }; - //------------------------------------------------------------------ /// Default constructor. /// /// Default constructor that initializes the object with invalid cpu type /// and subtype values. - //------------------------------------------------------------------ ArchSpec(); - //------------------------------------------------------------------ /// Constructor over triple. /// /// Constructs an ArchSpec with properties consistent with the given Triple. - //------------------------------------------------------------------ explicit ArchSpec(const llvm::Triple &triple); explicit ArchSpec(const char *triple_cstr); explicit ArchSpec(llvm::StringRef triple_str); - //------------------------------------------------------------------ /// Constructor over architecture name. /// /// Constructs an ArchSpec with properties consistent with the given object /// type and architecture name. - //------------------------------------------------------------------ explicit ArchSpec(ArchitectureType arch_type, uint32_t cpu_type, uint32_t cpu_subtype); - //------------------------------------------------------------------ /// Destructor. - //------------------------------------------------------------------ ~ArchSpec(); - //------------------------------------------------------------------ /// Assignment operator. /// /// \param[in] rhs another ArchSpec object to copy. /// /// \return A const reference to this object. - //------------------------------------------------------------------ const ArchSpec &operator=(const ArchSpec &rhs); - //--------------------------------------------------------------------------- /// Returns true if the OS, vendor and environment fields of the triple are /// unset. The triple is expected to be normalized /// (llvm::Triple::normalize). - //--------------------------------------------------------------------------- static bool ContainsOnlyArch(const llvm::Triple &normalized_triple); static void ListSupportedArchNames(StringList &list); static size_t AutoComplete(CompletionRequest &request); - //------------------------------------------------------------------ /// Returns a static string representing the current architecture. /// /// \return A static string corresponding to the current /// architecture. - //------------------------------------------------------------------ const char *GetArchitectureName() const; - //----------------------------------------------------------------- /// if MIPS architecture return true. /// /// \return a boolean value. - //----------------------------------------------------------------- bool IsMIPS() const; - //------------------------------------------------------------------ /// Returns a string representing current architecture as a target CPU for /// tools like compiler, disassembler etc. /// /// \return A string representing target CPU for the current /// architecture. - //------------------------------------------------------------------ std::string GetClangTargetCPU() const; - //------------------------------------------------------------------ /// Return a string representing target application ABI. /// /// \return A string representing target application ABI. - //------------------------------------------------------------------ std::string GetTargetABI() const; - //------------------------------------------------------------------ /// Clears the object state. /// /// Clears the object state back to a default invalid state. - //------------------------------------------------------------------ void Clear(); - //------------------------------------------------------------------ /// Returns the size in bytes of an address of the current architecture. /// /// \return The byte size of an address of the current architecture. - //------------------------------------------------------------------ uint32_t GetAddressByteSize() const; - //------------------------------------------------------------------ /// Returns a machine family for the current architecture. /// /// \return An LLVM arch type. - //------------------------------------------------------------------ llvm::Triple::ArchType GetMachine() const; - //------------------------------------------------------------------ /// Returns the distribution id of the architecture. /// /// This will be something like "ubuntu", "fedora", etc. on Linux. /// /// \return A ConstString ref containing the distribution id, /// potentially empty. - //------------------------------------------------------------------ ConstString GetDistributionId() const; - //------------------------------------------------------------------ /// Set the distribution id of the architecture. /// /// This will be something like "ubuntu", "fedora", etc. on Linux. This /// should be the same value returned by HostInfo::GetDistributionId (). - ///------------------------------------------------------------------ void SetDistributionId(const char *distribution_id); - //------------------------------------------------------------------ /// Tests if this ArchSpec is valid. /// /// \return True if the current architecture is valid, false /// otherwise. - //------------------------------------------------------------------ bool IsValid() const { return m_core >= eCore_arm_generic && m_core < kNumCores; } @@ -375,7 +341,6 @@ return m_triple.hasEnvironment(); } - //------------------------------------------------------------------ /// Merges fields from another ArchSpec into this ArchSpec. /// /// This will use the supplied ArchSpec to fill in any fields of the triple @@ -385,10 +350,8 @@ /// have a triple which is x64-pc-windows-msvc, then merging that triple /// into this one will result in the triple i386-pc-windows-msvc. /// - //------------------------------------------------------------------ void MergeFrom(const ArchSpec &other); - //------------------------------------------------------------------ /// Change the architecture object type, CPU type and OS type. /// /// \param[in] arch_type The object type of this ArchSpec. @@ -423,26 +386,21 @@ /// *-*-netbsd /// *-*-openbsd /// *-*-solaris - //------------------------------------------------------------------ bool SetArchitecture(ArchitectureType arch_type, uint32_t cpu, uint32_t sub, uint32_t os = 0); - //------------------------------------------------------------------ /// Returns the byte order for the architecture specification. /// /// \return The endian enumeration for the current endianness of /// the architecture specification - //------------------------------------------------------------------ lldb::ByteOrder GetByteOrder() const; - //------------------------------------------------------------------ /// Sets this ArchSpec's byte order. /// /// In the common case there is no need to call this method as the byte /// order can almost always be determined by the architecture. However, many /// CPU's are bi-endian (ARM, Alpha, PowerPC, etc) and the default/assumed /// byte order may be incorrect. - //------------------------------------------------------------------ void SetByteOrder(lldb::ByteOrder byte_order) { m_byte_order = byte_order; } uint32_t GetMinimumOpcodeByteSize() const; @@ -455,39 +413,30 @@ uint32_t GetMachOCPUSubType() const; - //------------------------------------------------------------------ /// 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() const; - //------------------------------------------------------------------ /// 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() const; - //------------------------------------------------------------------ /// Architecture triple accessor. /// /// \return A triple describing this ArchSpec. - //------------------------------------------------------------------ llvm::Triple &GetTriple() { return m_triple; } - //------------------------------------------------------------------ /// Architecture triple accessor. /// /// \return A triple describing this ArchSpec. - //------------------------------------------------------------------ const llvm::Triple &GetTriple() const { return m_triple; } void DumpTriple(Stream &s) const; - //------------------------------------------------------------------ /// Architecture triple setter. /// /// Configures this ArchSpec according to the given triple. If the triple @@ -498,44 +447,35 @@ /// etc. /// /// \return A triple describing this ArchSpec. - //------------------------------------------------------------------ bool SetTriple(const llvm::Triple &triple); bool SetTriple(llvm::StringRef triple_str); - //------------------------------------------------------------------ /// Returns the default endianness of the architecture. /// /// \return The endian enumeration for the default endianness of /// the architecture. - //------------------------------------------------------------------ lldb::ByteOrder GetDefaultEndian() const; - //------------------------------------------------------------------ /// Returns true if 'char' is a signed type by default in the architecture /// false otherwise /// /// \return True if 'char' is a signed type by default on the /// architecture and false otherwise. - //------------------------------------------------------------------ bool CharIsSignedByDefault() const; - //------------------------------------------------------------------ /// Compare an ArchSpec to another ArchSpec, requiring an exact cpu type /// match between them. e.g. armv7s is not an exact match with armv7 - this /// would return false /// /// \return true if the two ArchSpecs match. - //------------------------------------------------------------------ bool IsExactMatch(const ArchSpec &rhs) const; - //------------------------------------------------------------------ /// Compare an ArchSpec to another ArchSpec, requiring a compatible cpu type /// match between them. e.g. armv7s is compatible with armv7 - this method /// would return true /// /// \return true if the two ArchSpecs are compatible - //------------------------------------------------------------------ bool IsCompatibleMatch(const ArchSpec &rhs) const; bool IsFullySpecifiedTriple() const; @@ -545,7 +485,6 @@ bool &os_version_different, bool &env_different) const; - //------------------------------------------------------------------ /// Detect whether this architecture uses thumb code exclusively /// /// Some embedded ARM chips (e.g. the ARM Cortex M0-7 line) can only execute @@ -557,7 +496,6 @@ /// /// \return true if this is an arm ArchSpec which can only execute Thumb /// instructions - //------------------------------------------------------------------ bool IsAlwaysThumbInstructions() const; uint32_t GetFlags() const { return m_flags; } @@ -585,7 +523,6 @@ void CoreUpdated(bool update_triple); }; -//------------------------------------------------------------------ /// \fn bool operator< (const ArchSpec& lhs, const ArchSpec& rhs) Less than /// operator. /// @@ -595,7 +532,6 @@ /// rhs The Left Hand Side ArchSpec object to compare. /// /// \return true if \a lhs is less than \a rhs -//------------------------------------------------------------------ bool operator<(const ArchSpec &lhs, const ArchSpec &rhs); bool operator==(const ArchSpec &lhs, const ArchSpec &rhs); Index: include/lldb/Utility/Args.h =================================================================== --- include/lldb/Utility/Args.h +++ include/lldb/Utility/Args.h @@ -20,7 +20,6 @@ namespace lldb_private { -//---------------------------------------------------------------------- /// \class Args Args.h "lldb/Utility/Args.h" /// A command line argument class. /// @@ -30,7 +29,6 @@ /// quotes) surrounding the argument. Spaces can be escaped using a \ /// character to avoid having to surround an argument that contains a space /// with quotes. -//---------------------------------------------------------------------- class Args { public: struct ArgEntry { @@ -48,13 +46,10 @@ char quote; const char *c_str() const { return ptr.get(); } - //------------------------------------------------------------------ /// Returns true if this argument was quoted in any way. - //------------------------------------------------------------------ bool IsQuoted() const { return quote != '\0'; } }; - //------------------------------------------------------------------ /// Construct with an option command string. /// /// \param[in] command @@ -62,7 +57,6 @@ /// into arguments. /// /// \see Args::SetCommandString(llvm::StringRef) - //------------------------------------------------------------------ Args(llvm::StringRef command = llvm::StringRef()); Args(const Args &rhs); @@ -70,9 +64,7 @@ Args &operator=(const Args &rhs); - //------------------------------------------------------------------ /// Destructor. - //------------------------------------------------------------------ ~Args(); explicit Args(const Environment &env) : Args() { @@ -81,7 +73,6 @@ explicit operator Environment() const { return GetConstArgumentVector(); } - //------------------------------------------------------------------ /// Dump all entries to the stream \a s using label \a label_name. /// /// If label_name is nullptr, the dump operation is skipped. @@ -93,10 +84,8 @@ /// The label_name to use as the label printed for each /// entry of the args like so: /// {label_name}[{index}]={value} - //------------------------------------------------------------------ void Dump(Stream &s, const char *label_name = "argv") const; - //------------------------------------------------------------------ /// Sets the command string contained by this object. /// /// The command string will be copied and split up into arguments that can @@ -110,30 +99,25 @@ /// \see Args::GetArgumentAtIndex (size_t) const @see /// Args::GetArgumentVector () \see Args::Shift () \see Args::Unshift (const /// char *) - //------------------------------------------------------------------ void SetCommandString(llvm::StringRef command); bool GetCommandString(std::string &command) const; bool GetQuotedCommandString(std::string &command) const; - //------------------------------------------------------------------ /// Gets the number of arguments left in this command object. /// /// \return /// The number or arguments in this object. - //------------------------------------------------------------------ size_t GetArgumentCount() const; bool empty() const { return GetArgumentCount() == 0; } - //------------------------------------------------------------------ /// Gets the NULL terminated C string argument pointer for the argument at /// index \a idx. /// /// \return /// The NULL terminated C string argument pointer if \a idx is a /// valid argument index, NULL otherwise. - //------------------------------------------------------------------ const char *GetArgumentAtIndex(size_t idx) const; llvm::ArrayRef entries() const { return m_entries; } @@ -147,7 +131,6 @@ size_t size() const { return GetArgumentCount(); } const ArgEntry &operator[](size_t n) const { return m_entries[n]; } - //------------------------------------------------------------------ /// Gets the argument vector. /// /// The value returned by this function can be used by any function that @@ -160,10 +143,8 @@ /// \return /// An array of NULL terminated C string argument pointers that /// also has a terminating NULL C string pointer - //------------------------------------------------------------------ char **GetArgumentVector(); - //------------------------------------------------------------------ /// Gets the argument vector. /// /// The value returned by this function can be used by any function that @@ -176,19 +157,15 @@ /// \return /// An array of NULL terminate C string argument pointers that /// also has a terminating NULL C string pointer - //------------------------------------------------------------------ const char **GetConstArgumentVector() const; - //------------------------------------------------------------------ /// Gets the argument as an ArrayRef. Note that the return value does *not* /// have a nullptr const char * at the end, as the size of the list is /// embedded in the ArrayRef object. - //------------------------------------------------------------------ llvm::ArrayRef GetArgumentArrayRef() const { return llvm::makeArrayRef(m_argv).drop_back(); } - //------------------------------------------------------------------ /// Appends a new argument to the end of the list argument list. /// /// \param[in] arg_cstr @@ -196,14 +173,12 @@ /// /// \param[in] quote_char /// If the argument was originally quoted, put in the quote char here. - //------------------------------------------------------------------ void AppendArgument(llvm::StringRef arg_str, char quote_char = '\0'); void AppendArguments(const Args &rhs); void AppendArguments(const char **argv); - //------------------------------------------------------------------ /// Insert the argument value at index \a idx to \a arg_cstr. /// /// \param[in] idx @@ -217,11 +192,9 @@ /// /// \return /// The NULL terminated C string of the copy of \a arg_cstr. - //------------------------------------------------------------------ void InsertArgumentAtIndex(size_t idx, llvm::StringRef arg_str, char quote_char = '\0'); - //------------------------------------------------------------------ /// Replaces the argument value at index \a idx to \a arg_cstr if \a idx is /// a valid argument index. /// @@ -233,21 +206,17 @@ /// /// \param[in] quote_char /// If the argument was originally quoted, put in the quote char here. - //------------------------------------------------------------------ void ReplaceArgumentAtIndex(size_t idx, llvm::StringRef arg_str, char quote_char = '\0'); - //------------------------------------------------------------------ /// Deletes the argument value at index /// if \a idx is a valid argument index. /// /// \param[in] idx /// The index of the argument that will have its value replaced. /// - //------------------------------------------------------------------ void DeleteArgumentAtIndex(size_t idx); - //------------------------------------------------------------------ /// Sets the argument vector value, optionally copying all arguments into an /// internal buffer. /// @@ -255,12 +224,10 @@ /// will be copied into an internal buffers. // // FIXME: Handle the quote character somehow. - //------------------------------------------------------------------ void SetArguments(size_t argc, const char **argv); void SetArguments(const char **argv); - //------------------------------------------------------------------ /// Shifts the first argument C string value of the array off the argument /// array. /// @@ -269,10 +236,8 @@ /// returned value before calling Args::Shift(). /// /// \see Args::GetArgumentAtIndex (size_t) const - //------------------------------------------------------------------ void Shift(); - //------------------------------------------------------------------ /// Inserts a class owned copy of \a arg_cstr at the beginning of the /// argument vector. /// @@ -283,14 +248,11 @@ /// /// \param[in] quote_char /// If the argument was originally quoted, put in the quote char here. - //------------------------------------------------------------------ void Unshift(llvm::StringRef arg_str, char quote_char = '\0'); - //------------------------------------------------------------------ // Clear the arguments. // // For re-setting or blanking out the list of arguments. - //------------------------------------------------------------------ void Clear(); static const char *StripSpaces(std::string &s, bool leading = true, @@ -357,7 +319,6 @@ std::vector m_argv; }; -//---------------------------------------------------------------------- /// \class OptionsWithRaw Args.h "lldb/Utility/Args.h" /// A pair of an option list with a 'raw' string as a suffix. /// @@ -377,70 +338,55 @@ /// string without any options. /// /// \see Args -//---------------------------------------------------------------------- class OptionsWithRaw { public: - //------------------------------------------------------------------ /// Parse the given string as a list of optional arguments with a raw suffix. /// /// See the class description for a description of the input format. /// /// \param[in] argument_string /// The string that should be parsed. - //------------------------------------------------------------------ explicit OptionsWithRaw(llvm::StringRef argument_string); - //------------------------------------------------------------------ /// Returns true if there are any arguments before the raw suffix. - //------------------------------------------------------------------ bool HasArgs() const { return m_has_args; } - //------------------------------------------------------------------ /// Returns the list of arguments. /// /// You can only call this method if HasArgs returns true. - //------------------------------------------------------------------ Args &GetArgs() { assert(m_has_args); return m_args; } - //------------------------------------------------------------------ /// Returns the list of arguments. /// /// You can only call this method if HasArgs returns true. - //------------------------------------------------------------------ const Args &GetArgs() const { assert(m_has_args); return m_args; } - //------------------------------------------------------------------ /// Returns the part of the input string that was used for parsing the /// argument list. This string also includes the double dash that is used /// for separating the argument list from the suffix. /// /// You can only call this method if HasArgs returns true. - //------------------------------------------------------------------ llvm::StringRef GetArgStringWithDelimiter() const { assert(m_has_args); return m_arg_string_with_delimiter; } - //------------------------------------------------------------------ /// Returns the part of the input string that was used for parsing the /// argument list. /// /// You can only call this method if HasArgs returns true. - //------------------------------------------------------------------ llvm::StringRef GetArgString() const { assert(m_has_args); return m_arg_string; } - //------------------------------------------------------------------ /// Returns the raw suffix part of the parsed string. - //------------------------------------------------------------------ const std::string &GetRawPart() const { return m_suffix; } private: Index: include/lldb/Utility/Baton.h =================================================================== --- include/lldb/Utility/Baton.h +++ include/lldb/Utility/Baton.h @@ -20,7 +20,6 @@ namespace lldb_private { -//---------------------------------------------------------------------- /// \class Baton Baton.h "lldb/Core/Baton.h" /// A class designed to wrap callback batons so they can cleanup /// any acquired resources @@ -31,7 +30,6 @@ /// /// The default behavior is to not free anything. Subclasses can free any /// needed resources in their destructors. -//---------------------------------------------------------------------- class Baton { public: Baton() {} Index: include/lldb/Utility/Broadcaster.h =================================================================== --- include/lldb/Utility/Broadcaster.h +++ include/lldb/Utility/Broadcaster.h @@ -39,12 +39,10 @@ namespace lldb_private { -//---------------------------------------------------------------------- // lldb::BroadcastEventSpec // // This class is used to specify a kind of event to register for. The Debugger // maintains a list of BroadcastEventSpec's and when it is made -//---------------------------------------------------------------------- class BroadcastEventSpec { public: BroadcastEventSpec(ConstString broadcaster_class, uint32_t event_bits) @@ -221,7 +219,6 @@ }; }; -//---------------------------------------------------------------------- /// \class Broadcaster Broadcaster.h "lldb/Utility/Broadcaster.h" An event /// broadcasting class. /// @@ -241,9 +238,7 @@ /// class Foo : public Broadcaster /// { /// public: -/// //---------------------------------------------------------- /// // Broadcaster event bits definitions. -/// //---------------------------------------------------------- /// enum /// { /// eBroadcastBitOne = (1 << 0), @@ -252,31 +247,25 @@ /// ... /// }; /// \endcode -//---------------------------------------------------------------------- class Broadcaster { friend class Listener; friend class Event; public: - //------------------------------------------------------------------ /// Construct with a broadcaster with a name. /// /// \param[in] name /// A NULL terminated C string that contains the name of the /// broadcaster object. - //------------------------------------------------------------------ Broadcaster(lldb::BroadcasterManagerSP manager_sp, const char *name); - //------------------------------------------------------------------ /// Destructor. /// /// The destructor is virtual since this class gets subclassed. - //------------------------------------------------------------------ virtual ~Broadcaster(); void CheckInWithManager(); - //------------------------------------------------------------------ /// Broadcast an event which has no associated data. /// /// \param[in] event_type @@ -291,7 +280,6 @@ /// If true, then only add an event of this type if there isn't /// one already in the queue. /// - //------------------------------------------------------------------ void BroadcastEvent(lldb::EventSP &event_sp) { m_broadcaster_sp->BroadcastEvent(event_sp); } @@ -319,7 +307,6 @@ virtual void AddInitialEventsToListener(const lldb::ListenerSP &listener_sp, uint32_t requested_events); - //------------------------------------------------------------------ /// Listen for any events specified by \a event_mask. /// /// Only one listener can listen to each event bit in a given Broadcaster. @@ -339,21 +326,17 @@ /// /// \return /// The actual event bits that were acquired by \a listener. - //------------------------------------------------------------------ uint32_t AddListener(const lldb::ListenerSP &listener_sp, uint32_t event_mask) { return m_broadcaster_sp->AddListener(listener_sp, event_mask); } - //------------------------------------------------------------------ /// Get the NULL terminated C string name of this Broadcaster object. /// /// \return /// The NULL terminated C string name of this Broadcaster. - //------------------------------------------------------------------ ConstString GetBroadcasterName() { return m_broadcaster_name; } - //------------------------------------------------------------------ /// Get the event name(s) for one or more event bits. /// /// \param[in] event_mask @@ -361,14 +344,12 @@ /// /// \return /// The NULL terminated C string name of this Broadcaster. - //------------------------------------------------------------------ bool GetEventNames(Stream &s, const uint32_t event_mask, bool prefix_with_broadcaster_name) const { return m_broadcaster_sp->GetEventNames(s, event_mask, prefix_with_broadcaster_name); } - //------------------------------------------------------------------ /// Set the name for an event bit. /// /// \param[in] event_mask @@ -377,7 +358,6 @@ /// /// \return /// The NULL terminated C string name of this Broadcaster. - //------------------------------------------------------------------ void SetEventName(uint32_t event_mask, const char *name) { m_broadcaster_sp->SetEventName(event_mask, name); } @@ -390,7 +370,6 @@ return m_broadcaster_sp->EventTypeHasListeners(event_type); } - //------------------------------------------------------------------ /// Removes a Listener from this broadcasters list and frees the event bits /// specified by \a event_mask that were previously acquired by \a listener /// (assuming \a listener was listening to this object) for other listener @@ -407,13 +386,11 @@ /// and was removed, \b false otherwise. /// /// \see uint32_t Broadcaster::AddListener (Listener*, uint32_t) - //------------------------------------------------------------------ bool RemoveListener(const lldb::ListenerSP &listener_sp, uint32_t event_mask = UINT32_MAX) { return m_broadcaster_sp->RemoveListener(listener_sp, event_mask); } - //------------------------------------------------------------------ /// Provides a simple mechanism to temporarily redirect events from /// broadcaster. When you call this function passing in a listener and /// event type mask, all events from the broadcaster matching the mask will @@ -432,7 +409,6 @@ /// \b True if the event mask could be hijacked, \b false otherwise. /// /// \see uint32_t Broadcaster::AddListener (Listener*, uint32_t) - //------------------------------------------------------------------ bool HijackBroadcaster(const lldb::ListenerSP &listener_sp, uint32_t event_mask = UINT32_MAX) { return m_broadcaster_sp->HijackBroadcaster(listener_sp, event_mask); @@ -442,10 +418,8 @@ return m_broadcaster_sp->IsHijackedForEvent(event_mask); } - //------------------------------------------------------------------ /// Restore the state of the Broadcaster from a previous hijack attempt. /// - //------------------------------------------------------------------ void RestoreBroadcaster() { m_broadcaster_sp->RestoreBroadcaster(); } // This needs to be filled in if you are going to register the broadcaster @@ -537,9 +511,7 @@ const char *GetHijackingListenerName(); - //------------------------------------------------------------------ // - //------------------------------------------------------------------ typedef llvm::SmallVector, 4> collection; typedef std::map event_names_map; @@ -562,9 +534,7 @@ // collections, but for now this is just for private hijacking. private: - //------------------------------------------------------------------ // For Broadcaster only - //------------------------------------------------------------------ DISALLOW_COPY_AND_ASSIGN(BroadcasterImpl); }; @@ -576,14 +546,10 @@ const char *GetHijackingListenerName() { return m_broadcaster_sp->GetHijackingListenerName(); } - //------------------------------------------------------------------ // Classes that inherit from Broadcaster can see and modify these - //------------------------------------------------------------------ private: - //------------------------------------------------------------------ // For Broadcaster only - //------------------------------------------------------------------ BroadcasterImplSP m_broadcaster_sp; lldb::BroadcasterManagerSP m_manager_sp; const ConstString Index: include/lldb/Utility/CompletionRequest.h =================================================================== --- include/lldb/Utility/CompletionRequest.h +++ include/lldb/Utility/CompletionRequest.h @@ -17,9 +17,7 @@ namespace lldb_private { class CompletionResult { - //---------------------------------------------------------- /// A single completion and all associated data. - //---------------------------------------------------------- struct Completion { Completion(llvm::StringRef completion, llvm::StringRef description) : m_completion(completion.str()), m_descripton(description.str()) {} @@ -38,24 +36,19 @@ public: void AddResult(llvm::StringRef completion, llvm::StringRef description); - //---------------------------------------------------------- /// Adds all collected completion matches to the given list. /// The list will be cleared before the results are added. The number of /// results here is guaranteed to be equal to GetNumberOfResults(). - //---------------------------------------------------------- void GetMatches(StringList &matches) const; - //---------------------------------------------------------- /// Adds all collected completion descriptions to the given list. /// The list will be cleared before the results are added. The number of /// results here is guaranteed to be equal to GetNumberOfResults(). - //---------------------------------------------------------- void GetDescriptions(StringList &descriptions) const; std::size_t GetNumberOfResults() const { return m_results.size(); } }; -//---------------------------------------------------------------------- /// \class CompletionRequest CompletionRequest.h /// "lldb/Utility/ArgCompletionRequest.h" /// @@ -63,10 +56,8 @@ /// for the user. Will be filled with the generated completions by the different /// completions functions. /// -//---------------------------------------------------------------------- class CompletionRequest { public: - //---------------------------------------------------------- /// Constructs a completion request. /// /// \param [in] command_line @@ -87,7 +78,6 @@ /// \param [out] result /// The CompletionResult that will be filled with the results after this /// request has been handled. - //---------------------------------------------------------- CompletionRequest(llvm::StringRef command_line, unsigned raw_cursor_pos, int match_start_point, int max_return_elements, CompletionResult &result); Index: include/lldb/Utility/Connection.h =================================================================== --- include/lldb/Utility/Connection.h +++ include/lldb/Utility/Connection.h @@ -29,7 +29,6 @@ namespace lldb_private { -//---------------------------------------------------------------------- /// \class Connection Connection.h "lldb/Utility/Connection.h" /// A communication connection class. /// @@ -41,21 +40,15 @@ /// Instances can be instantiated and given to a Communication class to /// perform communications where clients can listen for broadcasts, and /// perform other higher level communications. -//---------------------------------------------------------------------- class Connection { public: - //------------------------------------------------------------------ /// Default constructor - //------------------------------------------------------------------ Connection() = default; - //------------------------------------------------------------------ /// Virtual destructor since this class gets subclassed and handed to a /// Communication object. - //------------------------------------------------------------------ virtual ~Connection(); - //------------------------------------------------------------------ /// Connect using the connect string \a url. /// /// \param[in] url @@ -73,11 +66,9 @@ /// appropriate value based on the result of this function. /// /// \see Status& Communication::GetError (); - //------------------------------------------------------------------ virtual lldb::ConnectionStatus Connect(llvm::StringRef url, Status *error_ptr) = 0; - //------------------------------------------------------------------ /// Disconnect the communications connection if one is currently connected. /// /// \param[out] error_ptr @@ -91,19 +82,15 @@ /// appropriate value based on the result of this function. /// /// \see Status& Communication::GetError (); - //------------------------------------------------------------------ virtual lldb::ConnectionStatus Disconnect(Status *error_ptr) = 0; - //------------------------------------------------------------------ /// Check if the connection is valid. /// /// \return /// \b True if this object is currently connected, \b false /// otherwise. - //------------------------------------------------------------------ virtual bool IsConnected() const = 0; - //------------------------------------------------------------------ /// The read function that attempts to read from the connection. /// /// \param[in] dst @@ -130,12 +117,10 @@ /// The number of bytes actually read. /// /// \see size_t Communication::Read (void *, size_t, uint32_t); - //------------------------------------------------------------------ virtual size_t Read(void *dst, size_t dst_len, const Timeout &timeout, lldb::ConnectionStatus &status, Status *error_ptr) = 0; - //------------------------------------------------------------------ /// The actual write function that attempts to write to the communications /// protocol. /// @@ -156,21 +141,17 @@ /// /// \return /// The number of bytes actually Written. - //------------------------------------------------------------------ virtual size_t Write(const void *dst, size_t dst_len, lldb::ConnectionStatus &status, Status *error_ptr) = 0; - //------------------------------------------------------------------ /// Returns a URI that describes this connection object /// /// Subclasses may override this function. /// /// \return /// Returns URI or an empty string if disconnecteds - //------------------------------------------------------------------ virtual std::string GetURI() = 0; - //------------------------------------------------------------------ /// Interrupts an ongoing Read() operation. /// /// If there is an ongoing read operation in another thread, this operation @@ -182,10 +163,8 @@ /// /// \return /// Returns true is the interrupt request was successful. - //------------------------------------------------------------------ virtual bool InterruptRead() = 0; - //------------------------------------------------------------------ /// Returns the underlying IOObject used by the Connection. /// /// The IOObject can be used to wait for data to become available on the @@ -194,13 +173,10 @@ /// /// \return /// The underlying IOObject used for reading. - //------------------------------------------------------------------ virtual lldb::IOObjectSP GetReadObject() { return lldb::IOObjectSP(); } private: - //------------------------------------------------------------------ // For Connection only - //------------------------------------------------------------------ DISALLOW_COPY_AND_ASSIGN(Connection); }; Index: include/lldb/Utility/ConstString.h =================================================================== --- include/lldb/Utility/ConstString.h +++ include/lldb/Utility/ConstString.h @@ -23,7 +23,6 @@ namespace lldb_private { -//---------------------------------------------------------------------- /// \class ConstString ConstString.h "lldb/Utility/ConstString.h" /// A uniqued constant string class. /// @@ -36,29 +35,23 @@ /// No reference counting is done on strings that are added to the string /// pool, once strings are added they are in the string pool for the life of /// the program. -//---------------------------------------------------------------------- class ConstString { public: - //------------------------------------------------------------------ /// Default constructor /// /// Initializes the string to an empty string. - //------------------------------------------------------------------ ConstString() : m_string(nullptr) {} - //------------------------------------------------------------------ /// Copy constructor /// /// Copies the string value in \a rhs into this object. /// /// \param[in] rhs /// Another string object to copy. - //------------------------------------------------------------------ ConstString(const ConstString &rhs) : m_string(rhs.m_string) {} explicit ConstString(const llvm::StringRef &s); - //------------------------------------------------------------------ /// Construct with C String value /// /// Constructs this object with a C string by looking to see if the @@ -67,10 +60,8 @@ /// /// \param[in] cstr /// A NULL terminated C string to add to the string pool. - //------------------------------------------------------------------ explicit ConstString(const char *cstr); - //------------------------------------------------------------------ /// Construct with C String value with max length /// /// Constructs this object with a C string with a length. If \a max_cstr_len @@ -91,23 +82,17 @@ /// truncated. If the string length of \a cstr is greater than /// \a max_cstr_len, then only max_cstr_len bytes will be used /// from \a cstr. - //------------------------------------------------------------------ explicit ConstString(const char *cstr, size_t max_cstr_len); - //------------------------------------------------------------------ /// Destructor /// /// Since constant string values are currently not reference counted, there /// isn't much to do here. - //------------------------------------------------------------------ ~ConstString() = default; - //---------------------------------------------------------------------- /// C string equality binary predicate function object for ConstString /// objects. - //---------------------------------------------------------------------- struct StringIsEqual { - //-------------------------------------------------------------- /// C equality test. /// /// Two C strings are equal when they are contained in ConstString objects @@ -116,13 +101,11 @@ /// \return /// Returns \b true if the C string in \a lhs is equal to /// the C string value in \a rhs, \b false otherwise. - //-------------------------------------------------------------- bool operator()(const char *lhs, const char *rhs) const { return lhs == rhs; } }; - //------------------------------------------------------------------ /// Convert to bool operator. /// /// This allows code to check a ConstString object to see if it contains a @@ -137,10 +120,8 @@ /// \return /// /b True this object contains a valid non-empty C string, \b /// false otherwise. - //------------------------------------------------------------------ explicit operator bool() const { return !IsEmpty(); } - //------------------------------------------------------------------ /// Assignment operator /// /// Assigns the string in this object with the value from \a rhs. @@ -150,13 +131,11 @@ /// /// \return /// A const reference to this object. - //------------------------------------------------------------------ ConstString operator=(ConstString rhs) { m_string = rhs.m_string; return *this; } - //------------------------------------------------------------------ /// Equal to operator /// /// Returns true if this string is equal to the string in \a rhs. This @@ -169,14 +148,12 @@ /// \return /// \li \b true if this object is equal to \a rhs. /// \li \b false if this object is not equal to \a rhs. - //------------------------------------------------------------------ bool operator==(ConstString rhs) const { // We can do a pointer compare to compare these strings since they must // come from the same pool in order to be equal. return m_string == rhs.m_string; } - //------------------------------------------------------------------ /// Not equal to operator /// /// Returns true if this string is not equal to the string in \a rhs. This @@ -189,14 +166,12 @@ /// \return /// \li \b true if this object is not equal to \a rhs. /// \li \b false if this object is equal to \a rhs. - //------------------------------------------------------------------ bool operator!=(ConstString rhs) const { return m_string != rhs.m_string; } bool operator<(ConstString rhs) const; - //------------------------------------------------------------------ /// Get the string value as a C string. /// /// Get the value of the contained string as a NULL terminated C string @@ -207,23 +182,19 @@ /// \return /// Returns \a value_if_empty if the string is empty, otherwise /// the C string value contained in this object. - //------------------------------------------------------------------ const char *AsCString(const char *value_if_empty = nullptr) const { return (IsEmpty() ? value_if_empty : m_string); } - //------------------------------------------------------------------ /// Get the string value as a llvm::StringRef /// /// \return /// Returns a new llvm::StringRef object filled in with the /// needed data. - //------------------------------------------------------------------ llvm::StringRef GetStringRef() const { return llvm::StringRef(m_string, GetLength()); } - //------------------------------------------------------------------ /// Get the string value as a C string. /// /// Get the value of the contained string as a NULL terminated C string @@ -234,10 +205,8 @@ /// \return /// Returns nullptr the string is invalid, otherwise the C string /// value contained in this object. - //------------------------------------------------------------------ const char *GetCString() const { return m_string; } - //------------------------------------------------------------------ /// Get the length in bytes of string value. /// /// The string pool stores the length of the string, so we can avoid calling @@ -246,18 +215,14 @@ /// \return /// Returns the number of bytes that this string occupies in /// memory, not including the NULL termination byte. - //------------------------------------------------------------------ size_t GetLength() const; - //------------------------------------------------------------------ /// Clear this object's state. /// /// Clear any contained string and reset the value to the empty string /// value. - //------------------------------------------------------------------ void Clear() { m_string = nullptr; } - //------------------------------------------------------------------ /// Equal to operator /// /// Returns true if this string is equal to the string in \a rhs. If case @@ -278,11 +243,9 @@ /// \return /// \li \b true if this object is equal to \a rhs. /// \li \b false if this object is not equal to \a rhs. - //------------------------------------------------------------------ static bool Equals(ConstString lhs, ConstString rhs, const bool case_sensitive = true); - //------------------------------------------------------------------ /// Compare two string objects. /// /// Compares the C string values contained in \a lhs and \a rhs and returns @@ -307,11 +270,9 @@ /// \li -1 if lhs < rhs /// \li 0 if lhs == rhs /// \li 1 if lhs > rhs - //------------------------------------------------------------------ static int Compare(ConstString lhs, ConstString rhs, const bool case_sensitive = true); - //------------------------------------------------------------------ /// Dump the object description to a stream. /// /// Dump the string value to the stream \a s. If the contained string is @@ -324,36 +285,28 @@ /// \param[in] value_if_empty /// The value to dump if the string is empty. If nullptr, nothing /// will be output to the stream. - //------------------------------------------------------------------ void Dump(Stream *s, const char *value_if_empty = nullptr) const; - //------------------------------------------------------------------ /// Dump the object debug description to a stream. /// /// \param[in] s /// The stream that will be used to dump the object description. - //------------------------------------------------------------------ void DumpDebug(Stream *s) const; - //------------------------------------------------------------------ /// Test for empty string. /// /// \return /// \li \b true if the contained string is empty. /// \li \b false if the contained string is not empty. - //------------------------------------------------------------------ bool IsEmpty() const { return m_string == nullptr || m_string[0] == '\0'; } - //------------------------------------------------------------------ /// Test for null string. /// /// \return /// \li \b true if there is no string associated with this instance. /// \li \b false if there is a string associated with this instance. - //------------------------------------------------------------------ bool IsNull() const { return m_string == nullptr; } - //------------------------------------------------------------------ /// Set the C string value. /// /// Set the string value in the object by uniquing the \a cstr string value @@ -365,12 +318,10 @@ /// /// \param[in] cstr /// A NULL terminated C string to add to the string pool. - //------------------------------------------------------------------ void SetCString(const char *cstr); void SetString(const llvm::StringRef &s); - //------------------------------------------------------------------ /// Set the C string value and its mangled counterpart. /// /// Object files and debug symbols often use mangled string to represent the @@ -386,11 +337,9 @@ /// \param[in] mangled /// The already uniqued mangled ConstString to correlate the /// soon to be uniqued version of \a demangled. - //------------------------------------------------------------------ void SetStringWithMangledCounterpart(llvm::StringRef demangled, ConstString mangled); - //------------------------------------------------------------------ /// Retrieve the mangled or demangled counterpart for a mangled or demangled /// ConstString. /// @@ -408,10 +357,8 @@ /// \return /// /b True if \a counterpart was filled in with the counterpart /// /b false otherwise. - //------------------------------------------------------------------ bool GetMangledCounterpart(ConstString &counterpart) const; - //------------------------------------------------------------------ /// Set the C string value with length. /// /// Set the string value in the object by uniquing \a cstr_len bytes @@ -428,18 +375,14 @@ /// /// \param[in] cstr_len /// The maximum length of the C string. - //------------------------------------------------------------------ void SetCStringWithLength(const char *cstr, size_t cstr_len); - //------------------------------------------------------------------ /// Set the C string value with the minimum length between \a fixed_cstr_len /// and the actual length of the C string. This can be used for data /// structures that have a fixed length to store a C string where the string /// might not be NULL terminated if the string takes the entire buffer. - //------------------------------------------------------------------ void SetTrimmedCStringWithLength(const char *cstr, size_t fixed_cstr_len); - //------------------------------------------------------------------ /// Get the memory cost of this object. /// /// Return the size in bytes that this object takes in memory. This returns @@ -450,10 +393,8 @@ /// The number of bytes that this object occupies in memory. /// /// \see ConstString::StaticMemorySize () - //------------------------------------------------------------------ size_t MemorySize() const { return sizeof(ConstString); } - //------------------------------------------------------------------ /// Get the size in bytes of the current global string pool. /// /// Reports the size in bytes of all shared C string values, containers and @@ -462,19 +403,14 @@ /// \return /// The number of bytes that the global string pool occupies /// in memory. - //------------------------------------------------------------------ static size_t StaticMemorySize(); protected: - //------------------------------------------------------------------ // Member variables - //------------------------------------------------------------------ const char *m_string; }; -//------------------------------------------------------------------ /// Stream the string value \a str to the stream \a s -//------------------------------------------------------------------ Stream &operator<<(Stream &s, ConstString str); } // namespace lldb_private Index: include/lldb/Utility/DataBuffer.h =================================================================== --- include/lldb/Utility/DataBuffer.h +++ include/lldb/Utility/DataBuffer.h @@ -19,7 +19,6 @@ namespace lldb_private { -//---------------------------------------------------------------------- /// \class DataBuffer DataBuffer.h "lldb/Core/DataBuffer.h" /// A pure virtual protocol class for abstracted data buffers. /// @@ -41,43 +40,34 @@ /// This class currently expects all data to be available without any extra /// calls being made, but we can modify it to optionally get data on demand /// with some extra function calls to load the data before it gets accessed. -//---------------------------------------------------------------------- class DataBuffer { public: - //------------------------------------------------------------------ /// Destructor /// /// The destructor is virtual as other classes will inherit from this class /// and be downcast to the DataBuffer pure virtual interface. The virtual /// destructor ensures that destructing the base class will destruct the /// class that inherited from it correctly. - //------------------------------------------------------------------ virtual ~DataBuffer() {} - //------------------------------------------------------------------ /// Get a pointer to the data. /// /// \return /// A pointer to the bytes owned by this object, or NULL if the /// object contains no bytes. - //------------------------------------------------------------------ virtual uint8_t *GetBytes() = 0; - //------------------------------------------------------------------ /// Get a const pointer to the data. /// /// \return /// A const pointer to the bytes owned by this object, or NULL /// if the object contains no bytes. - //------------------------------------------------------------------ virtual const uint8_t *GetBytes() const = 0; - //------------------------------------------------------------------ /// Get the number of bytes in the data buffer. /// /// \return /// The number of bytes this object currently contains. - //------------------------------------------------------------------ virtual lldb::offset_t GetByteSize() const = 0; llvm::ArrayRef GetData() const { Index: include/lldb/Utility/DataBufferHeap.h =================================================================== --- include/lldb/Utility/DataBufferHeap.h +++ include/lldb/Utility/DataBufferHeap.h @@ -18,7 +18,6 @@ namespace lldb_private { -//---------------------------------------------------------------------- /// \class DataBufferHeap DataBufferHeap.h "lldb/Core/DataBufferHeap.h" /// A subclass of DataBuffer that stores a data buffer on the heap. /// @@ -28,17 +27,13 @@ /// pages in. Large amounts of data that comes from files should probably use /// DataBufferLLVM, which can intelligently determine when memory mapping is /// optimal. -//---------------------------------------------------------------------- class DataBufferHeap : public DataBuffer { public: - //------------------------------------------------------------------ /// Default constructor /// /// Initializes the heap based buffer with no bytes. - //------------------------------------------------------------------ DataBufferHeap(); - //------------------------------------------------------------------ /// Construct with size \a n and fill with \a ch. /// /// Initialize this class with \a n bytes and fills the buffer with \a ch. @@ -48,10 +43,8 @@ /// /// \param[in] ch /// The character to use when filling the buffer initially. - //------------------------------------------------------------------ DataBufferHeap(lldb::offset_t n, uint8_t ch); - //------------------------------------------------------------------ /// Construct by making a copy of \a src_len bytes from \a src. /// /// \param[in] src @@ -59,33 +52,23 @@ /// /// \param[in] src_len /// The number of bytes in \a src to copy. - //------------------------------------------------------------------ DataBufferHeap(const void *src, lldb::offset_t src_len); - //------------------------------------------------------------------ /// Destructor. /// /// Virtual destructor since this class inherits from a pure virtual base /// class #DataBuffer. - //------------------------------------------------------------------ ~DataBufferHeap() override; - //------------------------------------------------------------------ /// \copydoc DataBuffer::GetBytes() - //------------------------------------------------------------------ uint8_t *GetBytes() override; - //------------------------------------------------------------------ /// \copydoc DataBuffer::GetBytes() const - //------------------------------------------------------------------ const uint8_t *GetBytes() const override; - //------------------------------------------------------------------ /// \copydoc DataBuffer::GetByteSize() const - //------------------------------------------------------------------ lldb::offset_t GetByteSize() const override; - //------------------------------------------------------------------ /// Set the number of bytes in the data buffer. /// /// Sets the number of bytes that this object should be able to contain. @@ -99,10 +82,8 @@ /// \return /// The size in bytes after that this heap buffer was /// successfully resized to. - //------------------------------------------------------------------ lldb::offset_t SetByteSize(lldb::offset_t byte_size); - //------------------------------------------------------------------ /// Makes a copy of the \a src_len bytes in \a src. /// /// Copies the data in \a src into an internal buffer. @@ -112,7 +93,6 @@ /// /// \param[in] src_len /// The number of bytes in \a src to copy. - //------------------------------------------------------------------ void CopyData(const void *src, lldb::offset_t src_len); void CopyData(llvm::StringRef src) { CopyData(src.data(), src.size()); } @@ -121,10 +101,8 @@ void Clear(); private: - //------------------------------------------------------------------ // This object uses a std::vector to store its data. This takes care // of free the data when the object is deleted. - //------------------------------------------------------------------ typedef std::vector buffer_t; ///< Buffer type buffer_t m_data; ///< The heap based buffer where data is stored }; Index: include/lldb/Utility/DataEncoder.h =================================================================== --- include/lldb/Utility/DataEncoder.h +++ include/lldb/Utility/DataEncoder.h @@ -21,7 +21,6 @@ namespace lldb_private { -//---------------------------------------------------------------------- /// \class DataEncoder DataEncoder.h "lldb/Core/DataEncoder.h" An binary data /// encoding class. /// @@ -30,17 +29,13 @@ /// that can be shared between multiple DataEncoder or DataEncoder instances. /// /// \see DataBuffer -//---------------------------------------------------------------------- class DataEncoder { public: - //------------------------------------------------------------------ /// Default constructor. /// /// Initialize all members to a default empty state. - //------------------------------------------------------------------ DataEncoder(); - //------------------------------------------------------------------ /// Construct with a buffer that is owned by the caller. /// /// This constructor allows us to use data that is owned by the caller. The @@ -57,11 +52,9 @@ /// /// \param[in] addr_size /// A new address byte size value. - //------------------------------------------------------------------ DataEncoder(void *data, uint32_t data_length, lldb::ByteOrder byte_order, uint8_t addr_size); - //------------------------------------------------------------------ /// Construct with shared data. /// /// Copies the data shared pointer which adds a reference to the contained @@ -77,57 +70,45 @@ /// /// \param[in] addr_size /// A new address byte size value. - //------------------------------------------------------------------ DataEncoder(const lldb::DataBufferSP &data_sp, lldb::ByteOrder byte_order, uint8_t addr_size); - //------------------------------------------------------------------ /// Destructor /// /// If this object contains a valid shared data reference, the reference /// count on the data will be decremented, and if zero, the data will be /// freed. - //------------------------------------------------------------------ ~DataEncoder(); - //------------------------------------------------------------------ /// Clears the object state. /// /// Clears the object contents back to a default invalid state, and release /// any references to shared data that this object may contain. - //------------------------------------------------------------------ void Clear(); - //------------------------------------------------------------------ /// Get the current address size. /// /// Return the size in bytes of any address values this object will extract. /// /// \return /// The size in bytes of address values that will be extracted. - //------------------------------------------------------------------ uint8_t GetAddressByteSize() const { return m_addr_size; } - //------------------------------------------------------------------ /// Get the number of bytes contained in this object. /// /// \return /// The total number of bytes of data this object refers to. - //------------------------------------------------------------------ size_t GetByteSize() const { return m_end - m_start; } - //------------------------------------------------------------------ /// Get the data end pointer. /// /// \return /// Returns a pointer to the next byte contained in this /// object's data, or NULL of there is no data in this object. - //------------------------------------------------------------------ uint8_t *GetDataEnd() { return m_end; } const uint8_t *GetDataEnd() const { return m_end; } - //------------------------------------------------------------------ /// Get the shared data offset. /// /// Get the offset of the first byte of data in the shared data (if any). @@ -135,30 +116,24 @@ /// \return /// If this object contains shared data, this function returns /// the offset in bytes into that shared data, zero otherwise. - //------------------------------------------------------------------ size_t GetSharedDataOffset() const; - //------------------------------------------------------------------ /// Get the current byte order value. /// /// \return /// The current byte order value from this object's internal /// state. - //------------------------------------------------------------------ lldb::ByteOrder GetByteOrder() const { return m_byte_order; } - //------------------------------------------------------------------ /// Get the data start pointer. /// /// \return /// Returns a pointer to the first byte contained in this /// object's data, or NULL of there is no data in this object. - //------------------------------------------------------------------ uint8_t *GetDataStart() { return m_start; } const uint8_t *GetDataStart() const { return m_start; } - //------------------------------------------------------------------ /// Encode unsigned integer values into the data at \a offset. /// /// \param[in] offset @@ -171,7 +146,6 @@ /// \return /// The next offset in the bytes of this data if the data /// was successfully encoded, UINT32_MAX if the encoding failed. - //------------------------------------------------------------------ uint32_t PutU8(uint32_t offset, uint8_t value); uint32_t PutU16(uint32_t offset, uint16_t value); @@ -180,7 +154,6 @@ uint32_t PutU64(uint32_t offset, uint64_t value); - //------------------------------------------------------------------ /// Encode an unsigned integer of size \a byte_size to \a offset. /// /// Encode a single integer value at \a offset and return the offset that @@ -203,10 +176,8 @@ /// \return /// The next offset in the bytes of this data if the integer /// was successfully encoded, UINT32_MAX if the encoding failed. - //------------------------------------------------------------------ uint32_t PutMaxU64(uint32_t offset, uint32_t byte_size, uint64_t value); - //------------------------------------------------------------------ /// Encode an arbitrary number of bytes. /// /// \param[in] offset @@ -222,10 +193,8 @@ /// \return /// The next valid offset within data if the put operation /// was successful, else UINT32_MAX to indicate the put failed. - //------------------------------------------------------------------ uint32_t PutData(uint32_t offset, const void *src, uint32_t src_len); - //------------------------------------------------------------------ /// Encode an address in the existing buffer at \a offset bytes into the /// buffer. /// @@ -245,10 +214,8 @@ /// \return /// The next valid offset within data if the put operation /// was successful, else UINT32_MAX to indicate the put failed. - //------------------------------------------------------------------ uint32_t PutAddress(uint32_t offset, lldb::addr_t addr); - //------------------------------------------------------------------ /// Put a C string to \a offset. /// /// Encodes a C string into the existing data including the terminating @@ -265,12 +232,10 @@ /// pointed to by \a offset_ptr is out of bounds, or if the /// offset plus the length of the C string is out of bounds, /// NULL will be returned. - //------------------------------------------------------------------ uint32_t PutCString(uint32_t offset_ptr, const char *cstr); lldb::DataBufferSP &GetSharedDataBuffer() { return m_data_sp; } - //------------------------------------------------------------------ /// Set the address byte size. /// /// Set the size in bytes that will be used when extracting any address and @@ -278,10 +243,8 @@ /// /// \param[in] addr_size /// The size in bytes to use when extracting addresses. - //------------------------------------------------------------------ void SetAddressByteSize(uint8_t addr_size) { m_addr_size = addr_size; } - //------------------------------------------------------------------ /// Set data with a buffer that is caller owned. /// /// Use data that is owned by the caller when extracting values. The data @@ -300,10 +263,8 @@ /// /// \return /// The number of bytes that this object now contains. - //------------------------------------------------------------------ uint32_t SetData(void *bytes, uint32_t length, lldb::ByteOrder byte_order); - //------------------------------------------------------------------ /// Adopt a subset of shared data in \a data_sp. /// /// Copies the data shared pointer which adds a reference to the contained @@ -326,11 +287,9 @@ /// /// \return /// The number of bytes that this object now contains. - //------------------------------------------------------------------ uint32_t SetData(const lldb::DataBufferSP &data_sp, uint32_t offset = 0, uint32_t length = UINT32_MAX); - //------------------------------------------------------------------ /// Set the byte_order value. /// /// Sets the byte order of the data to extract. Extracted values will be @@ -338,25 +297,20 @@ /// /// \param[in] byte_order /// The byte order value to use when extracting data. - //------------------------------------------------------------------ void SetByteOrder(lldb::ByteOrder byte_order) { m_byte_order = byte_order; } - //------------------------------------------------------------------ /// Test the validity of \a offset. /// /// \return /// \b true if \a offset is a valid offset into the data in this /// object, \b false otherwise. - //------------------------------------------------------------------ bool ValidOffset(uint32_t offset) const { return offset < GetByteSize(); } - //------------------------------------------------------------------ /// Test the availability of \a length bytes of data from \a offset. /// /// \return /// \b true if \a offset is a valid offset and there are \a /// length bytes available at that offset, \b false otherwise. - //------------------------------------------------------------------ bool ValidOffsetForDataOfSize(uint32_t offset, uint32_t length) const { return length <= BytesLeft(offset); } @@ -369,9 +323,7 @@ } protected: - //------------------------------------------------------------------ // Member variables - //------------------------------------------------------------------ uint8_t *m_start; ///< A pointer to the first byte of data. uint8_t *m_end; ///< A pointer to the byte that is past the end of the data. lldb::ByteOrder Index: include/lldb/Utility/DataExtractor.h =================================================================== --- include/lldb/Utility/DataExtractor.h +++ include/lldb/Utility/DataExtractor.h @@ -32,7 +32,6 @@ namespace lldb_private { -//---------------------------------------------------------------------- /// \class DataExtractor DataExtractor.h "lldb/Core/DataExtractor.h" An data /// extractor class. /// @@ -45,13 +44,10 @@ /// offsets. /// /// \see DataBuffer -//---------------------------------------------------------------------- class DataExtractor { public: - //------------------------------------------------------------------ /// \typedef DataExtractor::Type /// Type enumerations used in the dump routines. - //------------------------------------------------------------------ typedef enum { TypeUInt8, ///< Format output as unsigned 8 bit integers TypeChar, ///< Format output as characters @@ -63,14 +59,11 @@ TypeSLEB128 ///< Format output as SLEB128 numbers } Type; - //------------------------------------------------------------------ /// Default constructor. /// /// Initialize all members to a default empty state. - //------------------------------------------------------------------ DataExtractor(); - //------------------------------------------------------------------ /// Construct with a buffer that is owned by the caller. /// /// This constructor allows us to use data that is owned by the caller. The @@ -90,12 +83,10 @@ /// /// \param[in] target_byte_size /// A size of a target byte in 8-bit host bytes - //------------------------------------------------------------------ DataExtractor(const void *data, lldb::offset_t data_length, lldb::ByteOrder byte_order, uint32_t addr_size, uint32_t target_byte_size = 1); - //------------------------------------------------------------------ /// Construct with shared data. /// /// Copies the data shared pointer which adds a reference to the contained @@ -114,11 +105,9 @@ /// /// \param[in] target_byte_size /// A size of a target byte in 8-bit host bytes - //------------------------------------------------------------------ DataExtractor(const lldb::DataBufferSP &data_sp, lldb::ByteOrder byte_order, uint32_t addr_size, uint32_t target_byte_size = 1); - //------------------------------------------------------------------ /// Construct with a subset of \a data. /// /// Initialize this object with a subset of the data bytes in \a data. If \a @@ -141,13 +130,11 @@ /// /// \param[in] target_byte_size /// A size of a target byte in 8-bit host bytes - //------------------------------------------------------------------ DataExtractor(const DataExtractor &data, lldb::offset_t offset, lldb::offset_t length, uint32_t target_byte_size = 1); DataExtractor(const DataExtractor &rhs); - //------------------------------------------------------------------ /// Assignment operator. /// /// Copies all data, byte order and address size settings from \a rhs into @@ -159,29 +146,23 @@ /// /// \return /// A const reference to this object. - //------------------------------------------------------------------ const DataExtractor &operator=(const DataExtractor &rhs); - //------------------------------------------------------------------ /// Destructor /// /// If this object contains a valid shared data reference, the reference /// count on the data will be decremented, and if zero, the data will be /// freed. - //------------------------------------------------------------------ virtual ~DataExtractor(); uint32_t getTargetByteSize() const { return m_target_byte_size; } - //------------------------------------------------------------------ /// Clears the object state. /// /// Clears the object contents back to a default invalid state, and release /// any references to shared data that this object may contain. - //------------------------------------------------------------------ void Clear(); - //------------------------------------------------------------------ /// Dumps the binary data as \a type objects to stream \a s (or to Log() if /// \a s is nullptr) starting \a offset bytes into the data and stopping /// after dumping \a length bytes. The offset into the data is displayed at @@ -215,13 +196,11 @@ /// /// \return /// The offset at which dumping ended. - //------------------------------------------------------------------ lldb::offset_t PutToLog(Log *log, lldb::offset_t offset, lldb::offset_t length, uint64_t base_addr, uint32_t num_per_line, Type type, const char *type_format = nullptr) const; - //------------------------------------------------------------------ /// Extract an arbitrary number of bytes in the specified byte order. /// /// Attemps to extract \a length bytes starting at \a offset bytes into this @@ -247,11 +226,9 @@ /// The number of bytes that were extracted which will be \a /// length when the value is successfully extracted, or zero /// if there aren't enough bytes at the specified offset. - //------------------------------------------------------------------ size_t ExtractBytes(lldb::offset_t offset, lldb::offset_t length, lldb::ByteOrder dst_byte_order, void *dst) const; - //------------------------------------------------------------------ /// Extract an address from \a *offset_ptr. /// /// Extract a single address from the data and update the offset pointed to @@ -268,30 +245,24 @@ /// /// \return /// The extracted address value. - //------------------------------------------------------------------ uint64_t GetAddress(lldb::offset_t *offset_ptr) const; uint64_t GetAddress_unchecked(lldb::offset_t *offset_ptr) const; - //------------------------------------------------------------------ /// Get the current address size. /// /// Return the size in bytes of any address values this object will extract. /// /// \return /// The size in bytes of address values that will be extracted. - //------------------------------------------------------------------ uint32_t GetAddressByteSize() const { return m_addr_size; } - //------------------------------------------------------------------ /// Get the number of bytes contained in this object. /// /// \return /// The total number of bytes of data this object refers to. - //------------------------------------------------------------------ uint64_t GetByteSize() const { return m_end - m_start; } - //------------------------------------------------------------------ /// Extract a C string from \a *offset_ptr. /// /// Returns a pointer to a C String from the data at the offset pointed to @@ -311,10 +282,8 @@ /// pointed to by \a offset_ptr is out of bounds, or if the /// offset plus the length of the C string is out of bounds, /// nullptr will be returned. - //------------------------------------------------------------------ const char *GetCStr(lldb::offset_t *offset_ptr) const; - //------------------------------------------------------------------ /// Extract a C string from \a *offset_ptr with field size \a len. /// /// Returns a pointer to a C String from the data at the offset pointed to @@ -338,7 +307,6 @@ /// be returned. const char *GetCStr(lldb::offset_t *offset_ptr, lldb::offset_t len) const; - //------------------------------------------------------------------ /// Extract \a length bytes from \a *offset_ptr. /// /// Returns a pointer to a bytes in this object's data at the offset pointed @@ -360,7 +328,6 @@ /// \return /// A pointer to the bytes in this object's data if the offset /// and length are valid, or nullptr otherwise. - //------------------------------------------------------------------ const void *GetData(lldb::offset_t *offset_ptr, lldb::offset_t length) const { const uint8_t *ptr = PeekData(*offset_ptr, length); if (ptr) @@ -368,7 +335,6 @@ return ptr; } - //------------------------------------------------------------------ /// Copy \a length bytes from \a *offset, without swapping bytes. /// /// \param[in] offset @@ -383,11 +349,9 @@ /// \return /// Returns the number of bytes that were copied, or zero if /// anything goes wrong. - //------------------------------------------------------------------ lldb::offset_t CopyData(lldb::offset_t offset, lldb::offset_t length, void *dst) const; - //------------------------------------------------------------------ /// Copy \a dst_len bytes from \a *offset_ptr and ensure the copied data is /// treated as a value that can be swapped to match the specified byte /// order. @@ -424,22 +388,18 @@ /// \return /// Returns the number of bytes that were copied, or zero if /// anything goes wrong. - //------------------------------------------------------------------ lldb::offset_t CopyByteOrderedData(lldb::offset_t src_offset, lldb::offset_t src_len, void *dst, lldb::offset_t dst_len, lldb::ByteOrder dst_byte_order) const; - //------------------------------------------------------------------ /// Get the data end pointer. /// /// \return /// Returns a pointer to the next byte contained in this /// object's data, or nullptr of there is no data in this object. - //------------------------------------------------------------------ const uint8_t *GetDataEnd() const { return m_end; } - //------------------------------------------------------------------ /// Get the shared data offset. /// /// Get the offset of the first byte of data in the shared data (if any). @@ -447,19 +407,15 @@ /// \return /// If this object contains shared data, this function returns /// the offset in bytes into that shared data, zero otherwise. - //------------------------------------------------------------------ size_t GetSharedDataOffset() const; - //------------------------------------------------------------------ /// Get the data start pointer. /// /// \return /// Returns a pointer to the first byte contained in this /// object's data, or nullptr of there is no data in this object. - //------------------------------------------------------------------ const uint8_t *GetDataStart() const { return m_start; } - //------------------------------------------------------------------ /// Extract a float from \a *offset_ptr. /// /// Extract a single float value. @@ -473,14 +429,12 @@ /// /// \return /// The floating value that was extracted, or zero on failure. - //------------------------------------------------------------------ float GetFloat(lldb::offset_t *offset_ptr) const; double GetDouble(lldb::offset_t *offset_ptr) const; long double GetLongDouble(lldb::offset_t *offset_ptr) const; - //------------------------------------------------------------------ /// Extract an integer of size \a byte_size from \a *offset_ptr. /// /// Extract a single integer value and update the offset pointed to by \a @@ -500,10 +454,8 @@ /// /// \return /// The integer value that was extracted, or zero on failure. - //------------------------------------------------------------------ uint32_t GetMaxU32(lldb::offset_t *offset_ptr, size_t byte_size) const; - //------------------------------------------------------------------ /// Extract an unsigned integer of size \a byte_size from \a *offset_ptr. /// /// Extract a single unsigned integer value and update the offset pointed to @@ -525,13 +477,11 @@ /// \return /// The unsigned integer value that was extracted, or zero on /// failure. - //------------------------------------------------------------------ uint64_t GetMaxU64(lldb::offset_t *offset_ptr, size_t byte_size) const; uint64_t GetMaxU64_unchecked(lldb::offset_t *offset_ptr, size_t byte_size) const; - //------------------------------------------------------------------ /// Extract an signed integer of size \a byte_size from \a *offset_ptr. /// /// Extract a single signed integer value (sign extending if required) and @@ -553,10 +503,8 @@ /// \return /// The sign extended signed integer value that was extracted, /// or zero on failure. - //------------------------------------------------------------------ int64_t GetMaxS64(lldb::offset_t *offset_ptr, size_t byte_size) const; - //------------------------------------------------------------------ /// Extract an unsigned integer of size \a byte_size from \a *offset_ptr, /// then extract the bitfield from this value if \a bitfield_bit_size is /// non-zero. @@ -591,12 +539,10 @@ /// \return /// The unsigned bitfield integer value that was extracted, or /// zero on failure. - //------------------------------------------------------------------ uint64_t GetMaxU64Bitfield(lldb::offset_t *offset_ptr, size_t size, uint32_t bitfield_bit_size, uint32_t bitfield_bit_offset) const; - //------------------------------------------------------------------ /// Extract an signed integer of size \a byte_size from \a *offset_ptr, then /// extract and signe extend the bitfield from this value if \a /// bitfield_bit_size is non-zero. @@ -631,12 +577,10 @@ /// \return /// The signed bitfield integer value that was extracted, or /// zero on failure. - //------------------------------------------------------------------ int64_t GetMaxS64Bitfield(lldb::offset_t *offset_ptr, size_t size, uint32_t bitfield_bit_size, uint32_t bitfield_bit_offset) const; - //------------------------------------------------------------------ /// Extract an pointer from \a *offset_ptr. /// /// Extract a single pointer from the data and update the offset pointed to @@ -653,19 +597,15 @@ /// /// \return /// The extracted pointer value as a 64 integer. - //------------------------------------------------------------------ uint64_t GetPointer(lldb::offset_t *offset_ptr) const; - //------------------------------------------------------------------ /// Get the current byte order value. /// /// \return /// The current byte order value from this object's internal /// state. - //------------------------------------------------------------------ lldb::ByteOrder GetByteOrder() const { return m_byte_order; } - //------------------------------------------------------------------ /// Extract a uint8_t value from \a *offset_ptr. /// /// Extract a single uint8_t from the binary data at the offset pointed to @@ -680,7 +620,6 @@ /// /// \return /// The extracted uint8_t value. - //------------------------------------------------------------------ uint8_t GetU8(lldb::offset_t *offset_ptr) const; uint8_t GetU8_unchecked(lldb::offset_t *offset_ptr) const { @@ -694,7 +633,6 @@ uint32_t GetU32_unchecked(lldb::offset_t *offset_ptr) const; uint64_t GetU64_unchecked(lldb::offset_t *offset_ptr) const; - //------------------------------------------------------------------ /// Extract \a count uint8_t values from \a *offset_ptr. /// /// Extract \a count uint8_t values from the binary data at the offset @@ -718,10 +656,8 @@ /// \return /// \a dst if all values were properly extracted and copied, /// nullptr otherwise. - //------------------------------------------------------------------ void *GetU8(lldb::offset_t *offset_ptr, void *dst, uint32_t count) const; - //------------------------------------------------------------------ /// Extract a uint16_t value from \a *offset_ptr. /// /// Extract a single uint16_t from the binary data at the offset pointed to @@ -736,10 +672,8 @@ /// /// \return /// The extracted uint16_t value. - //------------------------------------------------------------------ uint16_t GetU16(lldb::offset_t *offset_ptr) const; - //------------------------------------------------------------------ /// Extract \a count uint16_t values from \a *offset_ptr. /// /// Extract \a count uint16_t values from the binary data at the offset @@ -763,10 +697,8 @@ /// \return /// \a dst if all values were properly extracted and copied, /// nullptr otherwise. - //------------------------------------------------------------------ void *GetU16(lldb::offset_t *offset_ptr, void *dst, uint32_t count) const; - //------------------------------------------------------------------ /// Extract a uint32_t value from \a *offset_ptr. /// /// Extract a single uint32_t from the binary data at the offset pointed to @@ -781,10 +713,8 @@ /// /// \return /// The extracted uint32_t value. - //------------------------------------------------------------------ uint32_t GetU32(lldb::offset_t *offset_ptr) const; - //------------------------------------------------------------------ /// Extract \a count uint32_t values from \a *offset_ptr. /// /// Extract \a count uint32_t values from the binary data at the offset @@ -808,10 +738,8 @@ /// \return /// \a dst if all values were properly extracted and copied, /// nullptr otherwise. - //------------------------------------------------------------------ void *GetU32(lldb::offset_t *offset_ptr, void *dst, uint32_t count) const; - //------------------------------------------------------------------ /// Extract a uint64_t value from \a *offset_ptr. /// /// Extract a single uint64_t from the binary data at the offset pointed to @@ -826,10 +754,8 @@ /// /// \return /// The extracted uint64_t value. - //------------------------------------------------------------------ uint64_t GetU64(lldb::offset_t *offset_ptr) const; - //------------------------------------------------------------------ /// Extract \a count uint64_t values from \a *offset_ptr. /// /// Extract \a count uint64_t values from the binary data at the offset @@ -853,10 +779,8 @@ /// \return /// \a dst if all values were properly extracted and copied, /// nullptr otherwise. - //------------------------------------------------------------------ void *GetU64(lldb::offset_t *offset_ptr, void *dst, uint32_t count) const; - //------------------------------------------------------------------ /// Extract a signed LEB128 value from \a *offset_ptr. /// /// Extracts an signed LEB128 number from this object's data starting at the @@ -873,10 +797,8 @@ /// /// \return /// The extracted signed integer value. - //------------------------------------------------------------------ int64_t GetSLEB128(lldb::offset_t *offset_ptr) const; - //------------------------------------------------------------------ /// Extract a unsigned LEB128 value from \a *offset_ptr. /// /// Extracts an unsigned LEB128 number from this object's data starting at @@ -893,12 +815,10 @@ /// /// \return /// The extracted unsigned integer value. - //------------------------------------------------------------------ uint64_t GetULEB128(lldb::offset_t *offset_ptr) const; lldb::DataBufferSP &GetSharedDataBuffer() { return m_data_sp; } - //------------------------------------------------------------------ /// Peek at a C string at \a offset. /// /// Peeks at a string in the contained data. No verification is done to make @@ -911,10 +831,8 @@ /// \return /// A non-nullptr C string pointer if \a offset is a valid offset, /// nullptr otherwise. - //------------------------------------------------------------------ const char *PeekCStr(lldb::offset_t offset) const; - //------------------------------------------------------------------ /// Peek at a bytes at \a offset. /// /// Returns a pointer to \a length bytes at \a offset as long as there are @@ -924,14 +842,12 @@ /// A non-nullptr data pointer if \a offset is a valid offset and /// there are \a length bytes available at that offset, nullptr /// otherwise. - //------------------------------------------------------------------ const uint8_t *PeekData(lldb::offset_t offset, lldb::offset_t length) const { if (ValidOffsetForDataOfSize(offset, length)) return m_start + offset; return nullptr; } - //------------------------------------------------------------------ /// Set the address byte size. /// /// Set the size in bytes that will be used when extracting any address and @@ -939,7 +855,6 @@ /// /// \param[in] addr_size /// The size in bytes to use when extracting addresses. - //------------------------------------------------------------------ void SetAddressByteSize(uint32_t addr_size) { #ifdef LLDB_CONFIGURATION_DEBUG assert(addr_size == 4 || addr_size == 8); @@ -947,7 +862,6 @@ m_addr_size = addr_size; } - //------------------------------------------------------------------ /// Set data with a buffer that is caller owned. /// /// Use data that is owned by the caller when extracting values. The data @@ -966,11 +880,9 @@ /// /// \return /// The number of bytes that this object now contains. - //------------------------------------------------------------------ lldb::offset_t SetData(const void *bytes, lldb::offset_t length, lldb::ByteOrder byte_order); - //------------------------------------------------------------------ /// Adopt a subset of \a data. /// /// Set this object's data to be a subset of the data bytes in \a data. If @@ -993,11 +905,9 @@ /// /// \return /// The number of bytes that this object now contains. - //------------------------------------------------------------------ lldb::offset_t SetData(const DataExtractor &data, lldb::offset_t offset, lldb::offset_t length); - //------------------------------------------------------------------ /// Adopt a subset of shared data in \a data_sp. /// /// Copies the data shared pointer which adds a reference to the contained @@ -1020,12 +930,10 @@ /// /// \return /// The number of bytes that this object now contains. - //------------------------------------------------------------------ lldb::offset_t SetData(const lldb::DataBufferSP &data_sp, lldb::offset_t offset = 0, lldb::offset_t length = LLDB_INVALID_OFFSET); - //------------------------------------------------------------------ /// Set the byte_order value. /// /// Sets the byte order of the data to extract. Extracted values will be @@ -1033,10 +941,8 @@ /// /// \param[in] byte_order /// The byte order value to use when extracting data. - //------------------------------------------------------------------ void SetByteOrder(lldb::ByteOrder byte_order) { m_byte_order = byte_order; } - //------------------------------------------------------------------ /// Skip an LEB128 number at \a *offset_ptr. /// /// Skips a LEB128 number (signed or unsigned) from this object's data @@ -1053,27 +959,22 @@ /// /// \return // The number of bytes consumed during the extraction. - //------------------------------------------------------------------ uint32_t Skip_LEB128(lldb::offset_t *offset_ptr) const; - //------------------------------------------------------------------ /// Test the validity of \a offset. /// /// \return /// \b true if \a offset is a valid offset into the data in this /// object, \b false otherwise. - //------------------------------------------------------------------ bool ValidOffset(lldb::offset_t offset) const { return offset < GetByteSize(); } - //------------------------------------------------------------------ /// Test the availability of \a length bytes of data from \a offset. /// /// \return /// \b true if \a offset is a valid offset and there are \a /// length bytes available at that offset, \b false otherwise. - //------------------------------------------------------------------ bool ValidOffsetForDataOfSize(lldb::offset_t offset, lldb::offset_t length) const { return length <= BytesLeft(offset); @@ -1099,9 +1000,7 @@ } protected: - //------------------------------------------------------------------ // Member variables - //------------------------------------------------------------------ const uint8_t *m_start; ///< A pointer to the first byte of data. const uint8_t *m_end; ///< A pointer to the byte that is past the end of the data. Index: include/lldb/Utility/Event.h =================================================================== --- include/lldb/Utility/Event.h +++ include/lldb/Utility/Event.h @@ -34,9 +34,7 @@ namespace lldb_private { -//---------------------------------------------------------------------- // lldb::EventData -//---------------------------------------------------------------------- class EventData { friend class Event; @@ -55,14 +53,10 @@ DISALLOW_COPY_AND_ASSIGN(EventData); }; -//---------------------------------------------------------------------- // lldb::EventDataBytes -//---------------------------------------------------------------------- class EventDataBytes : public EventData { public: - //------------------------------------------------------------------ // Constructors - //------------------------------------------------------------------ EventDataBytes(); EventDataBytes(const char *cstr); @@ -73,9 +67,7 @@ ~EventDataBytes() override; - //------------------------------------------------------------------ // Member functions - //------------------------------------------------------------------ ConstString GetFlavor() const override; void Dump(Stream *s) const override; @@ -90,9 +82,7 @@ void SetBytesFromCString(const char *cstr); - //------------------------------------------------------------------ // Static functions - //------------------------------------------------------------------ static const EventDataBytes *GetEventDataFromEvent(const Event *event_ptr); static const void *GetBytesFromEvent(const Event *event_ptr); @@ -132,16 +122,12 @@ } }; -//---------------------------------------------------------------------- /// This class handles one or more StructuredData::Dictionary entries /// that are raised for structured data events. -//---------------------------------------------------------------------- class EventDataStructuredData : public EventData { public: - //------------------------------------------------------------------ // Constructors - //------------------------------------------------------------------ EventDataStructuredData(); EventDataStructuredData(const lldb::ProcessSP &process_sp, @@ -150,9 +136,7 @@ ~EventDataStructuredData() override; - //------------------------------------------------------------------ // Member functions - //------------------------------------------------------------------ ConstString GetFlavor() const override; void Dump(Stream *s) const override; @@ -169,9 +153,7 @@ void SetStructuredDataPlugin(const lldb::StructuredDataPluginSP &plugin_sp); - //------------------------------------------------------------------ // Static functions - //------------------------------------------------------------------ static const EventDataStructuredData * GetEventDataFromEvent(const Event *event_ptr); @@ -192,9 +174,7 @@ DISALLOW_COPY_AND_ASSIGN(EventDataStructuredData); }; -//---------------------------------------------------------------------- // lldb::Event -//---------------------------------------------------------------------- class Event { friend class Listener; friend class EventData; Index: include/lldb/Utility/FileSpec.h =================================================================== --- include/lldb/Utility/FileSpec.h +++ include/lldb/Utility/FileSpec.h @@ -37,7 +37,6 @@ namespace lldb_private { -//---------------------------------------------------------------------- /// \class FileSpec FileSpec.h "lldb/Host/FileSpec.h" /// A file utility class. /// @@ -53,14 +52,12 @@ /// are already split up, it makes it easy for us to compare only the /// basenames of a lot of file specifications without having to split up the /// file path each time to get to the basename. -//---------------------------------------------------------------------- class FileSpec { public: using Style = llvm::sys::path::Style; FileSpec(); - //------------------------------------------------------------------ /// Constructor with path. /// /// Takes a path to a file which can be just a filename, or a full path. If @@ -74,22 +71,18 @@ /// The style of the path /// /// \see FileSpec::SetFile (const char *path) - //------------------------------------------------------------------ explicit FileSpec(llvm::StringRef path, Style style = Style::native); explicit FileSpec(llvm::StringRef path, const llvm::Triple &Triple); - //------------------------------------------------------------------ /// Copy constructor /// /// Makes a copy of the uniqued directory and filename strings from \a rhs. /// /// \param[in] rhs /// A const FileSpec object reference to copy. - //------------------------------------------------------------------ FileSpec(const FileSpec &rhs); - //------------------------------------------------------------------ /// Copy constructor /// /// Makes a copy of the uniqued directory and filename strings from \a rhs @@ -97,19 +90,15 @@ /// /// \param[in] rhs /// A const FileSpec object pointer to copy if non-nullptr. - //------------------------------------------------------------------ FileSpec(const FileSpec *rhs); - //------------------------------------------------------------------ /// Destructor. - //------------------------------------------------------------------ ~FileSpec(); bool DirectoryEquals(const FileSpec &other) const; bool FileEquals(const FileSpec &other) const; - //------------------------------------------------------------------ /// Assignment operator. /// /// Makes a copy of the uniqued directory and filename strings from \a rhs. @@ -119,10 +108,8 @@ /// /// \return /// A const reference to this object. - //------------------------------------------------------------------ const FileSpec &operator=(const FileSpec &rhs); - //------------------------------------------------------------------ /// Equal to operator /// /// Tests if this object is equal to \a rhs. @@ -134,10 +121,8 @@ /// \return /// \b true if this object is equal to \a rhs, \b false /// otherwise. - //------------------------------------------------------------------ bool operator==(const FileSpec &rhs) const; - //------------------------------------------------------------------ /// Not equal to operator /// /// Tests if this object is not equal to \a rhs. @@ -149,10 +134,8 @@ /// \return /// \b true if this object is equal to \a rhs, \b false /// otherwise. - //------------------------------------------------------------------ bool operator!=(const FileSpec &rhs) const; - //------------------------------------------------------------------ /// Less than to operator /// /// Tests if this object is less than \a rhs. @@ -164,10 +147,8 @@ /// \return /// \b true if this object is less than \a rhs, \b false /// otherwise. - //------------------------------------------------------------------ bool operator<(const FileSpec &rhs) const; - //------------------------------------------------------------------ /// Convert to pointer operator. /// /// This allows code to check a FileSpec object to see if it contains @@ -182,10 +163,8 @@ /// \return /// A pointer to this object if either the directory or filename /// is valid, nullptr otherwise. - //------------------------------------------------------------------ explicit operator bool() const; - //------------------------------------------------------------------ /// Logical NOT operator. /// /// This allows code to check a FileSpec object to see if it is invalid @@ -200,18 +179,14 @@ /// \return /// Returns \b true if the object has an empty directory and /// filename, \b false otherwise. - //------------------------------------------------------------------ bool operator!() const; - //------------------------------------------------------------------ /// Clears the object state. /// /// Clear this object by releasing both the directory and filename string /// values and reverting them to empty strings. - //------------------------------------------------------------------ void Clear(); - //------------------------------------------------------------------ /// Compare two FileSpec objects. /// /// If \a full is true, then both the directory and the filename must match. @@ -237,7 +212,6 @@ /// \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 FileSpec &lhs, const FileSpec &rhs, bool full); static bool Equal(const FileSpec &a, const FileSpec &b, bool full); @@ -249,16 +223,13 @@ /// unreliable (e.g. "c:\foo.txt" is a valid relative posix path). static llvm::Optional