diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2019-08-20 20:51:52 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2019-08-20 20:51:52 +0000 |
commit | 5f29bb8a675e8f96452b632e7129113f7dec850e (patch) | |
tree | 3d3f2a0d3ad10872a4dcaba8ec8d1d20c87ab147 /include | |
parent | 88c643b6fec27eec436c8d138fee6346e92337d6 (diff) | |
download | src-5f29bb8a675e8f96452b632e7129113f7dec850e.tar.gz src-5f29bb8a675e8f96452b632e7129113f7dec850e.zip |
Vendor import of stripped lldb trunk r366426 (just before the release_90
branch point):
https://llvm.org/svn/llvm-project/lldb/trunk@366426
Notes
Notes:
svn path=/vendor/lldb/dist/; revision=351290
Diffstat (limited to 'include')
480 files changed, 7911 insertions, 12506 deletions
diff --git a/include/lldb/API/LLDB.h b/include/lldb/API/LLDB.h index 2b3dd96aef0e..0806ab700a94 100644 --- a/include/lldb/API/LLDB.h +++ b/include/lldb/API/LLDB.h @@ -1,9 +1,8 @@ //===-- LLDB.h --------------------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -49,6 +48,7 @@ #include "lldb/API/SBProcessInfo.h" #include "lldb/API/SBQueue.h" #include "lldb/API/SBQueueItem.h" +#include "lldb/API/SBReproducer.h" #include "lldb/API/SBSection.h" #include "lldb/API/SBSourceManager.h" #include "lldb/API/SBStream.h" diff --git a/include/lldb/API/SBAddress.h b/include/lldb/API/SBAddress.h index 891324254cd6..2874a3602af2 100644 --- a/include/lldb/API/SBAddress.h +++ b/include/lldb/API/SBAddress.h @@ -1,9 +1,8 @@ //===-- SBAddress.h ---------------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -30,6 +29,12 @@ public: const lldb::SBAddress &operator=(const lldb::SBAddress &rhs); + explicit operator bool() const; + + // operator== is a free function + + bool operator!=(const SBAddress &rhs) const; + bool IsValid() const; void Clear(); @@ -115,7 +120,7 @@ protected: void SetAddress(const lldb_private::Address *lldb_object_ptr); private: - std::unique_ptr<lldb_private::Address> m_opaque_ap; + std::unique_ptr<lldb_private::Address> m_opaque_up; }; bool LLDB_API operator==(const SBAddress &lhs, const SBAddress &rhs); diff --git a/include/lldb/API/SBAttachInfo.h b/include/lldb/API/SBAttachInfo.h index 7ae006908ccc..3c20a08cb4a9 100644 --- a/include/lldb/API/SBAttachInfo.h +++ b/include/lldb/API/SBAttachInfo.h @@ -1,9 +1,8 @@ //===-- SBAttachInfo.h ------------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -22,35 +21,32 @@ public: SBAttachInfo(lldb::pid_t pid); - //------------------------------------------------------------------ /// Attach to a process by name. /// /// This function implies that a future call to SBTarget::Attach(...) /// will be synchronous. /// - /// @param[in] path + /// \param[in] path /// A full or partial name for the process to attach to. /// - /// @param[in] wait_for + /// \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 /// asynchronous depending on the \a async argument. /// - /// @param[in] path + /// \param[in] path /// A full or partial name for the process to attach to. /// - /// @param[in] wait_for + /// \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. /// - /// @param[in] async + /// \param[in] async /// If \b false, then the SBTarget::Attach(...) call will be a /// synchronous call with no way to cancel the attach in /// progress. @@ -60,7 +56,6 @@ public: /// eventually found. If the client wants to cancel the event, /// SBProcess::Stop() can be called and an eStateExited process /// event will be delivered. - //------------------------------------------------------------------ SBAttachInfo(const char *path, bool wait_for, bool async); SBAttachInfo(const SBAttachInfo &rhs); @@ -79,31 +74,28 @@ public: bool GetWaitForLaunch(); - //------------------------------------------------------------------ /// Set attach by process name settings. /// /// Designed to be used after a call to SBAttachInfo::SetExecutable(). /// This function implies that a call to SBTarget::Attach(...) will /// be synchronous. /// - /// @param[in] b + /// \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(). /// Future calls to SBTarget::Attach(...) will be synchronous or /// asynchronous depending on the \a async argument. /// - /// @param[in] b + /// \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. /// - /// @param[in] async + /// \param[in] async /// If \b false, then the SBTarget::Attach(...) call will be a /// synchronous call with no way to cancel the attach in /// progress. @@ -113,7 +105,6 @@ public: /// eventually found. If the client wants to cancel the event, /// SBProcess::Stop() can be called and an eStateExited process /// event will be delivered. - //------------------------------------------------------------------ void SetWaitForLaunch(bool b, bool async); bool GetIgnoreExisting(); @@ -158,23 +149,19 @@ public: bool ParentProcessIDIsValid(); - //---------------------------------------------------------------------- /// Get the listener that will be used to receive process events. /// /// If no listener has been set via a call to /// SBAttachInfo::SetListener(), then an invalid SBListener will be /// returned (SBListener::IsValid() will return false). If a listener /// has been set, then the valid listener object will be returned. - //---------------------------------------------------------------------- SBListener GetListener(); - //---------------------------------------------------------------------- /// Set the listener that will be used to receive process events. /// /// By default the SBDebugger, which has a listener, that the SBTarget /// belongs to will listen for the process events. Calling this function /// allows a different listener to be used to listen for process events. - //---------------------------------------------------------------------- void SetListener(SBListener &listener); protected: diff --git a/include/lldb/API/SBBlock.h b/include/lldb/API/SBBlock.h index 112de9673423..0ca92ff0c6ac 100644 --- a/include/lldb/API/SBBlock.h +++ b/include/lldb/API/SBBlock.h @@ -1,9 +1,8 @@ //===-- SBBlock.h -----------------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -29,6 +28,8 @@ public: bool IsInlined() const; + explicit operator bool() const; + bool IsValid() const; const char *GetInlinedName() const; @@ -59,16 +60,14 @@ public: lldb::SBValueList GetVariables(lldb::SBTarget &target, bool arguments, bool locals, bool statics); - //------------------------------------------------------------------ /// Get the inlined block that contains this block. /// - /// @return + /// \return /// If this block is inlined, it will return this block, else /// parent blocks will be searched to see if any contain this /// 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); diff --git a/include/lldb/API/SBBreakpoint.h b/include/lldb/API/SBBreakpoint.h index 2c93bf103e3e..75c0e69a4821 100644 --- a/include/lldb/API/SBBreakpoint.h +++ b/include/lldb/API/SBBreakpoint.h @@ -1,9 +1,8 @@ //===-- SBBreakpoint.h ------------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -37,6 +36,8 @@ public: break_id_t GetID() const; + explicit operator bool() const; + bool IsValid() const; void ClearAllBreakpointSites(); diff --git a/include/lldb/API/SBBreakpointLocation.h b/include/lldb/API/SBBreakpointLocation.h index 4b34bcbf1f28..085bed9399b9 100644 --- a/include/lldb/API/SBBreakpointLocation.h +++ b/include/lldb/API/SBBreakpointLocation.h @@ -1,9 +1,8 @@ //===-- SBBreakpointLocation.h ----------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -28,6 +27,8 @@ public: break_id_t GetID(); + explicit operator bool() const; + bool IsValid() const; lldb::SBAddress GetAddress(); diff --git a/include/lldb/API/SBBreakpointName.h b/include/lldb/API/SBBreakpointName.h index 321f0d784d6f..018238bcd074 100644 --- a/include/lldb/API/SBBreakpointName.h +++ b/include/lldb/API/SBBreakpointName.h @@ -1,9 +1,8 @@ //===-- SBBreakpointName.h ------------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -40,6 +39,8 @@ public: bool operator!=(const lldb::SBBreakpointName &rhs); + explicit operator bool() const; + bool IsValid() const; const char *GetName() const; diff --git a/include/lldb/API/SBBroadcaster.h b/include/lldb/API/SBBroadcaster.h index dc6c50ec0a8a..fc5e8880e9f2 100644 --- a/include/lldb/API/SBBroadcaster.h +++ b/include/lldb/API/SBBroadcaster.h @@ -1,9 +1,8 @@ //===-- SBBroadcaster.h -----------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -26,6 +25,8 @@ public: ~SBBroadcaster(); + explicit operator bool() const; + bool IsValid() const; void Clear(); diff --git a/include/lldb/API/SBCommandInterpreter.h b/include/lldb/API/SBCommandInterpreter.h index f98894478811..6c80e8eb26dc 100644 --- a/include/lldb/API/SBCommandInterpreter.h +++ b/include/lldb/API/SBCommandInterpreter.h @@ -1,9 +1,8 @@ //===-- SBCommandInterpreter.h ----------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -88,6 +87,8 @@ public: static bool EventIsCommandInterpreterEvent(const lldb::SBEvent &event); + explicit operator bool() const; + bool IsValid() const; bool CommandExists(const char *cmd); @@ -189,16 +190,13 @@ public: lldb_private::CommandInterpreter *interpreter_ptr = nullptr); // Access using SBDebugger::GetCommandInterpreter(); - //---------------------------------------------------------------------- /// Return true if the command interpreter is the active IO handler. /// /// This indicates that any input coming into the debugger handles will /// go to the command interpreter and will result in LLDB command line /// commands being executed. - //---------------------------------------------------------------------- bool IsActive(); - //---------------------------------------------------------------------- /// Get the string that needs to be written to the debugger stdin file /// handle when a control character is typed. /// @@ -207,43 +205,34 @@ public: /// terminal, so this function allows GUI programs to emulate this /// functionality. /// - /// @param[in] ch + /// \param[in] ch /// The character that was typed along with the control key /// - /// @return + /// \return /// 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: @@ -256,8 +245,6 @@ protected: private: friend class SBDebugger; - static void InitializeSWIG(); - lldb_private::CommandInterpreter *m_opaque_ptr; }; @@ -275,6 +262,8 @@ class SBCommand { public: SBCommand(); + explicit operator bool() const; + bool IsValid(); const char *GetName(); diff --git a/include/lldb/API/SBCommandReturnObject.h b/include/lldb/API/SBCommandReturnObject.h index 798aa92a7ef2..2877afb9b8b0 100644 --- a/include/lldb/API/SBCommandReturnObject.h +++ b/include/lldb/API/SBCommandReturnObject.h @@ -1,9 +1,8 @@ //===-- SBCommandReturnObject.h ---------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -33,6 +32,8 @@ public: lldb_private::CommandReturnObject *Release(); + explicit operator bool() const; + bool IsValid() const; const char *GetOutput(); @@ -100,7 +101,7 @@ protected: void SetLLDBObjectPtr(lldb_private::CommandReturnObject *ptr); private: - std::unique_ptr<lldb_private::CommandReturnObject> m_opaque_ap; + std::unique_ptr<lldb_private::CommandReturnObject> m_opaque_up; }; } // namespace lldb diff --git a/include/lldb/API/SBCommunication.h b/include/lldb/API/SBCommunication.h index f0016275b634..5b803fc6017c 100644 --- a/include/lldb/API/SBCommunication.h +++ b/include/lldb/API/SBCommunication.h @@ -1,9 +1,8 @@ //===-- SBCommunication.h ---------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -38,6 +37,8 @@ public: SBCommunication(const char *broadcaster_name); ~SBCommunication(); + explicit operator bool() const; + bool IsValid() const; lldb::SBBroadcaster GetBroadcaster(); diff --git a/include/lldb/API/SBCompileUnit.h b/include/lldb/API/SBCompileUnit.h index 4d5f9f36f246..b6b138207d60 100644 --- a/include/lldb/API/SBCompileUnit.h +++ b/include/lldb/API/SBCompileUnit.h @@ -1,9 +1,8 @@ //===-- SBCompileUnit.h -----------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -25,6 +24,8 @@ public: const lldb::SBCompileUnit &operator=(const lldb::SBCompileUnit &rhs); + explicit operator bool() const; + bool IsValid() const; lldb::SBFileSpec GetFileSpec() const; @@ -47,11 +48,10 @@ public: uint32_t FindSupportFileIndex(uint32_t start_idx, const SBFileSpec &sb_file, bool full); - //------------------------------------------------------------------ /// Get all types matching \a type_mask from debug info in this /// compile unit. /// - /// @param[in] type_mask + /// \param[in] type_mask /// A bitfield that consists of one or more bits logically OR'ed /// together from the lldb::TypeClass enumeration. This allows /// you to request only structure types, or only class, struct @@ -59,9 +59,8 @@ public: /// all types found in the debug information for this compile /// unit. /// - /// @return + /// \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(); diff --git a/include/lldb/API/SBData.h b/include/lldb/API/SBData.h index 7ff619e68667..886fe829a469 100644 --- a/include/lldb/API/SBData.h +++ b/include/lldb/API/SBData.h @@ -1,9 +1,8 @@ //===-- SBData.h -----------------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -30,6 +29,8 @@ public: void Clear(); + explicit operator bool() const; + bool IsValid(); size_t GetByteSize(); diff --git a/include/lldb/API/SBDebugger.h b/include/lldb/API/SBDebugger.h index 3f31bf16da8d..417cead24a8c 100644 --- a/include/lldb/API/SBDebugger.h +++ b/include/lldb/API/SBDebugger.h @@ -1,9 +1,8 @@ //===-- SBDebugger.h --------------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -13,7 +12,6 @@ #include <stdio.h> #include "lldb/API/SBDefines.h" -#include "lldb/API/SBInitializerOptions.h" #include "lldb/API/SBPlatform.h" namespace lldb { @@ -23,12 +21,12 @@ public: SBInputReader() = default; ~SBInputReader() = default; - SBError Initialize(lldb::SBDebugger &, - unsigned long (*)(void *, lldb::SBInputReader *, - lldb::InputReaderAction, char const *, - unsigned long), - void *, lldb::InputReaderGranularity, char const *, - char const *, bool); + SBError Initialize(lldb::SBDebugger &sb_debugger, + unsigned long (*callback)(void *, lldb::SBInputReader *, + lldb::InputReaderAction, + char const *, unsigned long), + void *a, lldb::InputReaderGranularity b, char const *c, + char const *d, bool e); void SetIsDone(bool); bool IsActive() const; }; @@ -46,7 +44,8 @@ public: lldb::SBDebugger &operator=(const lldb::SBDebugger &rhs); static void Initialize(); - static lldb::SBError Initialize(SBInitializerOptions &options); + + static lldb::SBError InitializeWithErrorHandling(); static void Terminate(); @@ -63,6 +62,8 @@ public: static void MemoryPressureDetected(); + explicit operator bool() const; + bool IsValid() const; void Clear(); @@ -150,7 +151,7 @@ public: /// Get the name and description of one of the available platforms. /// - /// @param[in] idx + /// \param[in] idx /// Zero-based index of the platform for which info should be retrieved, /// must be less than the value returned by GetNumAvailablePlatforms(). lldb::SBStructuredData GetAvailablePlatformInfoAtIndex(uint32_t idx); @@ -254,15 +255,11 @@ public: SBTypeFormat GetFormatForType(SBTypeNameSpecifier); -#ifndef LLDB_DISABLE_PYTHON SBTypeSummary GetSummaryForType(SBTypeNameSpecifier); -#endif SBTypeFilter GetFilterForType(SBTypeNameSpecifier); -#ifndef LLDB_DISABLE_PYTHON SBTypeSynthetic GetSyntheticForType(SBTypeNameSpecifier); -#endif void RunCommandInterpreter(bool auto_handle_events, bool spawn_thread); diff --git a/include/lldb/API/SBDeclaration.h b/include/lldb/API/SBDeclaration.h index 42cf76963847..d2b423e40fec 100644 --- a/include/lldb/API/SBDeclaration.h +++ b/include/lldb/API/SBDeclaration.h @@ -1,10 +1,9 @@ //===-- SBDeclaration.h -------------------------------------------*- C++ //-*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -26,6 +25,8 @@ public: const lldb::SBDeclaration &operator=(const lldb::SBDeclaration &rhs); + explicit operator bool() const; + bool IsValid() const; lldb::SBFileSpec GetFileSpec() const; @@ -62,7 +63,7 @@ private: void SetDeclaration(const lldb_private::Declaration &lldb_object_ref); - std::unique_ptr<lldb_private::Declaration> m_opaque_ap; + std::unique_ptr<lldb_private::Declaration> m_opaque_up; }; } // namespace lldb diff --git a/include/lldb/API/SBDefines.h b/include/lldb/API/SBDefines.h index c5c9851272f2..838c84cece6d 100644 --- a/include/lldb/API/SBDefines.h +++ b/include/lldb/API/SBDefines.h @@ -1,9 +1,8 @@ //===-- SBDefines.h ---------------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -17,10 +16,6 @@ #include "lldb/lldb-types.h" #include "lldb/lldb-versioning.h" -#ifdef SWIG -#define LLDB_API -#endif - // Forward Declarations namespace lldb { @@ -51,7 +46,6 @@ class LLDB_API SBFileSpecList; class LLDB_API SBFrame; class LLDB_API SBFunction; class LLDB_API SBHostOS; -class LLDB_API SBInitializerOptions; class LLDB_API SBInstruction; class LLDB_API SBInstructionList; class LLDB_API SBLanguageRuntime; diff --git a/include/lldb/API/SBError.h b/include/lldb/API/SBError.h index a27d2d042690..b076f87b7669 100644 --- a/include/lldb/API/SBError.h +++ b/include/lldb/API/SBError.h @@ -1,9 +1,8 @@ //===-- SBError.h -----------------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -47,27 +46,30 @@ public: int SetErrorStringWithFormat(const char *format, ...) __attribute__((format(printf, 2, 3))); + explicit operator bool() const; + bool IsValid() const; bool GetDescription(lldb::SBStream &description); protected: + friend class SBBreakpoint; + friend class SBBreakpointLocation; + friend class SBBreakpointName; friend class SBCommandReturnObject; + friend class SBCommunication; friend class SBData; friend class SBDebugger; - friend class SBCommunication; friend class SBHostOS; friend class SBPlatform; friend class SBProcess; + friend class SBReproducer; friend class SBStructuredData; + friend class SBTarget; friend class SBThread; friend class SBTrace; - friend class SBTarget; friend class SBValue; friend class SBWatchpoint; - friend class SBBreakpoint; - friend class SBBreakpointLocation; - friend class SBBreakpointName; lldb_private::Status *get(); @@ -80,7 +82,7 @@ protected: void SetError(const lldb_private::Status &lldb_error); private: - std::unique_ptr<lldb_private::Status> m_opaque_ap; + std::unique_ptr<lldb_private::Status> m_opaque_up; void CreateIfNeeded(); }; diff --git a/include/lldb/API/SBEvent.h b/include/lldb/API/SBEvent.h index ff15716d853e..d297cbeff671 100644 --- a/include/lldb/API/SBEvent.h +++ b/include/lldb/API/SBEvent.h @@ -1,9 +1,8 @@ //===-- SBEvent.h -----------------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -36,6 +35,8 @@ public: const SBEvent &operator=(const lldb::SBEvent &rhs); + explicit operator bool() const; + bool IsValid() const; const char *GetDataFlavor(); diff --git a/include/lldb/API/SBExecutionContext.h b/include/lldb/API/SBExecutionContext.h index c19d539bc80a..45c0b1b7f97b 100644 --- a/include/lldb/API/SBExecutionContext.h +++ b/include/lldb/API/SBExecutionContext.h @@ -1,10 +1,9 @@ //===-- SBExecutionContext.h -----------------------------------------*- C++ //-*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -51,8 +50,6 @@ public: SBFrame GetFrame() const; protected: - ExecutionContextRefSP &GetSP() const; - void reset(lldb::ExecutionContextRefSP &event_sp); lldb_private::ExecutionContextRef *get() const; diff --git a/include/lldb/API/SBExpressionOptions.h b/include/lldb/API/SBExpressionOptions.h index b861436caf98..04cd74f730f2 100644 --- a/include/lldb/API/SBExpressionOptions.h +++ b/include/lldb/API/SBExpressionOptions.h @@ -1,9 +1,8 @@ -//===-- SBEvent.h -----------------------------------------------*- C++ -*-===// +//===-- SBExpressionOptions.h -----------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -90,17 +89,14 @@ public: bool GetTopLevel(); void SetTopLevel(bool b = true); - + // Gets whether we will JIT an expression if it cannot be interpreted bool GetAllowJIT(); - + // Sets whether we will JIT an expression if it cannot be interpreted void SetAllowJIT(bool allow); protected: - SBExpressionOptions( - lldb_private::EvaluateExpressionOptions &expression_options); - lldb_private::EvaluateExpressionOptions *get() const; lldb_private::EvaluateExpressionOptions &ref() const; @@ -111,7 +107,7 @@ protected: private: // This auto_pointer is made in the constructor and is always valid. - mutable std::unique_ptr<lldb_private::EvaluateExpressionOptions> m_opaque_ap; + mutable std::unique_ptr<lldb_private::EvaluateExpressionOptions> m_opaque_up; }; } // namespace lldb diff --git a/include/lldb/API/SBFileSpec.h b/include/lldb/API/SBFileSpec.h index 9ad1a5df0cfa..27149775901e 100644 --- a/include/lldb/API/SBFileSpec.h +++ b/include/lldb/API/SBFileSpec.h @@ -1,9 +1,8 @@ //===-- SBFileSpec.h --------------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -29,6 +28,12 @@ public: const SBFileSpec &operator=(const lldb::SBFileSpec &rhs); + explicit operator bool() const; + + bool operator==(const SBFileSpec &rhs) const; + + bool operator!=(const SBFileSpec &rhs) const; + bool IsValid() const; bool Exists() const; @@ -59,7 +64,6 @@ private: friend class SBDeclaration; friend class SBFileSpecList; friend class SBHostOS; - friend class SBInitializerOptions; friend class SBLaunchInfo; friend class SBLineEntry; friend class SBModule; @@ -83,7 +87,7 @@ private: const lldb_private::FileSpec &ref() const; - std::unique_ptr<lldb_private::FileSpec> m_opaque_ap; + std::unique_ptr<lldb_private::FileSpec> m_opaque_up; }; } // namespace lldb diff --git a/include/lldb/API/SBFileSpecList.h b/include/lldb/API/SBFileSpecList.h index 97f843adbb5f..5a131509d269 100644 --- a/include/lldb/API/SBFileSpecList.h +++ b/include/lldb/API/SBFileSpecList.h @@ -1,10 +1,9 @@ //===-- SBFileSpecList.h --------------------------------------------*- C++ //-*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -50,7 +49,7 @@ private: const lldb_private::FileSpecList &ref() const; - std::unique_ptr<lldb_private::FileSpecList> m_opaque_ap; + std::unique_ptr<lldb_private::FileSpecList> m_opaque_up; }; } // namespace lldb diff --git a/include/lldb/API/SBFrame.h b/include/lldb/API/SBFrame.h index 1123dade5de2..b213f8985510 100644 --- a/include/lldb/API/SBFrame.h +++ b/include/lldb/API/SBFrame.h @@ -1,9 +1,8 @@ //===-- SBFrame.h -----------------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -27,6 +26,8 @@ public: bool IsEqual(const lldb::SBFrame &that) const; + explicit operator bool() const; + bool IsValid() const; uint32_t GetFrameID() const; diff --git a/include/lldb/API/SBFunction.h b/include/lldb/API/SBFunction.h index 23da02102cfb..43f01d7e57de 100644 --- a/include/lldb/API/SBFunction.h +++ b/include/lldb/API/SBFunction.h @@ -1,9 +1,8 @@ //===-- SBFunction.h --------------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -26,6 +25,8 @@ public: ~SBFunction(); + explicit operator bool() const; + bool IsValid() const; const char *GetName() const; diff --git a/include/lldb/API/SBHostOS.h b/include/lldb/API/SBHostOS.h index 1671917f865c..ecd7920f2c14 100644 --- a/include/lldb/API/SBHostOS.h +++ b/include/lldb/API/SBHostOS.h @@ -1,9 +1,8 @@ //===-- SBHostOS.h ----------------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// diff --git a/include/lldb/API/SBInitializerOptions.h b/include/lldb/API/SBInitializerOptions.h deleted file mode 100644 index 184c82df4f86..000000000000 --- a/include/lldb/API/SBInitializerOptions.h +++ /dev/null @@ -1,43 +0,0 @@ -//===-- SBInitializerOptions.h ----------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -#ifndef LLDB_SBInitializerOptuions_h_ -#define LLDB_SBInitializerOptuions_h_ - -#include "lldb/API/SBDefines.h" -#include "lldb/API/SBFileSpec.h" - -namespace lldb_private { -struct InitializerOptions; -} - -namespace lldb { - -class LLDB_API SBInitializerOptions { -public: - SBInitializerOptions(); - SBInitializerOptions(const lldb::SBInitializerOptions &rhs); - ~SBInitializerOptions(); - const SBInitializerOptions &operator=(const lldb::SBInitializerOptions &rhs); - - void SetCaptureReproducer(bool b); - void SetReplayReproducer(bool b); - void SetReproducerPath(const char *path); - - lldb_private::InitializerOptions &ref() const; - -private: - friend class SBDebugger; - - std::unique_ptr<lldb_private::InitializerOptions> m_opaque_up; -}; - -} // namespace lldb - -#endif // LLDB_SBInitializerOptuions_h_ diff --git a/include/lldb/API/SBInstruction.h b/include/lldb/API/SBInstruction.h index 5ef02b8f696a..0bb587795607 100644 --- a/include/lldb/API/SBInstruction.h +++ b/include/lldb/API/SBInstruction.h @@ -1,9 +1,8 @@ //===-- SBInstruction.h -----------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -32,6 +31,8 @@ public: ~SBInstruction(); + explicit operator bool() const; + bool IsValid(); SBAddress GetAddress(); diff --git a/include/lldb/API/SBInstructionList.h b/include/lldb/API/SBInstructionList.h index c8fed5c83192..4434d50f471f 100644 --- a/include/lldb/API/SBInstructionList.h +++ b/include/lldb/API/SBInstructionList.h @@ -1,9 +1,8 @@ //===-- SBInstructionList.h -------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -26,17 +25,17 @@ public: ~SBInstructionList(); + explicit operator bool() const; + bool IsValid() const; size_t GetSize(); 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); diff --git a/include/lldb/API/SBLanguageRuntime.h b/include/lldb/API/SBLanguageRuntime.h index 3912f352491b..d28c441593ea 100644 --- a/include/lldb/API/SBLanguageRuntime.h +++ b/include/lldb/API/SBLanguageRuntime.h @@ -1,9 +1,8 @@ //===-- SBLanguageRuntime.h -------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// diff --git a/include/lldb/API/SBLaunchInfo.h b/include/lldb/API/SBLaunchInfo.h index 80eea7e42921..c7b381ffdf97 100644 --- a/include/lldb/API/SBLaunchInfo.h +++ b/include/lldb/API/SBLaunchInfo.h @@ -1,9 +1,8 @@ //===-- SBLaunchInfo.h ------------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -43,7 +42,6 @@ public: SBFileSpec GetExecutableFile(); - //---------------------------------------------------------------------- /// Set the executable file that will be used to launch the process and /// optionally set it as the first argument in the argument vector. /// @@ -58,33 +56,28 @@ public: /// SBTarget::Launch(...), the target will use the resolved executable /// path that was used to create the target. /// - /// @param[in] exe_file + /// \param[in] exe_file /// The override path to use when launching the executable. /// - /// @param[in] add_as_first_arg + /// \param[in] add_as_first_arg /// If true, then the path will be inserted into the argument vector /// prior to launching. Otherwise the argument vector will be left /// alone. - //---------------------------------------------------------------------- void SetExecutableFile(SBFileSpec exe_file, bool add_as_first_arg); - //---------------------------------------------------------------------- /// Get the listener that will be used to receive process events. /// /// If no listener has been set via a call to /// SBLaunchInfo::SetListener(), then an invalid SBListener will be /// returned (SBListener::IsValid() will return false). If a listener /// has been set, then the valid listener object will be returned. - //---------------------------------------------------------------------- SBListener GetListener(); - //---------------------------------------------------------------------- /// Set the listener that will be used to receive process events. /// /// By default the SBDebugger, which has a listener, that the SBTarget /// belongs to will listen for the process events. Calling this function /// allows a different listener to be used to listen for process events. - //---------------------------------------------------------------------- void SetListener(SBListener &listener); uint32_t GetNumArguments(); diff --git a/include/lldb/API/SBLineEntry.h b/include/lldb/API/SBLineEntry.h index 3d58ea8278ea..855c28d14b83 100644 --- a/include/lldb/API/SBLineEntry.h +++ b/include/lldb/API/SBLineEntry.h @@ -1,9 +1,8 @@ //===-- SBLineEntry.h -------------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -30,6 +29,8 @@ public: lldb::SBAddress GetEndAddress() const; + explicit operator bool() const; + bool IsValid() const; lldb::SBFileSpec GetFileSpec() const; @@ -69,7 +70,7 @@ private: void SetLineEntry(const lldb_private::LineEntry &lldb_object_ref); - std::unique_ptr<lldb_private::LineEntry> m_opaque_ap; + std::unique_ptr<lldb_private::LineEntry> m_opaque_up; }; } // namespace lldb diff --git a/include/lldb/API/SBListener.h b/include/lldb/API/SBListener.h index a2f82a83c3ed..21aface97bd1 100644 --- a/include/lldb/API/SBListener.h +++ b/include/lldb/API/SBListener.h @@ -1,9 +1,8 @@ //===-- SBListener.h --------------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -30,6 +29,8 @@ public: void Clear(); + explicit operator bool() const; + bool IsValid() const; uint32_t StartListeningForEventClass(SBDebugger &debugger, diff --git a/include/lldb/API/SBMemoryRegionInfo.h b/include/lldb/API/SBMemoryRegionInfo.h index 5675d93b8eaf..2a9ae94218f2 100644 --- a/include/lldb/API/SBMemoryRegionInfo.h +++ b/include/lldb/API/SBMemoryRegionInfo.h @@ -1,9 +1,8 @@ //===-- SBMemoryRegionInfo.h ------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -28,64 +27,50 @@ public: void Clear(); - //------------------------------------------------------------------ /// Get the base address of this memory range. /// - /// @return + /// \return /// The base address of this memory range. - //------------------------------------------------------------------ lldb::addr_t GetRegionBase(); - //------------------------------------------------------------------ /// Get the end address of this memory range. /// - /// @return + /// \return /// The base address of this memory range. - //------------------------------------------------------------------ lldb::addr_t GetRegionEnd(); - //------------------------------------------------------------------ /// Check if this memory address is marked readable to the process. /// - /// @return + /// \return /// true if this memory address is marked readable - //------------------------------------------------------------------ bool IsReadable(); - //------------------------------------------------------------------ /// Check if this memory address is marked writable to the process. /// - /// @return + /// \return /// true if this memory address is marked writable - //------------------------------------------------------------------ bool IsWritable(); - //------------------------------------------------------------------ /// Check if this memory address is marked executable to the process. /// - /// @return + /// \return /// true if this memory address is marked executable - //------------------------------------------------------------------ bool IsExecutable(); - //------------------------------------------------------------------ /// Check if this memory address is mapped into the process address /// space. /// - /// @return + /// \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. /// - /// @return + /// \return /// 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; @@ -105,7 +90,7 @@ private: // Unused. SBMemoryRegionInfo(const lldb_private::MemoryRegionInfo *lldb_object_ptr); - lldb::MemoryRegionInfoUP m_opaque_ap; + lldb::MemoryRegionInfoUP m_opaque_up; }; } // namespace lldb diff --git a/include/lldb/API/SBMemoryRegionInfoList.h b/include/lldb/API/SBMemoryRegionInfoList.h index 1e67997cdaf1..5592efef4851 100644 --- a/include/lldb/API/SBMemoryRegionInfoList.h +++ b/include/lldb/API/SBMemoryRegionInfoList.h @@ -1,9 +1,8 @@ //===-- SBMemoryRegionInfoList.h --------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -48,7 +47,7 @@ private: const lldb_private::MemoryRegionInfos &ref() const; - std::unique_ptr<MemoryRegionInfoListImpl> m_opaque_ap; + std::unique_ptr<MemoryRegionInfoListImpl> m_opaque_up; }; } // namespace lldb diff --git a/include/lldb/API/SBModule.h b/include/lldb/API/SBModule.h index 7a10e9fc96b3..d2b6a18db84d 100644 --- a/include/lldb/API/SBModule.h +++ b/include/lldb/API/SBModule.h @@ -1,9 +1,8 @@ //===-- SBModule.h ----------------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -32,23 +31,22 @@ public: ~SBModule(); + explicit operator bool() const; + bool IsValid() const; void Clear(); - //------------------------------------------------------------------ /// Get const accessor for the module file specification. /// /// This function returns the file for the module on the host system /// that is running LLDB. This can differ from the path on the /// platform since we might be doing remote debugging. /// - /// @return + /// \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 @@ -60,14 +58,12 @@ public: /// '/tmp/lldb/platform-cache/remote.host.computer/usr/lib/liba.dylib' /// The file could also be cached in a local developer kit directory. /// - /// @return + /// \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 @@ -76,12 +72,10 @@ public: /// the target will install this module on the remote platform prior /// to launching. /// - /// @return + /// \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 @@ -96,9 +90,8 @@ public: /// or "./usr/lib", then the install path will be resolved using /// the platform's current working directory as the base path. /// - /// @param[in] file + /// \param[in] file /// A file specification object. - //------------------------------------------------------------------ bool SetRemoteInstallFileSpec(lldb::SBFileSpec &file); lldb::ByteOrder GetByteOrder(); @@ -129,18 +122,16 @@ public: lldb::SBCompileUnit GetCompileUnitAtIndex(uint32_t); - //------------------------------------------------------------------ /// Find compile units related to *this module and passed source /// file. /// - /// @param[in] sb_file_spec + /// \param[in] sb_file_spec /// A lldb::SBFileSpec object that contains source file /// specification. /// - /// @return + /// \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); @@ -157,59 +148,53 @@ public: size_t GetNumSections(); lldb::SBSection GetSectionAtIndex(size_t idx); - //------------------------------------------------------------------ /// Find functions by name. /// - /// @param[in] name + /// \param[in] name /// The name of the function we are looking for. /// - /// @param[in] name_type_mask + /// \param[in] name_type_mask /// A logical OR of one or more FunctionNameType enum bits that /// indicate what kind of names should be used when doing the /// lookup. Bits include fully qualified names, base names, /// C++ methods, or ObjC selectors. /// See FunctionNameType for more details. /// - /// @return + /// \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 + /// \param[in] target /// A valid SBTarget instance representing the debuggee. /// - /// @param[in] name + /// \param[in] name /// The name of the global or static variable we are looking /// for. /// - /// @param[in] max_matches + /// \param[in] max_matches /// Allow the number of matches to be limited to \a max_matches. /// - /// @return + /// \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 + /// \param[in] target /// A valid SBTarget instance representing the debuggee. /// - /// @param[in] name + /// \param[in] name /// The name of the global or static variable we are looking /// for. /// - /// @return + /// \return /// An SBValue that gets filled in with the found variable (if any). - //------------------------------------------------------------------ lldb::SBValue FindFirstGlobalVariable(lldb::SBTarget &target, const char *name); @@ -217,7 +202,6 @@ public: lldb::SBTypeList FindTypes(const char *type); - //------------------------------------------------------------------ /// Get a type using its type ID. /// /// Each symbol file reader will assign different user IDs to their @@ -226,34 +210,30 @@ public: /// /// For DWARF debug info, the type ID is the DIE offset. /// - /// @param[in] uid + /// \param[in] uid /// The type user ID. /// - /// @return + /// \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. /// - /// @param[in] type_mask + /// \param[in] type_mask /// A bitfield that consists of one or more bits logically OR'ed /// together from the lldb::TypeClass enumeration. This allows /// you to request only structure types, or only class, struct /// and union types. Passing in lldb::eTypeClassAny will return /// all types found in the debug information for this module. /// - /// @return + /// \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 @@ -267,7 +247,7 @@ public: /// function with a value of \a versions and \a num_versions that /// has enough storage to store some or all version numbers. /// - /// @param[out] versions + /// \param[out] versions /// A pointer to an array of uint32_t types that is \a num_versions /// long. If this value is NULL, the return value will indicate /// how many version numbers are required for a subsequent call @@ -278,7 +258,7 @@ public: /// will be filled with \a num_versions UINT32_MAX values /// and zero will be returned. /// - /// @param[in] num_versions + /// \param[in] num_versions /// The maximum number of entries to fill into \a versions. If /// this value is zero, then the return value will indicate /// how many version numbers there are in total so another call @@ -288,14 +268,12 @@ public: /// numbers in this object file, only \a num_versions will be /// filled into \a versions (if \a versions is non-NULL). /// - /// @return + /// \return /// 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 @@ -303,9 +281,8 @@ public: /// like '/usr/lib/liba.dylib' then debug information can be located /// in folder like '/usr/lib/liba.dylib.dSYM/'. /// - /// @return + /// \return /// A const reference to the file specification object. - //------------------------------------------------------------------ lldb::SBFileSpec GetSymbolFileSpec() const; lldb::SBAddress GetObjectFileHeaderAddress() const; diff --git a/include/lldb/API/SBModuleSpec.h b/include/lldb/API/SBModuleSpec.h index 1a862703a702..29b3117a261d 100644 --- a/include/lldb/API/SBModuleSpec.h +++ b/include/lldb/API/SBModuleSpec.h @@ -1,9 +1,8 @@ //===-- SBModuleSpec.h ------------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -25,25 +24,24 @@ public: const SBModuleSpec &operator=(const SBModuleSpec &rhs); + explicit operator bool() const; + bool IsValid() const; void Clear(); - //------------------------------------------------------------------ /// Get const accessor for the module file. /// /// This function returns the file for the module on the host system /// that is running LLDB. This can differ from the path on the /// platform since we might be doing remote debugging. /// - /// @return + /// \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 @@ -55,9 +53,8 @@ public: /// '/tmp/lldb/platform-cache/remote.host.computer/usr/lib/liba.dylib' /// The file could also be cached in a local developer kit directory. /// - /// @return + /// \return /// A const reference to the file specification object. - //------------------------------------------------------------------ lldb::SBFileSpec GetPlatformFileSpec(); void SetPlatformFileSpec(const lldb::SBFileSpec &fspec); @@ -87,7 +84,7 @@ private: friend class SBModule; friend class SBTarget; - std::unique_ptr<lldb_private::ModuleSpec> m_opaque_ap; + std::unique_ptr<lldb_private::ModuleSpec> m_opaque_up; }; class SBModuleSpecList { @@ -117,7 +114,7 @@ public: bool GetDescription(lldb::SBStream &description); private: - std::unique_ptr<lldb_private::ModuleSpecList> m_opaque_ap; + std::unique_ptr<lldb_private::ModuleSpecList> m_opaque_up; }; } // namespace lldb diff --git a/include/lldb/API/SBPlatform.h b/include/lldb/API/SBPlatform.h index 952e31066319..7207b2e2a78d 100644 --- a/include/lldb/API/SBPlatform.h +++ b/include/lldb/API/SBPlatform.h @@ -1,9 +1,8 @@ //===-- SBPlatform.h --------------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -92,6 +91,8 @@ public: ~SBPlatform(); + explicit operator bool() const; + bool IsValid() const; void Clear(); @@ -108,9 +109,7 @@ public: bool IsConnected(); - //---------------------------------------------------------------------- // The following functions will work if the platform is connected - //---------------------------------------------------------------------- const char *GetTriple(); const char *GetHostname(); diff --git a/include/lldb/API/SBProcess.h b/include/lldb/API/SBProcess.h index 69cf8b4ce854..863cb3ced674 100644 --- a/include/lldb/API/SBProcess.h +++ b/include/lldb/API/SBProcess.h @@ -1,9 +1,8 @@ //===-- SBProcess.h ---------------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -23,9 +22,7 @@ class SBEvent; class LLDB_API SBProcess { public: - //------------------------------------------------------------------ /// Broadcaster event bits definitions. - //------------------------------------------------------------------ FLAGS_ANONYMOUS_ENUM(){eBroadcastBitStateChanged = (1 << 0), eBroadcastBitInterrupt = (1 << 1), eBroadcastBitSTDOUT = (1 << 2), @@ -52,6 +49,8 @@ public: void Clear(); + explicit operator bool() const; + bool IsValid() const; lldb::SBTarget GetTarget() const; @@ -71,11 +70,9 @@ public: void AppendEventStateReport(const lldb::SBEvent &event, lldb::SBCommandReturnObject &result); - //------------------------------------------------------------------ /// Remote connection related functions. These will fail if the /// process is not in eStateConnected. They are intended for use /// when connecting to an externally managed debugserver instance. - //------------------------------------------------------------------ bool RemoteAttachToProcessWithID(lldb::pid_t pid, lldb::SBError &error); bool RemoteLaunch(char const **argv, char const **envp, @@ -84,9 +81,7 @@ public: uint32_t launch_flags, bool stop_at_entry, lldb::SBError &error); - //------------------------------------------------------------------ // Thread related functions - //------------------------------------------------------------------ uint32_t GetNumThreads(); lldb::SBThread GetThreadAtIndex(size_t index); @@ -97,12 +92,10 @@ public: lldb::SBThread GetSelectedThread() const; - //------------------------------------------------------------------ // Function for lazily creating a thread using the current OS plug-in. This // function will be removed in the future when there are APIs to create // SBThread objects through the interface and add them to the process through // the SBProcess API. - //------------------------------------------------------------------ lldb::SBThread CreateOSPluginThread(lldb::tid_t tid, lldb::addr_t context); bool SetSelectedThread(const lldb::SBThread &thread); @@ -111,16 +104,12 @@ public: bool SetSelectedThreadByIndexID(uint32_t index_id); - //------------------------------------------------------------------ // Queue related functions - //------------------------------------------------------------------ uint32_t GetNumQueues(); lldb::SBQueue GetQueueAtIndex(size_t index); - //------------------------------------------------------------------ // Stepping related functions - //------------------------------------------------------------------ lldb::StateType GetState(); @@ -128,7 +117,6 @@ public: const char *GetExitDescription(); - //------------------------------------------------------------------ /// Gets the process ID /// /// Returns the process identifier for the process as it is known @@ -136,15 +124,13 @@ public: /// this is typically the same as if you called "getpid()" in the /// process. /// - /// @return + /// \return /// Returns LLDB_INVALID_PROCESS_ID if this object does not /// 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 @@ -152,11 +138,10 @@ public: /// create a process with the same process ID, there needs to be a /// way to tell two process instances apart. /// - /// @return + /// \return /// 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; @@ -181,18 +166,16 @@ public: uint32_t GetStopID(bool include_expression_stops = false); - //------------------------------------------------------------------ /// Gets the stop event corresponding to stop ID. // /// Note that it wasn't fully implemented and tracks only the stop /// event for the last natural stop ID. /// - /// @param [in] stop_id + /// \param [in] stop_id /// The ID of the stop event to return. /// - /// @return + /// \return /// The stop event corresponding to stop ID. - //------------------------------------------------------------------ lldb::SBEvent GetStopEventForStopID(uint32_t stop_id); size_t ReadMemory(addr_t addr, void *buf, size_t size, lldb::SBError &error); @@ -235,10 +218,9 @@ public: bool GetDescription(lldb::SBStream &description); - //------------------------------------------------------------------ /// Start Tracing with the given SBTraceOptions. /// - /// @param[in] options + /// \param[in] options /// Class containing trace options like trace buffer size, meta /// data buffer size, TraceType and any custom parameters /// {formatted as a JSON Dictionary}. In case of errors in @@ -253,95 +235,88 @@ public: /// parameters, only the parameters recognized by the target /// would be used and others would be ignored. /// - /// @param[out] error + /// \param[out] error /// An error explaining what went wrong. /// - /// @return + /// \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 + /// \param[in] remote_image_spec /// The path for the shared library on the target what you want /// to load. /// - /// @param[out] error + /// \param[out] error /// An error object that gets filled in with any errors that /// might occur when trying to load the shared library. /// - /// @return + /// \return /// A token that represents the shared library that can be /// 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 + /// \param[in] local_image_spec /// The file spec that points to the shared library that you /// want to load if the library is located on the host. The /// library will be copied over to the location specified by /// remote_image_spec or into the current working directory with /// the same filename if the remote_image_spec isn't specified. /// - /// @param[in] remote_image_spec + /// \param[in] remote_image_spec /// If local_image_spec is specified then the location where the /// library should be copied over from the host. If /// local_image_spec isn't specified, then the path for the /// shared library on the target what you want to load. /// - /// @param[out] error + /// \param[out] error /// An error object that gets filled in with any errors that /// might occur when trying to load the shared library. /// - /// @return + /// \return /// A token that represents the shared library that can be /// 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. /// - /// @param[in] image_spec + /// \param[in] image_spec /// The name of the shared library that you want to load. /// If image_spec is a relative path, the relative path will be /// appended to the search paths. /// If the image_spec is an absolute path, just the basename is used. /// - /// @param[in] paths + /// \param[in] paths /// A list of paths to search for the library whose basename is /// local_spec. /// - /// @param[out] loaded_path + /// \param[out] loaded_path /// If the library was found along the paths, this will store the /// full path to the found library. /// - /// @param[out] error + /// \param[out] error /// An error object that gets filled in with any errors that /// might occur when trying to search for the shared library. /// - /// @return + /// \return /// A token that represents the shared library that can be /// 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, @@ -351,7 +326,6 @@ public: lldb::SBError SendEventData(const char *data); - //------------------------------------------------------------------ /// Return the number of different thread-origin extended backtraces /// this process can support. /// @@ -360,25 +334,22 @@ public: /// or the work item was enqueued to it (in the case of a libdispatch /// queue). /// - /// @return + /// \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. /// - /// @param [in] idx + /// \param [in] idx /// The index of the name to return. They will be returned in /// the order that the user will most likely want to see them. /// e.g. if the type at index 0 is not available for a thread, /// see if the type at index 1 provides an extended backtrace. /// - /// @return + /// \return /// The name at that index. - //------------------------------------------------------------------ const char *GetExtendedBacktraceTypeAtIndex(uint32_t idx); lldb::SBThreadCollection GetHistoryThreads(addr_t addr); @@ -388,40 +359,34 @@ public: /// Save the state of the process in a core file (or mini dump on Windows). lldb::SBError SaveCore(const char *file_name); - //------------------------------------------------------------------ /// Query the address load_addr and store the details of the memory /// region that contains it in the supplied SBMemoryRegionInfo object. /// To iterate over all memory regions use GetMemoryRegionList. /// - /// @param[in] load_addr + /// \param[in] load_addr /// The address to be queried. /// - /// @param[out] region_info + /// \param[out] region_info /// A reference to an SBMemoryRegionInfo object that will contain /// the details of the memory region containing load_addr. /// - /// @return + /// \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 + /// \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: diff --git a/include/lldb/API/SBProcessInfo.h b/include/lldb/API/SBProcessInfo.h index 421227f82c2d..86dba9a8e116 100644 --- a/include/lldb/API/SBProcessInfo.h +++ b/include/lldb/API/SBProcessInfo.h @@ -1,9 +1,8 @@ //===-- SBProcessInfo.h -----------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -23,6 +22,8 @@ public: SBProcessInfo &operator=(const SBProcessInfo &rhs); + explicit operator bool() const; + bool IsValid() const; const char *GetName(); @@ -56,7 +57,7 @@ private: void SetProcessInfo(const lldb_private::ProcessInstanceInfo &proc_info_ref); - std::unique_ptr<lldb_private::ProcessInstanceInfo> m_opaque_ap; + std::unique_ptr<lldb_private::ProcessInstanceInfo> m_opaque_up; }; } // namespace lldb diff --git a/include/lldb/API/SBQueue.h b/include/lldb/API/SBQueue.h index 53612c0a125f..0124c1c90dd2 100644 --- a/include/lldb/API/SBQueue.h +++ b/include/lldb/API/SBQueue.h @@ -1,9 +1,8 @@ //===-- SBQueue.h -----------------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -29,6 +28,8 @@ public: ~SBQueue(); + explicit operator bool() const; + bool IsValid() const; void Clear(); @@ -59,10 +60,6 @@ protected: void SetQueue(const lldb::QueueSP &queue_sp); - void FetchThreads(); - - void FetchItems(); - private: std::shared_ptr<lldb_private::QueueImpl> m_opaque_sp; }; diff --git a/include/lldb/API/SBQueueItem.h b/include/lldb/API/SBQueueItem.h index 78ca3ba02db1..455a1f98379a 100644 --- a/include/lldb/API/SBQueueItem.h +++ b/include/lldb/API/SBQueueItem.h @@ -1,9 +1,8 @@ //===-- SBQueueItem.h -------------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -23,6 +22,8 @@ public: ~SBQueueItem(); + explicit operator bool() const; + bool IsValid() const; void Clear(); diff --git a/include/lldb/API/SBReproducer.h b/include/lldb/API/SBReproducer.h new file mode 100644 index 000000000000..0f1739d0c5bd --- /dev/null +++ b/include/lldb/API/SBReproducer.h @@ -0,0 +1,28 @@ +//===-- SBReproducer.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. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef LLDB_API_SBREPRODUCER_H +#define LLDB_API_SBREPRODUCER_H + +#include "lldb/API/SBDefines.h" + +namespace lldb { + +/// The SBReproducer class is special because it bootstraps the capture and +/// replay of SB API calls. As a result we cannot rely on any other SB objects +/// in the interface or implementation of this class. +class LLDB_API SBReproducer { +public: + static const char *Capture(); + static const char *Capture(const char *path); + static const char *Replay(const char *path); +}; + +} // namespace lldb + +#endif diff --git a/include/lldb/API/SBSection.h b/include/lldb/API/SBSection.h index ffd8bf7c979b..06a195ee78df 100644 --- a/include/lldb/API/SBSection.h +++ b/include/lldb/API/SBSection.h @@ -1,9 +1,8 @@ //===-- SBSection.h ---------------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -25,6 +24,8 @@ public: const lldb::SBSection &operator=(const lldb::SBSection &rhs); + explicit operator bool() const; + bool IsValid() const; const char *GetName(); @@ -53,7 +54,6 @@ public: SectionType GetSectionType(); - //------------------------------------------------------------------ /// Gets the permissions (RWX) of the section of the object file /// /// Returns a mask of bits of enum lldb::Permissions for this section. @@ -62,21 +62,18 @@ public: /// i.e. for a section having read and execute permissions, the value /// returned is 6 /// - /// @return + /// \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 /// CODE or DATA buses. /// - /// @return + /// \return /// The number of host (8-bit) bytes needed to hold a target byte - //------------------------------------------------------------------ uint32_t GetTargetByteSize(); bool operator==(const lldb::SBSection &rhs); diff --git a/include/lldb/API/SBSourceManager.h b/include/lldb/API/SBSourceManager.h index 6f1c49504d52..3d69aa25a934 100644 --- a/include/lldb/API/SBSourceManager.h +++ b/include/lldb/API/SBSourceManager.h @@ -1,9 +1,8 @@ //===-- SBSourceManager.h ---------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -39,10 +38,8 @@ protected: friend class SBCommandInterpreter; friend class SBDebugger; - SBSourceManager(lldb_private::SourceManager *source_manager); - private: - std::unique_ptr<lldb_private::SourceManagerImpl> m_opaque_ap; + std::unique_ptr<lldb_private::SourceManagerImpl> m_opaque_up; }; } // namespace lldb diff --git a/include/lldb/API/SBStream.h b/include/lldb/API/SBStream.h index 7364ca7797f8..8afbf4575621 100644 --- a/include/lldb/API/SBStream.h +++ b/include/lldb/API/SBStream.h @@ -1,9 +1,8 @@ //===-- SBStream.h ----------------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -24,6 +23,8 @@ public: ~SBStream(); + explicit operator bool() const; + bool IsValid() const; // If this stream is not redirected to a file, it will maintain a local cache @@ -95,7 +96,7 @@ protected: private: DISALLOW_COPY_AND_ASSIGN(SBStream); - std::unique_ptr<lldb_private::Stream> m_opaque_ap; + std::unique_ptr<lldb_private::Stream> m_opaque_up; bool m_is_file; }; diff --git a/include/lldb/API/SBStringList.h b/include/lldb/API/SBStringList.h index 943384e544cd..1df1e45f96fe 100644 --- a/include/lldb/API/SBStringList.h +++ b/include/lldb/API/SBStringList.h @@ -1,9 +1,8 @@ //===-- SBStringList.h ------------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -24,6 +23,8 @@ public: ~SBStringList(); + explicit operator bool() const; + bool IsValid() const; void AppendString(const char *str); @@ -56,7 +57,7 @@ protected: const lldb_private::StringList &operator*() const; private: - std::unique_ptr<lldb_private::StringList> m_opaque_ap; + std::unique_ptr<lldb_private::StringList> m_opaque_up; }; } // namespace lldb diff --git a/include/lldb/API/SBStructuredData.h b/include/lldb/API/SBStructuredData.h index 629d4f3e35ee..5b10133500ef 100644 --- a/include/lldb/API/SBStructuredData.h +++ b/include/lldb/API/SBStructuredData.h @@ -1,9 +1,8 @@ //===-- SBStructuredData.h --------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -29,6 +28,8 @@ public: lldb::SBStructuredData &operator=(const lldb::SBStructuredData &rhs); + explicit operator bool() const; + bool IsValid() const; lldb::SBError SetFromJSON(lldb::SBStream &stream); @@ -39,69 +40,51 @@ public: lldb::SBError GetDescription(lldb::SBStream &stream) const; - //------------------------------------------------------------------ /// Return the type of data in this data structure - //------------------------------------------------------------------ lldb::StructuredDataType GetType() const; - //------------------------------------------------------------------ /// Return the size (i.e. number of elements) in this data structure /// if it is an array or dictionary type. For other types, 0 will be // returned. - //------------------------------------------------------------------ size_t GetSize() const; - //------------------------------------------------------------------ /// Fill keys with the keys in this object and return true if this data /// structure is a dictionary. Returns false otherwise. - //------------------------------------------------------------------ bool GetKeys(lldb::SBStringList &keys) const; - //------------------------------------------------------------------ /// Return the value corresponding to a key if this data structure /// is a dictionary type. - //------------------------------------------------------------------ lldb::SBStructuredData GetValueForKey(const char *key) const; - //------------------------------------------------------------------ /// Return the value corresponding to an index if this data structure /// is array. - //------------------------------------------------------------------ lldb::SBStructuredData GetItemAtIndex(size_t idx) const; - //------------------------------------------------------------------ /// Return the integer value if this data structure is an integer type. - //------------------------------------------------------------------ uint64_t GetIntegerValue(uint64_t fail_value = 0) const; - //------------------------------------------------------------------ /// Return the floating point value if this data structure is a floating /// type. - //------------------------------------------------------------------ double GetFloatValue(double fail_value = 0.0) const; - //------------------------------------------------------------------ /// Return the boolean value if this data structure is a boolean type. - //------------------------------------------------------------------ bool GetBooleanValue(bool fail_value = false) const; - //------------------------------------------------------------------ /// Provides the string value if this data structure is a string type. /// - /// @param[out] dst + /// \param[out] dst /// pointer where the string value will be written. In case it is null, - /// nothing will be written at @dst. + /// nothing will be written at \a dst. /// - /// @param[in] dst_len - /// max number of characters that can be written at @dst. In case it is - /// zero, nothing will be written at @dst. If this length is not enough - /// to write the complete string value, (dst_len-1) bytes of the string - /// value will be written at @dst followed by a null character. + /// \param[in] dst_len + /// max number of characters that can be written at \a dst. In case it is + /// zero, nothing will be written at \a dst. If this length is not enough + /// to write the complete string value, (\a dst_len - 1) bytes of the + /// string value will be written at \a dst followed by a null character. /// - /// @return + /// \return /// Returns the byte size needed to completely write the string value at - /// @dst in all cases. - //------------------------------------------------------------------ + /// \a dst in all cases. size_t GetStringValue(char *dst, size_t dst_len) const; protected: diff --git a/include/lldb/API/SBSymbol.h b/include/lldb/API/SBSymbol.h index a29ac61d2912..52486b83d1a7 100644 --- a/include/lldb/API/SBSymbol.h +++ b/include/lldb/API/SBSymbol.h @@ -1,9 +1,8 @@ //===-- SBSymbol.h ----------------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -27,6 +26,8 @@ public: const lldb::SBSymbol &operator=(const lldb::SBSymbol &rhs); + explicit operator bool() const; + bool IsValid() const; const char *GetName() const; @@ -54,16 +55,12 @@ public: bool GetDescription(lldb::SBStream &description); - //---------------------------------------------------------------------- // Returns true if the symbol is externally visible in the module that it is // defined in - //---------------------------------------------------------------------- bool IsExternal(); - //---------------------------------------------------------------------- // Returns true if the symbol was synthetically generated from something // other than the actual symbol table itself in the object file. - //---------------------------------------------------------------------- bool IsSynthetic(); protected: diff --git a/include/lldb/API/SBSymbolContext.h b/include/lldb/API/SBSymbolContext.h index 9078b5b789e0..3d16d0989ca1 100644 --- a/include/lldb/API/SBSymbolContext.h +++ b/include/lldb/API/SBSymbolContext.h @@ -1,9 +1,8 @@ //===-- SBSymbolContext.h ---------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -30,6 +29,8 @@ public: ~SBSymbolContext(); + explicit operator bool() const; + bool IsValid() const; const lldb::SBSymbolContext &operator=(const lldb::SBSymbolContext &rhs); @@ -74,7 +75,7 @@ protected: void SetSymbolContext(const lldb_private::SymbolContext *sc_ptr); private: - std::unique_ptr<lldb_private::SymbolContext> m_opaque_ap; + std::unique_ptr<lldb_private::SymbolContext> m_opaque_up; }; } // namespace lldb diff --git a/include/lldb/API/SBSymbolContextList.h b/include/lldb/API/SBSymbolContextList.h index e7299dd5330c..577993ce96dd 100644 --- a/include/lldb/API/SBSymbolContextList.h +++ b/include/lldb/API/SBSymbolContextList.h @@ -1,9 +1,8 @@ //===-- SBSymbolContextList.h -----------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -26,6 +25,8 @@ public: const lldb::SBSymbolContextList & operator=(const lldb::SBSymbolContextList &rhs); + explicit operator bool() const; + bool IsValid() const; uint32_t GetSize() const; @@ -49,7 +50,7 @@ protected: lldb_private::SymbolContextList &operator*() const; private: - std::unique_ptr<lldb_private::SymbolContextList> m_opaque_ap; + std::unique_ptr<lldb_private::SymbolContextList> m_opaque_up; }; } // namespace lldb diff --git a/include/lldb/API/SBTarget.h b/include/lldb/API/SBTarget.h index 18de267fee00..80a7fa00dbc5 100644 --- a/include/lldb/API/SBTarget.h +++ b/include/lldb/API/SBTarget.h @@ -1,9 +1,8 @@ //===-- SBTarget.h ----------------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -29,9 +28,7 @@ class SBPlatform; class LLDB_API SBTarget { public: - //------------------------------------------------------------------ // Broadcaster bits. - //------------------------------------------------------------------ enum { eBroadcastBitBreakpointChanged = (1 << 0), eBroadcastBitModulesLoaded = (1 << 1), @@ -40,22 +37,20 @@ public: eBroadcastBitSymbolsLoaded = (1 << 4) }; - //------------------------------------------------------------------ // Constructors - //------------------------------------------------------------------ SBTarget(); SBTarget(const lldb::SBTarget &rhs); SBTarget(const lldb::TargetSP &target_sp); - //------------------------------------------------------------------ // Destructor - //------------------------------------------------------------------ ~SBTarget(); const lldb::SBTarget &operator=(const lldb::SBTarget &rhs); + explicit operator bool() const; + bool IsValid() const; static bool EventIsTargetEvent(const lldb::SBEvent &event); @@ -71,45 +66,34 @@ public: lldb::SBProcess GetProcess(); - //------------------------------------------------------------------ /// Sets whether we should collect statistics on lldb or not. /// - /// @param[in] v + /// \param[in] v /// A boolean to control the collection. - /// @return - /// void - //------------------------------------------------------------------ void SetCollectingStats(bool v); - //------------------------------------------------------------------ /// Returns whether statistics collection are enabled. /// - /// @return + /// \return /// true if statistics are currently being collected, false /// otherwise. - //------------------------------------------------------------------ bool GetCollectingStats(); - //------------------------------------------------------------------ /// Returns a dump of the collected statistics. /// - /// @return + /// \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 /// validity. /// - /// @return + /// \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. @@ -119,13 +103,11 @@ public: /// have an install location set, it will be installed in the remote /// platform's working directory. /// - /// @return + /// \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 @@ -135,49 +117,48 @@ public: /// optionally re-directed to \a stdin_path, \a stdout_path, and /// \a stderr_path. /// - /// @param[in] listener + /// \param[in] listener /// An optional listener that will receive all process events. /// If \a listener is valid then \a listener will listen to all /// process events. If not valid, then this target's debugger /// (SBTarget::GetDebugger()) will listen to all process events. /// - /// @param[in] argv + /// \param[in] argv /// The argument array. /// - /// @param[in] envp + /// \param[in] envp /// The environment array. /// - /// @param[in] stdin_path + /// \param[in] stdin_path /// The path to use when re-directing the STDIN of the new /// process. If all stdXX_path arguments are nullptr, a pseudo /// terminal will be used. /// - /// @param[in] stdout_path + /// \param[in] stdout_path /// The path to use when re-directing the STDOUT of the new /// process. If all stdXX_path arguments are nullptr, a pseudo /// terminal will be used. /// - /// @param[in] stderr_path + /// \param[in] stderr_path /// The path to use when re-directing the STDERR of the new /// process. If all stdXX_path arguments are nullptr, a pseudo /// terminal will be used. /// - /// @param[in] working_directory + /// \param[in] working_directory /// The working directory to have the child process run in /// - /// @param[in] launch_flags + /// \param[in] launch_flags /// Some launch options specified by logical OR'ing /// lldb::LaunchFlags enumeration values together. /// - /// @param[in] stop_at_entry + /// \param[in] stop_at_entry /// If false do not stop the inferior at the entry point. /// - /// @param[out] error + /// \param[out] error /// An error object. Contains the reason if there is some failure. /// - /// @return + /// \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, @@ -188,16 +169,15 @@ public: SBProcess LoadCore(const char *core_file); SBProcess LoadCore(const char *core_file, lldb::SBError &error); - //------------------------------------------------------------------ /// Launch a new process with sensible defaults. /// - /// @param[in] argv + /// \param[in] argv /// The argument array. /// - /// @param[in] envp + /// \param[in] envp /// The environment array. /// - /// @param[in] working_directory + /// \param[in] working_directory /// The working directory to have the child process run in /// /// Default: listener @@ -211,9 +191,8 @@ public: /// Default: stderr_path /// A pseudo terminal will be used. /// - /// @return + /// \return /// A process object for the newly created process. - //------------------------------------------------------------------ SBProcess LaunchSimple(const char **argv, const char **envp, const char *working_directory); @@ -221,73 +200,67 @@ public: SBProcess Attach(SBAttachInfo &attach_info, SBError &error); - //------------------------------------------------------------------ /// Attach to process with pid. /// - /// @param[in] listener + /// \param[in] listener /// An optional listener that will receive all process events. /// If \a listener is valid then \a listener will listen to all /// process events. If not valid, then this target's debugger /// (SBTarget::GetDebugger()) will listen to all process events. /// - /// @param[in] pid + /// \param[in] pid /// The process ID to attach to. /// - /// @param[out] error + /// \param[out] error /// An error explaining what went wrong if attach fails. /// - /// @return + /// \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 + /// \param[in] listener /// An optional listener that will receive all process events. /// If \a listener is valid then \a listener will listen to all /// process events. If not valid, then this target's debugger /// (SBTarget::GetDebugger()) will listen to all process events. /// - /// @param[in] name + /// \param[in] name /// Basename of process to attach to. /// - /// @param[in] wait_for + /// \param[in] wait_for /// If true wait for a new instance of 'name' to be launched. /// - /// @param[out] error + /// \param[out] error /// An error explaining what went wrong if attach fails. /// - /// @return + /// \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 + /// \param[in] listener /// An optional listener that will receive all process events. /// If \a listener is valid then \a listener will listen to all /// process events. If not valid, then this target's debugger /// (SBTarget::GetDebugger()) will listen to all process events. /// - /// @param[in] url + /// \param[in] url /// The url to connect to, e.g., 'connect://localhost:12345'. /// - /// @param[in] plugin_name + /// \param[in] plugin_name /// The plugin name to be used; can be nullptr. /// - /// @param[out] error + /// \param[out] error /// An error explaining what went wrong if the connect fails. /// - /// @return + /// \return /// A process object for the connected process. - //------------------------------------------------------------------ lldb::SBProcess ConnectRemote(SBListener &listener, const char *url, const char *plugin_name, SBError &error); @@ -317,18 +290,16 @@ public: lldb::SBModule FindModule(const lldb::SBFileSpec &file_spec); - //------------------------------------------------------------------ /// Find compile units related to *this target and passed source /// file. /// - /// @param[in] sb_file_spec + /// \param[in] sb_file_spec /// A lldb::SBFileSpec object that contains source file /// specification. /// - /// @return + /// \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); @@ -338,55 +309,46 @@ public: const char *GetTriple(); - //------------------------------------------------------------------ /// Architecture data byte width accessor /// - /// @return + /// \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 + /// \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 + /// \param[in] section /// The section whose base load address will be set within this /// target. /// - /// @param[in] section_base_addr + /// \param[in] section_base_addr /// The base address for the section. /// - /// @return + /// \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 + /// \param[in] section /// The section whose base load address will be cleared within /// this target. /// - /// @return + /// \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. /// @@ -395,150 +357,132 @@ public: /// this function will allow you to easily and quickly slide all /// module sections. /// - /// @param[in] module + /// \param[in] module /// The module to load. /// - /// @param[in] sections_offset + /// \param[in] sections_offset /// An offset that will be applied to all section file addresses /// (the virtual addresses found in the object file itself). /// - /// @return + /// \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 + /// \param[in] module /// The module to unload. /// - /// @return + /// \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 + /// \param[in] name /// The name of the function we are looking for. /// - /// @param[in] name_type_mask + /// \param[in] name_type_mask /// A logical OR of one or more FunctionNameType enum bits that /// indicate what kind of names should be used when doing the /// lookup. Bits include fully qualified names, base names, /// C++ methods, or ObjC selectors. /// See FunctionNameType for more details. /// - /// @return + /// \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 + /// \param[in] name /// The name of the global or static variable we are looking /// for. /// - /// @param[in] max_matches + /// \param[in] max_matches /// Allow the number of matches to be limited to \a max_matches. /// - /// @return + /// \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 + /// \param[in] name /// The name of the global or static variable we are looking /// for. /// - /// @return + /// \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 + /// \param[in] name /// The pattern to search for global or static variables /// - /// @param[in] max_matches + /// \param[in] max_matches /// Allow the number of matches to be limited to \a max_matches. /// - /// @param[in] matchtype + /// \param[in] matchtype /// The match type to use. /// - /// @return + /// \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 + /// \param[in] name /// The pattern to search for global or static variables /// - /// @param[in] max_matches + /// \param[in] max_matches /// Allow the number of matches to be limited to \a max_matches. /// - /// @param[in] matchtype + /// \param[in] matchtype /// The match type to use. /// - /// @return + /// \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 + /// \param[in] file_addr /// The file address to resolve. /// - /// @return + /// \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 + /// \param[in] vm_addr /// A virtual address from the current process state that is to /// be translated into a section offset address. /// - /// @return + /// \return /// An SBAddress which will be valid if \a vm_addr was /// 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. /// - /// @param[in] stop_id + /// \param[in] stop_id /// Each time a process stops, the process stop ID integer gets /// incremented. These stop IDs are used to identify past times /// and can be used in history objects as a cheap way to store @@ -546,44 +490,41 @@ public: /// UINT32_MAX will always resolve the address using the /// currently loaded sections. /// - /// @param[in] vm_addr + /// \param[in] vm_addr /// A virtual address from the current process state that is to /// be translated into a section offset address. /// - /// @return + /// \return /// An SBAddress which will be valid if \a vm_addr was /// 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 /// bytes, the data read back will preserve the target's byte order. /// - /// @param[in] addr + /// \param[in] addr /// A target address to read from. /// - /// @param[out] buf + /// \param[out] buf /// The buffer to read memory into. /// - /// @param[in] size + /// \param[in] size /// The maximum number of host bytes to read in the buffer passed /// into this call /// - /// @param[out] error + /// \param[out] error /// Status information is written here if the memory read fails. /// - /// @return + /// \return /// The amount of data read in host bytes. - //------------------------------------------------------------------ size_t ReadMemory(const SBAddress addr, void *buf, size_t size, lldb::SBError &error); @@ -684,30 +625,28 @@ public: lldb::SBBreakpoint BreakpointCreateBySBAddress(SBAddress &address); - //------------------------------------------------------------------ /// Create a breakpoint using a scripted resolver. /// - /// @param[in] class_name + /// \param[in] class_name /// This is the name of the class that implements a scripted resolver. /// - /// @param[in] extra_args + /// \param[in] extra_args /// This is an SBStructuredData object that will get passed to the /// constructor of the class in class_name. You can use this to /// reuse the same class, parametrizing with entries from this /// dictionary. /// - /// @param module_list + /// \param module_list /// If this is non-empty, this will be used as the module filter in the /// SearchFilter created for this breakpoint. /// - /// @param file_list + /// \param file_list /// If this is non-empty, this will be used as the comp unit filter in the /// SearchFilter created for this breakpoint. /// - /// @return + /// \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, @@ -715,71 +654,63 @@ public: const SBFileSpecList &file_list, bool request_hardware = false); - //------------------------------------------------------------------ /// Read breakpoints from source_file and return the newly created /// breakpoints in bkpt_list. /// - /// @param[in] source_file + /// \param[in] source_file /// The file from which to read the breakpoints. /// - /// @param[out] new_bps + /// \param[out] new_bps /// A list of the newly created breakpoints. /// - /// @return + /// \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. /// - /// @param[in] source_file + /// \param[in] source_file /// The file from which to read the breakpoints. /// - /// @param[in] matching_names + /// \param[in] matching_names /// Only read in breakpoints whose names match one of the names in this /// list. /// - /// @param[out] new_bps + /// \param[out] new_bps /// A list of the newly created breakpoints. /// - /// @return + /// \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 + /// \param[in] dest_file /// The file to which to write the breakpoints. /// - /// @return + /// \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 + /// \param[in] dest_file /// The file to which to write the breakpoints. /// - /// @param[in] bkpt_list + /// \param[in] bkpt_list /// Only write breakpoints from this list. /// - /// @param[in] append - /// If \btrue, append the breakpoints in bkpt_list to the others + /// \param[in] append + /// If \b true, append the breakpoints in bkpt_list to the others /// serialized in dest_file. If dest_file doesn't exist, then a new /// file will be created and the breakpoints in bkpt_list written to it. /// - /// @return + /// \return /// An SBError detailing any errors in writing in the breakpoints. - //------------------------------------------------------------------ lldb::SBError BreakpointsWriteToFile(SBFileSpec &dest_file, SBBreakpointList &bkpt_list, bool append = false); @@ -905,10 +836,8 @@ protected: friend class SBValue; friend class SBVariablesOptions; - //------------------------------------------------------------------ // Constructors are private, use static Target::Create function to create an // instance of this class. - //------------------------------------------------------------------ lldb::TargetSP GetSP() const; diff --git a/include/lldb/API/SBThread.h b/include/lldb/API/SBThread.h index 63816eef51b7..da8726a2a9b2 100644 --- a/include/lldb/API/SBThread.h +++ b/include/lldb/API/SBThread.h @@ -1,9 +1,8 @@ //===-- SBThread.h ----------------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -40,6 +39,8 @@ public: lldb::SBQueue GetQueue() const; + explicit operator bool() const; + bool IsValid() const; void Clear(); @@ -50,7 +51,6 @@ public: /// See also GetStopReasonDataAtIndex(). size_t GetStopReasonDataCount(); - //-------------------------------------------------------------------------- /// Get information associated with a stop reason. /// /// Breakpoint stop reasons will have data that consists of pairs of @@ -67,7 +67,6 @@ public: /// eStopReasonException N exception data /// eStopReasonExec 0 /// eStopReasonPlanComplete 0 - //-------------------------------------------------------------------------- uint64_t GetStopReasonDataAtIndex(uint32_t idx); bool GetStopReasonExtendedInfoAsJSON(lldb::SBStream &stream); @@ -133,7 +132,6 @@ public: SBError UnwindInnermostExpression(); - //-------------------------------------------------------------------------- /// LLDB currently supports process centric debugging which means when any /// thread in a process stops, all other threads are stopped. The Suspend() /// call here tells our process to suspend a thread and not let it run when @@ -153,7 +151,6 @@ public: /// Suspend() and Resume() functions are not currently reference counted, if /// anyone has the need for them to be reference counted, please let us /// know. - //-------------------------------------------------------------------------- bool Suspend(); bool Suspend(SBError &error); @@ -204,14 +201,7 @@ public: bool SafeToCallFunctions(); -#ifndef SWIG - lldb_private::Thread *operator->(); - - lldb_private::Thread *get(); - -#endif - -protected: +private: friend class SBBreakpoint; friend class SBBreakpointLocation; friend class SBBreakpointCallbackBaton; @@ -222,16 +212,18 @@ protected: friend class SBValue; friend class lldb_private::QueueImpl; friend class SBQueueItem; + friend class SBThreadPlan; void SetThread(const lldb::ThreadSP &lldb_object_sp); -#ifndef SWIG SBError ResumeNewPlan(lldb_private::ExecutionContext &exe_ctx, lldb_private::ThreadPlan *new_plan); -#endif -private: lldb::ExecutionContextRefSP m_opaque_sp; + + lldb_private::Thread *operator->(); + + lldb_private::Thread *get(); }; } // namespace lldb diff --git a/include/lldb/API/SBThreadCollection.h b/include/lldb/API/SBThreadCollection.h index 715b0826b962..1c6b4639c6ef 100644 --- a/include/lldb/API/SBThreadCollection.h +++ b/include/lldb/API/SBThreadCollection.h @@ -1,9 +1,8 @@ //===-- SBThreadCollection.h ------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -24,6 +23,8 @@ public: ~SBThreadCollection(); + explicit operator bool() const; + bool IsValid() const; size_t GetSize(); diff --git a/include/lldb/API/SBThreadPlan.h b/include/lldb/API/SBThreadPlan.h index 5084a427e1b8..007e9e2de21a 100644 --- a/include/lldb/API/SBThreadPlan.h +++ b/include/lldb/API/SBThreadPlan.h @@ -1,9 +1,8 @@ -//===-- SBThread.h ----------------------------------------------*- C++ -*-===// +//===-- SBThreadPlan.h ------------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -31,6 +30,8 @@ public: ~SBThreadPlan(); + explicit operator bool() const; + bool IsValid() const; void Clear(); @@ -41,7 +42,6 @@ public: /// See also GetStopReasonDataAtIndex(). size_t GetStopReasonDataCount(); - //-------------------------------------------------------------------------- /// Get information associated with a stop reason. /// /// Breakpoint stop reasons will have data that consists of pairs of @@ -58,7 +58,6 @@ public: /// eStopReasonException N exception data /// eStopReasonExec 0 /// eStopReasonPlanComplete 0 - //-------------------------------------------------------------------------- uint64_t GetStopReasonDataAtIndex(uint32_t idx); SBThread GetThread() const; @@ -102,11 +101,7 @@ public: SBThreadPlan QueueThreadPlanForStepScripted(const char *script_class_name, SBError &error); -#ifndef SWIG - lldb_private::ThreadPlan *get(); -#endif - -protected: +private: friend class SBBreakpoint; friend class SBBreakpointLocation; friend class SBFrame; @@ -116,11 +111,9 @@ protected: friend class lldb_private::QueueImpl; friend class SBQueueItem; -#ifndef SWIG + lldb_private::ThreadPlan *get(); void SetThreadPlan(const lldb::ThreadPlanSP &lldb_object_sp); -#endif -private: lldb::ThreadPlanSP m_opaque_sp; }; diff --git a/include/lldb/API/SBTrace.h b/include/lldb/API/SBTrace.h index 244a01e5ce11..87c67adac75b 100644 --- a/include/lldb/API/SBTrace.h +++ b/include/lldb/API/SBTrace.h @@ -1,9 +1,8 @@ //===-- SBTrace.h -----------------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -20,25 +19,24 @@ namespace lldb { class LLDB_API SBTrace { public: SBTrace(); - //------------------------------------------------------------------ /// Obtain the trace data as raw bytes. /// - /// @param[out] error + /// \param[out] error /// An error explaining what went wrong. /// - /// @param[in] buf + /// \param[in] buf /// Buffer to write the trace data to. /// - /// @param[in] size + /// \param[in] size /// The size of the buffer used to read the data. This is /// also the size of the data intended to read. It is also /// possible to partially read the trace data for some trace /// technologies by specifying a smaller buffer. /// - /// @param[in] offset + /// \param[in] offset /// The start offset to begin reading the trace data. /// - /// @param[in] thread_id + /// \param[in] thread_id /// Tracing could be started for the complete process or a /// single thread, in the first case the traceid obtained would /// map to all the threads existing within the process and the @@ -46,28 +44,24 @@ public: /// such a scenario to select the trace data for a specific /// thread. /// - /// @return + /// \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. /// - /// @param[out] error + /// \param[out] error /// An error explaining what went wrong. /// - /// @param[in] thread_id + /// \param[in] thread_id /// The trace id could map to a tracing instance for a thread /// or could also map to a group of threads being traced with /// the same trace options. A thread_id is normally optional @@ -81,26 +75,25 @@ public: /// trace id of the process. /// Now if the StopTrace API is called for the whole process, /// thread A will not be stopped and must be stopped separately. - //------------------------------------------------------------------ void StopTrace(SBError &error, lldb::tid_t thread_id = LLDB_INVALID_THREAD_ID); - //------------------------------------------------------------------ /// Get the trace configuration being used for the trace instance. /// The threadid in the SBTraceOptions needs to be set when the /// configuration used by a specific thread is being requested. /// - /// @param[out] options + /// \param[out] options /// The trace options actually used by the trace instance /// would be filled by the API. /// - /// @param[out] error + /// \param[out] error /// An error explaining what went wrong. - //------------------------------------------------------------------ void GetTraceConfig(SBTraceOptions &options, SBError &error); lldb::user_id_t GetTraceUID(); + explicit operator bool() const; + bool IsValid(); protected: diff --git a/include/lldb/API/SBTraceOptions.h b/include/lldb/API/SBTraceOptions.h index c9735e1ca246..4c586bfd55c4 100644 --- a/include/lldb/API/SBTraceOptions.h +++ b/include/lldb/API/SBTraceOptions.h @@ -1,9 +1,8 @@ //===-- SBTraceOptions ------------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -45,6 +44,8 @@ public: lldb::tid_t getThreadID(); + explicit operator bool() const; + bool IsValid(); protected: diff --git a/include/lldb/API/SBType.h b/include/lldb/API/SBType.h index 0dde0257909f..b3f92b7bcd04 100644 --- a/include/lldb/API/SBType.h +++ b/include/lldb/API/SBType.h @@ -1,9 +1,8 @@ //===-- SBType.h ------------------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -26,6 +25,8 @@ public: lldb::SBTypeMember &operator=(const lldb::SBTypeMember &rhs); + explicit operator bool() const; + bool IsValid() const; const char *GetName(); @@ -52,7 +53,7 @@ protected: const lldb_private::TypeMemberImpl &ref() const; - std::unique_ptr<lldb_private::TypeMemberImpl> m_opaque_ap; + std::unique_ptr<lldb_private::TypeMemberImpl> m_opaque_up; }; class SBTypeMemberFunction { @@ -65,6 +66,8 @@ public: lldb::SBTypeMemberFunction &operator=(const lldb::SBTypeMemberFunction &rhs); + explicit operator bool() const; + bool IsValid() const; const char *GetName(); @@ -106,6 +109,8 @@ public: ~SBType(); + explicit operator bool() const; + bool IsValid() const; uint64_t GetByteSize(); @@ -236,6 +241,8 @@ public: lldb::SBTypeList &operator=(const lldb::SBTypeList &rhs); + explicit operator bool() const; + bool IsValid(); void Append(lldb::SBType type); @@ -245,7 +252,7 @@ public: uint32_t GetSize(); private: - std::unique_ptr<lldb_private::TypeListImpl> m_opaque_ap; + std::unique_ptr<lldb_private::TypeListImpl> m_opaque_up; friend class SBModule; friend class SBCompileUnit; }; diff --git a/include/lldb/API/SBTypeCategory.h b/include/lldb/API/SBTypeCategory.h index f44dfc451e44..c0f4cee1d268 100644 --- a/include/lldb/API/SBTypeCategory.h +++ b/include/lldb/API/SBTypeCategory.h @@ -1,10 +1,9 @@ //===-- SBTypeCategory.h --------------------------------------------*- C++ //-*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -23,6 +22,8 @@ public: ~SBTypeCategory(); + explicit operator bool() const; + bool IsValid() const; bool GetEnabled(); @@ -46,9 +47,7 @@ public: uint32_t GetNumFilters(); -#ifndef LLDB_DISABLE_PYTHON uint32_t GetNumSynthetics(); -#endif SBTypeNameSpecifier GetTypeNameSpecifierForFilterAtIndex(uint32_t); @@ -56,43 +55,29 @@ public: SBTypeNameSpecifier GetTypeNameSpecifierForSummaryAtIndex(uint32_t); -#ifndef LLDB_DISABLE_PYTHON SBTypeNameSpecifier GetTypeNameSpecifierForSyntheticAtIndex(uint32_t); -#endif SBTypeFilter GetFilterForType(SBTypeNameSpecifier); SBTypeFormat GetFormatForType(SBTypeNameSpecifier); -#ifndef LLDB_DISABLE_PYTHON SBTypeSummary GetSummaryForType(SBTypeNameSpecifier); -#endif -#ifndef LLDB_DISABLE_PYTHON SBTypeSynthetic GetSyntheticForType(SBTypeNameSpecifier); -#endif -#ifndef LLDB_DISABLE_PYTHON SBTypeFilter GetFilterAtIndex(uint32_t); -#endif SBTypeFormat GetFormatAtIndex(uint32_t); -#ifndef LLDB_DISABLE_PYTHON SBTypeSummary GetSummaryAtIndex(uint32_t); -#endif -#ifndef LLDB_DISABLE_PYTHON SBTypeSynthetic GetSyntheticAtIndex(uint32_t); -#endif bool AddTypeFormat(SBTypeNameSpecifier, SBTypeFormat); bool DeleteTypeFormat(SBTypeNameSpecifier); -#ifndef LLDB_DISABLE_PYTHON bool AddTypeSummary(SBTypeNameSpecifier, SBTypeSummary); -#endif bool DeleteTypeSummary(SBTypeNameSpecifier); @@ -100,11 +85,9 @@ public: bool DeleteTypeFilter(SBTypeNameSpecifier); -#ifndef LLDB_DISABLE_PYTHON bool AddTypeSynthetic(SBTypeNameSpecifier, SBTypeSynthetic); bool DeleteTypeSynthetic(SBTypeNameSpecifier); -#endif lldb::SBTypeCategory &operator=(const lldb::SBTypeCategory &rhs); diff --git a/include/lldb/API/SBTypeEnumMember.h b/include/lldb/API/SBTypeEnumMember.h index f45c234d2c77..2410dbcc2125 100644 --- a/include/lldb/API/SBTypeEnumMember.h +++ b/include/lldb/API/SBTypeEnumMember.h @@ -1,10 +1,9 @@ //===-- SBTypeEnumMember.h --------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -25,6 +24,8 @@ public: SBTypeEnumMember &operator=(const SBTypeEnumMember &rhs); + explicit operator bool() const; + bool IsValid() const; int64_t GetValueAsSigned(); @@ -63,6 +64,8 @@ public: SBTypeEnumMemberList &operator=(const SBTypeEnumMemberList &rhs); + explicit operator bool() const; + bool IsValid(); void Append(SBTypeEnumMember entry); @@ -72,7 +75,7 @@ public: uint32_t GetSize(); private: - std::unique_ptr<lldb_private::TypeEnumMemberListImpl> m_opaque_ap; + std::unique_ptr<lldb_private::TypeEnumMemberListImpl> m_opaque_up; }; } // namespace lldb diff --git a/include/lldb/API/SBTypeFilter.h b/include/lldb/API/SBTypeFilter.h index 19888ba7cfb6..4a0de11d19c4 100644 --- a/include/lldb/API/SBTypeFilter.h +++ b/include/lldb/API/SBTypeFilter.h @@ -1,10 +1,9 @@ //===-- SBTypeFilter.h --------------------------------------------*- C++ //-*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -25,6 +24,8 @@ public: ~SBTypeFilter(); + explicit operator bool() const; + bool IsValid() const; uint32_t GetNumberOfExpressionPaths(); diff --git a/include/lldb/API/SBTypeFormat.h b/include/lldb/API/SBTypeFormat.h index d0429e97ff9c..8a0ac77a1e9d 100644 --- a/include/lldb/API/SBTypeFormat.h +++ b/include/lldb/API/SBTypeFormat.h @@ -1,10 +1,9 @@ //===-- SBTypeFormat.h --------------------------------------------*- C++ //-*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -29,6 +28,8 @@ public: ~SBTypeFormat(); + explicit operator bool() const; + bool IsValid() const; lldb::Format GetFormat(); diff --git a/include/lldb/API/SBTypeNameSpecifier.h b/include/lldb/API/SBTypeNameSpecifier.h index 2a4f09c2068b..9fe449d029c6 100644 --- a/include/lldb/API/SBTypeNameSpecifier.h +++ b/include/lldb/API/SBTypeNameSpecifier.h @@ -1,10 +1,9 @@ //===-- SBTypeNameSpecifier.h --------------------------------------*- C++ //-*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -27,6 +26,8 @@ public: ~SBTypeNameSpecifier(); + explicit operator bool() const; + bool IsValid() const; const char *GetName(); diff --git a/include/lldb/API/SBTypeSummary.h b/include/lldb/API/SBTypeSummary.h index c9ccdff834ce..bb7121f8ae40 100644 --- a/include/lldb/API/SBTypeSummary.h +++ b/include/lldb/API/SBTypeSummary.h @@ -1,10 +1,9 @@ //===-- SBTypeSummary.h -------------------------------------------*- C++ //-*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -24,6 +23,8 @@ public: ~SBTypeSummaryOptions(); + explicit operator bool() const; + bool IsValid(); lldb::LanguageType GetLanguage(); @@ -50,7 +51,7 @@ protected: void SetOptions(const lldb_private::TypeSummaryOptions *lldb_object_ptr); private: - std::unique_ptr<lldb_private::TypeSummaryOptions> m_opaque_ap; + std::unique_ptr<lldb_private::TypeSummaryOptions> m_opaque_up; }; class SBTypeSummary { @@ -80,6 +81,8 @@ public: ~SBTypeSummary(); + explicit operator bool() const; + bool IsValid() const; bool IsFunctionCode(); diff --git a/include/lldb/API/SBTypeSynthetic.h b/include/lldb/API/SBTypeSynthetic.h index 2099df316194..c190643c1ebb 100644 --- a/include/lldb/API/SBTypeSynthetic.h +++ b/include/lldb/API/SBTypeSynthetic.h @@ -1,10 +1,9 @@ //===-- SBTypeSynthetic.h -----------------------------------------*- C++ //-*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -13,8 +12,6 @@ #include "lldb/API/SBDefines.h" -#ifndef LLDB_DISABLE_PYTHON - namespace lldb { class LLDB_API SBTypeSynthetic { @@ -33,6 +30,8 @@ public: ~SBTypeSynthetic(); + explicit operator bool() const; + bool IsValid() const; bool IsClassCode(); @@ -78,6 +77,4 @@ protected: } // namespace lldb -#endif // LLDB_DISABLE_PYTHON - #endif // LLDB_SBTypeSynthetic_h_ diff --git a/include/lldb/API/SBUnixSignals.h b/include/lldb/API/SBUnixSignals.h index d44a508fbb42..c7e99d1f63d1 100644 --- a/include/lldb/API/SBUnixSignals.h +++ b/include/lldb/API/SBUnixSignals.h @@ -1,10 +1,9 @@ //===-- SBUnixSignals.h -----------------------------------------------*- C++ //-*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -27,6 +26,8 @@ public: void Clear(); + explicit operator bool() const; + bool IsValid() const; const char *GetSignalAsCString(int32_t signo) const; diff --git a/include/lldb/API/SBValue.h b/include/lldb/API/SBValue.h index ab5bdfea993d..c36ba20297f0 100644 --- a/include/lldb/API/SBValue.h +++ b/include/lldb/API/SBValue.h @@ -1,9 +1,8 @@ //===-- SBValue.h -----------------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -29,6 +28,8 @@ public: ~SBValue(); + explicit operator bool() const; + bool IsValid(); void Clear(); @@ -111,9 +112,7 @@ public: lldb::SBTypeFilter GetTypeFilter(); -#ifndef LLDB_DISABLE_PYTHON lldb::SBTypeSynthetic GetTypeSynthetic(); -#endif lldb::SBValue GetChildAtIndex(uint32_t idx); @@ -138,7 +137,6 @@ public: lldb::SBValue CreateValueFromData(const char *name, lldb::SBData data, lldb::SBType type); - //------------------------------------------------------------------ /// Get a child value by index from a value. /// /// Structs, unions, classes, arrays and pointers have child @@ -176,22 +174,21 @@ public: /// that aren't in the array bounds using positive or negative /// indexes. /// - /// @param[in] idx + /// \param[in] idx /// The index of the child value to get /// - /// @param[in] use_dynamic + /// \param[in] use_dynamic /// An enumeration that specifies whether to get dynamic values, /// and also if the target can be run to figure out the dynamic /// type of the child value. /// - /// @param[in] can_create_synthetic + /// \param[in] can_create_synthetic /// If \b true, then allow child values to be created by index /// for pointers and arrays for indexes that normally wouldn't /// be allowed. /// - /// @return + /// \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); @@ -218,46 +215,41 @@ public: lldb::SBAddress GetAddress(); - //------------------------------------------------------------------ /// Get an SBData wrapping what this SBValue points to. /// /// This method will dereference the current SBValue, if its /// data type is a T* or T[], and extract item_count elements /// of type T from it, copying their contents in an SBData. /// - /// @param[in] item_idx + /// \param[in] item_idx /// The index of the first item to retrieve. For an array /// this is equivalent to array[item_idx], for a pointer /// to *(pointer + item_idx). In either case, the measurement /// unit for item_idx is the sizeof(T) rather than the byte /// - /// @param[in] item_count + /// \param[in] item_count /// How many items should be copied into the output. By default /// only one item is copied, but more can be asked for. /// - /// @return + /// \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 /// and copy them into an SBData for future use. /// - /// @return + /// \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 @@ -269,10 +261,9 @@ public: /// pointers, references, arrays and more. Again, it does so without /// doing any expensive type completion. /// - /// @return + /// \return /// Returns \b true if the SBValue might have children, or \b /// false otherwise. - //------------------------------------------------------------------ bool MightHaveChildren(); bool IsRuntimeSupportValue(); @@ -307,70 +298,72 @@ public: bool GetExpressionPath(lldb::SBStream &description, bool qualify_cxx_base_classes); + lldb::SBValue EvaluateExpression(const char *expr) const; + lldb::SBValue EvaluateExpression(const char *expr, + const SBExpressionOptions &options) const; + lldb::SBValue EvaluateExpression(const char *expr, + const SBExpressionOptions &options, + const char *name) const; + SBValue(const lldb::ValueObjectSP &value_sp); - //------------------------------------------------------------------ /// Watch this value if it resides in memory. /// /// Sets a watchpoint on the value. /// - /// @param[in] resolve_location + /// \param[in] resolve_location /// Resolve the location of this value once and watch its address. /// This value must currently be set to \b true as watching all /// locations of a variable or a variable path is not yet supported, /// though we plan to support it in the future. /// - /// @param[in] read + /// \param[in] read /// Stop when this value is accessed. /// - /// @param[in] write + /// \param[in] write /// Stop when this value is modified /// - /// @param[out] error + /// \param[out] error /// An error object. Contains the reason if there is some failure. /// - /// @return + /// \return /// An SBWatchpoint object. This object might not be valid upon /// 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. /// - /// @param[in] resolve_location + /// \param[in] resolve_location /// Resolve the location of this value once and watch its address. /// This value must currently be set to \b true as watching all /// locations of a variable or a variable path is not yet supported, /// though we plan to support it in the future. /// - /// @param[in] read + /// \param[in] read /// Stop when this value is accessed. /// - /// @param[in] write + /// \param[in] write /// Stop when this value is modified /// - /// @param[out] error + /// \param[out] error /// An error object. Contains the reason if there is some failure. /// - /// @return + /// \return /// An SBWatchpoint object. This object might not be valid upon /// 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, @@ -379,10 +372,9 @@ public: /// already /// holding the two above-mentioned locks. /// - /// @return + /// \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: @@ -392,7 +384,6 @@ protected: friend class SBThread; friend class SBValueList; - //------------------------------------------------------------------ /// Get the appropriate ValueObjectSP from this SBValue, consulting the /// use_dynamic and use_synthetic options passed in to SetSP when the /// SBValue's contents were set. Since this often requires examining memory, @@ -407,16 +398,15 @@ protected: /// ValueObject.h/cpp or somewhere else convenient. We haven't needed to so /// far. /// - /// @param[in] value_locker + /// \param[in] value_locker /// An object that will hold the Target API, and Process RunLocks, and /// auto-destroy them when it goes out of scope. Currently this is only /// useful in /// SBValue.cpp. /// - /// @return + /// \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 diff --git a/include/lldb/API/SBValueList.h b/include/lldb/API/SBValueList.h index 0242dd7f71a2..d305b3564c2b 100644 --- a/include/lldb/API/SBValueList.h +++ b/include/lldb/API/SBValueList.h @@ -1,9 +1,8 @@ //===-- SBValueList.h -------------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -24,6 +23,8 @@ public: ~SBValueList(); + explicit operator bool() const; + bool IsValid() const; void Clear(); @@ -66,7 +67,7 @@ private: ValueListImpl &ref(); - std::unique_ptr<ValueListImpl> m_opaque_ap; + std::unique_ptr<ValueListImpl> m_opaque_up; }; } // namespace lldb diff --git a/include/lldb/API/SBVariablesOptions.h b/include/lldb/API/SBVariablesOptions.h index 0059a41129c5..e226ce4ae13b 100644 --- a/include/lldb/API/SBVariablesOptions.h +++ b/include/lldb/API/SBVariablesOptions.h @@ -1,10 +1,9 @@ //===-- SBVariablesOptions.h ------------------------------------------*- C++ //-*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -27,6 +26,8 @@ public: ~SBVariablesOptions(); + explicit operator bool() const; + bool IsValid() const; bool GetIncludeArguments() const; @@ -73,7 +74,7 @@ protected: void SetOptions(VariablesOptionsImpl *lldb_object_ptr); private: - std::unique_ptr<VariablesOptionsImpl> m_opaque_ap; + std::unique_ptr<VariablesOptionsImpl> m_opaque_up; }; } // namespace lldb diff --git a/include/lldb/API/SBWatchpoint.h b/include/lldb/API/SBWatchpoint.h index 92d4851fc14d..05ff0ca7e443 100644 --- a/include/lldb/API/SBWatchpoint.h +++ b/include/lldb/API/SBWatchpoint.h @@ -1,9 +1,8 @@ //===-- SBWatchpoint.h ----------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -26,6 +25,12 @@ public: const lldb::SBWatchpoint &operator=(const lldb::SBWatchpoint &rhs); + explicit operator bool() const; + + bool operator==(const SBWatchpoint &rhs) const; + + bool operator!=(const SBWatchpoint &rhs) const; + bool IsValid() const; SBError GetError(); diff --git a/include/lldb/Breakpoint/Breakpoint.h b/include/lldb/Breakpoint/Breakpoint.h index 5861a3be36e1..f561b6d900a1 100644 --- a/include/lldb/Breakpoint/Breakpoint.h +++ b/include/lldb/Breakpoint/Breakpoint.h @@ -1,9 +1,8 @@ //===-- Breakpoint.h --------------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -28,12 +27,9 @@ namespace lldb_private { -//---------------------------------------------------------------------- -/// @class Breakpoint Breakpoint.h "lldb/Breakpoint/Breakpoint.h" Class that +/// \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 @@ -79,17 +75,14 @@ namespace lldb_private { /// subtle point worth observing here is that you don't actually stop at a /// Breakpoint, you always stop at one of its locations. So the "should stop" /// tests are done by the location, not by the breakpoint. -//---------------------------------------------------------------------- class Breakpoint : public std::enable_shared_from_this<Breakpoint>, public Stoppoint { public: - static const ConstString &GetEventIdentifier(); + 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; + enum MatchType { Exact, Regexp, Glob }; private: enum class OptionNames : uint32_t { Names = 0, Hardware, LastOptionName }; @@ -109,9 +102,9 @@ public: ~BreakpointEventData() override; - static const ConstString &GetFlavorString(); + static ConstString GetFlavorString(); - const ConstString &GetFlavor() const override; + ConstString GetFlavor() const override; lldb::BreakpointEventType GetBreakpointEventType() const; @@ -147,19 +140,6 @@ public: DISALLOW_COPY_AND_ASSIGN(BreakpointEventData); }; - class BreakpointPrecondition { - public: - virtual ~BreakpointPrecondition() = default; - - virtual bool EvaluatePrecondition(StoppointCallbackContext &context); - - virtual Status ConfigurePrecondition(Args &options); - - virtual void GetDescription(Stream &stream, lldb::DescriptionLevel level); - }; - - typedef std::shared_ptr<BreakpointPrecondition> BreakpointPreconditionSP; - // Saving & restoring breakpoints: static lldb::BreakpointSP CreateFromStructuredData( Target &target, StructuredData::ObjectSP &data_object_sp, Status &error); @@ -171,173 +151,138 @@ public: virtual StructuredData::ObjectSP SerializeToStructuredData(); static const char *GetSerializationKey() { return "Breakpoint"; } - //------------------------------------------------------------------ /// Destructor. /// /// The destructor is not virtual since there should be no reason to /// subclass breakpoints. The varieties of breakpoints are specified /// instead by providing different resolvers & filters. - //------------------------------------------------------------------ ~Breakpoint() override; - //------------------------------------------------------------------ // Methods - //------------------------------------------------------------------ - //------------------------------------------------------------------ - /// Tell whether this breakpoint is an "internal" breakpoint. @return + /// 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. /// - /// @param[in] module_list + /// \param[in] module_list /// The list of modules to look in for new locations. /// - /// @param[in] send_event + /// \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. /// - /// @param[in] changed_modules + /// \param[in] changed_modules /// The list of modules to look in for new locations. /// - /// @param[in] new_locations + /// \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. /// - /// @param[in] changedModules + /// \param[in] changedModules /// The list of modules to look in for new locations. - /// @param[in] load_event + /// \param[in] load_event /// If \b true then the modules were loaded, if \b false, unloaded. - /// @param[in] delete_locations + /// \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.) /// - /// @param[in] old_module_sp + /// \param[in] old_module_sp /// The old module that is going away. - /// @param[in] new_module_sp + /// \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? /// - /// @param[in] addr + /// \param[in] addr /// The Address specifying the new location. - /// @param[out] new_location + /// \param[out] new_location /// Set to \b true if a new location was created, to \b false if there /// already was a location at this Address. - /// @return + /// \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 + /// \param[in] addr /// The Address specifying the location. - /// @return + /// \return /// 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 + /// \param[in] addr /// The Address specifying the location. - /// @return + /// \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 + /// \param[in] bp_loc_id /// The ID specifying the location. - /// @return + /// \return /// Returns a shared pointer to the location with ID \a bp_loc_id. The /// 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 + /// \param[in] index /// The location index. /// - /// @return + /// \return /// 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 @@ -348,86 +293,61 @@ public: /// This is typically used after the process calls exec, or anytime the /// architecture of the target changes. /// - /// @param[in] arch + /// \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 + /// \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 + /// \param[in] count /// The number of breakpoint hits to ignore. - //------------------------------------------------------------------ void SetIgnoreCount(uint32_t count); - //------------------------------------------------------------------ /// Return the current ignore count/ - /// @return + /// \return /// The number of breakpoint hits to be ignored. - //------------------------------------------------------------------ uint32_t GetIgnoreCount() const; - //------------------------------------------------------------------ - /// Return the current hit count for all locations. @return + /// 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 + /// \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 + /// \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 + /// \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 + /// \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); @@ -442,22 +362,20 @@ public: const char *GetQueueName() const; - //------------------------------------------------------------------ /// Set the callback action invoked when the breakpoint is hit. /// - /// @param[in] callback + /// \param[in] callback /// The method that will get called when the breakpoint is hit. - /// @param[in] baton + /// \param[in] baton /// A void * pointer that will get passed back to the callback function. - /// @param[in] is_synchronous + /// \param[in] is_synchronous /// If \b true the callback will be run on the private event thread /// before the stop event gets reported. If false, the callback will get /// handled on the public event thread after the stop has been posted. /// - /// @return + /// \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); @@ -467,92 +385,72 @@ public: void ClearCallback(); - //------------------------------------------------------------------ /// Set the breakpoint's condition. /// - /// @param[in] 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 + /// \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 + /// \return /// The number locations resolved breakpoint sites. - //------------------------------------------------------------------ size_t GetNumResolvedLocations() const; - //------------------------------------------------------------------ /// Return whether this breakpoint has any resolved locations. /// - /// @return + /// \return /// True if GetNumResolvedLocations > 0 - //------------------------------------------------------------------ bool HasResolvedLocations() const; - //------------------------------------------------------------------ /// Return the number of breakpoint locations. /// - /// @return + /// \return /// The number breakpoint locations. - //------------------------------------------------------------------ size_t GetNumLocations() const; - //------------------------------------------------------------------ /// Put a description of this breakpoint into the stream \a s. /// - /// @param[in] s + /// \param[in] s /// Stream into which to dump the description. /// - /// @param[in] level + /// \param[in] level /// The description level that indicates the detail level to /// provide. /// - /// @see lldb::DescriptionLevel - //------------------------------------------------------------------ + /// \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 /// breakpoint number doesn't have meaning to the user. /// - /// @param[in] kind + /// \param[in] kind /// New "kind" description. - //------------------------------------------------------------------ void SetBreakpointKind(const char *kind) { m_kind_description.assign(kind); } - //------------------------------------------------------------------ /// Return the "kind" description for a breakpoint. /// - /// @return + /// \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 + /// \return /// This breakpoint's Target. - //------------------------------------------------------------------ Target &GetTarget() { return m_target; } const Target &GetTarget() const { return m_target; } @@ -561,13 +459,12 @@ public: void GetResolverDescription(Stream *s); - //------------------------------------------------------------------ /// Find breakpoint locations which match the (filename, line_number) /// description. The breakpoint location collection is to be filled with the /// matching locations. It should be initialized with 0 size by the API /// client. /// - /// @return + /// \return /// True if there is a match /// /// The locations which match the filename and line_number in loc_coll. @@ -575,46 +472,39 @@ public: /// size is 0 and true is returned, it means the breakpoint fully matches /// the /// description. - //------------------------------------------------------------------ - bool GetMatchingFileLine(const ConstString &filename, uint32_t line_number, + 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 + /// \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 + /// \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. /// - /// @param[in] context + /// \param[in] context /// Described the breakpoint event. /// - /// @param[in] bp_loc_id + /// \param[in] bp_loc_id /// Which breakpoint location hit this breakpoint. /// - /// @return + /// \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); @@ -645,7 +535,6 @@ public: } } - //------------------------------------------------------------------ /// Set a pre-condition filter that overrides all user provided /// filters/callbacks etc. /// @@ -656,15 +545,14 @@ public: /// The Precondition should not continue the target, it should return true /// if the condition says to stop and false otherwise. /// - //------------------------------------------------------------------ - void SetPrecondition(BreakpointPreconditionSP precondition_sp) { + void SetPrecondition(lldb::BreakpointPreconditionSP precondition_sp) { m_precondition_sp = precondition_sp; } bool EvaluatePrecondition(StoppointCallbackContext &context); - BreakpointPreconditionSP GetPrecondition() { return m_precondition_sp; } - + lldb::BreakpointPreconditionSP GetPrecondition() { return m_precondition_sp; } + // Produces the OR'ed values for all the names assigned to this breakpoint. const BreakpointName::Permissions &GetPermissions() const { return m_permissions; @@ -686,39 +574,35 @@ public: protected: friend class Target; - //------------------------------------------------------------------ // Protected Methods - //------------------------------------------------------------------ - //------------------------------------------------------------------ /// Constructors and Destructors /// Only the Target can make a breakpoint, and it owns the breakpoint /// lifespans. The constructor takes a filter and a resolver. Up in Target /// there are convenience variants that make breakpoints for some common /// cases. /// - /// @param[in] target + /// \param[in] target /// The target in which the breakpoint will be set. /// - /// @param[in] filter_sp + /// \param[in] filter_sp /// Shared pointer to the search filter that restricts the search domain of /// the breakpoint. /// - /// @param[in] resolver_sp + /// \param[in] resolver_sp /// Shared pointer to the resolver object that will determine breakpoint /// matches. /// - /// @param hardware + /// \param hardware /// If true, request a hardware breakpoint to be used to implement the /// breakpoint locations. /// - /// @param resolve_indirect_symbols + /// \param resolve_indirect_symbols /// If true, and the address of a given breakpoint location in this /// breakpoint is set on an /// 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, @@ -749,9 +633,7 @@ private: // target - primarily from the dummy target to prime new targets. Breakpoint(Target &new_target, Breakpoint &bp_to_copy_from); - //------------------------------------------------------------------ // For Breakpoint only - //------------------------------------------------------------------ bool m_being_created; bool m_hardware; // If this breakpoint is required to use a hardware breakpoint @@ -764,9 +646,9 @@ private: m_filter_sp; // The filter that constrains the breakpoint's domain. lldb::BreakpointResolverSP m_resolver_sp; // The resolver that defines this breakpoint. - BreakpointPreconditionSP m_precondition_sp; // The precondition is a - // breakpoint-level hit filter - // that can be used + lldb::BreakpointPreconditionSP m_precondition_sp; // The precondition is a + // breakpoint-level hit + // filter that can be used // to skip certain breakpoint hits. For instance, exception breakpoints use // this to limit the stop to certain exception classes, while leaving the // condition & callback free for user specification. diff --git a/include/lldb/Breakpoint/BreakpointID.h b/include/lldb/Breakpoint/BreakpointID.h index 5acb942ed2ad..095132988eb2 100644 --- a/include/lldb/Breakpoint/BreakpointID.h +++ b/include/lldb/Breakpoint/BreakpointID.h @@ -1,9 +1,8 @@ //===-- BreakpointID.h ------------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -19,9 +18,7 @@ namespace lldb_private { -//---------------------------------------------------------------------- // class BreakpointID -//---------------------------------------------------------------------- class BreakpointID { public: @@ -51,49 +48,43 @@ public: static bool IsValidIDExpression(llvm::StringRef str); static llvm::ArrayRef<llvm::StringRef> GetRangeSpecifiers(); - //------------------------------------------------------------------ /// Takes an input string containing the description of a breakpoint or /// breakpoint and location and returns a BreakpointID filled out with /// the proper id and location. /// - /// @param[in] input + /// \param[in] input /// A string containing JUST the breakpoint description. - /// @return + /// \return /// If \p input was not a valid breakpoint ID string, returns /// \b llvm::None. Otherwise returns a BreakpointID with members filled /// out accordingly. - //------------------------------------------------------------------ static llvm::Optional<BreakpointID> ParseCanonicalReference(llvm::StringRef input); - //------------------------------------------------------------------ /// Takes an input string and checks to see whether it is a breakpoint name. /// If it is a mal-formed breakpoint name, error will be set to an appropriate /// error string. /// - /// @param[in] input + /// \param[in] input /// A string containing JUST the breakpoint description. - /// @param[out] error + /// \param[out] error /// If the name is a well-formed breakpoint name, set to success, /// otherwise set to an error. - /// @return + /// \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. /// - /// @param[out] break_id + /// \param[out] break_id /// This is the break id. /// - /// @param[out] break_loc_id + /// \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); diff --git a/include/lldb/Breakpoint/BreakpointIDList.h b/include/lldb/Breakpoint/BreakpointIDList.h index 2820b9fdcaa5..c6429220c7ff 100644 --- a/include/lldb/Breakpoint/BreakpointIDList.h +++ b/include/lldb/Breakpoint/BreakpointIDList.h @@ -1,9 +1,8 @@ //===-- BreakpointIDList.h --------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -21,9 +20,7 @@ namespace lldb_private { -//---------------------------------------------------------------------- // class BreakpointIDList -//---------------------------------------------------------------------- class BreakpointIDList { public: diff --git a/include/lldb/Breakpoint/BreakpointList.h b/include/lldb/Breakpoint/BreakpointList.h index c4fc650a29f0..fe10adbda8a6 100644 --- a/include/lldb/Breakpoint/BreakpointList.h +++ b/include/lldb/Breakpoint/BreakpointList.h @@ -1,9 +1,8 @@ //===-- BreakpointList.h ----------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -17,15 +16,11 @@ namespace lldb_private { -//---------------------------------------------------------------------- -/// @class BreakpointList BreakpointList.h "lldb/Breakpoint/BreakpointList.h" +/// \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: @@ -33,81 +28,66 @@ public: ~BreakpointList(); - //------------------------------------------------------------------ /// Add the breakpoint \a bp_sp to the list. /// - /// @param[in] bp_sp + /// \param[in] bp_sp /// Shared pointer to the breakpoint that will get added to the list. /// - /// @result + /// \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. /// - /// @param[in] breakID + /// \param[in] breakID /// The breakpoint ID to seek for. /// - /// @result + /// \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 + /// \param[in] i /// The breakpoint index to seek for. /// - /// @result + /// \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 + /// \param[in] name /// The breakpoint name for which to search. /// - /// @result + /// \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 + /// \result /// The number of elements. - //------------------------------------------------------------------ size_t GetSize() const { std::lock_guard<std::recursive_mutex> guard(m_mutex); return m_breakpoints.size(); } - //------------------------------------------------------------------ /// Removes the breakpoint given by \b breakID from this list. /// - /// @param[in] breakID + /// \param[in] breakID /// The breakpoint index to remove. /// - /// @result + /// \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 @@ -118,43 +98,36 @@ public: /// This is typically used after the process calls exec, or anytime the /// architecture of the target changes. /// - /// @param[in] arch + /// \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. /// - /// @param[in] module_list + /// \param[in] module_list /// The module list that has changed. /// - /// @param[in] load + /// \param[in] load /// \b true if the modules are loaded, \b false if unloaded. /// - /// @param[in] delete_locations + /// \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); @@ -163,12 +136,10 @@ public: void ClearAllBreakpointSites(); - //------------------------------------------------------------------ /// Sets the passed in Locker to hold the Breakpoint List mutex. /// - /// @param[in] locker + /// \param[in] locker /// The locker object that is set. - //------------------------------------------------------------------ void GetListMutex(std::unique_lock<std::recursive_mutex> &lock); protected: diff --git a/include/lldb/Breakpoint/BreakpointLocation.h b/include/lldb/Breakpoint/BreakpointLocation.h index 6448cb16e927..7b27160563a0 100644 --- a/include/lldb/Breakpoint/BreakpointLocation.h +++ b/include/lldb/Breakpoint/BreakpointLocation.h @@ -1,9 +1,8 @@ //===-- BreakpointLocation.h ------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -21,13 +20,10 @@ namespace lldb_private { -//---------------------------------------------------------------------- -/// @class BreakpointLocation BreakpointLocation.h +/// \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 @@ -37,7 +33,6 @@ namespace lldb_private { /// FIXME: Should we also store some fingerprint for the location, so /// we can map one location to the "equivalent location" on rerun? This would /// be useful if you've set options on the locations. -//---------------------------------------------------------------------- class BreakpointLocation : public std::enable_shared_from_this<BreakpointLocation>, @@ -45,100 +40,76 @@ class BreakpointLocation public: ~BreakpointLocation() override; - //------------------------------------------------------------------ - /// Gets the load address for this breakpoint location @return + /// 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 + /// Gets the Address for this breakpoint location \return /// Returns breakpoint location Address. - //------------------------------------------------------------------ Address &GetAddress(); - //------------------------------------------------------------------ - /// Gets the Breakpoint that created this breakpoint location @return + /// 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. /// /// Side Effects: This may evaluate the breakpoint condition, and run the /// callback. So this command may do a considerable amount of work. /// - /// @return + /// \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 + /// \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 + /// \return /// \b true if the breakpoint is set to auto-continue, \b false if not. - //------------------------------------------------------------------ bool IsAutoContinue() const; - //------------------------------------------------------------------ /// Return the current Ignore Count. /// - /// @return + /// \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 + /// \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 /// stop at this breakpoint or not. /// - /// @param[in] callback + /// \param[in] callback /// The method that will get called when the breakpoint is hit. /// - /// @param[in] callback_baton_sp + /// \param[in] callback_baton_sp /// A shared pointer to a Baton that provides the void * needed /// for the callback. /// - /// @see lldb_private::Baton - //------------------------------------------------------------------ + /// \see lldb_private::Baton void SetCallback(BreakpointHitCallback callback, const lldb::BatonSP &callback_baton_sp, bool is_synchronous); @@ -147,31 +118,25 @@ public: void ClearCallback(); - //------------------------------------------------------------------ /// Set the breakpoint location's condition. /// - /// @param[in] 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 + /// \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 + /// \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(); @@ -188,150 +153,122 @@ public: const char *GetQueueName() const; - //------------------------------------------------------------------ // The next section deals with this location's breakpoint sites. - //------------------------------------------------------------------ - //------------------------------------------------------------------ /// Try to resolve the breakpoint site for this location. /// - /// @return + /// \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 + /// \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 + /// 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 + /// \param[in] s /// The stream to which to print the description. /// - /// @param[in] level + /// \param[in] level /// The description level that indicates the detail level to /// provide. /// - /// @see lldb::DescriptionLevel - //------------------------------------------------------------------ + /// \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 /// hasn't been done already /// - /// @return + /// \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. /// - /// @param[in] kind + /// \param[in] kind /// The particular option you are looking up. - /// @return + /// \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. /// - /// @param[in] context + /// \param[in] context /// Described the breakpoint event. /// - /// @param[in] bp_loc_id + /// \param[in] bp_loc_id /// Which breakpoint location hit this breakpoint. /// - /// @return + /// \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 + /// \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 + /// \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 + /// \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. /// - /// @param[in] location + /// \param[in] location /// The location to compare against. /// - /// @return + /// \return /// \b true or \b false as given in the description above. - //------------------------------------------------------------------ bool EquivalentToLocation(BreakpointLocation &location); protected: @@ -340,16 +277,14 @@ protected: friend class Process; friend class StopInfoBreakpoint; - //------------------------------------------------------------------ /// Set the breakpoint site for this location to \a bp_site_sp. /// - /// @param[in] bp_site_sp + /// \param[in] bp_site_sp /// The breakpoint site we are setting for this location. /// - /// @return + /// \return /// \b true if we were successful at setting the breakpoint site, /// \b false otherwise. - //------------------------------------------------------------------ bool SetBreakpointSite(lldb::BreakpointSiteSP &bp_site_sp); void DecrementIgnoreCount(); @@ -363,46 +298,40 @@ private: void UndoBumpHitCount(); - //------------------------------------------------------------------ // Constructors and Destructors // // Only the Breakpoint can make breakpoint locations, and it owns them. - //------------------------------------------------------------------ - //------------------------------------------------------------------ /// Constructor. /// - /// @param[in] owner + /// \param[in] owner /// A back pointer to the breakpoint that owns this location. /// - /// @param[in] addr + /// \param[in] addr /// The Address defining this location. /// - /// @param[in] tid + /// \param[in] tid /// The thread for which this breakpoint location is valid, or /// LLDB_INVALID_THREAD_ID if it is valid for all threads. /// - /// @param[in] hardware + /// \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; bool m_is_indirect; Address m_address; ///< The address defining this location. Breakpoint &m_owner; ///< The breakpoint that produced this object. - std::unique_ptr<BreakpointOptions> m_options_ap; ///< Breakpoint options - ///pointer, nullptr if we're - ///using our breakpoint's - ///options. + std::unique_ptr<BreakpointOptions> m_options_up; ///< Breakpoint options + /// pointer, nullptr if we're + /// using our breakpoint's + /// options. lldb::BreakpointSiteSP m_bp_site_sp; ///< Our breakpoint site (it may be ///shared by more than one location.) lldb::UserExpressionSP m_user_expression_sp; ///< The compiled expression to diff --git a/include/lldb/Breakpoint/BreakpointLocationCollection.h b/include/lldb/Breakpoint/BreakpointLocationCollection.h index 5a188539622b..3da52eb7962a 100644 --- a/include/lldb/Breakpoint/BreakpointLocationCollection.h +++ b/include/lldb/Breakpoint/BreakpointLocationCollection.h @@ -1,9 +1,8 @@ //===-- BreakpointLocationCollection.h --------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -23,165 +22,141 @@ public: BreakpointLocationCollection(); ~BreakpointLocationCollection(); + + BreakpointLocationCollection &operator=(const BreakpointLocationCollection &rhs); - //------------------------------------------------------------------ /// Add the breakpoint \a bp_loc_sp to the list. /// - /// @param[in] bp_sp + /// \param[in] bp_sp /// Shared pointer to the breakpoint location that will get added /// to the list. /// - /// @result + /// \result /// Returns breakpoint location id. - //------------------------------------------------------------------ void Add(const lldb::BreakpointLocationSP &bp_loc_sp); - //------------------------------------------------------------------ /// Removes the breakpoint location given by \b breakID from this /// list. /// - /// @param[in] break_id + /// \param[in] break_id /// The breakpoint index to remove. /// - /// @param[in] break_loc_id + /// \param[in] break_loc_id /// The breakpoint location index in break_id to remove. /// - /// @result + /// \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. /// - /// @param[in] break_id + /// \param[in] break_id /// The breakpoint ID to seek for. /// - /// @param[in] break_loc_id + /// \param[in] break_loc_id /// The breakpoint location ID in \a break_id to seek for. /// - /// @result + /// \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. /// - /// @param[in] breakID + /// \param[in] breakID /// The breakpoint location ID to seek for. /// - /// @param[in] break_loc_id + /// \param[in] break_loc_id /// The breakpoint location ID in \a break_id to seek for. /// - /// @result + /// \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. /// - /// @param[in] i + /// \param[in] i /// The breakpoint location index to seek for. /// - /// @result + /// \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. /// - /// @param[in] i + /// \param[in] i /// The breakpoint location index to seek for. /// - /// @result + /// \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 + /// \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. /// - /// @param[in] context + /// \param[in] context /// This contains the information about this stop. /// - /// @param[in] breakID + /// \param[in] breakID /// This break ID that we hit. /// - /// @return + /// \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. /// - /// @param[in] s + /// \param[in] s /// The stream to which to print the description. /// - /// @param[in] level + /// \param[in] level /// The description level that indicates the detail level to /// provide. /// - /// @see lldb::DescriptionLevel - //------------------------------------------------------------------ + /// \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. /// - /// @param[in] thread + /// \param[in] thread /// The thread against which to test. /// /// 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 + /// \result /// \b true if all breakpoint locations are owned by internal breakpoints, /// \b false otherwise. - //------------------------------------------------------------------ bool IsInternal() const; protected: - //------------------------------------------------------------------ // Classes that inherit from BreakpointLocationCollection can see and modify // these - //------------------------------------------------------------------ private: - //------------------------------------------------------------------ // For BreakpointLocationCollection only - //------------------------------------------------------------------ typedef std::vector<lldb::BreakpointLocationSP> collection; diff --git a/include/lldb/Breakpoint/BreakpointLocationList.h b/include/lldb/Breakpoint/BreakpointLocationList.h index 01ee5b5dcce9..b7e0e49cff83 100644 --- a/include/lldb/Breakpoint/BreakpointLocationList.h +++ b/include/lldb/Breakpoint/BreakpointLocationList.h @@ -1,9 +1,8 @@ //===-- BreakpointLocationList.h --------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -20,12 +19,10 @@ namespace lldb_private { -//---------------------------------------------------------------------- -/// @class BreakpointLocationList BreakpointLocationList.h +/// \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 @@ -37,178 +34,146 @@ class BreakpointLocationList { public: virtual ~BreakpointLocationList(); - //------------------------------------------------------------------ /// Standard "Dump" method. At present it does nothing. - //------------------------------------------------------------------ void Dump(Stream *s) const; - //------------------------------------------------------------------ /// Returns a shared pointer to the breakpoint location at address \a addr - /// const version. /// - /// @param[in] addr + /// \param[in] addr /// The address to look for. /// - /// @result + /// \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. /// - /// @param[in] breakID + /// \param[in] breakID /// The breakpoint location ID to seek for. /// - /// @result + /// \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. /// - /// @param[in] addr + /// \param[in] addr /// The address to match. /// - /// @result + /// \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. /// - /// @param[in] module + /// \param[in] module /// The module to seek in. /// - /// @param[in] + /// \param[in] /// A breakpoint collection that gets any breakpoint locations /// that match \a module appended to. /// - /// @result + /// \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 + /// \param[in] i /// The breakpoint location index to seek for. /// - /// @result + /// \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. /// - /// @param[in] i + /// \param[in] i /// The breakpoint location index to seek for. /// - /// @result + /// \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 + /// \result /// Number of qualifying breakpoint locations. - //------------------------------------------------------------------ size_t GetNumResolvedLocations() const; - //------------------------------------------------------------------ /// Returns the number hit count of all locations in this list. /// - /// @result + /// \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. /// - /// @param[in] context + /// \param[in] context /// This contains the information about this stop. /// - /// @param[in] breakID + /// \param[in] breakID /// This break ID that we hit. /// - /// @return + /// \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 + /// \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. /// - /// @param[in] s + /// \param[in] s /// The stream to which to print the description. /// - /// @param[in] level + /// \param[in] level /// The description level that indicates the detail level to /// provide. /// - /// @see lldb::DescriptionLevel - //------------------------------------------------------------------ + /// \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 + /// \param[in] bp_sp /// Shared pointer to the breakpoint location that will get /// added to the list. /// - /// @result + /// \result /// Returns breakpoint location id. - //------------------------------------------------------------------ lldb::BreakpointLocationSP Create(const Address &addr, bool resolve_indirect_symbols); diff --git a/include/lldb/Breakpoint/BreakpointName.h b/include/lldb/Breakpoint/BreakpointName.h index 5e5a04fe9117..61020a628070 100644 --- a/include/lldb/Breakpoint/BreakpointName.h +++ b/include/lldb/Breakpoint/BreakpointName.h @@ -1,9 +1,8 @@ //===-- BreakpointName.h --------------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -137,13 +136,13 @@ public: } }; - BreakpointName(const ConstString &name, const char *help = nullptr) : + BreakpointName(ConstString name, const char *help = nullptr) : m_name(name), m_options(false) { SetHelp(help); } - BreakpointName(const ConstString &name, + BreakpointName(ConstString name, BreakpointOptions &options, const Permissions &permissions = Permissions(), const char *help = nullptr) : @@ -157,10 +156,10 @@ public: m_permissions(rhs.m_permissions), m_help(rhs.m_help) {} - BreakpointName(const ConstString &name, const Breakpoint &bkpt, + BreakpointName(ConstString name, const Breakpoint &bkpt, const char *help); - const ConstString &GetName() const { return m_name; } + ConstString GetName() const { return m_name; } BreakpointOptions &GetOptions() { return m_options; } const BreakpointOptions &GetOptions() const { return m_options; } diff --git a/include/lldb/Breakpoint/BreakpointOptions.h b/include/lldb/Breakpoint/BreakpointOptions.h index e91df20ed305..cdac5d3dbd75 100644 --- a/include/lldb/Breakpoint/BreakpointOptions.h +++ b/include/lldb/Breakpoint/BreakpointOptions.h @@ -1,9 +1,8 @@ //===-- BreakpointOptions.h -------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -21,11 +20,9 @@ namespace lldb_private { -//---------------------------------------------------------------------- -/// @class BreakpointOptions BreakpointOptions.h +/// \class BreakpointOptions BreakpointOptions.h /// "lldb/Breakpoint/BreakpointOptions.h" Class that manages the options on a /// breakpoint or breakpoint location. -//---------------------------------------------------------------------- class BreakpointOptions { friend class BreakpointLocation; @@ -96,32 +93,26 @@ public: typedef std::shared_ptr<CommandBaton> CommandBatonSP; - //------------------------------------------------------------------ // Constructors and Destructors - //------------------------------------------------------------------ - //------------------------------------------------------------------ /// This constructor allows you to specify all the breakpoint options except /// the callback. That one is more complicated, and better to do by hand. /// - /// @param[in] condition + /// \param[in] condition /// The expression which if it evaluates to \b true if we are to stop /// - /// @param[in] enabled + /// \param[in] enabled /// Is this breakpoint enabled. /// - /// @param[in] ignore + /// \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); @@ -136,17 +127,12 @@ public: static const char *GetSerializationKey() { return "BKPTOptions"; } - //------------------------------------------------------------------ // Operators - //------------------------------------------------------------------ const BreakpointOptions &operator=(const BreakpointOptions &rhs); - //------------------------------------------------------------------ /// Copy over only the options set in the incoming BreakpointOptions. - //------------------------------------------------------------------ void CopyOverSetOptions(const BreakpointOptions &rhs); - //------------------------------------------------------------------ // Callbacks // // Breakpoint callbacks come in two forms, synchronous and asynchronous. @@ -178,21 +164,18 @@ public: // should be the last action the callback does. We will relax this condition // at some point, but it will take a bit of plumbing to get that to work. // - //------------------------------------------------------------------ - //------------------------------------------------------------------ /// Adds a callback to the breakpoint option set. /// - /// @param[in] callback + /// \param[in] callback /// The function to be called when the breakpoint gets hit. /// - /// @param[in] baton_sp + /// \param[in] baton_sp /// A baton which will get passed back to the callback when it is invoked. /// - /// @param[in] synchronous + /// \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); @@ -200,30 +183,25 @@ public: const BreakpointOptions::CommandBatonSP &command_baton_sp, bool synchronous = false); - //------------------------------------------------------------------ /// Returns the command line commands for the callback on this breakpoint. /// - /// @param[out] command_list + /// \param[out] command_list /// The commands will be appended to this list. /// - /// @return + /// \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 + /// \param[in] context /// The context in which the callback is to be invoked. This includes the /// stop event, the /// execution context of the stop (since you might hit the same breakpoint @@ -231,169 +209,128 @@ public: /// whether we are currently executing synchronous or asynchronous /// callbacks. /// - /// @param[in] break_id + /// \param[in] break_id /// The breakpoint ID that owns this option set. /// - /// @param[in] break_loc_id + /// \param[in] break_loc_id /// The breakpoint location ID that owns this option set. /// - /// @return + /// \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 + /// \return /// The synchronicity of our callback. - //------------------------------------------------------------------ bool IsCallbackSynchronous() const { return m_callback_is_synchronous; } - //------------------------------------------------------------------ /// Fetch the baton from the callback. /// - /// @return + /// \return /// The baton. - //------------------------------------------------------------------ Baton *GetBaton(); - //------------------------------------------------------------------ /// Fetch a const version of the baton from the callback. /// - /// @return + /// \return /// The baton. - //------------------------------------------------------------------ const Baton *GetBaton() const; - //------------------------------------------------------------------ // Condition - //------------------------------------------------------------------ - //------------------------------------------------------------------ /// Set the breakpoint option's condition. /// - /// @param[in] 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 + /// \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 + /// \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 + /// \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 + /// \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 + /// \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 + /// \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 + /// \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] + /// Set a callback based on BreakpointOptions::CommandData. \param[in] /// cmd_data /// A UP holding the new'ed CommandData object. /// The breakpoint will take ownership of pointer held by this object. - //------------------------------------------------------------------ void SetCommandDataCallback(std::unique_ptr<CommandData> &cmd_data); void Clear(); @@ -403,9 +340,7 @@ public: } protected: -//------------------------------------------------------------------ // Classes that inherit from BreakpointOptions can see and modify these - //------------------------------------------------------------------ bool IsOptionSet(OptionKind kind) { return m_set_flags.Test(kind); @@ -432,9 +367,7 @@ protected: void SetThreadSpec(std::unique_ptr<ThreadSpec> &thread_spec_up); private: - //------------------------------------------------------------------ // For BreakpointOptions only - //------------------------------------------------------------------ BreakpointHitCallback m_callback; // This is the callback function pointer lldb::BatonSP m_callback_baton_sp; // This is the client data for the callback bool m_baton_is_command_baton; @@ -443,7 +376,7 @@ private: bool m_one_shot; uint32_t m_ignore_count; // Number of times to ignore this breakpoint std::unique_ptr<ThreadSpec> - m_thread_spec_ap; // Thread for which this breakpoint will take + m_thread_spec_up; // Thread for which this breakpoint will take std::string m_condition_text; // The condition to test. size_t m_condition_text_hash; // Its hash, so that locations know when the // condition is updated. diff --git a/include/lldb/Breakpoint/BreakpointPrecondition.h b/include/lldb/Breakpoint/BreakpointPrecondition.h new file mode 100644 index 000000000000..2a9461b52fab --- /dev/null +++ b/include/lldb/Breakpoint/BreakpointPrecondition.h @@ -0,0 +1,30 @@ +//===-- BreakpointPrecondition.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. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef liblldb_BreakpointPrecondition_h_ +#define liblldb_BreakpointPrecondition_h_ + +#include "lldb/lldb-enumerations.h" + +namespace lldb_private { + +class Args; +class Status; +class StoppointCallbackContext; +class Stream; + +class BreakpointPrecondition { +public: + virtual ~BreakpointPrecondition() = default; + virtual bool EvaluatePrecondition(StoppointCallbackContext &context); + virtual Status ConfigurePrecondition(Args &args); + virtual void GetDescription(Stream &stream, lldb::DescriptionLevel level); +}; +} // namespace lldb_private + +#endif diff --git a/include/lldb/Breakpoint/BreakpointResolver.h b/include/lldb/Breakpoint/BreakpointResolver.h index 32008f3dd96f..11e183b33482 100644 --- a/include/lldb/Breakpoint/BreakpointResolver.h +++ b/include/lldb/Breakpoint/BreakpointResolver.h @@ -1,9 +1,8 @@ //===-- BreakpointResolver.h ------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -20,13 +19,10 @@ namespace lldb_private { -//---------------------------------------------------------------------- -/// @class BreakpointResolver BreakpointResolver.h +/// \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 @@ -35,92 +31,73 @@ namespace lldb_private { /// Each Breakpoint has a BreakpointResolver, and it calls either /// ResolveBreakpoint or ResolveBreakpointInModules to tell it to look for new /// breakpoint locations. -//---------------------------------------------------------------------- class BreakpointResolver : public Searcher { friend class Breakpoint; public: - //------------------------------------------------------------------ /// The breakpoint resolver need to have a breakpoint for "ResolveBreakpoint /// to make sense. It can be constructed without a breakpoint, but you have /// to call SetBreakpoint before ResolveBreakpoint. /// - /// @param[in] bkpt + /// \param[in] bkpt /// The breakpoint that owns this resolver. - /// @param[in] resolverType + /// \param[in] resolverType /// The concrete breakpoint resolver type for this breakpoint. /// - /// @result + /// \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 + /// \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 + /// \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 + /// \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 + /// \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 + /// \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 + /// \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 @@ -143,8 +120,6 @@ public: StructuredData::DictionarySP WrapOptionsDict(StructuredData::DictionarySP options_dict_sp); - //------------------------------------------------------------------ - //------------------------------------------------------------------ /// An enumeration for keeping track of the concrete subclass that is /// actually instantiated. Values of this enumeration are kept in the /// BreakpointResolver's SubclassID field. They are used for concrete type @@ -164,7 +139,6 @@ public: // index, and one for UnknownResolver. static const char *g_ty_to_name[LastKnownResolverType + 2]; - //------------------------------------------------------------------ /// getResolverID - Return an ID for the concrete type of this object. This /// is used to implement the LLVM classof checks. This should not be used /// for any other purpose, as the values may change as LLDB evolves. @@ -221,7 +195,6 @@ public: } protected: - //------------------------------------------------------------------ /// Takes a symbol context list of matches which supposedly represent the /// same file and line number in a CU, and find the nearest actual line /// number that matches, and then filter down the matching addresses to @@ -236,7 +209,7 @@ protected: const char *) = delete; lldb::BreakpointLocationSP AddLocation(Address loc_addr, - bool *new_location = NULL); + bool *new_location = nullptr); Breakpoint *m_breakpoint; // This is the breakpoint we add locations to. lldb::addr_t m_offset; // A random offset the user asked us to add to any diff --git a/include/lldb/Breakpoint/BreakpointResolverAddress.h b/include/lldb/Breakpoint/BreakpointResolverAddress.h index 5d8c0b6b7530..949a788282b9 100644 --- a/include/lldb/Breakpoint/BreakpointResolverAddress.h +++ b/include/lldb/Breakpoint/BreakpointResolverAddress.h @@ -1,9 +1,8 @@ //===-- BreakpointResolverAddress.h -----------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -15,12 +14,10 @@ namespace lldb_private { -//---------------------------------------------------------------------- -/// @class BreakpointResolverAddress BreakpointResolverAddress.h +/// \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: diff --git a/include/lldb/Breakpoint/BreakpointResolverFileLine.h b/include/lldb/Breakpoint/BreakpointResolverFileLine.h index 8671cd2e5562..f146a704ca54 100644 --- a/include/lldb/Breakpoint/BreakpointResolverFileLine.h +++ b/include/lldb/Breakpoint/BreakpointResolverFileLine.h @@ -1,9 +1,8 @@ //===-- BreakpointResolverFileLine.h ----------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -14,12 +13,10 @@ namespace lldb_private { -//---------------------------------------------------------------------- -/// @class BreakpointResolverFileLine BreakpointResolverFileLine.h +/// \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: diff --git a/include/lldb/Breakpoint/BreakpointResolverFileRegex.h b/include/lldb/Breakpoint/BreakpointResolverFileRegex.h index db4f67cf3951..963145722e39 100644 --- a/include/lldb/Breakpoint/BreakpointResolverFileRegex.h +++ b/include/lldb/Breakpoint/BreakpointResolverFileRegex.h @@ -1,10 +1,9 @@ //===-- BreakpointResolverFileRegex.h ----------------------------*- C++ //-*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -17,12 +16,10 @@ namespace lldb_private { -//---------------------------------------------------------------------- -/// @class BreakpointResolverFileRegex BreakpointResolverFileRegex.h +/// \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: diff --git a/include/lldb/Breakpoint/BreakpointResolverName.h b/include/lldb/Breakpoint/BreakpointResolverName.h index 416e1aa301b1..85a41b6007f0 100644 --- a/include/lldb/Breakpoint/BreakpointResolverName.h +++ b/include/lldb/Breakpoint/BreakpointResolverName.h @@ -1,9 +1,8 @@ //===-- BreakpointResolverName.h --------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -18,11 +17,9 @@ namespace lldb_private { -//---------------------------------------------------------------------- -/// @class BreakpointResolverName BreakpointResolverName.h +/// \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: @@ -88,7 +85,7 @@ protected: lldb::LanguageType m_language; bool m_skip_prologue; - void AddNameLookup(const ConstString &name, + void AddNameLookup(ConstString name, lldb::FunctionNameType name_type_mask); }; diff --git a/include/lldb/Breakpoint/BreakpointResolverScripted.h b/include/lldb/Breakpoint/BreakpointResolverScripted.h index aaa9cbe4d354..980bb4693d03 100644 --- a/include/lldb/Breakpoint/BreakpointResolverScripted.h +++ b/include/lldb/Breakpoint/BreakpointResolverScripted.h @@ -1,9 +1,8 @@ //===-- BreakpointResolverScripted.h -----------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -17,12 +16,10 @@ namespace lldb_private { -//---------------------------------------------------------------------- -/// @class BreakpointResolverScripted BreakpointResolverScripted.h +/// \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: diff --git a/include/lldb/Breakpoint/BreakpointSite.h b/include/lldb/Breakpoint/BreakpointSite.h index 8d1d69076b1c..51ed84f7bf2d 100644 --- a/include/lldb/Breakpoint/BreakpointSite.h +++ b/include/lldb/Breakpoint/BreakpointSite.h @@ -1,9 +1,8 @@ //===-- BreakpointSite.h ----------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -22,8 +21,7 @@ namespace lldb_private { -//---------------------------------------------------------------------- -/// @class BreakpointSite BreakpointSite.h "lldb/Breakpoint/BreakpointSite.h" +/// \class BreakpointSite BreakpointSite.h "lldb/Breakpoint/BreakpointSite.h" /// Class that manages the actual breakpoint that will be inserted into the /// running program. /// @@ -33,7 +31,6 @@ namespace lldb_private { /// that share this physical site. When the breakpoint is hit, all the /// locations are informed by the breakpoint site. Breakpoint sites are owned /// by the process. -//---------------------------------------------------------------------- class BreakpointSite : public std::enable_shared_from_this<BreakpointSite>, public StoppointLocation { @@ -50,182 +47,142 @@ public: ~BreakpointSite() override; - //---------------------------------------------------------------------- // This section manages the breakpoint traps - //---------------------------------------------------------------------- - //------------------------------------------------------------------ /// Returns the Opcode Bytes for this breakpoint - //------------------------------------------------------------------ uint8_t *GetTrapOpcodeBytes(); - //------------------------------------------------------------------ /// Returns the Opcode Bytes for this breakpoint - const version - //------------------------------------------------------------------ const uint8_t *GetTrapOpcodeBytes() const; - //------------------------------------------------------------------ /// Get the size of the trap opcode for this address - //------------------------------------------------------------------ size_t GetTrapOpcodeMaxByteSize() const; - //------------------------------------------------------------------ /// Sets the trap opcode - //------------------------------------------------------------------ bool SetTrapOpcode(const uint8_t *trap_opcode, uint32_t trap_opcode_size); - //------------------------------------------------------------------ /// Gets the original instruction bytes that were overwritten by the trap - //------------------------------------------------------------------ uint8_t *GetSavedOpcodeBytes(); - //------------------------------------------------------------------ /// Gets the original instruction bytes that were overwritten by the trap /// const version - //------------------------------------------------------------------ const uint8_t *GetSavedOpcodeBytes() const; - //------------------------------------------------------------------ /// Says whether \a addr and size \a size intersects with the address \a /// intersect_addr - //------------------------------------------------------------------ bool IntersectsRange(lldb::addr_t addr, size_t size, lldb::addr_t *intersect_addr, size_t *intersect_size, size_t *opcode_offset) const; - //------------------------------------------------------------------ /// Tells whether the current breakpoint site is enabled or not /// /// This is a low-level enable bit for the breakpoint sites. If a /// breakpoint site has no enabled owners, it should just get removed. This /// enable/disable is for the low-level target code to enable and disable /// breakpoint sites when single stepping, etc. - //------------------------------------------------------------------ bool IsEnabled() const; - //------------------------------------------------------------------ /// Sets whether the current breakpoint site is enabled or not /// - /// @param[in] enabled + /// \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. /// - /// @param[in] context + /// \param[in] context /// This contains the information about this stop. /// - /// @return + /// \return /// \b true if we should stop, \b false otherwise. - //------------------------------------------------------------------ bool ShouldStop(StoppointCallbackContext *context) override; - //------------------------------------------------------------------ /// Standard Dump method /// - /// @param[in] context + /// \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 + /// \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 + /// \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 /// owners /// - /// @param[in] index + /// \param[in] index /// The index in the list of owners for which you wish the owner location. - /// @return + /// \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. /// - /// @param[out] out_collection + /// \param[out] out_collection /// The BreakpointLocationCollection into which to put the owners /// of this breakpoint site. /// - /// @return + /// \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. /// - /// @param[in] thread + /// \param[in] thread /// The thread against which to test. /// /// 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 /// site itself. /// - /// @param[in] s + /// \param[in] s /// The stream to which to print the description. /// - /// @param[in] level + /// \param[in] level /// The description level that indicates the detail level to /// provide. /// - /// @see lldb::DescriptionLevel - //------------------------------------------------------------------ + /// \see lldb::DescriptionLevel void GetDescription(Stream *s, lldb::DescriptionLevel level); - //------------------------------------------------------------------ /// Tell whether a breakpoint has a location at this site. /// - /// @param[in] bp_id + /// \param[in] bp_id /// The breakpoint id to query. /// - /// @result + /// \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 + /// \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; } @@ -242,13 +199,11 @@ private: void BumpHitCounts(); - //------------------------------------------------------------------ /// The method removes the owner at \a break_loc_id from this breakpoint /// list. /// - /// @param[in] context + /// \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. diff --git a/include/lldb/Breakpoint/BreakpointSiteList.h b/include/lldb/Breakpoint/BreakpointSiteList.h index 2f2e31cd3126..b10d119fcce6 100644 --- a/include/lldb/Breakpoint/BreakpointSiteList.h +++ b/include/lldb/Breakpoint/BreakpointSiteList.h @@ -1,9 +1,8 @@ //===-- BreakpointSiteList.h ------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -18,11 +17,9 @@ namespace lldb_private { -//---------------------------------------------------------------------- -/// @class BreakpointSiteList BreakpointSiteList.h +/// \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). @@ -30,123 +27,101 @@ class BreakpointSiteList { friend class Process; public: - //------------------------------------------------------------------ /// Default constructor makes an empty list. - //------------------------------------------------------------------ BreakpointSiteList(); - //------------------------------------------------------------------ /// Destructor, currently does nothing. - //------------------------------------------------------------------ ~BreakpointSiteList(); - //------------------------------------------------------------------ /// Add a BreakpointSite to the list. /// - /// @param[in] bp_site_sp + /// \param[in] bp_site_sp /// A shared pointer to a breakpoint site being added to the list. /// - /// @return + /// \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 + /// 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 + /// \param[in] addr /// The address to look for. /// - /// @result + /// \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 + /// \param[in] breakID /// The breakpoint site ID to seek for. /// - /// @result + /// \result /// 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. /// - /// @param[in] breakID + /// \param[in] breakID /// The breakpoint site ID to seek for. /// - /// @result + /// \result /// 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. /// - /// @param[in] addr + /// \param[in] addr /// The address to match. /// - /// @result + /// \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. /// - /// @param[in] bp_site_id + /// \param[in] bp_site_id /// The breakpoint site id to query. /// - /// @param[in] bp_id + /// \param[in] bp_id /// The breakpoint id to look for in \a bp_site_id. /// - /// @result + /// \result /// True if \a bp_site_id exists in the site list AND \a bp_id is one of the /// owners of that site. - //------------------------------------------------------------------ bool BreakpointSiteContainsBreakpoint(lldb::break_id_t bp_site_id, lldb::break_id_t bp_id); void ForEach(std::function<void(BreakpointSite *)> const &callback); - //------------------------------------------------------------------ /// Removes the breakpoint site given by \b breakID from this list. /// - /// @param[in] breakID + /// \param[in] breakID /// The breakpoint site index to remove. /// - /// @result + /// \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 + /// \param[in] addr /// The address from which to remove a breakpoint site. /// - /// @result + /// \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, @@ -155,27 +130,23 @@ public: typedef void (*BreakpointSiteSPMapFunc)(lldb::BreakpointSiteSP &bp, void *baton); - //------------------------------------------------------------------ /// Enquires of the breakpoint site on in this list with ID \a breakID /// whether we should stop for the breakpoint or not. /// - /// @param[in] context + /// \param[in] context /// This contains the information about this stop. /// - /// @param[in] breakID + /// \param[in] breakID /// This break ID that we hit. /// - /// @return + /// \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 + /// \result /// The number of elements. - //------------------------------------------------------------------ size_t GetSize() const { std::lock_guard<std::recursive_mutex> guard(m_mutex); return m_bp_site_list.size(); diff --git a/include/lldb/Breakpoint/Stoppoint.h b/include/lldb/Breakpoint/Stoppoint.h index 78baa6ce6cbb..f20b10074051 100644 --- a/include/lldb/Breakpoint/Stoppoint.h +++ b/include/lldb/Breakpoint/Stoppoint.h @@ -1,9 +1,8 @@ //===-- Stoppoint.h ---------------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -17,16 +16,12 @@ namespace lldb_private { class Stoppoint { public: - //------------------------------------------------------------------ // Constructors and Destructors - //------------------------------------------------------------------ Stoppoint(); virtual ~Stoppoint(); - //------------------------------------------------------------------ // Methods - //------------------------------------------------------------------ virtual void Dump(Stream *) = 0; virtual bool IsEnabled() = 0; @@ -41,9 +36,7 @@ protected: lldb::break_id_t m_bid; private: - //------------------------------------------------------------------ // For Stoppoint only - //------------------------------------------------------------------ DISALLOW_COPY_AND_ASSIGN(Stoppoint); }; diff --git a/include/lldb/Breakpoint/StoppointCallbackContext.h b/include/lldb/Breakpoint/StoppointCallbackContext.h index 1dac342d3325..c1724a6b276f 100644 --- a/include/lldb/Breakpoint/StoppointCallbackContext.h +++ b/include/lldb/Breakpoint/StoppointCallbackContext.h @@ -1,9 +1,8 @@ //===-- StoppointCallbackContext.h ------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -15,18 +14,14 @@ namespace lldb_private { -//---------------------------------------------------------------------- -/// @class StoppointCallbackContext StoppointCallbackContext.h +/// \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: @@ -35,17 +30,13 @@ public: StoppointCallbackContext(Event *event, const ExecutionContext &exe_ctx, bool synchronously = false); - //------------------------------------------------------------------ /// Clear the object's state. /// /// Sets the event, process and thread to NULL, and the frame index to an /// invalid value. - //------------------------------------------------------------------ void Clear(); - //------------------------------------------------------------------ // Member variables - //------------------------------------------------------------------ Event *event; // This is the event, the callback can modify this to indicate // the meaning of the breakpoint hit ExecutionContextRef diff --git a/include/lldb/Breakpoint/StoppointLocation.h b/include/lldb/Breakpoint/StoppointLocation.h index 5c78d2e3d659..3926f452e564 100644 --- a/include/lldb/Breakpoint/StoppointLocation.h +++ b/include/lldb/Breakpoint/StoppointLocation.h @@ -1,9 +1,8 @@ //===-- StoppointLocation.h -------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -18,9 +17,7 @@ namespace lldb_private { class StoppointLocation { public: - //------------------------------------------------------------------ // Constructors and Destructors - //------------------------------------------------------------------ StoppointLocation(lldb::break_id_t bid, lldb::addr_t m_addr, bool hardware); StoppointLocation(lldb::break_id_t bid, lldb::addr_t m_addr, @@ -28,13 +25,9 @@ public: virtual ~StoppointLocation(); - //------------------------------------------------------------------ // Operators - //------------------------------------------------------------------ - //------------------------------------------------------------------ // Methods - //------------------------------------------------------------------ virtual lldb::addr_t GetLoadAddress() const { return m_addr; } virtual void SetLoadAddress(lldb::addr_t addr) { m_addr = addr; } @@ -60,9 +53,7 @@ public: lldb::break_id_t GetID() const { return m_loc_id; } protected: - //------------------------------------------------------------------ // Classes that inherit from StoppointLocation can see and modify these - //------------------------------------------------------------------ lldb::break_id_t m_loc_id; // Stoppoint location ID lldb::addr_t m_addr; // The load address of this stop point. The base Stoppoint doesn't @@ -85,11 +76,9 @@ protected: void DecrementHitCount(); private: - //------------------------------------------------------------------ // For StoppointLocation only - //------------------------------------------------------------------ DISALLOW_COPY_AND_ASSIGN(StoppointLocation); - StoppointLocation(); // Disallow default constructor + StoppointLocation() = delete; }; } // namespace lldb_private diff --git a/include/lldb/Breakpoint/Watchpoint.h b/include/lldb/Breakpoint/Watchpoint.h index 2aaae37eb095..e71f89b3e384 100644 --- a/include/lldb/Breakpoint/Watchpoint.h +++ b/include/lldb/Breakpoint/Watchpoint.h @@ -1,9 +1,8 @@ //===-- Watchpoint.h --------------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -32,9 +31,9 @@ public: ~WatchpointEventData() override; - static const ConstString &GetFlavorString(); + static ConstString GetFlavorString(); - const ConstString &GetFlavor() const override; + ConstString GetFlavor() const override; lldb::WatchpointEventType GetWatchpointEventType() const; @@ -98,30 +97,26 @@ public: Target &GetTarget() { return m_target; } const Status &GetError() { return m_error; } - //------------------------------------------------------------------ /// Returns the WatchpointOptions structure set for this watchpoint. /// - /// @return + /// \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 + /// \param[in] callback /// The method that will get called when the watchpoint is hit. - /// @param[in] callback_baton + /// \param[in] callback_baton /// A void * pointer that will get passed back to the callback function. - /// @param[in] is_synchronous + /// \param[in] is_synchronous /// If \b true the callback will be run on the private event thread /// before the stop event gets reported. If false, the callback will get /// handled on the public event thread after the stop has been posted. /// - /// @return + /// \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); @@ -131,36 +126,28 @@ public: void ClearCallback(); - //------------------------------------------------------------------ /// Invoke the callback action when the watchpoint is hit. /// - /// @param[in] context + /// \param[in] context /// Described the watchpoint event. /// - /// @return + /// \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 + /// \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 + /// \return /// A pointer to the condition expression text, or nullptr if no // condition has been set. - //------------------------------------------------------------------ const char *GetConditionText() const; void TurnOnEphemeralMode(); @@ -214,7 +201,7 @@ private: // the callback machinery. bool m_being_created; - std::unique_ptr<UserExpression> m_condition_ap; // The condition to test. + std::unique_ptr<UserExpression> m_condition_up; // The condition to test. void SetID(lldb::watch_id_t id) { m_loc_id = id; } diff --git a/include/lldb/Breakpoint/WatchpointList.h b/include/lldb/Breakpoint/WatchpointList.h index 9bfa817456bc..98c64832d46d 100644 --- a/include/lldb/Breakpoint/WatchpointList.h +++ b/include/lldb/Breakpoint/WatchpointList.h @@ -1,9 +1,8 @@ //===-- WatchpointList.h ----------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -19,12 +18,10 @@ namespace lldb_private { -//---------------------------------------------------------------------- -/// @class WatchpointList WatchpointList.h "lldb/Breakpoint/WatchpointList.h" +/// \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 @@ -34,193 +31,157 @@ class WatchpointList { friend class Target; public: - //------------------------------------------------------------------ /// Default constructor makes an empty list. - //------------------------------------------------------------------ WatchpointList(); - //------------------------------------------------------------------ /// Destructor, currently does nothing. - //------------------------------------------------------------------ ~WatchpointList(); - //------------------------------------------------------------------ /// Add a Watchpoint to the list. /// - /// @param[in] wp_sp + /// \param[in] wp_sp /// A shared pointer to a watchpoint being added to the list. /// - /// @return + /// \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. /// - /// @param[in] addr + /// \param[in] addr /// The address to look for. /// - /// @result + /// \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. /// - /// @param[in] spec + /// \param[in] spec /// The watchpoint spec to look for. /// - /// @result + /// \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. /// - /// @param[in] watchID + /// \param[in] watchID /// The watchpoint location ID to seek for. /// - /// @result + /// \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 + /// \param[in] addr /// The address to match. /// - /// @result + /// \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. /// - /// @param[in] spec + /// \param[in] spec /// The watchpoint spec to match. /// - /// @result + /// \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 + /// \param[in] i /// The watchpoint index to seek for. /// - /// @result + /// \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. /// - /// @param[in] i + /// \param[in] i /// The watchpoint index to seek for. /// - /// @result + /// \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 + /// \param[in] watchID /// The watchpoint ID to remove. /// - /// @result + /// \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 + /// \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. /// - /// @param[in] context + /// \param[in] context /// This contains the information about this stop. /// - /// @param[in] watchID + /// \param[in] watchID /// This watch ID that we hit. /// - /// @return + /// \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 + /// \result /// The number of elements. - //------------------------------------------------------------------ size_t GetSize() const { std::lock_guard<std::recursive_mutex> guard(m_mutex); return m_watchpoints.size(); } - //------------------------------------------------------------------ /// Print a description of the watchpoints in this list to the stream \a s. /// - /// @param[in] s + /// \param[in] s /// The stream to which to print the description. /// - /// @param[in] level + /// \param[in] level /// The description level that indicates the detail level to /// provide. /// - /// @see lldb::DescriptionLevel - //------------------------------------------------------------------ + /// \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 + /// \param[in] locker /// The locker object that is set. - //------------------------------------------------------------------ void GetListMutex(std::unique_lock<std::recursive_mutex> &lock); protected: diff --git a/include/lldb/Breakpoint/WatchpointOptions.h b/include/lldb/Breakpoint/WatchpointOptions.h index 0f4f399b5e4d..b395dde21901 100644 --- a/include/lldb/Breakpoint/WatchpointOptions.h +++ b/include/lldb/Breakpoint/WatchpointOptions.h @@ -1,9 +1,8 @@ //===-- WatchpointOptions.h -------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -19,49 +18,38 @@ namespace lldb_private { -//---------------------------------------------------------------------- -/// @class WatchpointOptions WatchpointOptions.h +/// \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 + /// \param[in] callback /// This is the plugin for some code that gets run, returns \b true if we /// are to stop. /// - /// @param[in] baton + /// \param[in] baton /// Client data that will get passed to the callback. /// - /// @param[in] thread_id + /// \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. @@ -89,36 +77,30 @@ public: // take a bit of plumbing to get // that to work. // - //------------------------------------------------------------------ - //------------------------------------------------------------------ /// Adds a callback to the watchpoint option set. /// - /// @param[in] callback + /// \param[in] callback /// The function to be called when the watchpoint gets hit. /// - /// @param[in] baton_sp + /// \param[in] baton_sp /// A baton which will get passed back to the callback when it is invoked. /// - /// @param[in] synchronous + /// \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 + /// \param[in] context /// The context in which the callback is to be invoked. This includes the /// stop event, the /// execution context of the stop (since you might hit the same watchpoint @@ -126,77 +108,60 @@ public: /// whether we are currently executing synchronous or asynchronous /// callbacks. /// - /// @param[in] watch_id + /// \param[in] watch_id /// The watchpoint ID that owns this option set. /// - /// @return + /// \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 + /// \return /// The synchronicity of our callback. - //------------------------------------------------------------------ bool IsCallbackSynchronous() { return m_callback_is_synchronous; } - //------------------------------------------------------------------ /// Fetch the baton from the callback. /// - /// @return + /// \return /// The baton. - //------------------------------------------------------------------ Baton *GetBaton(); - //------------------------------------------------------------------ /// Fetch a const version of the baton from the callback. /// - /// @return + /// \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 + /// \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 + /// \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); @@ -219,19 +184,15 @@ public: }; protected: - //------------------------------------------------------------------ // Classes that inherit from WatchpointOptions can see and modify these - //------------------------------------------------------------------ private: - //------------------------------------------------------------------ // For WatchpointOptions only - //------------------------------------------------------------------ WatchpointHitCallback m_callback; // This is the callback function pointer lldb::BatonSP m_callback_baton_sp; // This is the client data for the callback bool m_callback_is_synchronous; std::unique_ptr<ThreadSpec> - m_thread_spec_ap; // Thread for which this watchpoint will take + m_thread_spec_up; // Thread for which this watchpoint will take }; } // namespace lldb_private diff --git a/include/lldb/Core/Address.h b/include/lldb/Core/Address.h index a02a0d45a082..080c00e76328 100644 --- a/include/lldb/Core/Address.h +++ b/include/lldb/Core/Address.h @@ -1,9 +1,8 @@ //===-- Address.h -----------------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -20,39 +19,17 @@ namespace lldb_private { class Block; -} -namespace lldb_private { class CompileUnit; -} -namespace lldb_private { class ExecutionContextScope; -} -namespace lldb_private { class Function; -} -namespace lldb_private { class SectionList; -} -namespace lldb_private { class Stream; -} -namespace lldb_private { class Symbol; -} -namespace lldb_private { class SymbolContext; -} -namespace lldb_private { class Target; -} -namespace lldb_private { struct LineEntry; -} -namespace lldb_private { - -//---------------------------------------------------------------------- -/// @class Address Address.h "lldb/Core/Address.h" +/// \class Address Address.h "lldb/Core/Address.h" /// A section + offset based address class. /// /// The Address class allows addresses to be relative to a section that can @@ -60,8 +37,8 @@ namespace lldb_private { /// frameworks) being loaded at different addresses than the addresses found /// in the object file that represents them on disk. There are currently two /// types of addresses for a section: -/// @li file addresses -/// @li load addresses +/// \li file addresses +/// \li load addresses /// /// File addresses represent the virtual addresses that are in the "on disk" /// object files. These virtual addresses are converted to be relative to @@ -79,14 +56,11 @@ namespace lldb_private { /// load addresses of the main executable and any images (shared libraries) /// will be resolved/unresolved. When this happens, breakpoints that are in /// one of these sections can be set/cleared. -//---------------------------------------------------------------------- class Address { public: - //------------------------------------------------------------------ /// Dump styles allow the Address::Dump(Stream *,DumpStyle) const function /// to display Address contents in a variety of ways. - //------------------------------------------------------------------ - typedef enum { + enum DumpStyle { DumpStyleInvalid, ///< Invalid dump style DumpStyleSectionNameOffset, ///< Display as the section name + offset. ///< \code @@ -102,7 +76,7 @@ public: /// // address for printf in libSystem.B.dylib as a file address /// 0x000000000005dcff \endcode DumpStyleModuleWithFileAddress, ///< Display as the file address with the - ///module name prepended (if any). + /// module name prepended (if any). ///< \code /// // address for printf in libSystem.B.dylib as a file address /// libSystem.B.dylib[0x000000000005dcff] \endcode @@ -111,54 +85,48 @@ public: /// // address for printf in libSystem.B.dylib as a load address /// 0x00007fff8306bcff \endcode DumpStyleResolvedDescription, ///< Display the details about what an address - ///resolves to. This can + /// resolves to. This can ///< be anything from a symbol context summary (module, function/symbol, ///< and file and line), to information about what the pointer points to ///< if the address is in a section (section of pointers, c strings, etc). DumpStyleResolvedDescriptionNoModule, DumpStyleResolvedDescriptionNoFunctionArguments, DumpStyleNoFunctionName, ///< Elide the function name; display an offset - ///into the current function. + /// into the current function. ///< Used primarily in disassembly symbolication DumpStyleDetailedSymbolContext, ///< Detailed symbol context information for - ///an address for all symbol + /// an address for all symbol ///< context members. DumpStyleResolvedPointerDescription ///< Dereference a pointer at the - ///current address and then lookup the + /// current address and then lookup the ///< 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 + /// \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. /// - /// @param[in] section + /// \param[in] section /// A section pointer to a valid lldb::Section, or NULL if the /// address doesn't have a section or will get resolved later. /// - /// @param[in] offset + /// \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) @@ -167,63 +135,53 @@ public: m_section_wp = section_sp; } - //------------------------------------------------------------------ /// Construct with a virtual address and section list. /// /// Initialize and resolve the address with the supplied virtual address \a /// file_addr. /// - /// @param[in] file_addr + /// \param[in] file_addr /// A virtual file address. /// - /// @param[in] section_list + /// \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 /// object. /// -/// @param[in] rhs +/// \param[in] rhs /// A const Address object reference to copy. /// -/// @return +/// \return /// A const Address object reference to \a this. -//------------------------------------------------------------------ -#ifndef SWIG const Address &operator=(const Address &rhs); -#endif - //------------------------------------------------------------------ /// 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 + /// \param[in] lhs /// The Left Hand Side const Address object reference. /// - /// @param[in] rhs + /// \param[in] rhs /// The Right Hand Side const Address object reference. /// - /// @return - /// @li -1 if lhs < rhs - /// @li 0 if lhs == rhs - /// @li 1 if lhs > rhs - //------------------------------------------------------------------ + /// \return + /// \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, @@ -242,51 +200,46 @@ public: } }; - //------------------------------------------------------------------ /// Dump a description of this object to a Stream. /// /// Dump a description of the contents of this object to the supplied stream /// \a s. There are many ways to display a section offset based address, and /// \a style lets the user choose. /// - /// @param[in] s + /// \param[in] s /// The stream to which to dump the object description. /// - /// @param[in] style + /// \param[in] style /// The display style for the address. /// - /// @param[in] fallback_style + /// \param[in] fallback_style /// The display style for the address. /// - /// @return + /// \return /// Returns \b true if the address was able to be displayed. /// File and load addresses may be unresolved and it may not be /// possible to display a valid value, \b false will be returned /// in such cases. /// - /// @see Address::DumpStyle - //------------------------------------------------------------------ + /// \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 /// addresses, then it has a virtual address that is relative to unique /// section in the object file. /// - /// @return + /// \return /// 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,13 +249,11 @@ public: /// loaded/unloaded. If a section is loaded, then the load address can be /// resolved. /// - /// @return + /// \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,14 +263,12 @@ public: /// target) that are required when changing the program counter to setting a /// return address. /// - /// @return + /// \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 @@ -331,25 +280,21 @@ public: /// special purposes. The result of this function can be used to safely /// write a software breakpoint trap to memory. /// - /// @return + /// \return /// 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 + /// \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,49 +303,41 @@ public: /// returns true if the current value contained in this object is section /// offset based. /// - /// @return + /// \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 /// offset (for section offset based addresses), or just a valid offset /// (for absolute addresses that have no section). /// - /// @return + /// \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 + /// \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 /// one of the file sections. /// - /// @return + /// \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 @@ -408,25 +345,24 @@ public: /// valid section and offset. Else this address object will have no section /// (NULL) and the offset will be \a load_addr. /// - /// @param[in] load_addr + /// \param[in] load_addr /// A load address from a current process. /// - /// @param[in] target + /// \param[in] target /// The target to use when trying resolve the address into /// a section + offset. The Target's SectionLoadList object /// is used to resolve the address. /// - /// @param[in] allow_section_end + /// \param[in] allow_section_end /// If true, treat an address pointing to the end of the module as /// belonging to that module. /// - /// @return + /// \return /// Returns \b true if the load address was resolved to be /// section/offset, \b false otherwise. It is often ok for an - /// address no not resolve to a section in a module, this often + /// 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); @@ -437,34 +373,28 @@ public: bool SetCallableLoadAddress(lldb::addr_t load_addr, Target *target); - //------------------------------------------------------------------ /// Get accessor for the module for this address. /// - /// @return + /// \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 + /// \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 + /// \param[in] offset /// A new offset value for this object. /// - /// @return + /// \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; @@ -484,21 +414,18 @@ public: return false; } - //------------------------------------------------------------------ /// Set accessor for the section. /// - /// @param[in] 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 @@ -506,8 +433,7 @@ public: /// can reconstruct their symbol context by looking up the address in the /// module found in the section. /// - /// @see SymbolContextScope::CalculateSymbolContext(SymbolContext*) - //------------------------------------------------------------------ + /// \see SymbolContextScope::CalculateSymbolContext(SymbolContext*) uint32_t CalculateSymbolContext(SymbolContext *sc, lldb::SymbolContextItem resolve_scope = lldb::eSymbolContextEverything) const; @@ -524,33 +450,26 @@ public: bool CalculateSymbolContextLineEntry(LineEntry &line_entry) const; - //------------------------------------------------------------------ // Returns true if the section should be valid, but isn't because the shared // pointer to the section can't be reconstructed from a weak pointer that // contains a valid weak reference to a section. Returns false if the section // weak pointer has no reference to a section, or if the section is still // valid - //------------------------------------------------------------------ bool SectionWasDeleted() const; protected: - //------------------------------------------------------------------ // Member variables. - //------------------------------------------------------------------ lldb::SectionWP m_section_wp; ///< The section for the address, can be NULL. lldb::addr_t m_offset; ///< Offset into section if \a m_section_wp is valid... - //------------------------------------------------------------------ // Returns true if the m_section_wp once had a reference to a valid section // shared pointer, but no longer does. This can happen if we have an address // from a module that gets unloaded and deleted. This function should only be // called if GetSection() returns an empty shared pointer and you want to // know if this address used to have a valid section. - //------------------------------------------------------------------ bool SectionWasDeletedPrivate() const; }; -//---------------------------------------------------------------------- // NOTE: Be careful using this operator. It can correctly compare two // addresses from the same Module correctly. It can't compare two addresses // from different modules in any meaningful way, but it will compare the module @@ -562,7 +481,6 @@ protected: // address results to make much sense // // This basically lets Address objects be used in ordered collection classes. -//---------------------------------------------------------------------- bool operator<(const Address &lhs, const Address &rhs); bool operator>(const Address &lhs, const Address &rhs); bool operator==(const Address &lhs, const Address &rhs); diff --git a/include/lldb/Core/AddressRange.h b/include/lldb/Core/AddressRange.h index e3c820782aaf..4a019bfcfc3f 100644 --- a/include/lldb/Core/AddressRange.h +++ b/include/lldb/Core/AddressRange.h @@ -1,9 +1,8 @@ //===-- AddressRange.h ------------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -18,179 +17,159 @@ namespace lldb_private { class SectionList; -} -namespace lldb_private { class Stream; -} -namespace lldb_private { class Target; -} - -namespace lldb_private { -//---------------------------------------------------------------------- -/// @class AddressRange AddressRange.h "lldb/Core/AddressRange.h" +/// \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 /// byte_size. /// - /// @param[in] section + /// \param[in] section /// A section pointer to a valid lldb::Section, or NULL if the /// address doesn't have a section or will get resolved later. /// - /// @param[in] offset + /// \param[in] offset /// The offset in bytes into \a section. /// - /// @param[in] byte_size + /// \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 /// file_addr, and byte size \a byte_size. /// - /// @param[in] file_addr + /// \param[in] file_addr /// A virtual address. /// - /// @param[in] byte_size + /// \param[in] byte_size /// The size in bytes of the address range. /// - /// @param[in] section_list + /// \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 /// setting the byte size to \a byte_size. /// - /// @param[in] so_addr + /// \param[in] so_addr /// A section offset address object. /// - /// @param[in] byte_size + /// \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 + /// \param[in] so_addr /// A section offset address object reference. /// - /// @return + /// \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 + /// \param[in] so_addr_ptr /// A section offset address object pointer. /// - /// @return + /// \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. /// - /// @param[in] so_addr + /// \param[in] so_addr /// A section offset address object reference. /// - /// @return + /// \return /// 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. /// - /// @param[in] so_addr + /// \param[in] so_addr /// A section offset address object reference. /// - /// @return + /// \return /// 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. /// - /// @param[in] so_addr + /// \param[in] so_addr /// A section offset address object reference. /// - /// @return + /// \return /// 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. /// - /// @param[in] so_addr + /// \param[in] so_addr /// A section offset address object reference. /// - /// @return + /// \return /// 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; //------------------------------------------------------------------ + /// Extends this range with \b rhs_range if it overlaps this range on the + /// right side. The range overlaps on the right side if the base address + /// of \b rhs_range lies within this range or if it's contiguous on its + /// right side. + /// + /// @param[in] rhs_range + /// The range to extend at the right side. + /// + /// @return + /// Returns \b true if this range was extended, \b false otherwise. + //------------------------------------------------------------------ + bool Extend(const AddressRange &rhs_range); + /// Dump a description of this object to a Stream. /// /// Dump a description of the contents of this object to the supplied stream @@ -198,25 +177,23 @@ public: /// range, and \a style lets the user choose how the base address gets /// displayed. /// - /// @param[in] s + /// \param[in] s /// The stream to which to dump the object description. /// - /// @param[in] style + /// \param[in] style /// The display style for the address. /// - /// @return + /// \return /// Returns \b true if the address was able to be displayed. /// File and load addresses may be unresolved and it may not be /// possible to display a valid value, \b false will be returned /// in such cases. /// - /// @see Address::DumpStyle - //------------------------------------------------------------------ + /// \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 @@ -225,59 +202,46 @@ public: /// The debug description contains verbose internal state such and pointer /// values, reference counts, etc. /// - /// @param[in] s + /// \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 + /// \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 + /// \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 + /// \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 + /// \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 + /// \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. }; diff --git a/include/lldb/Core/AddressResolver.h b/include/lldb/Core/AddressResolver.h index 32751d64d6b4..cd95c7c31cd6 100644 --- a/include/lldb/Core/AddressResolver.h +++ b/include/lldb/Core/AddressResolver.h @@ -1,9 +1,8 @@ //===-- AddressResolver.h ---------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -19,29 +18,21 @@ namespace lldb_private { class ModuleList; -} -namespace lldb_private { class Stream; -} -namespace lldb_private { -//---------------------------------------------------------------------- -/// @class AddressResolver AddressResolver.h "lldb/Core/AddressResolver.h" +/// \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: - typedef enum { Exact, Regexp, Glob } MatchType; + enum MatchType { Exact, Regexp, Glob }; AddressResolver(); diff --git a/include/lldb/Core/AddressResolverFileLine.h b/include/lldb/Core/AddressResolverFileLine.h index bee72245ee6b..b98e7d4c6338 100644 --- a/include/lldb/Core/AddressResolverFileLine.h +++ b/include/lldb/Core/AddressResolverFileLine.h @@ -1,9 +1,8 @@ //===-- AddressResolverFileLine.h -------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -19,22 +18,13 @@ namespace lldb_private { class Address; -} -namespace lldb_private { class Stream; -} -namespace lldb_private { class SymbolContext; -} - -namespace lldb_private { -//---------------------------------------------------------------------- -/// @class AddressResolverFileLine AddressResolverFileLine.h +/// \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: diff --git a/include/lldb/Core/AddressResolverName.h b/include/lldb/Core/AddressResolverName.h index b4291938b290..ad14ef6daeb1 100644 --- a/include/lldb/Core/AddressResolverName.h +++ b/include/lldb/Core/AddressResolverName.h @@ -1,9 +1,8 @@ //===-- AddressResolverName.h -----------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -18,21 +17,12 @@ namespace lldb_private { class Address; -} -namespace lldb_private { class Stream; -} -namespace lldb_private { class SymbolContext; -} - -namespace lldb_private { -//---------------------------------------------------------------------- -/// @class AddressResolverName AddressResolverName.h +/// \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: diff --git a/include/lldb/Core/Architecture.h b/include/lldb/Core/Architecture.h index 20537d67b02c..d8dbbb4f540f 100644 --- a/include/lldb/Core/Architecture.h +++ b/include/lldb/Core/Architecture.h @@ -1,9 +1,8 @@ //===-- Architecture.h ------------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -17,9 +16,8 @@ namespace lldb_private { class Architecture : public PluginInterface { public: Architecture() = default; - virtual ~Architecture() = default; + ~Architecture() override = 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 @@ -30,10 +28,8 @@ public: /// executed and therefore it wouldn't be correct to show the program /// stopped at the current PC. The code is generic and applies to all /// ARM CPUs. - //------------------------------------------------------------------ virtual void OverrideStopInfo(Thread &thread) const = 0; - //------------------------------------------------------------------ /// This method is used to get the number of bytes that should be /// skipped, from function start address, to reach the first /// instruction after the prologue. If overrode, it must return @@ -49,12 +45,10 @@ public: /// be compared with current address, in order to find out the /// number of bytes that should be skipped, in case we are stopped /// at either function entry point. - //------------------------------------------------------------------ virtual size_t GetBytesToSkip(Symbol &func, const Address &curr_addr) const { return 0; } - //------------------------------------------------------------------ /// Adjust function breakpoint address, if needed. In some cases, /// the function start address is not the right place to set the /// breakpoint, specially in functions with multiple entry points. @@ -63,12 +57,10 @@ public: /// both a global and a local entry point. In this case, the /// breakpoint is adjusted to the first function address reached /// by both entry points. - //------------------------------------------------------------------ virtual void AdjustBreakpointAddress(const Symbol &func, Address &addr) const {} - //------------------------------------------------------------------ /// Get \a load_addr as a callable code load address for this target /// /// Take \a load_addr and potentially add any address bits that are @@ -78,13 +70,11 @@ public: /// adjustment will always happen. If it is set to an address class /// that doesn't have code in it, LLDB_INVALID_ADDRESS will be /// returned. - //------------------------------------------------------------------ virtual lldb::addr_t GetCallableLoadAddress( lldb::addr_t addr, AddressClass addr_class = AddressClass::eInvalid) const { return addr; } - //------------------------------------------------------------------ /// Get \a load_addr as an opcode for this target. /// /// Take \a load_addr and potentially strip any address bits that are @@ -95,7 +85,6 @@ public: /// adjustment will always happen. If it is set to an address class /// that doesn't have code in it, LLDB_INVALID_ADDRESS will be /// returned. - //------------------------------------------------------------------ virtual lldb::addr_t GetOpcodeLoadAddress( lldb::addr_t addr, AddressClass addr_class = AddressClass::eInvalid) const { diff --git a/include/lldb/Core/ClangForward.h b/include/lldb/Core/ClangForward.h index 3fc12a555301..6b24b47c8a96 100644 --- a/include/lldb/Core/ClangForward.h +++ b/include/lldb/Core/ClangForward.h @@ -1,9 +1,8 @@ //===-- ClangForward.h ------------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// diff --git a/include/lldb/Core/Communication.h b/include/lldb/Core/Communication.h index f129b8f879d0..901b8fdb8c8b 100644 --- a/include/lldb/Core/Communication.h +++ b/include/lldb/Core/Communication.h @@ -1,9 +1,8 @@ //===-- Communication.h -----------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -28,18 +27,10 @@ namespace lldb_private { class Connection; -} -namespace lldb_private { class ConstString; -} -namespace lldb_private { class Status; -} - -namespace lldb_private { -//---------------------------------------------------------------------- -/// @class Communication Communication.h "lldb/Core/Communication.h" An +/// \class Communication Communication.h "lldb/Core/Communication.h" An /// abstract communications class. /// /// Communication is an class that handles data communication between two data @@ -60,8 +51,8 @@ namespace lldb_private { /// "eBroadcastBit" below). /// /// There are two modes in which communications can occur: -/// @li single-threaded -/// @li multi-threaded +/// \li single-threaded +/// \li multi-threaded /// /// In single-threaded mode, all reads and writes happen synchronously on the /// calling thread. @@ -90,7 +81,6 @@ namespace lldb_private { /// eBroadcastBitReadThreadDidExit event will be broadcast. Clients can also /// post a \b eBroadcastBitReadThreadShouldExit event to this object which /// will cause the read thread to exit. -//---------------------------------------------------------------------- class Communication : public Broadcaster { public: FLAGS_ANONYMOUS_ENUM(){ @@ -116,72 +106,61 @@ public: typedef void (*ReadThreadBytesReceived)(void *baton, const void *src, size_t src_len); - //------------------------------------------------------------------ /// Construct the Communication object with the specified name for the /// Broadcaster that this object inherits from. /// - /// @param[in] broadcaster_name + /// \param[in] broadcaster_name /// The name of the broadcaster object. This name should be as /// 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. /// - /// @param[in] url + /// \param[in] url /// A string that contains all information needed by the /// subclass to connect to another client. /// - /// @return + /// \return /// \b True if the connect succeeded, \b false otherwise. The /// internal error object should be filled in with an /// appropriate value based on the result of this function. /// - /// @see Status& Communication::GetError (); - /// @see bool Connection::Connect (const char *url); - //------------------------------------------------------------------ + /// \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 + /// \return /// \b True if the disconnect succeeded, \b false otherwise. The /// internal error object should be filled in with an /// appropriate value based on the result of this function. /// - /// @see Status& Communication::GetError (); - /// @see bool Connection::Disconnect (); - //------------------------------------------------------------------ + /// \see Status& Communication::GetError (); + /// \see bool Connection::Disconnect (); lldb::ConnectionStatus Disconnect(Status *error_ptr = nullptr); - //------------------------------------------------------------------ /// Check if the connection is valid. /// - /// @return + /// \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 @@ -194,46 +173,42 @@ public: /// event. If this function consumes all of the bytes in the cache, it will /// reset the \a eBroadcastBitReadThreadGotBytes event bit. /// - /// @param[in] dst + /// \param[in] dst /// A destination buffer that must be at least \a dst_len bytes /// long. /// - /// @param[in] dst_len + /// \param[in] dst_len /// The number of bytes to attempt to read, and also the max /// number of bytes that can be placed into \a dst. /// - /// @param[in] timeout + /// \param[in] timeout /// A timeout value or llvm::None for no timeout. /// - /// @return + /// \return /// The number of bytes actually read. /// - /// @see size_t Connection::Read (void *, size_t); - //------------------------------------------------------------------ + /// \see size_t Connection::Read (void *, size_t); size_t Read(void *dst, size_t dst_len, const Timeout<std::micro> &timeout, lldb::ConnectionStatus &status, Status *error_ptr); - //------------------------------------------------------------------ /// The actual write function that attempts to write to the communications /// protocol. /// /// Subclasses must override this function. /// - /// @param[in] src + /// \param[in] src /// A source buffer that must be at least \a src_len bytes /// long. /// - /// @param[in] src_len + /// \param[in] src_len /// The number of bytes to attempt to write, and also the /// number of bytes are currently available in \a src. /// - /// @return + /// \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 @@ -241,15 +216,13 @@ public: /// connection without any interruption to the client. It also allows the /// Communication class to be subclassed for packet based communication. /// - /// @param[in] connection + /// \param[in] connection /// A connection that this class will own and destroy. /// - /// @see + /// \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: /// @@ -265,60 +238,51 @@ public: /// default action of caching the bytes and broadcasting a \b /// eBroadcastBitReadThreadGotBytes event. /// - /// @return + /// \return /// \b True if the read thread was successfully started, \b /// false otherwise. /// - /// @see size_t Connection::Read (void *, size_t); - /// @see void Communication::AppendBytesToCache (const uint8_t * bytes, + /// \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 + /// \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 + /// \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 /// broadcast a \b eBroadcastBitReadThreadGotBytes event. /// - /// @param[in] comm_ptr + /// \param[in] comm_ptr /// A pointer to an instance of this class. /// - /// @return + /// \return /// \b NULL. /// - /// @see void Communication::ReadThreadGotBytes (const uint8_t *, size_t); - //------------------------------------------------------------------ + /// \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); @@ -355,7 +319,6 @@ protected: const Timeout<std::micro> &timeout, lldb::ConnectionStatus &status, Status *error_ptr); - //------------------------------------------------------------------ /// Append new bytes that get read from the read thread into the internal /// object byte cache. This will cause a \b eBroadcastBitReadThreadGotBytes /// event to be broadcast if \a broadcast is true. @@ -368,34 +331,31 @@ protected: /// of the \a eBroadcastBitReadThreadGotBytes event by setting \a broadcast /// to false. /// - /// @param[in] src + /// \param[in] src /// A source buffer that must be at least \a src_len bytes /// long. /// - /// @param[in] src_len + /// \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. /// - /// @param[in] dst + /// \param[in] dst /// A destination buffer that must be at least \a dst_len bytes /// long. /// - /// @param[in] dst_len + /// \param[in] dst_len /// The number of bytes to attempt to read from the cache, /// and also the max number of bytes that can be placed into /// \a dst. /// - /// @return + /// \return /// The number of bytes extracted from the data cache. - //------------------------------------------------------------------ size_t GetCachedBytes(void *dst, size_t dst_len); private: diff --git a/include/lldb/Core/Debugger.h b/include/lldb/Core/Debugger.h index 09f75ef0f8c6..8e608717a801 100644 --- a/include/lldb/Core/Debugger.h +++ b/include/lldb/Core/Debugger.h @@ -1,9 +1,8 @@ //===-- Debugger.h ----------------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -46,36 +45,26 @@ #include <stddef.h> #include <stdio.h> -namespace lldb_private { -class Address; +namespace llvm { +class raw_ostream; } + namespace lldb_private { +class Address; class CommandInterpreter; -} -namespace lldb_private { class Process; -} -namespace lldb_private { class Stream; -} -namespace lldb_private { class SymbolContext; -} -namespace lldb_private { class Target; -} -namespace llvm { -class raw_ostream; -} -namespace lldb_private { +namespace repro { +class DataRecorder; +} -//---------------------------------------------------------------------- -/// @class Debugger Debugger.h "lldb/Core/Debugger.h" +/// \class Debugger Debugger.h "lldb/Core/Debugger.h" /// A class to manage flag bits. /// /// Provides a global root objects for the debugger core. -//---------------------------------------------------------------------- class Debugger : public std::enable_shared_from_this<Debugger>, public UserID, @@ -106,7 +95,7 @@ public: static lldb::DebuggerSP FindDebuggerWithID(lldb::user_id_t id); static lldb::DebuggerSP - FindDebuggerWithInstanceName(const ConstString &instance_name); + FindDebuggerWithInstanceName(ConstString instance_name); static size_t GetNumDebuggers(); @@ -130,7 +119,10 @@ public: lldb::StreamFileSP GetErrorFile() { return m_error_file_sp; } - void SetInputFileHandle(FILE *fh, bool tranfer_ownership); + repro::DataRecorder *GetInputRecorder(); + + void SetInputFileHandle(FILE *fh, bool tranfer_ownership, + repro::DataRecorder *recorder = nullptr); void SetOutputFileHandle(FILE *fh, bool tranfer_ownership); @@ -145,10 +137,12 @@ public: lldb::StreamSP GetAsyncErrorStream(); CommandInterpreter &GetCommandInterpreter() { - assert(m_command_interpreter_ap.get()); - return *m_command_interpreter_ap; + assert(m_command_interpreter_up.get()); + return *m_command_interpreter_up; } + ScriptInterpreter *GetScriptInterpreter(bool can_create = true); + lldb::ListenerSP GetListener() { return m_listener_sp; } // This returns the Debugger's scratch source manager. It won't be able to @@ -162,16 +156,14 @@ public: } ExecutionContext GetSelectedExecutionContext(); - //------------------------------------------------------------------ /// Get accessor for the target list. /// /// The target list is part of the global debugger object. This the single /// debugger shared instance to control where targets get created and to /// allow for tracking and searching for targets based on certain criteria. /// - /// @return + /// \return /// A global shared target list. - //------------------------------------------------------------------ TargetList &GetTargetList() { return m_target_list; } PlatformList &GetPlatformList() { return m_platform_list; } @@ -180,10 +172,8 @@ public: void DispatchInputEndOfFile(); - //------------------------------------------------------------------ // If any of the streams are not set, set them to the in/out/err stream of // the top most input reader to ensure they at least have something - //------------------------------------------------------------------ void AdoptTopIOHandlerFilesIfInvalid(lldb::StreamFileSP &in, lldb::StreamFileSP &out, lldb::StreamFileSP &err); @@ -222,9 +212,7 @@ public: void SetLoggingCallback(lldb::LogOutputCallback log_callback, void *baton); - //---------------------------------------------------------------------- // Properties Functions - //---------------------------------------------------------------------- enum StopDisassemblyType { eStopDisassemblyTypeNever = 0, eStopDisassemblyTypeNoDebugInfo, @@ -303,7 +291,7 @@ public: bool GetNotifyVoid() const; - const ConstString &GetInstanceName() { return m_instance_name; } + ConstString GetInstanceName() { return m_instance_name; } bool LoadPlugin(const FileSpec &spec, Status &error); @@ -371,6 +359,9 @@ protected: lldb::StreamFileSP m_output_file_sp; lldb::StreamFileSP m_error_file_sp; + /// Used for shadowing the input file when capturing a reproducer. + repro::DataRecorder *m_input_recorder; + lldb::BroadcasterManagerSP m_broadcaster_manager_sp; // The debugger acts as a // broadcaster manager of // last resort. @@ -382,7 +373,7 @@ protected: PlatformList m_platform_list; lldb::ListenerSP m_listener_sp; - std::unique_ptr<SourceManager> m_source_manager_ap; // This is a scratch + std::unique_ptr<SourceManager> m_source_manager_up; // This is a scratch // source manager that we // return if we have no // targets. @@ -391,7 +382,10 @@ protected: // this debugger used this // shared // source file cache. - std::unique_ptr<CommandInterpreter> m_command_interpreter_ap; + std::unique_ptr<CommandInterpreter> m_command_interpreter_up; + + lldb::ScriptInterpreterSP m_script_interpreter_sp; + std::recursive_mutex m_script_interpreter_mutex; IOHandlerStack m_input_reader_stack; llvm::StringMap<std::weak_ptr<llvm::raw_ostream>> m_log_streams; @@ -406,9 +400,7 @@ protected: lldb::ListenerSP m_forward_listener_sp; llvm::once_flag m_clear_once; - //---------------------------------------------------------------------- // Events for m_sync_broadcaster - //---------------------------------------------------------------------- enum { eBroadcastBitEventThreadIsListening = (1 << 0), }; diff --git a/include/lldb/Core/Disassembler.h b/include/lldb/Core/Disassembler.h index 7cec837e71f8..ba9ca87832f6 100644 --- a/include/lldb/Core/Disassembler.h +++ b/include/lldb/Core/Disassembler.h @@ -1,9 +1,8 @@ //===-- Disassembler.h ------------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -39,41 +38,21 @@ #include <stdint.h> #include <stdio.h> -namespace lldb_private { -class AddressRange; +namespace llvm { +template <typename T> class SmallVectorImpl; } + namespace lldb_private { +class AddressRange; class DataExtractor; -} -namespace lldb_private { class Debugger; -} -namespace lldb_private { class Disassembler; -} -namespace lldb_private { class Module; -} -namespace lldb_private { class Stream; -} -namespace lldb_private { class SymbolContext; -} -namespace lldb_private { class SymbolContextList; -} -namespace lldb_private { class Target; -} -namespace lldb_private { struct RegisterInfo; -} -namespace llvm { -template <typename T> class SmallVectorImpl; -} - -namespace lldb_private { class Instruction { public: @@ -110,38 +89,37 @@ public: m_address = addr; } - //------------------------------------------------------------------ /// Dump the text representation of this Instruction to a Stream /// /// Print the (optional) address, (optional) bytes, opcode, /// operands, and instruction comments to a stream. /// - /// @param[in] s + /// \param[in] s /// The Stream to add the text to. /// - /// @param[in] show_address + /// \param[in] show_address /// Whether the address (using disassembly_addr_format_spec formatting) /// should be printed. /// - /// @param[in] show_bytes + /// \param[in] show_bytes /// Whether the bytes of the assembly instruction should be printed. /// - /// @param[in] max_opcode_byte_size + /// \param[in] max_opcode_byte_size /// The size (in bytes) of the largest instruction in the list that /// we are printing (for text justification/alignment purposes) /// Only needed if show_bytes is true. /// - /// @param[in] exe_ctx + /// \param[in] exe_ctx /// The current execution context, if available. May be used in /// the assembling of the operands+comments for this instruction. /// Pass NULL if not applicable. /// - /// @param[in] sym_ctx + /// \param[in] sym_ctx /// The SymbolContext for this instruction. /// Pass NULL if not available/computed. /// Only needed if show_address is true. /// - /// @param[in] prev_sym_ctx + /// \param[in] prev_sym_ctx /// The SymbolContext for the previous instruction. Depending on /// the disassembly address format specification, a change in /// Symbol / Function may mean that a line is printed with the new @@ -150,17 +128,16 @@ public: /// the InstructionList. /// Only needed if show_address is true. /// - /// @param[in] disassembly_addr_format + /// \param[in] disassembly_addr_format /// The format specification for how addresses are printed. /// Only needed if show_address is true. /// - /// @param[in] max_address_text_size + /// \param[in] max_address_text_size /// The length of the longest address string at the start of the /// disassembly line that will be printed (the /// Debugger::FormatDisassemblerAddress() string) /// so this method can properly align the instruction opcodes. /// May be 0 to indicate no indentation/alignment of the opcodes. - //------------------------------------------------------------------ virtual void Dump(Stream *s, uint32_t max_opcode_byte_size, bool show_address, bool show_bytes, const ExecutionContext *exe_ctx, const SymbolContext *sym_ctx, @@ -293,8 +270,32 @@ public: lldb::InstructionSP GetInstructionAtIndex(size_t idx) const; + //------------------------------------------------------------------ + /// Get the index of the next branch instruction. + /// + /// Given a list of instructions, find the next branch instruction + /// in the list by returning an index. + /// + /// @param[in] start + /// The instruction index of the first instruction to check. + /// + /// @param[in] target + /// A LLDB target object that is used to resolve addresses. + /// + /// @param[in] ignore_calls + /// It true, then fine the first branch instruction that isn't + /// a function call (a branch that calls and returns to the next + /// instruction). If false, find the instruction index of any + /// branch in the list. + /// + /// @return + /// The instruction index of the first branch that is at or past + /// \a start. Returns UINT32_MAX if no matching branches are + /// found. + //------------------------------------------------------------------ uint32_t GetIndexOfNextBranchInstruction(uint32_t start, - Target &target) const; + Target &target, + bool ignore_calls) const; uint32_t GetIndexOfInstructionAtLoadAddress(lldb::addr_t load_addr, Target &target); @@ -414,7 +415,7 @@ public: static bool Disassemble(Debugger &debugger, const ArchSpec &arch, const char *plugin_name, const char *flavor, const ExecutionContext &exe_ctx, - const ConstString &name, Module *module, + ConstString name, Module *module, uint32_t num_instructions, bool mixed_source_and_assembly, uint32_t num_mixed_context_lines, uint32_t options, Stream &strm); @@ -424,9 +425,7 @@ public: uint32_t num_instructions, bool mixed_source_and_assembly, uint32_t num_mixed_context_lines, uint32_t options, Stream &strm); - //------------------------------------------------------------------ // Constructors and Destructors - //------------------------------------------------------------------ Disassembler(const ArchSpec &arch, const char *flavor); ~Disassembler() override; @@ -536,18 +535,14 @@ protected: return ElideMixedSourceAndDisassemblyLine(exe_ctx, sc, sl); }; - //------------------------------------------------------------------ // Classes that inherit from Disassembler can see and modify these - //------------------------------------------------------------------ ArchSpec m_arch; InstructionList m_instruction_list; lldb::addr_t m_base_addr; std::string m_flavor; private: - //------------------------------------------------------------------ // For Disassembler only - //------------------------------------------------------------------ DISALLOW_COPY_AND_ASSIGN(Disassembler); }; diff --git a/include/lldb/Core/DumpDataExtractor.h b/include/lldb/Core/DumpDataExtractor.h index 88446d48fa64..2a9d778e0a6a 100644 --- a/include/lldb/Core/DumpDataExtractor.h +++ b/include/lldb/Core/DumpDataExtractor.h @@ -1,9 +1,8 @@ //===-- DumpDataExtractor.h -------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -21,7 +20,6 @@ class DataExtractor; class ExecutionContextScope; class Stream; -//------------------------------------------------------------------ /// Dumps \a item_count objects into the stream \a s. /// /// Dumps \a item_count objects using \a item_format, each of which @@ -35,31 +33,31 @@ class Stream; /// same start offset, format and size, yet differing \a /// item_bit_size and \a item_bit_offset values. /// -/// @param[in] s +/// \param[in] s /// The stream to dump the output to. This value can not be nullptr. /// -/// @param[in] offset +/// \param[in] offset /// The offset into the data at which to start dumping. /// -/// @param[in] item_format +/// \param[in] item_format /// The format to use when dumping each item. /// -/// @param[in] item_byte_size +/// \param[in] item_byte_size /// The byte size of each item. /// -/// @param[in] item_count +/// \param[in] item_count /// The number of items to dump. /// -/// @param[in] num_per_line +/// \param[in] num_per_line /// The number of items to display on each line. /// -/// @param[in] base_addr +/// \param[in] base_addr /// The base address that gets added to the offset displayed on /// each line if the value is valid. Is \a base_addr is /// LLDB_INVALID_ADDRESS then no address values will be prepended /// to any lines. /// -/// @param[in] item_bit_size +/// \param[in] item_bit_size /// If the value to display is a bitfield, this value should /// be the number of bits that the bitfield item has within the /// item's byte size value. This function will need to be called @@ -68,7 +66,7 @@ class Stream; /// exist within the same integer value. If the items being /// displayed are not bitfields, this value should be zero. /// -/// @param[in] item_bit_offset +/// \param[in] item_bit_offset /// If the value to display is a bitfield, this value should /// be the offset in bits, or shift right amount, that the /// bitfield item occupies within the item's byte size value. @@ -78,9 +76,8 @@ class Stream; /// same integer value. If the items being displayed are not /// bitfields, this value should be zero. /// -/// @return +/// \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, diff --git a/include/lldb/Core/DumpRegisterValue.h b/include/lldb/Core/DumpRegisterValue.h index bc4860fbc0e5..443fdb34266a 100644 --- a/include/lldb/Core/DumpRegisterValue.h +++ b/include/lldb/Core/DumpRegisterValue.h @@ -1,9 +1,8 @@ //===-- DumpRegisterValue.h -------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// diff --git a/include/lldb/Core/EmulateInstruction.h b/include/lldb/Core/EmulateInstruction.h index 5198f3eac922..6b19c17e5491 100644 --- a/include/lldb/Core/EmulateInstruction.h +++ b/include/lldb/Core/EmulateInstruction.h @@ -1,9 +1,8 @@ //===-- EmulateInstruction.h ------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -24,29 +23,16 @@ #include <stddef.h> #include <stdint.h> + namespace lldb_private { class OptionValueDictionary; -} -namespace lldb_private { class RegisterContext; -} -namespace lldb_private { class RegisterValue; -} -namespace lldb_private { class Stream; -} -namespace lldb_private { class Target; -} -namespace lldb_private { class UnwindPlan; -} - -namespace lldb_private { -//---------------------------------------------------------------------- -/// @class EmulateInstruction EmulateInstruction.h +/// \class EmulateInstruction EmulateInstruction.h /// "lldb/Core/EmulateInstruction.h" /// A class that allows emulation of CPU opcodes. /// @@ -103,7 +89,6 @@ namespace lldb_private { /// paths in a debugger (single step prediction, finding save restore /// locations of registers for unwinding stack frame variables) and emulating /// the instruction is just a bonus. -//---------------------------------------------------------------------- class EmulateInstruction : public PluginInterface { public: @@ -368,9 +353,7 @@ public: ~EmulateInstruction() override = default; - //---------------------------------------------------------------------- // Mandatory overrides - //---------------------------------------------------------------------- virtual bool SupportsEmulatingInstructionsOfType(InstructionType inst_type) = 0; @@ -390,9 +373,7 @@ public: 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); @@ -401,9 +382,7 @@ public: 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, @@ -415,9 +394,7 @@ public: bool WriteRegisterUnsigned(const Context &context, const RegisterInfo *reg_info, uint64_t reg_value); - //---------------------------------------------------------------------- // Register kind and number variants - //---------------------------------------------------------------------- bool ReadRegister(lldb::RegisterKind reg_kind, uint32_t reg_num, RegisterValue ®_value); @@ -512,18 +489,16 @@ public: protected: ArchSpec m_arch; - void *m_baton; - ReadMemoryCallback m_read_mem_callback; - WriteMemoryCallback m_write_mem_callback; - ReadRegisterCallback m_read_reg_callback; - WriteRegisterCallback m_write_reg_callback; - lldb::addr_t m_addr; + void *m_baton = nullptr; + ReadMemoryCallback m_read_mem_callback = &ReadMemoryDefault; + WriteMemoryCallback m_write_mem_callback = &WriteMemoryDefault; + ReadRegisterCallback m_read_reg_callback = &ReadRegisterDefault; + WriteRegisterCallback m_write_reg_callback = &WriteRegisterDefault; + lldb::addr_t m_addr = LLDB_INVALID_ADDRESS; Opcode m_opcode; private: - //------------------------------------------------------------------ // For EmulateInstruction only - //------------------------------------------------------------------ DISALLOW_COPY_AND_ASSIGN(EmulateInstruction); }; diff --git a/include/lldb/Core/FileLineResolver.h b/include/lldb/Core/FileLineResolver.h index 6de99bc0c4dc..1967ed58cd3b 100644 --- a/include/lldb/Core/FileLineResolver.h +++ b/include/lldb/Core/FileLineResolver.h @@ -1,9 +1,8 @@ //===-- FileLineResolver.h --------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -19,18 +18,11 @@ namespace lldb_private { class Address; -} -namespace lldb_private { class Stream; -} - -namespace lldb_private { -//---------------------------------------------------------------------- -/// @class FileLineResolver FileLineResolver.h "lldb/Core/FileLineResolver.h" +/// \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: diff --git a/include/lldb/Core/FileSpecList.h b/include/lldb/Core/FileSpecList.h index db6490ef7133..79623ef1fdca 100644 --- a/include/lldb/Core/FileSpecList.h +++ b/include/lldb/Core/FileSpecList.h @@ -1,9 +1,8 @@ //===-- FileSpecList.h ------------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -19,165 +18,138 @@ namespace lldb_private { class Stream; -} - -namespace lldb_private { -//---------------------------------------------------------------------- -/// @class FileSpecList FileSpecList.h "lldb/Core/FileSpecList.h" +/// \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. - /// - /// Initialize this object with a copy of the file list from \a rhs. - /// - /// @param[in] rhs - /// A const reference to another file list object. - //------------------------------------------------------------------ - FileSpecList(const FileSpecList &rhs); + FileSpecList(const FileSpecList &rhs) = default; + + /// Move constructor + FileSpecList(FileSpecList &&rhs) = default; + + /// Initialize this object from a vector of FileSpecs + FileSpecList(std::vector<FileSpec> &&rhs) : m_files(std::move(rhs)) {} - //------------------------------------------------------------------ /// Destructor. - //------------------------------------------------------------------ ~FileSpecList(); - //------------------------------------------------------------------ /// Assignment operator. /// /// Replace the file list in this object with the file list from \a rhs. /// - /// @param[in] rhs + /// \param[in] rhs /// A file list object to copy. /// - /// @return + /// \return /// A const reference to this object. - //------------------------------------------------------------------ - const FileSpecList &operator=(const FileSpecList &rhs); + 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 + /// \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 /// in the file list. /// - /// @param[in] file + /// \param[in] file /// A new file to append to this file list. /// - /// @return + /// \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 + /// \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 /// starting \a idx entries into the file spec list. /// - /// @param[in] idx + /// \param[in] idx /// An index into the file list. /// - /// @param[in] file + /// \param[in] file /// The file specification to search for. /// - /// @param[in] full + /// \param[in] full /// Should FileSpec::Equal be called with "full" true or false. /// - /// @return + /// \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 /// FileSpec object will be returned. The file objects that are returned can /// be tested using FileSpec::operator void*(). /// - /// @param[in] idx + /// \param[in] idx /// An index into the file list. /// - /// @return + /// \return /// 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 /// be tested using FileSpec::operator void*(). /// - /// @param[in] idx + /// \param[in] idx /// An index into the file list. /// - /// @return + /// \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 /// the size in bytes of this object, not any shared string values it may /// refer to. /// - /// @return + /// \return /// The number of bytes that this object occupies in memory. /// - /// @see ConstString::StaticMemorySize () - //------------------------------------------------------------------ + /// \see ConstString::StaticMemorySize () size_t MemorySize() const; bool IsEmpty() const { return m_files.empty(); } - //------------------------------------------------------------------ /// Get the number of files in the file list. /// - /// @return + /// \return /// The number of files in the file spec list. - //------------------------------------------------------------------ size_t GetSize() const; bool Insert(size_t idx, const FileSpec &file) { diff --git a/include/lldb/Core/FormatEntity.h b/include/lldb/Core/FormatEntity.h index b58f3b104e46..634d9df2ad83 100644 --- a/include/lldb/Core/FormatEntity.h +++ b/include/lldb/Core/FormatEntity.h @@ -1,9 +1,8 @@ //===-- FormatEntity.h ------------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -24,20 +23,10 @@ namespace lldb_private { class Address; -} -namespace lldb_private { class ExecutionContext; -} -namespace lldb_private { class Stream; -} -namespace lldb_private { class StringList; -} -namespace lldb_private { class SymbolContext; -} -namespace lldb_private { class ValueObject; } namespace llvm { @@ -52,7 +41,7 @@ public: Invalid, ParentNumber, ParentString, - InsertString, + EscapeCode, Root, String, Scope, @@ -111,14 +100,10 @@ public: CurrentPCArrow }; - enum FormatType { None, UInt32, UInt64, CString }; - struct Definition { const char *name; const char *string; // Insert this exact string into the output Entry::Type type; - FormatType format_type; // uint32_t, uint64_t, cstr, or anything that can - // be formatted by printf or lldb::Format uint64_t data; uint32_t num_children; Definition *children; // An array of "num_children" Definition entries, @@ -216,14 +201,12 @@ public: static size_t AutoComplete(lldb_private::CompletionRequest &request); - //---------------------------------------------------------------------- // Format the current elements into the stream \a s. // // The root element will be stripped off and the format str passed in will be // either an empty string (print a description of this object), or contain a // `.`-separated series like a domain name that identifies further // sub-elements to display. - //---------------------------------------------------------------------- static bool FormatFileSpec(const FileSpec &file, Stream &s, llvm::StringRef elements, llvm::StringRef element_format); diff --git a/include/lldb/Core/Highlighter.h b/include/lldb/Core/Highlighter.h index 220557c1f032..88d3bb3a3cd1 100644 --- a/include/lldb/Core/Highlighter.h +++ b/include/lldb/Core/Highlighter.h @@ -1,9 +1,8 @@ //===-- Highlighter.h -------------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -19,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; @@ -48,8 +43,8 @@ struct HighlightStyle { void Apply(Stream &s, llvm::StringRef value) const; /// Sets the prefix and suffix strings. - /// @param prefix - /// @param suffix + /// \param prefix + /// \param suffix void Set(llvm::StringRef prefix, llvm::StringRef suffix); }; @@ -84,9 +79,7 @@ struct HighlightStyle { /// Matches '(' or ')' ColorStyle parentheses; - //----------------------------------------------------------------------- // C language specific options - //----------------------------------------------------------------------- /// Matches directives to a preprocessor (if the language has any). ColorStyle pp_directive; @@ -95,9 +88,7 @@ struct HighlightStyle { static HighlightStyle MakeVimStyle(); }; -//---------------------------------------------------------------------- /// Annotates source code with color attributes. -//---------------------------------------------------------------------- class Highlighter { public: Highlighter() = default; diff --git a/include/lldb/Core/IOHandler.h b/include/lldb/Core/IOHandler.h index 4bd577390b2c..b7180675cf4e 100644 --- a/include/lldb/Core/IOHandler.h +++ b/include/lldb/Core/IOHandler.h @@ -1,9 +1,8 @@ //===-- IOHandler.h ---------------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -14,6 +13,7 @@ #include "lldb/Utility/ConstString.h" #include "lldb/Utility/Flags.h" #include "lldb/Utility/Predicate.h" +#include "lldb/Utility/Reproducer.h" #include "lldb/Utility/Stream.h" #include "lldb/Utility/StringList.h" #include "lldb/lldb-defines.h" @@ -59,7 +59,8 @@ public: IOHandler(Debugger &debugger, IOHandler::Type type, const lldb::StreamFileSP &input_sp, const lldb::StreamFileSP &output_sp, - const lldb::StreamFileSP &error_sp, uint32_t flags); + const lldb::StreamFileSP &error_sp, uint32_t flags, + repro::DataRecorder *data_recorder); virtual ~IOHandler(); @@ -137,23 +138,19 @@ public: const Flags &GetFlags() const { return m_flags; } - //------------------------------------------------------------------ /// Check if the input is being supplied interactively by a user /// /// This will return true if the input stream is a terminal (tty or /// pty) and can cause IO handlers to do different things (like /// for a confirmation when deleting all breakpoints). - //------------------------------------------------------------------ bool GetIsInteractive(); - //------------------------------------------------------------------ /// Check if the input is coming from a real terminal. /// /// A real terminal has a valid size with a certain number of rows /// and columns. If this function returns true, then terminal escape /// sequences are expected to work (cursor movement escape sequences, /// clearing lines, etc). - //------------------------------------------------------------------ bool GetIsRealTerminal(); void SetPopped(bool b); @@ -170,6 +167,7 @@ protected: lldb::StreamFileSP m_input_sp; lldb::StreamFileSP m_output_sp; lldb::StreamFileSP m_error_sp; + repro::DataRecorder *m_data_recorder; Predicate<bool> m_popped; Flags m_flags; Type m_type; @@ -181,14 +179,12 @@ private: DISALLOW_COPY_AND_ASSIGN(IOHandler); }; -//------------------------------------------------------------------ /// A delegate class for use with IOHandler subclasses. /// /// The IOHandler delegate is designed to be mixed into classes so /// they can use an IOHandler subclass to fetch input and notify the /// object that inherits from this delegate class when a token is /// received. -//------------------------------------------------------------------ class IOHandlerDelegate { public: enum class Completion { None, LLDBCommand, Expression }; @@ -198,7 +194,7 @@ public: virtual ~IOHandlerDelegate() = default; - virtual void IOHandlerActivated(IOHandler &io_handler) {} + virtual void IOHandlerActivated(IOHandler &io_handler, bool interactive) {} virtual void IOHandlerDeactivated(IOHandler &io_handler) {} @@ -209,37 +205,34 @@ public: virtual const char *IOHandlerGetFixIndentationCharacters() { return nullptr; } - //------------------------------------------------------------------ /// Called when a new line is created or one of an identified set of /// indentation characters is typed. /// /// This function determines how much indentation should be added /// or removed to match the recommended amount for the final line. /// - /// @param[in] io_handler + /// \param[in] io_handler /// The IOHandler that responsible for input. /// - /// @param[in] lines + /// \param[in] lines /// The current input up to the line to be corrected. Lines /// following the line containing the cursor are not included. /// - /// @param[in] cursor_position + /// \param[in] cursor_position /// The number of characters preceding the cursor on the final /// line at the time. /// - /// @return + /// \return /// Returns an integer describing the number of spaces needed /// 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 @@ -247,29 +240,26 @@ public: /// "quit" is entered as a command, of when an empty line is /// received. It is up to the delegate to determine when a line /// should cause a IOHandler to exit. - //------------------------------------------------------------------ virtual void IOHandlerInputComplete(IOHandler &io_handler, std::string &data) = 0; virtual void IOHandlerInputInterrupted(IOHandler &io_handler, std::string &data) {} - //------------------------------------------------------------------ /// Called to determine whether typing enter after the last line in /// \a lines should end input. This function will not be called on /// IOHandler objects that are getting single lines. - /// @param[in] io_handler + /// \param[in] io_handler /// The IOHandler that responsible for updating the lines. /// - /// @param[in] lines + /// \param[in] lines /// The current multi-line content. May be altered to provide /// alternative input when complete. /// - /// @return + /// \return /// 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 @@ -285,24 +275,20 @@ public: virtual const char *IOHandlerGetHelpPrologue() { return nullptr; } - //------------------------------------------------------------------ // Intercept the IOHandler::Interrupt() calls and do something. // // Return true if the interrupt was handled, false if the IOHandler should // continue to try handle the interrupt itself. - //------------------------------------------------------------------ virtual bool IOHandlerInterrupt(IOHandler &io_handler) { return false; } protected: Completion m_completion; // Support for common builtin completions }; -//---------------------------------------------------------------------- // IOHandlerDelegateMultiline // // A IOHandlerDelegate that handles terminating multi-line input when // the last line is equal to "end_line" which is specified in the constructor. -//---------------------------------------------------------------------- class IOHandlerDelegateMultiline : public IOHandlerDelegate { public: IOHandlerDelegateMultiline(const char *end_line, @@ -344,7 +330,8 @@ public: uint32_t line_number_start, // If non-zero show line numbers // starting at // 'line_number_start' - IOHandlerDelegate &delegate); + IOHandlerDelegate &delegate, + repro::DataRecorder *data_recorder); IOHandlerEditline(Debugger &debugger, IOHandler::Type type, const lldb::StreamFileSP &input_sp, @@ -356,7 +343,8 @@ public: uint32_t line_number_start, // If non-zero show line numbers // starting at // 'line_number_start' - IOHandlerDelegate &delegate); + IOHandlerDelegate &delegate, + repro::DataRecorder *data_recorder); IOHandlerEditline(Debugger &, IOHandler::Type, const char *, const char *, const char *, bool, bool, uint32_t, @@ -436,7 +424,7 @@ private: protected: #ifndef LLDB_DISABLE_LIBEDIT - std::unique_ptr<Editline> m_editline_ap; + std::unique_ptr<Editline> m_editline_up; #endif IOHandlerDelegate &m_delegate; std::string m_prompt; diff --git a/include/lldb/Core/IOStreamMacros.h b/include/lldb/Core/IOStreamMacros.h index 2562f179ca5d..45bde88f9441 100644 --- a/include/lldb/Core/IOStreamMacros.h +++ b/include/lldb/Core/IOStreamMacros.h @@ -1,9 +1,8 @@ //===-- IOStreamMacros.h ----------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// diff --git a/include/lldb/Core/LoadedModuleInfoList.h b/include/lldb/Core/LoadedModuleInfoList.h index 5ef0f8929b89..f7f83604fc1a 100644 --- a/include/lldb/Core/LoadedModuleInfoList.h +++ b/include/lldb/Core/LoadedModuleInfoList.h @@ -1,9 +1,8 @@ //===-- LoadedModuleInfoList.h ----------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// diff --git a/include/lldb/Core/Mangled.h b/include/lldb/Core/Mangled.h index 12edf8200e43..fb52afd6ed34 100644 --- a/include/lldb/Core/Mangled.h +++ b/include/lldb/Core/Mangled.h @@ -1,9 +1,8 @@ //===-- Mangled.h -----------------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -23,8 +22,7 @@ namespace lldb_private { -//---------------------------------------------------------------------- -/// @class Mangled Mangled.h "lldb/Core/Mangled.h" +/// \class Mangled Mangled.h "lldb/Core/Mangled.h" /// A class that handles mangled names. /// /// Designed to handle mangled names. The demangled version of any names will @@ -34,7 +32,6 @@ namespace lldb_private { /// class for their mangled names. Uniqued string pools are used for the /// mangled, demangled, and token string values to allow for faster /// comparisons and for efficient memory use. -//---------------------------------------------------------------------- class Mangled { public: enum NamePreference { @@ -49,188 +46,156 @@ public: eManglingSchemeItanium }; - //---------------------------------------------------------------------- /// Default constructor. /// /// Initialize with both mangled and demangled names empty. - //---------------------------------------------------------------------- Mangled(); - //---------------------------------------------------------------------- /// Construct with name. /// /// Constructor with an optional string and a boolean indicating if it is /// the mangled version. /// - /// @param[in] name + /// \param[in] name /// The already const name to copy into this object. /// - /// @param[in] is_mangled + /// \param[in] is_mangled /// If \b true then \a name is a mangled name, if \b false then /// \a name is demangled. - //---------------------------------------------------------------------- - Mangled(const ConstString &name, bool is_mangled); + 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 /// mangled or not. /// - /// @param[in] name + /// \param[in] name /// The already const name to copy into this object. - //---------------------------------------------------------------------- - explicit Mangled(const ConstString &name); + 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 /// mangled name using code such as: /// - /// @code + /// \code /// Mangled mangled(...); /// if (mangled) /// { ... - /// @endcode + /// \endcode /// - /// @return + /// \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 /// empty mangled name using code such as: /// - /// @code + /// \code /// Mangled mangled(...); /// if (!mangled) /// { ... - /// @endcode + /// \endcode /// - /// @return + /// \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. /// - /// @param[in] lhs + /// \param[in] lhs /// A const reference to the Left Hand Side object to compare. /// - /// @param[in] rhs + /// \param[in] rhs /// A const reference to the Right Hand Side object to compare. /// - /// @return - /// @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 - //---------------------------------------------------------------------- + /// \return + /// \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 /// to be computed currently (we don't use the accessor). /// - /// @param[in] s + /// \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 + /// \param[in] s /// The stream to which to dump the object description. - //---------------------------------------------------------------------- void DumpDebug(Stream *s) const; - //---------------------------------------------------------------------- /// Demangled name get accessor. /// - /// @return + /// \return /// A const reference to the demangled name string object. - //---------------------------------------------------------------------- - const ConstString &GetDemangledName(lldb::LanguageType language) const; + ConstString GetDemangledName(lldb::LanguageType language) const; - //---------------------------------------------------------------------- /// Display demangled name get accessor. /// - /// @return + /// \return /// A const reference to the display demangled name string object. - //---------------------------------------------------------------------- ConstString GetDisplayDemangledName(lldb::LanguageType language) const; - void SetDemangledName(const ConstString &name) { m_demangled = name; } + void SetDemangledName(ConstString name) { m_demangled = name; } - void SetMangledName(const ConstString &name) { m_mangled = name; } + void SetMangledName(ConstString name) { m_mangled = name; } - //---------------------------------------------------------------------- /// Mangled name get accessor. /// - /// @return + /// \return /// A reference to the mangled name string object. - //---------------------------------------------------------------------- ConstString &GetMangledName() { return m_mangled; } - //---------------------------------------------------------------------- /// Mangled name get accessor. /// - /// @return + /// \return /// A const reference to the mangled name string object. - //---------------------------------------------------------------------- - const ConstString &GetMangledName() const { return m_mangled; } + ConstString GetMangledName() const { return m_mangled; } - //---------------------------------------------------------------------- /// Best name get accessor. /// - /// @param[in] preference + /// \param[in] preference /// Which name would you prefer to get? /// - /// @return + /// \return /// 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 + /// \param[in] name /// A name to match against both strings. /// - /// @return + /// \return /// \b True if \a name matches either name, \b false otherwise. - //---------------------------------------------------------------------- - bool NameMatches(const ConstString &name, lldb::LanguageType language) const { + bool NameMatches(ConstString name, lldb::LanguageType language) const { if (m_mangled == name) return true; return GetDemangledName(language) == name; @@ -238,47 +203,40 @@ public: 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 /// the size in bytes of this object, not any shared string values it may /// refer to. /// - /// @return + /// \return /// The number of bytes that this object occupies in memory. /// - /// @see ConstString::StaticMemorySize () - //---------------------------------------------------------------------- + /// \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, /// else the demangled name is set to \a name. /// - /// @param[in] name + /// \param[in] name /// The already const version of the name for this object. /// - /// @param[in] is_mangled + /// \param[in] is_mangled /// If \b true then \a name is a mangled name, if \b false then /// \a name is demangled. - //---------------------------------------------------------------------- - void SetValue(const ConstString &name, bool is_mangled); + 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 /// string value and looking for common mangling prefixes. /// - /// @param[in] name + /// \param[in] name /// The already const version of the name for this object. - //---------------------------------------------------------------------- - void SetValue(const ConstString &name); + 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 @@ -290,16 +248,14 @@ public: /// aren't mangled and it isn't clear what language the name represents /// (there will be no mangled name). /// - /// @return + /// \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() @@ -312,24 +268,21 @@ public: /// This function is thread-safe when used with different \a context /// instances in different threads. /// - /// @param[in] context + /// \param[in] context /// The context for this function. A single instance can be stack- /// allocated in the caller's frame and used for multiple calls. /// - /// @param[in] skip_mangled_name + /// \param[in] skip_mangled_name /// A filtering function for skipping entities based on name and mangling /// scheme. This can be null if unused. /// - /// @return + /// \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 diff --git a/include/lldb/Core/MappedHash.h b/include/lldb/Core/MappedHash.h index 8d9a91e69079..7dc9b5be3465 100644 --- a/include/lldb/Core/MappedHash.h +++ b/include/lldb/Core/MappedHash.h @@ -1,9 +1,8 @@ //===-- MappedHash.h --------------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// diff --git a/include/lldb/Core/Module.h b/include/lldb/Core/Module.h index 270a401172fa..544895ea89e9 100644 --- a/include/lldb/Core/Module.h +++ b/include/lldb/Core/Module.h @@ -1,9 +1,8 @@ //===-- Module.h ------------------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -40,60 +39,24 @@ namespace lldb_private { class CompilerDeclContext; -} -namespace lldb_private { class Function; -} -namespace lldb_private { class Log; -} -namespace lldb_private { class ObjectFile; -} -namespace lldb_private { class RegularExpression; -} -namespace lldb_private { class SectionList; -} -namespace lldb_private { class Stream; -} -namespace lldb_private { class Symbol; -} -namespace lldb_private { class SymbolContext; -} -namespace lldb_private { class SymbolContextList; -} -namespace lldb_private { class SymbolFile; -} -namespace lldb_private { class SymbolVendor; -} -namespace lldb_private { class Symtab; -} -namespace lldb_private { class Target; -} -namespace lldb_private { class TypeList; -} -namespace lldb_private { class TypeMap; -} -namespace lldb_private { class VariableList; -} - -namespace lldb_private { -//---------------------------------------------------------------------- -/// @class Module Module.h "lldb/Core/Module.h" +/// \class Module Module.h "lldb/Core/Module.h" /// A class that describes an executable image and its associated /// object and symbol files. /// @@ -108,7 +71,6 @@ namespace lldb_private { /// Module::GetSymbolVendor() is called. /// /// The module will parse more detailed information as more queries are made. -//---------------------------------------------------------------------- class Module : public std::enable_shared_from_this<Module>, public SymbolContextScope { public: @@ -124,30 +86,28 @@ public: static std::recursive_mutex &GetAllocationModuleCollectionMutex(); - //------------------------------------------------------------------ /// Construct with file specification and architecture. /// /// Clients that wish to share modules with other targets should use /// ModuleList::GetSharedModule(). /// - /// @param[in] file_spec + /// \param[in] file_spec /// The file specification for the on disk representation of /// this executable image. /// - /// @param[in] arch + /// \param[in] arch /// The architecture to set as the current architecture in /// this module. /// - /// @param[in] object_name + /// \param[in] object_name /// The name of an object in a module used to extract a module /// within a module (.a files and modules that contain multiple /// architectures). /// - /// @param[in] object_offset + /// \param[in] object_offset /// 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, @@ -164,25 +124,26 @@ public: lldb::ModuleSP module_sp(new Module()); module_sp->m_objfile_sp = std::make_shared<ObjFilePlugin>(module_sp, std::forward<Args>(args)...); - - // Once we get the object file, update our module with the object file's - // architecture since it might differ in vendor/os if some parts were - // unknown. - if (ArchSpec arch = module_sp->m_objfile_sp->GetArchitecture()) { - module_sp->m_arch = arch; - return module_sp; - } - return nullptr; + module_sp->m_did_load_objfile.store(true, std::memory_order_relaxed); + + // Once we get the object file, set module ArchSpec to the one we get from + // the object file. If the object file does not have an architecture, we + // consider the creation a failure. + ArchSpec arch = module_sp->m_objfile_sp->GetArchitecture(); + if (!arch) + return nullptr; + module_sp->m_arch = arch; + + // Also copy the object file's FileSpec. + module_sp->m_file = module_sp->m_objfile_sp->GetFileSpec(); + 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. /// @@ -191,23 +152,23 @@ public: /// address for all top level sections to be the section file address + /// offset. /// - /// @param[in] target + /// \param[in] target /// The target in which to apply the section load addresses. /// - /// @param[in] value + /// \param[in] value /// if \a value_is_offset is true, then value is the offset to /// apply to all file addresses for all top level sections in /// the object file as each section load address is being set. /// If \a value_is_offset is false, then "value" is the new /// absolute base address for the image. /// - /// @param[in] value_is_offset + /// \param[in] value_is_offset /// If \b true, then \a value is an offset to apply to each /// file address of each top level section. /// If \b false, then \a value is the image base address that /// will be used to rigidly slide all loadable sections. /// - /// @param[out] changed + /// \param[out] changed /// If any section load addresses were changed in \a target, /// then \a changed will be set to \b true. Else \a changed /// will be set to false. This allows this function to be @@ -216,18 +177,15 @@ public: /// be false and no module updated notification will need to /// be sent out. /// - /// @return + /// \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*) + /// \copydoc SymbolContextScope::CalculateSymbolContext(SymbolContext*) /// - /// @see SymbolContextScope - //------------------------------------------------------------------ + /// \see SymbolContextScope void CalculateSymbolContext(SymbolContext *sc) override; lldb::ModuleSP CalculateSymbolContextModule() override; @@ -236,7 +194,6 @@ public: GetDescription(Stream *s, lldb::DescriptionLevel level = lldb::eDescriptionLevelFull); - //------------------------------------------------------------------ /// Get the module path and object name. /// /// Modules can refer to object files. In this case the specification is @@ -252,12 +209,10 @@ public: /// There are many places where logging wants to log this fully qualified /// specification, so we centralize this functionality here. /// - /// @return + /// \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 @@ -265,39 +220,34 @@ public: /// to this point at which this function is called, so this is a good way to /// see what has been parsed in a module. /// - /// @param[in] s + /// \param[in] s /// The stream to which to dump the object description. - //------------------------------------------------------------------ void Dump(Stream *s); - //------------------------------------------------------------------ - /// @copydoc SymbolContextScope::DumpSymbolContext(Stream*) + /// \copydoc SymbolContextScope::DumpSymbolContext(Stream*) /// - /// @see SymbolContextScope - //------------------------------------------------------------------ + /// \see SymbolContextScope void DumpSymbolContext(Stream *s) override; - //------------------------------------------------------------------ /// Find a symbol in the object file's symbol table. /// - /// @param[in] name + /// \param[in] name /// The name of the symbol that we are looking for. /// - /// @param[in] symbol_type + /// \param[in] symbol_type /// If set to eSymbolTypeAny, find a symbol of any type that /// has a name that matches \a name. If set to any other valid /// SymbolType enumeration value, then search only for /// symbols that match \a symbol_type. /// - /// @return + /// \return /// Returns a valid symbol pointer if a symbol was found, /// nullptr otherwise. - //------------------------------------------------------------------ const Symbol *FindFirstSymbolWithNameAndType( - const ConstString &name, + ConstString name, lldb::SymbolType symbol_type = lldb::eSymbolTypeAny); - size_t FindSymbolsWithNameAndType(const ConstString &name, + size_t FindSymbolsWithNameAndType(ConstString name, lldb::SymbolType symbol_type, SymbolContextList &sc_list); @@ -305,132 +255,123 @@ public: lldb::SymbolType symbol_type, SymbolContextList &sc_list); - //------------------------------------------------------------------ /// Find a function symbols in the object file's symbol table. /// - /// @param[in] name + /// \param[in] name /// The name of the symbol that we are looking for. /// - /// @param[in] name_type_mask + /// \param[in] name_type_mask /// A mask that has one or more bitwise OR'ed values from the /// lldb::FunctionNameType enumeration type that indicate what /// kind of names we are looking for. /// - /// @param[out] sc_list + /// \param[out] sc_list /// A list to append any matching symbol contexts to. /// - /// @return + /// \return /// The number of symbol contexts that were added to \a sc_list - //------------------------------------------------------------------ - size_t FindFunctionSymbols(const ConstString &name, uint32_t name_type_mask, + 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 /// returns the results in \a sc_list. /// - /// @param[in] path + /// \param[in] path /// The name of the function we are looking for. /// - /// @param[in] append + /// \param[in] append /// If \b true, then append any compile units that were found /// to \a sc_list. If \b false, then the \a sc_list is cleared /// and the contents of \a sc_list are replaced. /// - /// @param[out] sc_list + /// \param[out] sc_list /// A symbol context list that gets filled in with all of the /// matches. /// - /// @return + /// \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, /// representing the inlined function, and the function will be the /// containing function. If it is not inlined, then the block will be NULL. /// - /// @param[in] name + /// \param[in] name /// The name of the compile unit we are looking for. /// - /// @param[in] namespace_decl + /// \param[in] namespace_decl /// If valid, a namespace to search in. /// - /// @param[in] name_type_mask + /// \param[in] name_type_mask /// A bit mask of bits that indicate what kind of names should /// be used when doing the lookup. Bits include fully qualified /// names, base names, C++ methods, or ObjC selectors. /// See FunctionNameType for more details. /// - /// @param[in] append + /// \param[in] append /// If \b true, any matches will be appended to \a sc_list, else /// matches replace the contents of \a sc_list. /// - /// @param[out] sc_list + /// \param[out] sc_list /// A symbol context list that gets filled in with all of the /// matches. /// - /// @return + /// \return /// The number of matches added to \a sc_list. - //------------------------------------------------------------------ - size_t FindFunctions(const ConstString &name, + 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, /// representing the inlined function, and the function will be the /// containing function. If it is not inlined, then the block will be NULL. /// - /// @param[in] regex + /// \param[in] regex /// A regular expression to use when matching the name. /// - /// @param[in] append + /// \param[in] append /// If \b true, any matches will be appended to \a sc_list, else /// matches replace the contents of \a sc_list. /// - /// @param[out] sc_list + /// \param[out] sc_list /// A symbol context list that gets filled in with all of the /// matches. /// - /// @return + /// \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 + /// \param[in] target_sp /// The target the addresses are desired for. /// - /// @param[in] file + /// \param[in] file /// Source file to locate. /// - /// @param[in] line + /// \param[in] line /// Source line to locate. /// - /// @param[in] function + /// \param[in] function /// Optional filter function. Addresses within this function will be /// added to the 'local' list. All others will be added to the 'extern' /// list. /// - /// @param[out] output_local + /// \param[out] output_local /// All matching addresses within 'function' /// - /// @param[out] output_extern + /// \param[out] output_extern /// All matching addresses not within 'function' void FindAddressesForLine(const lldb::TargetSP target_sp, const FileSpec &file, uint32_t line, @@ -438,50 +379,45 @@ public: std::vector<Address> &output_local, std::vector<Address> &output_extern); - //------------------------------------------------------------------ /// Find global and static variables by name. /// - /// @param[in] name + /// \param[in] name /// The name of the global or static variable we are looking /// for. /// - /// @param[in] parent_decl_ctx + /// \param[in] parent_decl_ctx /// If valid, a decl context that results must exist within /// - /// @param[in] max_matches + /// \param[in] max_matches /// Allow the number of matches to be limited to \a /// max_matches. Specify UINT32_MAX to get all possible matches. /// - /// @param[in] variable_list + /// \param[in] variable_list /// A list of variables that gets the matches appended to. /// - /// @return + /// \return /// The number of matches added to \a variable_list. - //------------------------------------------------------------------ - size_t FindGlobalVariables(const ConstString &name, + 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 + /// \param[in] regex /// A regular expression to use when matching the name. /// - /// @param[in] max_matches + /// \param[in] max_matches /// Allow the number of matches to be limited to \a /// max_matches. Specify UINT32_MAX to get all possible matches. /// - /// @param[in] variable_list + /// \param[in] variable_list /// A list of variables that gets the matches appended to. /// - /// @return + /// \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 @@ -499,74 +435,66 @@ public: /// have to specify complete scoping on all expressions, but it also allows /// for exact matching when required. /// - /// @param[in] type_name + /// \param[in] type_name /// The name of the type we are looking for that is a fully /// or partially qualified type name. /// - /// @param[in] exact_match + /// \param[in] exact_match /// If \b true, \a type_name is fully qualified and must match /// exactly. If \b false, \a type_name is a partially qualified /// name where the leading namespaces or classes can be /// omitted to make finding types that a user may type /// easier. /// - /// @param[out] type_list + /// \param[out] type_list /// A type list gets populated with any matches. /// - /// @return + /// \return /// The number of matches added to \a type_list. - //------------------------------------------------------------------ size_t - FindTypes(const ConstString &type_name, bool exact_match, size_t max_matches, + FindTypes(ConstString type_name, bool exact_match, size_t max_matches, llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files, TypeList &types); lldb::TypeSP FindFirstType(const SymbolContext &sc, - const ConstString &type_name, bool exact_match); + 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. /// - /// @param[in] type_name + /// \param[in] type_name /// The name of a type within a namespace that should not include /// any qualifying namespaces (just a type basename). /// - /// @param[in] namespace_decl + /// \param[in] namespace_decl /// The namespace declaration that this type must exist in. /// - /// @param[out] type_list + /// \param[out] type_list /// A type list gets populated with any matches. /// - /// @return + /// \return /// The number of matches added to \a type_list. - //------------------------------------------------------------------ - size_t FindTypesInNamespace(const ConstString &type_name, + 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 + /// \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 /// running LLDB. This can differ from the path on the platform since we /// might be doing remote debugging. /// - /// @return + /// \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 @@ -577,9 +505,8 @@ public: /// "/tmp/lldb/platform-cache/remote.host.computer/usr/lib/liba.dylib" The /// file could also be cached in a local developer kit directory. /// - /// @return + /// \return /// A const reference to the file specification object. - //------------------------------------------------------------------ const FileSpec &GetPlatformFileSpec() const { if (m_platform_file) return m_platform_file; @@ -614,63 +541,54 @@ public: m_mod_time = mod_time; } - //------------------------------------------------------------------ /// Tells whether this module is capable of being the main executable for a /// process. /// - /// @return + /// \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. /// - /// @param[in] target + /// \param[in] target /// The target to check whether this is loaded in. /// - /// @return + /// \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 + /// \return /// The number of compile units that the symbol vendor plug-in /// finds. - //------------------------------------------------------------------ size_t GetNumCompileUnits(); lldb::CompUnitSP GetCompileUnitAtIndex(size_t idx); - const ConstString &GetObjectName() const; + ConstString GetObjectName() const; 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 /// will find the best ObjectFile plug-in that can parse Module::m_file. /// - /// @return + /// \return /// If Module::m_file does not exist, or no plug-in was found /// that can parse the file, or the object file doesn't contain /// the current architecture in Module::m_arch, nullptr will be /// 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. @@ -678,12 +596,10 @@ public: /// If the symbol vendor has not been loaded yet, this function will return /// the section list for the object file. /// - /// @return + /// \return /// Unified module section list. - //------------------------------------------------------------------ virtual SectionList *GetSectionList(); - //------------------------------------------------------------------ /// Notify the module that the file addresses for the Sections have been /// updated. /// @@ -691,12 +607,23 @@ public: /// should be called. Any parts of the module, object file, or symbol file /// that has cached those file addresses must invalidate or update its /// cache. - //------------------------------------------------------------------ virtual void SectionFileAddressesChanged(); + /// Returns a reference to the UnwindTable for this Module + /// + /// The UnwindTable contains FuncUnwinders objects for any function in this + /// Module. If a FuncUnwinders object hasn't been created yet (i.e. the + /// function has yet to be unwound in a stack walk), it will be created when + /// requested. Specifically, we do not create FuncUnwinders objects for + /// functions until they are needed. + /// + /// \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 @@ -705,54 +632,46 @@ public: /// enable the ObjectFile plugins to read the header of the object file /// without going back to the process. /// - /// @return + /// \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 /// find the best SymbolVendor plug-in that can use the current object file. /// - /// @return + /// \return /// If this module does not have a valid object file, or no /// plug-in can be found that can use the object file, nullptr will /// 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 + /// \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 /// the file format, an MD5 checksum of the entire file, or slice of the /// file for the current architecture should be used. /// - /// @return + /// \return /// 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. /// @@ -763,12 +682,10 @@ public: /// complete list of the resulting debug information that gets parsed, or as /// a debug function to ensure that the module can consume all of the debug /// data the symbol vendor provides. - //------------------------------------------------------------------ void ParseAllDebugSymbols(); bool ResolveFileAddress(lldb::addr_t vm_addr, Address &so_addr); - //------------------------------------------------------------------ /// Resolve the symbol context for the given address. /// /// Tries to resolve the matching symbol context based on a lookup from the @@ -782,10 +699,10 @@ public: /// line entry. Use the return value to determine which of these properties /// have been modified. /// - /// @param[in] so_addr + /// \param[in] so_addr /// A load address to resolve. /// - /// @param[in] resolve_scope + /// \param[in] resolve_scope /// The scope that should be resolved (see SymbolContext::Scope). /// A combination of flags from the enumeration SymbolContextItem /// requesting a resolution depth. Note that the flags that are @@ -794,24 +711,22 @@ public: /// eSymbolContextModule, and eSymbolContextFunction requires /// eSymbolContextSymbol. /// - /// @param[out] sc + /// \param[out] sc /// The SymbolContext that is modified based on symbol resolution. /// - /// @param[in] resolve_tail_call_address + /// \param[in] resolve_tail_call_address /// Determines if so_addr should resolve to a symbol in the case /// of a function whose last instruction is a call. In this case, /// the PC can be one past the address range of the function. /// - /// @return + /// \return /// The scope that has been resolved (see SymbolContext::Scope). /// - /// @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 @@ -823,40 +738,38 @@ public: /// to only what is needed -- typically the module, compile unit, line table /// and line table entry are sufficient. /// - /// @param[in] file_path + /// \param[in] file_path /// A path to a source file to match. If \a file_path does not /// specify a directory, then this query will match all files /// whose base filename matches. If \a file_path does specify /// a directory, the fullpath to the file must match. /// - /// @param[in] line + /// \param[in] line /// The source line to match, or zero if just the compile unit /// should be resolved. /// - /// @param[in] check_inlines + /// \param[in] check_inlines /// Check for inline file and line number matches. This option /// should be used sparingly as it will cause all line tables /// for every compile unit to be parsed and searched for /// matching inline file entries. /// - /// @param[in] resolve_scope + /// \param[in] resolve_scope /// The scope that should be resolved (see /// SymbolContext::Scope). /// - /// @param[out] sc_list + /// \param[out] sc_list /// A symbol context list that gets matching symbols contexts /// appended to. /// - /// @return + /// \return /// The number of matches that were added to \a sc_list. /// - /// @see SymbolContext::Scope - //------------------------------------------------------------------ + /// \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 @@ -868,42 +781,41 @@ public: /// to only what is needed -- typically the module, compile unit, line table /// and line table entry are sufficient. /// - /// @param[in] file_spec + /// \param[in] file_spec /// A file spec to a source file to match. If \a file_path does /// not specify a directory, then this query will match all /// files whose base filename matches. If \a file_path does /// specify a directory, the fullpath to the file must match. /// - /// @param[in] line + /// \param[in] line /// The source line to match, or zero if just the compile unit /// should be resolved. /// - /// @param[in] check_inlines + /// \param[in] check_inlines /// Check for inline file and line number matches. This option /// should be used sparingly as it will cause all line tables /// for every compile unit to be parsed and searched for /// matching inline file entries. /// - /// @param[in] resolve_scope + /// \param[in] resolve_scope /// The scope that should be resolved (see /// SymbolContext::Scope). /// - /// @param[out] sc_list + /// \param[out] sc_list /// A symbol context list that gets filled in with all of the /// matches. /// - /// @return + /// \return /// A integer that contains SymbolContext::Scope bits set for /// each item that was successfully resolved. /// - /// @see SymbolContext::Scope - //------------------------------------------------------------------ + /// \see SymbolContext::Scope uint32_t ResolveSymbolContextsForFileSpec( const FileSpec &file_spec, uint32_t line, bool check_inlines, lldb::SymbolContextItem resolve_scope, SymbolContextList &sc_list); void SetFileSpecAndObjectName(const FileSpec &file, - const ConstString &object_name); + ConstString object_name); bool GetIsDynamicLinkEditor(); @@ -931,17 +843,13 @@ public: void ReportErrorIfModifyDetected(const char *format, ...) __attribute__((format(printf, 2, 3))); - //------------------------------------------------------------------ // Return true if the file backing this module has changed since the module // was originally created since we saved the initial file modification time // when the module first gets created. - //------------------------------------------------------------------ bool FileHasChanged() const; - //------------------------------------------------------------------ // SymbolVendor, SymbolFile and ObjectFile member objects should lock the // module mutex to avoid deadlocks. - //------------------------------------------------------------------ std::recursive_mutex &GetMutex() const { return m_mutex; } PathMappingList &GetSourceMappingList() { return m_source_mappings; } @@ -950,7 +858,6 @@ public: return m_source_mappings; } - //------------------------------------------------------------------ /// Finds a source file given a file spec using the module source path /// remappings (if any). /// @@ -959,41 +866,37 @@ public: /// if the remappings are on a network file system, so use this function /// sparingly (not in a tight debug info parsing loop). /// - /// @param[in] orig_spec + /// \param[in] orig_spec /// The original source file path to try and remap. /// - /// @param[out] new_spec + /// \param[out] new_spec /// The newly remapped filespec that is guaranteed to exist. /// - /// @return + /// \return /// /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 /// stat the file system so it can be used in tight loops where debug info /// is being parsed. /// - /// @param[in] path + /// \param[in] path /// The original source file path to try and remap. /// - /// @param[out] new_path + /// \param[out] new_path /// The newly remapped filespec that is may or may not exist. /// - /// @return + /// \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" + /// \class LookupInfo Module.h "lldb/Core/Module.h" /// A class that encapsulates name lookup information. /// /// Users can type a wide variety of partial names when setting breakpoints @@ -1014,7 +917,6 @@ public: /// Function lookups are done in Module.cpp, ModuleList.cpp and in /// BreakpointResolverName.cpp and they all now use this class to do lookups /// correctly. - //---------------------------------------------------------------------- class LookupInfo { public: LookupInfo() @@ -1022,16 +924,16 @@ public: m_name_type_mask(lldb::eFunctionNameTypeNone), m_match_name_after_lookup(false) {} - LookupInfo(const ConstString &name, lldb::FunctionNameType name_type_mask, + LookupInfo(ConstString name, lldb::FunctionNameType name_type_mask, lldb::LanguageType language); - const ConstString &GetName() const { return m_name; } + ConstString GetName() const { return m_name; } - void SetName(const ConstString &name) { m_name = name; } + void SetName(ConstString name) { m_name = name; } - const ConstString &GetLookupName() const { return m_lookup_name; } + ConstString GetLookupName() const { return m_lookup_name; } - void SetLookupName(const ConstString &name) { m_lookup_name = name; } + void SetLookupName(ConstString name) { m_lookup_name = name; } lldb::FunctionNameType GetNameTypeMask() const { return m_name_type_mask; } @@ -1061,9 +963,7 @@ public: }; protected: - //------------------------------------------------------------------ // Member Variables - //------------------------------------------------------------------ mutable std::recursive_mutex m_mutex; ///< A mutex to keep this object happy ///in multi-threaded environments. @@ -1091,8 +991,11 @@ protected: lldb::ObjectFileSP m_objfile_sp; ///< A shared pointer to the object file ///parser for this module as it may or may ///not be shared with the SymbolFile + llvm::Optional<UnwindTable> m_unwind_table; ///< Table of FuncUnwinders + /// objects created for this + /// Module's functions lldb::SymbolVendorUP - m_symfile_ap; ///< A pointer to the symbol vendor for this module. + m_symfile_up; ///< A pointer to the symbol vendor for this module. std::vector<lldb::SymbolVendorUP> m_old_symfiles; ///< If anyone calls Module::SetSymbolFileFileSpec() and ///changes the symbol file, @@ -1104,9 +1007,9 @@ protected: ///when you have debug info for a module ///that doesn't match where the sources ///currently are - lldb::SectionListUP m_sections_ap; ///< Unified section list for module that - ///is used by the ObjectFile and and - ///ObjectFile instances for the debug info + lldb::SectionListUP m_sections_up; ///< Unified section list for module that + /// is used by the ObjectFile and and + /// ObjectFile instances for the debug info std::atomic<bool> m_did_load_objfile{false}; std::atomic<bool> m_did_load_symbol_vendor{false}; @@ -1115,7 +1018,6 @@ protected: m_first_file_changed_log : 1; /// See if the module was modified after it /// was initially opened. - //------------------------------------------------------------------ /// Resolve a file or load virtual address. /// /// Tries to resolve \a vm_addr as a file address (if \a @@ -1124,31 +1026,30 @@ protected: /// indicates what clients wish to resolve and can be used to limit the /// scope of what is parsed. /// - /// @param[in] vm_addr + /// \param[in] vm_addr /// The load virtual address to resolve. /// - /// @param[in] vm_addr_is_file_addr + /// \param[in] vm_addr_is_file_addr /// If \b true, \a vm_addr is a file address, else \a vm_addr /// if a load address. /// - /// @param[in] resolve_scope + /// \param[in] resolve_scope /// The scope that should be resolved (see /// SymbolContext::Scope). /// - /// @param[out] so_addr + /// \param[out] so_addr /// The section offset based address that got resolved if /// any bits are returned. /// - /// @param[out] sc + /// \param[out] sc // The symbol context that has objects filled in. Each bit /// in the \a resolve_scope pertains to a member in the \a sc. /// - /// @return + /// \return /// A integer that contains SymbolContext::Scope bits set for /// each item that was successfully resolved. /// - /// @see SymbolContext::Scope - //------------------------------------------------------------------ + /// \see SymbolContext::Scope uint32_t ResolveSymbolContextForAddress(lldb::addr_t vm_addr, bool vm_addr_is_file_addr, lldb::SymbolContextItem resolve_scope, @@ -1172,7 +1073,7 @@ private: Module(); // Only used internally by CreateJITModule () size_t FindTypes_Impl( - const ConstString &name, const CompilerDeclContext *parent_decl_ctx, + ConstString name, const CompilerDeclContext *parent_decl_ctx, bool append, size_t max_matches, llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files, TypeMap &types); diff --git a/include/lldb/Core/ModuleChild.h b/include/lldb/Core/ModuleChild.h index 73438040c359..8a81c1a6cf8a 100644 --- a/include/lldb/Core/ModuleChild.h +++ b/include/lldb/Core/ModuleChild.h @@ -1,9 +1,8 @@ //===-- ModuleChild.h -------------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -14,68 +13,46 @@ namespace lldb_private { -//---------------------------------------------------------------------- -/// @class ModuleChild ModuleChild.h "lldb/Core/ModuleChild.h" +/// \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 + /// \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 + /// \param[in] rhs /// A const ModuleChild class reference to copy. /// - /// @return + /// \return /// A const reference to this object. - //------------------------------------------------------------------ const ModuleChild &operator=(const ModuleChild &rhs); - //------------------------------------------------------------------ /// Get const accessor for the module pointer. /// - /// @return + /// \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 + /// \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. }; diff --git a/include/lldb/Core/ModuleList.h b/include/lldb/Core/ModuleList.h index a28d97113d63..1e26c35e4c15 100644 --- a/include/lldb/Core/ModuleList.h +++ b/include/lldb/Core/ModuleList.h @@ -1,9 +1,8 @@ //===-- ModuleList.h --------------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -32,48 +31,19 @@ namespace lldb_private { class ConstString; -} -namespace lldb_private { class FileSpecList; -} -namespace lldb_private { class Function; -} -namespace lldb_private { class Log; -} -namespace lldb_private { class Module; -} -namespace lldb_private { class RegularExpression; -} -namespace lldb_private { class Stream; -} -namespace lldb_private { class SymbolContext; -} -namespace lldb_private { class SymbolContextList; -} -namespace lldb_private { class SymbolFile; -} -namespace lldb_private { class Target; -} -namespace lldb_private { class TypeList; -} -namespace lldb_private { class UUID; -} -namespace lldb_private { class VariableList; -} - -namespace lldb_private { class ModuleListProperties : public Properties { public: @@ -82,91 +52,101 @@ public: FileSpec GetClangModulesCachePath() const; bool SetClangModulesCachePath(llvm::StringRef path); bool GetEnableExternalLookup() const; + bool SetEnableExternalLookup(bool new_value); }; -//---------------------------------------------------------------------- -/// @class ModuleList ModuleList.h "lldb/Core/ModuleList.h" +/// \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 { public: virtual ~Notifier() = default; - virtual void ModuleAdded(const ModuleList &module_list, - const lldb::ModuleSP &module_sp) = 0; - virtual void ModuleRemoved(const ModuleList &module_list, - const lldb::ModuleSP &module_sp) = 0; - virtual void ModuleUpdated(const ModuleList &module_list, - const lldb::ModuleSP &old_module_sp, - const lldb::ModuleSP &new_module_sp) = 0; - virtual void WillClearList(const ModuleList &module_list) = 0; + virtual void NotifyModuleAdded(const ModuleList &module_list, + const lldb::ModuleSP &module_sp) = 0; + virtual void NotifyModuleRemoved(const ModuleList &module_list, + const lldb::ModuleSP &module_sp) = 0; + virtual void NotifyModuleUpdated(const ModuleList &module_list, + const lldb::ModuleSP &old_module_sp, + const lldb::ModuleSP &new_module_sp) = 0; + virtual void NotifyWillClearList(const ModuleList &module_list) = 0; + + 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 + /// \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. /// - /// @param[in] rhs + /// \param[in] rhs /// Another module list object. /// - /// @return + /// \return /// A const reference to this object. - //------------------------------------------------------------------ const ModuleList &operator=(const ModuleList &rhs); - //------------------------------------------------------------------ /// Append a module to the module list. /// - /// Appends the module to the collection. - /// - /// @param[in] module_sp + /// \param[in] module_sp /// A shared pointer to a module to add to this collection. - //------------------------------------------------------------------ - void Append(const lldb::ModuleSP &module_sp); + /// + /// \param[in] notify + /// If true, and a notifier function is set, the notifier function + /// will be called. Defaults to true. + /// + /// When this ModuleList is the Target's ModuleList, the notifier + /// function is Target::ModulesDidLoad -- the call to + /// 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. /// /// Replaces the module to the collection. /// - /// @param[in] module_sp + /// \param[in] module_sp /// A shared pointer to a module to replace in this collection. - //------------------------------------------------------------------ void ReplaceEquivalent(const lldb::ModuleSP &module_sp); - bool AppendIfNeeded(const lldb::ModuleSP &module_sp); + /// Append a module to the module list, if it is not already there. + /// + /// \param[in] module_sp + /// + /// \param[in] notify + /// If true, and a notifier function is set, the notifier function + /// will be called. Defaults to true. + /// + /// When this ModuleList is the Target's ModuleList, the notifier + /// function is Target::ModulesDidLoad -- the call to + /// 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); @@ -175,36 +155,30 @@ public: bool ReplaceModule(const lldb::ModuleSP &old_module_sp, const lldb::ModuleSP &new_module_sp); - //------------------------------------------------------------------ /// Clear the object's state. /// /// Clears the list of modules and releases a reference to each module /// object and if the reference count goes to zero, the module will be /// deleted. - //------------------------------------------------------------------ void Clear(); - //------------------------------------------------------------------ /// Clear the object's state. /// /// Clears the list of modules and releases a reference to each module /// object and if the reference count goes to zero, the module will be /// deleted. Also release all memory that might be held by any collection /// classes (like std::vector) - //------------------------------------------------------------------ void Destroy(); - //------------------------------------------------------------------ /// Dump the description of each module contained in this list. /// /// Dump the description of each module contained in this list to the /// supplied stream \a s. /// - /// @param[in] s + /// \param[in] s /// The stream to which to dump the object description. /// - /// @see Module::Dump(Stream *) const - //------------------------------------------------------------------ + /// \see Module::Dump(Stream *) const void Dump(Stream *s) const; void LogUUIDAndPaths(Log *log, const char *prefix_cstr); @@ -213,155 +187,134 @@ public: size_t GetIndexForModule(const Module *module) const; - //------------------------------------------------------------------ /// Get the module shared pointer for the module at index \a idx. /// - /// @param[in] idx + /// \param[in] idx /// An index into this module collection. /// - /// @return + /// \return /// A shared pointer to a Module which can contain NULL if /// \a idx is out of range. /// - /// @see ModuleList::GetSize() - //------------------------------------------------------------------ + /// \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. /// - /// @param[in] idx + /// \param[in] idx /// An index into this module collection. /// - /// @return + /// \return /// A shared pointer to a Module which can contain NULL if /// \a idx is out of range. /// - /// @see ModuleList::GetSize() - //------------------------------------------------------------------ + /// \see ModuleList::GetSize() lldb::ModuleSP GetModuleAtIndexUnlocked(size_t idx) const; - //------------------------------------------------------------------ /// Get the module pointer for the module at index \a idx. /// - /// @param[in] idx + /// \param[in] idx /// An index into this module collection. /// - /// @return + /// \return /// A pointer to a Module which can by nullptr if \a idx is out /// of range. /// - /// @see ModuleList::GetSize() - //------------------------------------------------------------------ + /// \see ModuleList::GetSize() Module *GetModulePointerAtIndex(size_t idx) const; - //------------------------------------------------------------------ /// Get the module pointer for |