Vendor import of stripped lldb trunk r366426 (just before the release_90

branch point):

https://llvm.org/svn/llvm-project/lldb/trunk@366426
This commit is contained in:
Dimitry Andric 2019-08-20 20:51:52 +00:00
parent 88c643b6fe
commit 5f29bb8a67
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/vendor/lldb/dist/; revision=351290
1714 changed files with 48549 additions and 46993 deletions

View File

@ -1,3 +1,241 @@
==============================================================================
The LLVM Project is under the Apache License v2.0 with LLVM Exceptions:
==============================================================================
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
---- LLVM Exceptions to the Apache 2.0 License ----
As an exception, if, as a result of your compiling your source code, portions
of this Software are embedded into an Object form of such source code, you
may redistribute such embedded portions in such Object form without complying
with the conditions of Sections 4(a), 4(b) and 4(d) of the License.
In addition, if you combine or link compiled forms of this Software with
software that is licensed under the GPLv2 ("Combined Software") and if a
court of competent jurisdiction determines that the patent provision (Section
3), the indemnity provision (Section 9) or other Section of the License
conflicts with the conditions of the GPLv2, you may retroactively and
prospectively choose to deem waived or otherwise exclude such Section(s) of
the License, but only in their entirety and only with respect to the Combined
Software.
==============================================================================
Software from third parties included in the LLVM Project:
==============================================================================
The LLVM Project contains third party software which is under different license
terms. All such code will be identified clearly using at least one of two
mechanisms:
1) It will be in a separate directory tree with its own `LICENSE.txt` or
`LICENSE` file at the top containing the specific license and restrictions
which apply to that software, or
2) It will contain specific license and restriction terms at the top of every
file.
==============================================================================
Legacy LLVM License (https://llvm.org/docs/DeveloperPolicy.html#legacy):
==============================================================================
University of Illinois/NCSA
Open Source License

View File

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

View File

@ -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 @@ class LLDB_API SBAddress {
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 @@ class LLDB_API SBAddress {
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);

View File

@ -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 @@ class LLDB_API SBAttachInfo {
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 @@ class LLDB_API SBAttachInfo {
/// 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 @@ class LLDB_API SBAttachInfo {
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 @@ class LLDB_API SBAttachInfo {
/// 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 @@ class LLDB_API SBAttachInfo {
bool ParentProcessIDIsValid();
//----------------------------------------------------------------------
/// Get the listener that will be used to receive process events.
///
/// If no listener has been set via a call to
/// SBAttachInfo::SetListener(), then an invalid SBListener will be
/// returned (SBListener::IsValid() will return false). If a listener
/// has been set, then the valid listener object will be returned.
//----------------------------------------------------------------------
SBListener GetListener();
//----------------------------------------------------------------------
/// Set the listener that will be used to receive process events.
///
/// By default the SBDebugger, which has a listener, that the SBTarget
/// belongs to will listen for the process events. Calling this function
/// allows a different listener to be used to listen for process events.
//----------------------------------------------------------------------
void SetListener(SBListener &listener);
protected:

View File

@ -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 @@ class LLDB_API SBBlock {
bool IsInlined() const;
explicit operator bool() const;
bool IsValid() const;
const char *GetInlinedName() const;
@ -59,16 +60,14 @@ class LLDB_API SBBlock {
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);

View File

@ -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 @@ class LLDB_API SBBreakpoint {
break_id_t GetID() const;
explicit operator bool() const;
bool IsValid() const;
void ClearAllBreakpointSites();

View File

@ -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 @@ class LLDB_API SBBreakpointLocation {
break_id_t GetID();
explicit operator bool() const;
bool IsValid() const;
lldb::SBAddress GetAddress();

View File

@ -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 @@ class LLDB_API SBBreakpointName {
bool operator!=(const lldb::SBBreakpointName &rhs);
explicit operator bool() const;
bool IsValid() const;
const char *GetName() const;

View File

@ -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 @@ class LLDB_API SBBroadcaster {
~SBBroadcaster();
explicit operator bool() const;
bool IsValid() const;
void Clear();

View File

@ -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 @@ class SBCommandInterpreter {
static bool EventIsCommandInterpreterEvent(const lldb::SBEvent &event);
explicit operator bool() const;
bool IsValid() const;
bool CommandExists(const char *cmd);
@ -189,16 +190,13 @@ class SBCommandInterpreter {
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 @@ class SBCommandInterpreter {
/// 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 @@ class SBCommandInterpreter {
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();

View File

@ -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 @@ class LLDB_API SBCommandReturnObject {
lldb_private::CommandReturnObject *Release();
explicit operator bool() const;
bool IsValid() const;
const char *GetOutput();
@ -100,7 +101,7 @@ class LLDB_API SBCommandReturnObject {
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

View File

@ -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 @@ class LLDB_API SBCommunication {
SBCommunication(const char *broadcaster_name);
~SBCommunication();
explicit operator bool() const;
bool IsValid() const;
lldb::SBBroadcaster GetBroadcaster();

View File

@ -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 @@ class LLDB_API SBCompileUnit {
const lldb::SBCompileUnit &operator=(const lldb::SBCompileUnit &rhs);
explicit operator bool() const;
bool IsValid() const;
lldb::SBFileSpec GetFileSpec() const;
@ -47,11 +48,10 @@ class LLDB_API SBCompileUnit {
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 @@ class LLDB_API SBCompileUnit {
/// 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();

View File

@ -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 @@ class LLDB_API SBData {
void Clear();
explicit operator bool() const;
bool IsValid();
size_t GetByteSize();

View File

@ -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 @@ class LLDB_API SBInputReader {
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 @@ class LLDB_API SBDebugger {
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 @@ class LLDB_API SBDebugger {
static void MemoryPressureDetected();
explicit operator bool() const;
bool IsValid() const;
void Clear();
@ -150,7 +151,7 @@ class LLDB_API SBDebugger {
/// 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 @@ class LLDB_API SBDebugger {
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);

View File

@ -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 @@ class LLDB_API SBDeclaration {
const lldb::SBDeclaration &operator=(const lldb::SBDeclaration &rhs);
explicit operator bool() const;
bool IsValid() const;
lldb::SBFileSpec GetFileSpec() const;
@ -62,7 +63,7 @@ class LLDB_API SBDeclaration {
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

View File

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

View File

@ -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 @@ class LLDB_API SBError {
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 SBCommandReturnObject;
friend class SBData;
friend class SBDebugger;
friend class SBCommunication;
friend class SBHostOS;
friend class SBPlatform;
friend class SBProcess;
friend class SBStructuredData;
friend class SBThread;
friend class SBTrace;
friend class SBTarget;
friend class SBValue;
friend class SBWatchpoint;
friend class SBBreakpoint;
friend class SBBreakpointLocation;
friend class SBBreakpointName;
friend class SBCommandReturnObject;
friend class SBCommunication;
friend class SBData;
friend class SBDebugger;
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 SBValue;
friend class SBWatchpoint;
lldb_private::Status *get();
@ -80,7 +82,7 @@ class LLDB_API SBError {
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();
};

View File

@ -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 @@ class LLDB_API SBEvent {
const SBEvent &operator=(const lldb::SBEvent &rhs);
explicit operator bool() const;
bool IsValid() const;
const char *GetDataFlavor();

View File

@ -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 @@ class LLDB_API SBExecutionContext {
SBFrame GetFrame() const;
protected:
ExecutionContextRefSP &GetSP() const;
void reset(lldb::ExecutionContextRefSP &event_sp);
lldb_private::ExecutionContextRef *get() const;

View File

@ -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 @@ class LLDB_API SBExpressionOptions {
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 @@ class LLDB_API SBExpressionOptions {
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

View File

@ -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 @@ class LLDB_API SBFileSpec {
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 @@ class LLDB_API SBFileSpec {
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 @@ class LLDB_API SBFileSpec {
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

View File

@ -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 @@ class LLDB_API SBFileSpecList {
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

View File

@ -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 @@ class LLDB_API SBFrame {
bool IsEqual(const lldb::SBFrame &that) const;
explicit operator bool() const;
bool IsValid() const;
uint32_t GetFrameID() const;

View File

@ -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 @@ class LLDB_API SBFunction {
~SBFunction();
explicit operator bool() const;
bool IsValid() const;
const char *GetName() const;

View File

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

View File

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

View File

@ -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 @@ class LLDB_API SBInstruction {
~SBInstruction();
explicit operator bool() const;
bool IsValid();
SBAddress GetAddress();

View File

@ -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 @@ class LLDB_API SBInstructionList {
~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);

View File

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

View File

@ -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 @@ class LLDB_API SBLaunchInfo {
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 @@ class LLDB_API SBLaunchInfo {
/// 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();

View File

@ -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 @@ class LLDB_API SBLineEntry {
lldb::SBAddress GetEndAddress() const;
explicit operator bool() const;
bool IsValid() const;
lldb::SBFileSpec GetFileSpec() const;
@ -69,7 +70,7 @@ class LLDB_API SBLineEntry {
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

View File

@ -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 @@ class LLDB_API SBListener {
void Clear();
explicit operator bool() const;
bool IsValid() const;
uint32_t StartListeningForEventClass(SBDebugger &debugger,

View File

@ -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 @@ class LLDB_API SBMemoryRegionInfo {
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 @@ class LLDB_API SBMemoryRegionInfo {
// Unused.
SBMemoryRegionInfo(const lldb_private::MemoryRegionInfo *lldb_object_ptr);
lldb::MemoryRegionInfoUP m_opaque_ap;
lldb::MemoryRegionInfoUP m_opaque_up;
};
} // namespace lldb

View File

@ -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 @@ class LLDB_API SBMemoryRegionInfoList {
const lldb_private::MemoryRegionInfos &ref() const;
std::unique_ptr<MemoryRegionInfoListImpl> m_opaque_ap;
std::unique_ptr<MemoryRegionInfoListImpl> m_opaque_up;
};
} // namespace lldb

View File

@ -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 @@ class LLDB_API SBModule {
~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 @@ class LLDB_API SBModule {
/// '/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 @@ class LLDB_API SBModule {
/// 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 @@ class LLDB_API SBModule {
/// 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 @@ class LLDB_API SBModule {
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 @@ class LLDB_API SBModule {
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 @@ class LLDB_API SBModule {
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 @@ class LLDB_API SBModule {
///
/// 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 @@ class LLDB_API SBModule {
/// 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 @@ class LLDB_API SBModule {
/// 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 @@ class LLDB_API SBModule {
/// 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 @@ class LLDB_API SBModule {
/// 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;

View File

@ -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 @@ class LLDB_API SBModuleSpec {
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 @@ class LLDB_API SBModuleSpec {
/// '/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 @@ class LLDB_API SBModuleSpec {
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 @@ class SBModuleSpecList {
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

View File

@ -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 @@ class LLDB_API SBPlatform {
~SBPlatform();
explicit operator bool() const;
bool IsValid() const;
void Clear();
@ -108,9 +109,7 @@ class LLDB_API SBPlatform {
bool IsConnected();
//----------------------------------------------------------------------
// The following functions will work if the platform is connected
//----------------------------------------------------------------------
const char *GetTriple();
const char *GetHostname();

View File

@ -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 @@ class LLDB_API SBProcess {
void Clear();
explicit operator bool() const;
bool IsValid() const;
lldb::SBTarget GetTarget() const;
@ -71,11 +70,9 @@ class LLDB_API SBProcess {
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 @@ class LLDB_API SBProcess {
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 @@ class LLDB_API SBProcess {
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 @@ class LLDB_API SBProcess {
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 @@ class LLDB_API SBProcess {
const char *GetExitDescription();
//------------------------------------------------------------------
/// Gets the process ID
///
/// Returns the process identifier for the process as it is known
@ -136,15 +124,13 @@ class LLDB_API SBProcess {
/// 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 @@ class LLDB_API SBProcess {
/// 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 @@ class LLDB_API SBProcess {
uint32_t GetStopID(bool include_expression_stops = false);
//------------------------------------------------------------------
/// Gets the stop event corresponding to stop ID.
//
/// Note that it wasn't fully implemented and tracks only the stop
/// event for the last natural stop ID.
///
/// @param [in] stop_id
/// \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 @@ class LLDB_API SBProcess {
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 @@ class LLDB_API SBProcess {
/// 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 @@ class LLDB_API SBProcess {
lldb::SBError SendEventData(const char *data);
//------------------------------------------------------------------
/// Return the number of different thread-origin extended backtraces
/// this process can support.
///
@ -360,25 +334,22 @@ class LLDB_API SBProcess {
/// 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 @@ class LLDB_API SBProcess {
/// 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 &region_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:

View File

@ -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 @@ class LLDB_API SBProcessInfo {
SBProcessInfo &operator=(const SBProcessInfo &rhs);
explicit operator bool() const;
bool IsValid() const;
const char *GetName();
@ -56,7 +57,7 @@ class LLDB_API SBProcessInfo {
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

View File

@ -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 @@ class LLDB_API SBQueue {
~SBQueue();
explicit operator bool() const;
bool IsValid() const;
void Clear();
@ -59,10 +60,6 @@ class LLDB_API SBQueue {
void SetQueue(const lldb::QueueSP &queue_sp);
void FetchThreads();
void FetchItems();
private:
std::shared_ptr<lldb_private::QueueImpl> m_opaque_sp;
};

View File

@ -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 @@ class LLDB_API SBQueueItem {
~SBQueueItem();
explicit operator bool() const;
bool IsValid() const;
void Clear();

View File

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

View File

@ -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 @@ class LLDB_API SBSection {
const lldb::SBSection &operator=(const lldb::SBSection &rhs);
explicit operator bool() const;
bool IsValid() const;
const char *GetName();
@ -53,7 +54,6 @@ class LLDB_API SBSection {
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 @@ class LLDB_API SBSection {
/// 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);

View File

@ -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 @@ class LLDB_API SBSourceManager {
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

View File

@ -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 @@ class LLDB_API SBStream {
~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 @@ class LLDB_API SBStream {
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;
};

View File

@ -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 @@ class LLDB_API SBStringList {
~SBStringList();
explicit operator bool() const;
bool IsValid() const;
void AppendString(const char *str);
@ -56,7 +57,7 @@ class LLDB_API SBStringList {
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

View File

@ -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 @@ class SBStructuredData {
lldb::SBStructuredData &operator=(const lldb::SBStructuredData &rhs);
explicit operator bool() const;
bool IsValid() const;
lldb::SBError SetFromJSON(lldb::SBStream &stream);
@ -39,69 +40,51 @@ class SBStructuredData {
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:

View File

@ -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 @@ class LLDB_API SBSymbol {
const lldb::SBSymbol &operator=(const lldb::SBSymbol &rhs);
explicit operator bool() const;
bool IsValid() const;
const char *GetName() const;
@ -54,16 +55,12 @@ class LLDB_API SBSymbol {
bool GetDescription(lldb::SBStream &description);
//----------------------------------------------------------------------
// Returns true if the symbol is externally visible in the module that it is
// defined in
//----------------------------------------------------------------------
bool IsExternal();
//----------------------------------------------------------------------
// Returns true if the symbol was synthetically generated from something
// other than the actual symbol table itself in the object file.
//----------------------------------------------------------------------
bool IsSynthetic();
protected:

View File

@ -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 @@ class LLDB_API SBSymbolContext {
~SBSymbolContext();
explicit operator bool() const;
bool IsValid() const;
const lldb::SBSymbolContext &operator=(const lldb::SBSymbolContext &rhs);
@ -74,7 +75,7 @@ class LLDB_API SBSymbolContext {
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

View File

@ -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 @@ class LLDB_API SBSymbolContextList {
const lldb::SBSymbolContextList &
operator=(const lldb::SBSymbolContextList &rhs);
explicit operator bool() const;
bool IsValid() const;
uint32_t GetSize() const;
@ -49,7 +50,7 @@ class LLDB_API SBSymbolContextList {
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

View File

@ -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 @@ class LLDB_API SBTarget {
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 @@ class LLDB_API SBTarget {
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 @@ class LLDB_API SBTarget {
/// 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 @@ class LLDB_API SBTarget {
/// 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 @@ class LLDB_API SBTarget {
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 @@ class LLDB_API SBTarget {
/// 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 @@ class LLDB_API SBTarget {
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 @@ class LLDB_API SBTarget {
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 @@ class LLDB_API SBTarget {
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 @@ class LLDB_API SBTarget {
/// 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 @@ class LLDB_API SBTarget {
/// 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 @@ class LLDB_API SBTarget {
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 @@ class LLDB_API SBTarget {
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 @@ class LLDB_API SBTarget {
friend class SBValue;
friend class SBVariablesOptions;
//------------------------------------------------------------------
// Constructors are private, use static Target::Create function to create an
// instance of this class.
//------------------------------------------------------------------
lldb::TargetSP GetSP() const;

View File

@ -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 @@ class LLDB_API SBThread {
lldb::SBQueue GetQueue() const;
explicit operator bool() const;
bool IsValid() const;
void Clear();
@ -50,7 +51,6 @@ class LLDB_API SBThread {
/// 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 @@ class LLDB_API SBThread {
/// eStopReasonException N exception data
/// eStopReasonExec 0
/// eStopReasonPlanComplete 0
//--------------------------------------------------------------------------
uint64_t GetStopReasonDataAtIndex(uint32_t idx);
bool GetStopReasonExtendedInfoAsJSON(lldb::SBStream &stream);
@ -133,7 +132,6 @@ class LLDB_API SBThread {
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 @@ class LLDB_API SBThread {
/// 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 @@ class LLDB_API SBThread {
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 @@ class LLDB_API SBThread {
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

View File

@ -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 @@ class LLDB_API SBThreadCollection {
~SBThreadCollection();
explicit operator bool() const;
bool IsValid() const;
size_t GetSize();

View File

@ -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 @@ class LLDB_API SBThreadPlan {
~SBThreadPlan();
explicit operator bool() const;
bool IsValid() const;
void Clear();
@ -41,7 +42,6 @@ class LLDB_API SBThreadPlan {
/// 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 @@ class LLDB_API SBThreadPlan {
/// eStopReasonException N exception data
/// eStopReasonExec 0
/// eStopReasonPlanComplete 0
//--------------------------------------------------------------------------
uint64_t GetStopReasonDataAtIndex(uint32_t idx);
SBThread GetThread() const;
@ -102,11 +101,7 @@ class LLDB_API SBThreadPlan {
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 @@ class LLDB_API SBThreadPlan {
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;
};

View File

@ -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 @@ class LLDB_API SBTrace {
/// 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 @@ class LLDB_API SBTrace {
/// 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:

View File

@ -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 @@ class LLDB_API SBTraceOptions {
lldb::tid_t getThreadID();
explicit operator bool() const;
bool IsValid();
protected:

View File

@ -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 @@ class LLDB_API SBTypeMember {
lldb::SBTypeMember &operator=(const lldb::SBTypeMember &rhs);
explicit operator bool() const;
bool IsValid() const;
const char *GetName();
@ -52,7 +53,7 @@ class LLDB_API SBTypeMember {
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 @@ class SBTypeMemberFunction {
lldb::SBTypeMemberFunction &operator=(const lldb::SBTypeMemberFunction &rhs);
explicit operator bool() const;
bool IsValid() const;
const char *GetName();
@ -106,6 +109,8 @@ class SBType {
~SBType();
explicit operator bool() const;
bool IsValid() const;
uint64_t GetByteSize();
@ -236,6 +241,8 @@ class SBTypeList {
lldb::SBTypeList &operator=(const lldb::SBTypeList &rhs);
explicit operator bool() const;
bool IsValid();
void Append(lldb::SBType type);
@ -245,7 +252,7 @@ class SBTypeList {
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;
};

View File

@ -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 @@ class LLDB_API SBTypeCategory {
~SBTypeCategory();
explicit operator bool() const;
bool IsValid() const;
bool GetEnabled();
@ -46,9 +47,7 @@ class LLDB_API SBTypeCategory {
uint32_t GetNumFilters();
#ifndef LLDB_DISABLE_PYTHON
uint32_t GetNumSynthetics();
#endif
SBTypeNameSpecifier GetTypeNameSpecifierForFilterAtIndex(uint32_t);
@ -56,43 +55,29 @@ class LLDB_API SBTypeCategory {
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 @@ class LLDB_API SBTypeCategory {
bool DeleteTypeFilter(SBTypeNameSpecifier);
#ifndef LLDB_DISABLE_PYTHON
bool AddTypeSynthetic(SBTypeNameSpecifier, SBTypeSynthetic);
bool DeleteTypeSynthetic(SBTypeNameSpecifier);
#endif
lldb::SBTypeCategory &operator=(const lldb::SBTypeCategory &rhs);

View File

@ -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 @@ class LLDB_API SBTypeEnumMember {
SBTypeEnumMember &operator=(const SBTypeEnumMember &rhs);
explicit operator bool() const;
bool IsValid() const;
int64_t GetValueAsSigned();
@ -63,6 +64,8 @@ class SBTypeEnumMemberList {
SBTypeEnumMemberList &operator=(const SBTypeEnumMemberList &rhs);
explicit operator bool() const;
bool IsValid();
void Append(SBTypeEnumMember entry);
@ -72,7 +75,7 @@ class SBTypeEnumMemberList {
uint32_t GetSize();
private:
std::unique_ptr<lldb_private::TypeEnumMemberListImpl> m_opaque_ap;
std::unique_ptr<lldb_private::TypeEnumMemberListImpl> m_opaque_up;
};
} // namespace lldb

View File

@ -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 @@ class LLDB_API SBTypeFilter {
~SBTypeFilter();
explicit operator bool() const;
bool IsValid() const;
uint32_t GetNumberOfExpressionPaths();

View File

@ -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 @@ class LLDB_API SBTypeFormat {
~SBTypeFormat();
explicit operator bool() const;
bool IsValid() const;
lldb::Format GetFormat();

View File

@ -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 @@ class LLDB_API SBTypeNameSpecifier {
~SBTypeNameSpecifier();
explicit operator bool() const;
bool IsValid() const;
const char *GetName();

View File

@ -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 @@ class LLDB_API SBTypeSummaryOptions {
~SBTypeSummaryOptions();
explicit operator bool() const;
bool IsValid();
lldb::LanguageType GetLanguage();
@ -50,7 +51,7 @@ class LLDB_API SBTypeSummaryOptions {
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 @@ class SBTypeSummary {
~SBTypeSummary();
explicit operator bool() const;
bool IsValid() const;
bool IsFunctionCode();

View File

@ -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 @@ class LLDB_API SBTypeSynthetic {
~SBTypeSynthetic();
explicit operator bool() const;
bool IsValid() const;
bool IsClassCode();
@ -78,6 +77,4 @@ class LLDB_API SBTypeSynthetic {
} // namespace lldb
#endif // LLDB_DISABLE_PYTHON
#endif // LLDB_SBTypeSynthetic_h_

View File

@ -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 @@ class LLDB_API SBUnixSignals {
void Clear();
explicit operator bool() const;
bool IsValid() const;
const char *GetSignalAsCString(int32_t signo) const;

View File

@ -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 @@ class LLDB_API SBValue {
~SBValue();
explicit operator bool() const;
bool IsValid();
void Clear();
@ -111,9 +112,7 @@ class LLDB_API SBValue {
lldb::SBTypeFilter GetTypeFilter();
#ifndef LLDB_DISABLE_PYTHON
lldb::SBTypeSynthetic GetTypeSynthetic();
#endif
lldb::SBValue GetChildAtIndex(uint32_t idx);
@ -138,7 +137,6 @@ class LLDB_API SBValue {
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 @@ class LLDB_API SBValue {
/// 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 @@ class LLDB_API SBValue {
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 @@ class LLDB_API SBValue {
/// 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 @@ class LLDB_API SBValue {
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 @@ class LLDB_API SBValue {
/// 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 @@ class LLDB_API SBValue {
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 @@ class LLDB_API SBValue {
/// 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

View File

@ -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 @@ class LLDB_API SBValueList {
~SBValueList();
explicit operator bool() const;
bool IsValid() const;
void Clear();
@ -66,7 +67,7 @@ class LLDB_API SBValueList {
ValueListImpl &ref();
std::unique_ptr<ValueListImpl> m_opaque_ap;
std::unique_ptr<ValueListImpl> m_opaque_up;
};
} // namespace lldb

View File

@ -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 @@ class LLDB_API SBVariablesOptions {
~SBVariablesOptions();
explicit operator bool() const;
bool IsValid() const;
bool GetIncludeArguments() const;
@ -73,7 +74,7 @@ class LLDB_API SBVariablesOptions {
void SetOptions(VariablesOptionsImpl *lldb_object_ptr);
private:
std::unique_ptr<VariablesOptionsImpl> m_opaque_ap;
std::unique_ptr<VariablesOptionsImpl> m_opaque_up;
};
} // namespace lldb

View File

@ -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 @@ class LLDB_API SBWatchpoint {
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();

View File

@ -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 @@ class Breakpoint : public std::enable_shared_from_this<Breakpoint>,
~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 @@ class Breakpoint : public std::enable_shared_from_this<Breakpoint>,
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 @@ class Breakpoint : public std::enable_shared_from_this<Breakpoint>,
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 @@ class Breakpoint : public std::enable_shared_from_this<Breakpoint>,
/// 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 @@ class Breakpoint : public std::enable_shared_from_this<Breakpoint>,
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 @@ class Breakpoint : public std::enable_shared_from_this<Breakpoint>,
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 @@ class Breakpoint : public std::enable_shared_from_this<Breakpoint>,
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 @@ class Breakpoint : public std::enable_shared_from_this<Breakpoint>,
/// 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 @@ class Breakpoint : public std::enable_shared_from_this<Breakpoint>,
}
}
//------------------------------------------------------------------
/// Set a pre-condition filter that overrides all user provided
/// filters/callbacks etc.
///
@ -656,15 +545,14 @@ class Breakpoint : public std::enable_shared_from_this<Breakpoint>,
/// 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 @@ class Breakpoint : public std::enable_shared_from_this<Breakpoint>,
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 @@ class Breakpoint : public std::enable_shared_from_this<Breakpoint>,
// 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 @@ class Breakpoint : public std::enable_shared_from_this<Breakpoint>,
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.

View File

@ -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 @@ class BreakpointID {
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);

View File

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

View File

@ -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 @@ class BreakpointList {
~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 @@ class BreakpointList {
/// 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 @@ class BreakpointList {
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:

View File

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

View File

@ -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 @@ class BreakpointLocationCollection {
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;

View File

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

View File

@ -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 @@ class BreakpointName {
}
};
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 @@ class BreakpointName {
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; }

View File

@ -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 @@ friend class Breakpoint;
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 @@ friend class Breakpoint;
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 @@ friend class Breakpoint;
// 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 @@ friend class Breakpoint;
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 @@ friend class Breakpoint;
/// 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 @@ friend class Breakpoint;
}
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 @@ friend class Breakpoint;
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 @@ friend class Breakpoint;
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.

View File

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

View File

@ -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 @@ class BreakpointResolver : public Searcher {
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 @@ class BreakpointResolver : public Searcher {
// 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 @@ class BreakpointResolver : public Searcher {
}
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 @@ class BreakpointResolver : public Searcher {
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

View File

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

View File

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

View File

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

View File

@ -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 @@ class BreakpointResolverName : public BreakpointResolver {
lldb::LanguageType m_language;
bool m_skip_prologue;
void AddNameLookup(const ConstString &name,
void AddNameLookup(ConstString name,
lldb::FunctionNameType name_type_mask);
};

View File

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

View File

@ -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 @@ class BreakpointSite : public std::enable_shared_from_this<BreakpointSite>,
~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 @@ class BreakpointSite : public std::enable_shared_from_this<BreakpointSite>,
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.

View File

@ -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 @@ class BreakpointSiteList {
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();

View File

@ -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 @@ class Stoppoint {
lldb::break_id_t m_bid;
private:
//------------------------------------------------------------------
// For Stoppoint only
//------------------------------------------------------------------
DISALLOW_COPY_AND_ASSIGN(Stoppoint);
};

View File

@ -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 @@ class StoppointCallbackContext {
StoppointCallbackContext(Event *event, const ExecutionContext &exe_ctx,
bool synchronously = false);
//------------------------------------------------------------------
/// Clear the object's state.
///
/// Sets the event, process and thread to NULL, and the frame index to an
/// invalid value.
//------------------------------------------------------------------
void Clear();
//------------------------------------------------------------------
// Member variables
//------------------------------------------------------------------
Event *event; // This is the event, the callback can modify this to indicate
// the meaning of the breakpoint hit
ExecutionContextRef

View File

@ -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 @@ class StoppointLocation {
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 @@ class StoppointLocation {
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 @@ class StoppointLocation {
void DecrementHitCount();
private:
//------------------------------------------------------------------
// For StoppointLocation only
//------------------------------------------------------------------
DISALLOW_COPY_AND_ASSIGN(StoppointLocation);
StoppointLocation(); // Disallow default constructor
StoppointLocation() = delete;
};
} // namespace lldb_private

View File

@ -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 @@ class Watchpoint : public std::enable_shared_from_this<Watchpoint>,
~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 @@ class Watchpoint : public std::enable_shared_from_this<Watchpoint>,
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 @@ class Watchpoint : public std::enable_shared_from_this<Watchpoint>,
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 @@ class Watchpoint : public std::enable_shared_from_this<Watchpoint>,
// 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; }

View File

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

View File

@ -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 @@ class WatchpointOptions {
// 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 @@ class WatchpointOptions {
/// 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 @@ class WatchpointOptions {
};
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

View File

@ -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 @@ class Address {
/// // 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 @@ class Address {
/// // 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 &section_sp, lldb::addr_t offset)
: m_section_wp(), // Don't init with section_sp in case section_sp is
// invalid (the weak_ptr will throw)
@ -167,63 +135,53 @@ class Address {
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 @@ class Address {
}
};
//------------------------------------------------------------------
/// 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 @@ class Address {
/// 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 @@ class Address {
/// 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 @@ class Address {
/// 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 @@ class Address {
/// 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 @@ class Address {
/// 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 @@ class Address {
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 @@ class Address {
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 &section_sp) {
m_section_wp = section_sp;
}
void ClearSection() { m_section_wp.reset(); }
//------------------------------------------------------------------
/// Reconstruct a symbol context from an address.
///
/// This class doesn't inherit from SymbolContextScope because many address
@ -506,8 +433,7 @@ class Address {
/// 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 @@ class Address {
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 @@ class Address {
// address results to make much sense
//
// This basically lets Address objects be used in ordered collection classes.
//----------------------------------------------------------------------
bool operator<(const Address &lhs, const Address &rhs);
bool operator>(const Address &lhs, const Address &rhs);
bool operator==(const Address &lhs, const Address &rhs);

View File

@ -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 &section, lldb::addr_t offset,
lldb::addr_t byte_size);
//------------------------------------------------------------------
/// Construct with a virtual address, section list and byte size.
///
/// Initialize and resolve the address with the supplied virtual address \a
/// 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 @@ class AddressRange {
/// 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 @@ class AddressRange {
/// 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.
};

View File

@ -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();

View File

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

View File

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

View File

@ -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 @@ class Architecture : public PluginInterface {
/// 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 @@ class Architecture : public PluginInterface {
/// 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 @@ class Architecture : public PluginInterface {
/// 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 @@ class Architecture : public PluginInterface {
/// 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 @@ class Architecture : public PluginInterface {
/// 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 {

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