Import lldb as of SVN r188801
(A number of files not required for the FreeBSD build have been removed.) Sponsored by: DARPA, AFRL
This commit is contained in:
commit
f034231a6a
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/vendor/lldb/dist/; revision=254721
38
LICENSE.TXT
Normal file
38
LICENSE.TXT
Normal file
@ -0,0 +1,38 @@
|
||||
University of Illinois/NCSA
|
||||
Open Source License
|
||||
|
||||
Copyright (c) 2010 Apple Inc.
|
||||
All rights reserved.
|
||||
|
||||
Developed by:
|
||||
|
||||
LLDB Team
|
||||
|
||||
http://lldb.llvm.org/
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal with
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do
|
||||
so, subject to the following conditions:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimers.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimers in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the names of the LLDB Team, copyright holders, nor the names of
|
||||
its contributors may be used to endorse or promote products derived from
|
||||
this Software without specific prior written permission.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
|
||||
SOFTWARE.
|
||||
|
54
include/lldb/API/LLDB.h
Normal file
54
include/lldb/API/LLDB.h
Normal file
@ -0,0 +1,54 @@
|
||||
//===-- LLDB.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_LLDB_h_
|
||||
#define LLDB_LLDB_h_
|
||||
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/API/SBDefines.h"
|
||||
#include "lldb/API/SBAddress.h"
|
||||
#include "lldb/API/SBBlock.h"
|
||||
#include "lldb/API/SBBreakpoint.h"
|
||||
#include "lldb/API/SBBreakpointLocation.h"
|
||||
#include "lldb/API/SBBroadcaster.h"
|
||||
#include "lldb/API/SBCommandInterpreter.h"
|
||||
#include "lldb/API/SBCommandReturnObject.h"
|
||||
#include "lldb/API/SBCommunication.h"
|
||||
#include "lldb/API/SBCompileUnit.h"
|
||||
#include "lldb/API/SBData.h"
|
||||
#include "lldb/API/SBDebugger.h"
|
||||
#include "lldb/API/SBDeclaration.h"
|
||||
#include "lldb/API/SBError.h"
|
||||
#include "lldb/API/SBEvent.h"
|
||||
#include "lldb/API/SBFileSpec.h"
|
||||
#include "lldb/API/SBFrame.h"
|
||||
#include "lldb/API/SBFunction.h"
|
||||
#include "lldb/API/SBHostOS.h"
|
||||
#include "lldb/API/SBInputReader.h"
|
||||
#include "lldb/API/SBInstruction.h"
|
||||
#include "lldb/API/SBInstructionList.h"
|
||||
#include "lldb/API/SBLineEntry.h"
|
||||
#include "lldb/API/SBListener.h"
|
||||
#include "lldb/API/SBModule.h"
|
||||
#include "lldb/API/SBProcess.h"
|
||||
#include "lldb/API/SBSourceManager.h"
|
||||
#include "lldb/API/SBStream.h"
|
||||
#include "lldb/API/SBStringList.h"
|
||||
#include "lldb/API/SBSymbol.h"
|
||||
#include "lldb/API/SBSymbolContext.h"
|
||||
#include "lldb/API/SBTarget.h"
|
||||
#include "lldb/API/SBThread.h"
|
||||
#include "lldb/API/SBType.h"
|
||||
#include "lldb/API/SBValue.h"
|
||||
#include "lldb/API/SBValueList.h"
|
||||
|
||||
#endif // LLDB_LLDB_h_
|
150
include/lldb/API/SBAddress.h
Normal file
150
include/lldb/API/SBAddress.h
Normal file
@ -0,0 +1,150 @@
|
||||
//===-- SBAddress.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_SBAddress_h_
|
||||
#define LLDB_SBAddress_h_
|
||||
|
||||
#include "lldb/API/SBDefines.h"
|
||||
#include "lldb/API/SBModule.h"
|
||||
|
||||
namespace lldb {
|
||||
|
||||
class SBAddress
|
||||
{
|
||||
public:
|
||||
|
||||
SBAddress ();
|
||||
|
||||
SBAddress (const lldb::SBAddress &rhs);
|
||||
|
||||
SBAddress (lldb::SBSection section, lldb::addr_t offset);
|
||||
|
||||
// Create an address by resolving a load address using the supplied target
|
||||
SBAddress (lldb::addr_t load_addr, lldb::SBTarget &target);
|
||||
|
||||
~SBAddress ();
|
||||
|
||||
const lldb::SBAddress &
|
||||
operator = (const lldb::SBAddress &rhs);
|
||||
|
||||
bool
|
||||
IsValid () const;
|
||||
|
||||
void
|
||||
Clear ();
|
||||
|
||||
addr_t
|
||||
GetFileAddress () const;
|
||||
|
||||
addr_t
|
||||
GetLoadAddress (const lldb::SBTarget &target) const;
|
||||
|
||||
void
|
||||
SetAddress (lldb::SBSection section, lldb::addr_t offset);
|
||||
|
||||
void
|
||||
SetLoadAddress (lldb::addr_t load_addr,
|
||||
lldb::SBTarget &target);
|
||||
bool
|
||||
OffsetAddress (addr_t offset);
|
||||
|
||||
bool
|
||||
GetDescription (lldb::SBStream &description);
|
||||
|
||||
// The following queries can lookup symbol information for a given address.
|
||||
// An address might refer to code or data from an existing module, or it
|
||||
// might refer to something on the stack or heap. The following functions
|
||||
// will only return valid values if the address has been resolved to a code
|
||||
// or data address using "void SBAddress::SetLoadAddress(...)" or
|
||||
// "lldb::SBAddress SBTarget::ResolveLoadAddress (...)".
|
||||
lldb::SBSymbolContext
|
||||
GetSymbolContext (uint32_t resolve_scope);
|
||||
|
||||
|
||||
// The following functions grab individual objects for a given address and
|
||||
// are less efficient if you want more than one symbol related objects.
|
||||
// Use one of the following when you want multiple debug symbol related
|
||||
// objects for an address:
|
||||
// lldb::SBSymbolContext SBAddress::GetSymbolContext (uint32_t resolve_scope);
|
||||
// lldb::SBSymbolContext SBTarget::ResolveSymbolContextForAddress (const SBAddress &addr, uint32_t resolve_scope);
|
||||
// One or more bits from the SymbolContextItem enumerations can be logically
|
||||
// OR'ed together to more efficiently retrieve multiple symbol objects.
|
||||
|
||||
lldb::SBSection
|
||||
GetSection ();
|
||||
|
||||
lldb::addr_t
|
||||
GetOffset ();
|
||||
|
||||
lldb::SBModule
|
||||
GetModule ();
|
||||
|
||||
lldb::SBCompileUnit
|
||||
GetCompileUnit ();
|
||||
|
||||
lldb::SBFunction
|
||||
GetFunction ();
|
||||
|
||||
lldb::SBBlock
|
||||
GetBlock ();
|
||||
|
||||
lldb::SBSymbol
|
||||
GetSymbol ();
|
||||
|
||||
lldb::SBLineEntry
|
||||
GetLineEntry ();
|
||||
|
||||
lldb::AddressClass
|
||||
GetAddressClass ();
|
||||
|
||||
protected:
|
||||
|
||||
friend class SBBlock;
|
||||
friend class SBBreakpointLocation;
|
||||
friend class SBFrame;
|
||||
friend class SBFunction;
|
||||
friend class SBLineEntry;
|
||||
friend class SBInstruction;
|
||||
friend class SBModule;
|
||||
friend class SBSection;
|
||||
friend class SBSymbol;
|
||||
friend class SBSymbolContext;
|
||||
friend class SBTarget;
|
||||
friend class SBThread;
|
||||
friend class SBValue;
|
||||
|
||||
lldb_private::Address *
|
||||
operator->();
|
||||
|
||||
const lldb_private::Address *
|
||||
operator->() const;
|
||||
|
||||
lldb_private::Address *
|
||||
get ();
|
||||
|
||||
lldb_private::Address &
|
||||
ref();
|
||||
|
||||
const lldb_private::Address &
|
||||
ref() const;
|
||||
|
||||
SBAddress (const lldb_private::Address *lldb_object_ptr);
|
||||
|
||||
void
|
||||
SetAddress (const lldb_private::Address *lldb_object_ptr);
|
||||
|
||||
private:
|
||||
|
||||
std::unique_ptr<lldb_private::Address> m_opaque_ap;
|
||||
};
|
||||
|
||||
|
||||
} // namespace lldb
|
||||
|
||||
#endif // LLDB_SBAddress_h_
|
123
include/lldb/API/SBBlock.h
Normal file
123
include/lldb/API/SBBlock.h
Normal file
@ -0,0 +1,123 @@
|
||||
//===-- SBBlock.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_SBBlock_h_
|
||||
#define LLDB_SBBlock_h_
|
||||
|
||||
#include "lldb/API/SBDefines.h"
|
||||
#include "lldb/API/SBFrame.h"
|
||||
#include "lldb/API/SBTarget.h"
|
||||
#include "lldb/API/SBValueList.h"
|
||||
|
||||
namespace lldb {
|
||||
|
||||
class SBBlock
|
||||
{
|
||||
public:
|
||||
|
||||
SBBlock ();
|
||||
|
||||
SBBlock (const lldb::SBBlock &rhs);
|
||||
|
||||
~SBBlock ();
|
||||
|
||||
const lldb::SBBlock &
|
||||
operator = (const lldb::SBBlock &rhs);
|
||||
|
||||
bool
|
||||
IsInlined () const;
|
||||
|
||||
bool
|
||||
IsValid () const;
|
||||
|
||||
const char *
|
||||
GetInlinedName () const;
|
||||
|
||||
lldb::SBFileSpec
|
||||
GetInlinedCallSiteFile () const;
|
||||
|
||||
uint32_t
|
||||
GetInlinedCallSiteLine () const;
|
||||
|
||||
uint32_t
|
||||
GetInlinedCallSiteColumn () const;
|
||||
|
||||
lldb::SBBlock
|
||||
GetParent ();
|
||||
|
||||
lldb::SBBlock
|
||||
GetSibling ();
|
||||
|
||||
lldb::SBBlock
|
||||
GetFirstChild ();
|
||||
|
||||
uint32_t
|
||||
GetNumRanges ();
|
||||
|
||||
lldb::SBAddress
|
||||
GetRangeStartAddress (uint32_t idx);
|
||||
|
||||
lldb::SBAddress
|
||||
GetRangeEndAddress (uint32_t idx);
|
||||
|
||||
uint32_t
|
||||
GetRangeIndexForBlockAddress (lldb::SBAddress block_addr);
|
||||
|
||||
lldb::SBValueList
|
||||
GetVariables (lldb::SBFrame& frame,
|
||||
bool arguments,
|
||||
bool locals,
|
||||
bool statics,
|
||||
lldb::DynamicValueType use_dynamic);
|
||||
|
||||
lldb::SBValueList
|
||||
GetVariables (lldb::SBTarget& target,
|
||||
bool arguments,
|
||||
bool locals,
|
||||
bool statics);
|
||||
//------------------------------------------------------------------
|
||||
/// Get the inlined block that contains this block.
|
||||
///
|
||||
/// @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);
|
||||
|
||||
private:
|
||||
friend class SBAddress;
|
||||
friend class SBFrame;
|
||||
friend class SBFunction;
|
||||
friend class SBSymbolContext;
|
||||
|
||||
lldb_private::Block *
|
||||
GetPtr ();
|
||||
|
||||
void
|
||||
SetPtr (lldb_private::Block *lldb_object_ptr);
|
||||
|
||||
SBBlock (lldb_private::Block *lldb_object_ptr);
|
||||
|
||||
void
|
||||
AppendVariables (bool can_create, bool get_parent_variables, lldb_private::VariableList *var_list);
|
||||
|
||||
lldb_private::Block *m_opaque_ptr;
|
||||
};
|
||||
|
||||
|
||||
} // namespace lldb
|
||||
|
||||
#endif // LLDB_SBBlock_h_
|
175
include/lldb/API/SBBreakpoint.h
Normal file
175
include/lldb/API/SBBreakpoint.h
Normal file
@ -0,0 +1,175 @@
|
||||
//===-- SBBreakpoint.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_SBBreakpoint_h_
|
||||
#define LLDB_SBBreakpoint_h_
|
||||
|
||||
#include "lldb/API/SBDefines.h"
|
||||
|
||||
namespace lldb {
|
||||
|
||||
class SBBreakpoint
|
||||
{
|
||||
public:
|
||||
|
||||
typedef bool (*BreakpointHitCallback) (void *baton,
|
||||
SBProcess &process,
|
||||
SBThread &thread,
|
||||
lldb::SBBreakpointLocation &location);
|
||||
|
||||
SBBreakpoint ();
|
||||
|
||||
SBBreakpoint (const lldb::SBBreakpoint& rhs);
|
||||
|
||||
~SBBreakpoint();
|
||||
|
||||
const lldb::SBBreakpoint &
|
||||
operator = (const lldb::SBBreakpoint& rhs);
|
||||
|
||||
// Tests to see if the opaque breakpoint object in this object matches the
|
||||
// opaque breakpoint object in "rhs".
|
||||
bool
|
||||
operator == (const lldb::SBBreakpoint& rhs);
|
||||
|
||||
bool
|
||||
operator != (const lldb::SBBreakpoint& rhs);
|
||||
|
||||
break_id_t
|
||||
GetID () const;
|
||||
|
||||
bool
|
||||
IsValid() const;
|
||||
|
||||
void
|
||||
ClearAllBreakpointSites ();
|
||||
|
||||
lldb::SBBreakpointLocation
|
||||
FindLocationByAddress (lldb::addr_t vm_addr);
|
||||
|
||||
lldb::break_id_t
|
||||
FindLocationIDByAddress (lldb::addr_t vm_addr);
|
||||
|
||||
lldb::SBBreakpointLocation
|
||||
FindLocationByID (lldb::break_id_t bp_loc_id);
|
||||
|
||||
lldb::SBBreakpointLocation
|
||||
GetLocationAtIndex (uint32_t index);
|
||||
|
||||
void
|
||||
SetEnabled (bool enable);
|
||||
|
||||
bool
|
||||
IsEnabled ();
|
||||
|
||||
void
|
||||
SetOneShot (bool one_shot);
|
||||
|
||||
bool
|
||||
IsOneShot () const;
|
||||
|
||||
bool
|
||||
IsInternal ();
|
||||
|
||||
uint32_t
|
||||
GetHitCount () const;
|
||||
|
||||
void
|
||||
SetIgnoreCount (uint32_t count);
|
||||
|
||||
uint32_t
|
||||
GetIgnoreCount () const;
|
||||
|
||||
void
|
||||
SetCondition (const char *condition);
|
||||
|
||||
const char *
|
||||
GetCondition ();
|
||||
|
||||
void
|
||||
SetThreadID (lldb::tid_t sb_thread_id);
|
||||
|
||||
lldb::tid_t
|
||||
GetThreadID ();
|
||||
|
||||
void
|
||||
SetThreadIndex (uint32_t index);
|
||||
|
||||
uint32_t
|
||||
GetThreadIndex() const;
|
||||
|
||||
void
|
||||
SetThreadName (const char *thread_name);
|
||||
|
||||
const char *
|
||||
GetThreadName () const;
|
||||
|
||||
void
|
||||
SetQueueName (const char *queue_name);
|
||||
|
||||
const char *
|
||||
GetQueueName () const;
|
||||
|
||||
void
|
||||
SetCallback (BreakpointHitCallback callback, void *baton);
|
||||
|
||||
size_t
|
||||
GetNumResolvedLocations() const;
|
||||
|
||||
size_t
|
||||
GetNumLocations() const;
|
||||
|
||||
bool
|
||||
GetDescription (lldb::SBStream &description);
|
||||
|
||||
static bool
|
||||
EventIsBreakpointEvent (const lldb::SBEvent &event);
|
||||
|
||||
static lldb::BreakpointEventType
|
||||
GetBreakpointEventTypeFromEvent (const lldb::SBEvent& event);
|
||||
|
||||
static lldb::SBBreakpoint
|
||||
GetBreakpointFromEvent (const lldb::SBEvent& event);
|
||||
|
||||
static lldb::SBBreakpointLocation
|
||||
GetBreakpointLocationAtIndexFromEvent (const lldb::SBEvent& event, uint32_t loc_idx);
|
||||
|
||||
static uint32_t
|
||||
GetNumBreakpointLocationsFromEvent (const lldb::SBEvent &event_sp);
|
||||
|
||||
|
||||
private:
|
||||
friend class SBBreakpointLocation;
|
||||
friend class SBTarget;
|
||||
|
||||
SBBreakpoint (const lldb::BreakpointSP &bp_sp);
|
||||
|
||||
lldb_private::Breakpoint *
|
||||
operator->() const;
|
||||
|
||||
lldb_private::Breakpoint *
|
||||
get() const;
|
||||
|
||||
lldb::BreakpointSP &
|
||||
operator *();
|
||||
|
||||
const lldb::BreakpointSP &
|
||||
operator *() const;
|
||||
|
||||
static bool
|
||||
PrivateBreakpointHitCallback (void *baton,
|
||||
lldb_private::StoppointCallbackContext *context,
|
||||
lldb::user_id_t break_id,
|
||||
lldb::user_id_t break_loc_id);
|
||||
|
||||
lldb::BreakpointSP m_opaque_sp;
|
||||
};
|
||||
|
||||
} // namespace lldb
|
||||
|
||||
#endif // LLDB_SBBreakpoint_h_
|
110
include/lldb/API/SBBreakpointLocation.h
Normal file
110
include/lldb/API/SBBreakpointLocation.h
Normal file
@ -0,0 +1,110 @@
|
||||
//===-- SBBreakpointLocation.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_SBBreakpointLocation_h_
|
||||
#define LLDB_SBBreakpointLocation_h_
|
||||
|
||||
#include "lldb/API/SBDefines.h"
|
||||
#include "lldb/API/SBBreakpoint.h"
|
||||
|
||||
namespace lldb {
|
||||
|
||||
class SBBreakpointLocation
|
||||
{
|
||||
public:
|
||||
|
||||
SBBreakpointLocation ();
|
||||
|
||||
SBBreakpointLocation (const lldb::SBBreakpointLocation &rhs);
|
||||
|
||||
~SBBreakpointLocation ();
|
||||
|
||||
const lldb::SBBreakpointLocation &
|
||||
operator = (const lldb::SBBreakpointLocation &rhs);
|
||||
|
||||
break_id_t
|
||||
GetID ();
|
||||
|
||||
bool
|
||||
IsValid() const;
|
||||
|
||||
lldb::SBAddress
|
||||
GetAddress ();
|
||||
|
||||
lldb::addr_t
|
||||
GetLoadAddress ();
|
||||
|
||||
void
|
||||
SetEnabled(bool enabled);
|
||||
|
||||
bool
|
||||
IsEnabled ();
|
||||
|
||||
uint32_t
|
||||
GetIgnoreCount ();
|
||||
|
||||
void
|
||||
SetIgnoreCount (uint32_t n);
|
||||
|
||||
void
|
||||
SetCondition (const char *condition);
|
||||
|
||||
const char *
|
||||
GetCondition ();
|
||||
|
||||
void
|
||||
SetThreadID (lldb::tid_t sb_thread_id);
|
||||
|
||||
lldb::tid_t
|
||||
GetThreadID ();
|
||||
|
||||
void
|
||||
SetThreadIndex (uint32_t index);
|
||||
|
||||
uint32_t
|
||||
GetThreadIndex() const;
|
||||
|
||||
void
|
||||
SetThreadName (const char *thread_name);
|
||||
|
||||
const char *
|
||||
GetThreadName () const;
|
||||
|
||||
void
|
||||
SetQueueName (const char *queue_name);
|
||||
|
||||
const char *
|
||||
GetQueueName () const;
|
||||
|
||||
bool
|
||||
IsResolved ();
|
||||
|
||||
bool
|
||||
GetDescription (lldb::SBStream &description, DescriptionLevel level);
|
||||
|
||||
SBBreakpoint
|
||||
GetBreakpoint ();
|
||||
|
||||
SBBreakpointLocation (const lldb::BreakpointLocationSP &break_loc_sp);
|
||||
|
||||
private:
|
||||
friend class SBBreakpoint;
|
||||
#ifndef LLDB_DISABLE_PYTHON
|
||||
friend class lldb_private::ScriptInterpreterPython;
|
||||
#endif
|
||||
void
|
||||
SetLocation (const lldb::BreakpointLocationSP &break_loc_sp);
|
||||
|
||||
lldb::BreakpointLocationSP m_opaque_sp;
|
||||
|
||||
};
|
||||
|
||||
} // namespace lldb
|
||||
|
||||
#endif // LLDB_SBBreakpointLocation_h_
|
97
include/lldb/API/SBBroadcaster.h
Normal file
97
include/lldb/API/SBBroadcaster.h
Normal file
@ -0,0 +1,97 @@
|
||||
//===-- SBBroadcaster.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_SBBroadcaster_h_
|
||||
#define LLDB_SBBroadcaster_h_
|
||||
|
||||
#include "lldb/API/SBDefines.h"
|
||||
|
||||
namespace lldb {
|
||||
|
||||
class SBBroadcaster
|
||||
{
|
||||
public:
|
||||
SBBroadcaster ();
|
||||
|
||||
SBBroadcaster (const char *name);
|
||||
|
||||
SBBroadcaster (const SBBroadcaster &rhs);
|
||||
|
||||
const SBBroadcaster &
|
||||
operator = (const SBBroadcaster &rhs);
|
||||
|
||||
~SBBroadcaster();
|
||||
|
||||
bool
|
||||
IsValid () const;
|
||||
|
||||
void
|
||||
Clear ();
|
||||
|
||||
void
|
||||
BroadcastEventByType (uint32_t event_type, bool unique = false);
|
||||
|
||||
void
|
||||
BroadcastEvent (const lldb::SBEvent &event, bool unique = false);
|
||||
|
||||
void
|
||||
AddInitialEventsToListener (const lldb::SBListener &listener, uint32_t requested_events);
|
||||
|
||||
uint32_t
|
||||
AddListener (const lldb::SBListener &listener, uint32_t event_mask);
|
||||
|
||||
const char *
|
||||
GetName () const;
|
||||
|
||||
bool
|
||||
EventTypeHasListeners (uint32_t event_type);
|
||||
|
||||
bool
|
||||
RemoveListener (const lldb::SBListener &listener, uint32_t event_mask = UINT32_MAX);
|
||||
|
||||
// This comparison is checking if the internal opaque pointer value
|
||||
// is equal to that in "rhs".
|
||||
bool
|
||||
operator == (const lldb::SBBroadcaster &rhs) const;
|
||||
|
||||
// This comparison is checking if the internal opaque pointer value
|
||||
// is not equal to that in "rhs".
|
||||
bool
|
||||
operator != (const lldb::SBBroadcaster &rhs) const;
|
||||
|
||||
// This comparison is checking if the internal opaque pointer value
|
||||
// is less than that in "rhs" so SBBroadcaster objects can be contained
|
||||
// in ordered containers.
|
||||
bool
|
||||
operator < (const lldb::SBBroadcaster &rhs) const;
|
||||
|
||||
protected:
|
||||
friend class SBCommandInterpreter;
|
||||
friend class SBCommunication;
|
||||
friend class SBEvent;
|
||||
friend class SBListener;
|
||||
friend class SBProcess;
|
||||
friend class SBTarget;
|
||||
|
||||
SBBroadcaster (lldb_private::Broadcaster *broadcaster, bool owns);
|
||||
|
||||
lldb_private::Broadcaster *
|
||||
get () const;
|
||||
|
||||
void
|
||||
reset (lldb_private::Broadcaster *broadcaster, bool owns);
|
||||
|
||||
private:
|
||||
lldb::BroadcasterSP m_opaque_sp;
|
||||
lldb_private::Broadcaster *m_opaque_ptr;
|
||||
};
|
||||
|
||||
} // namespace lldb
|
||||
|
||||
#endif // LLDB_SBBroadcaster_h_
|
193
include/lldb/API/SBCommandInterpreter.h
Normal file
193
include/lldb/API/SBCommandInterpreter.h
Normal file
@ -0,0 +1,193 @@
|
||||
//===-- SBCommandInterpreter.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_SBCommandInterpreter_h_
|
||||
#define LLDB_SBCommandInterpreter_h_
|
||||
|
||||
#include "lldb/API/SBDefines.h"
|
||||
#include "lldb/API/SBDebugger.h"
|
||||
|
||||
namespace lldb {
|
||||
|
||||
class SBCommandInterpreter
|
||||
{
|
||||
public:
|
||||
enum
|
||||
{
|
||||
eBroadcastBitThreadShouldExit = (1 << 0),
|
||||
eBroadcastBitResetPrompt = (1 << 1),
|
||||
eBroadcastBitQuitCommandReceived = (1 << 2), // User entered quit
|
||||
eBroadcastBitAsynchronousOutputData = (1 << 3),
|
||||
eBroadcastBitAsynchronousErrorData = (1 << 4)
|
||||
};
|
||||
|
||||
SBCommandInterpreter (const lldb::SBCommandInterpreter &rhs);
|
||||
|
||||
const lldb::SBCommandInterpreter &
|
||||
operator = (const lldb::SBCommandInterpreter &rhs);
|
||||
|
||||
~SBCommandInterpreter ();
|
||||
|
||||
static const char *
|
||||
GetArgumentTypeAsCString (const lldb::CommandArgumentType arg_type);
|
||||
|
||||
static const char *
|
||||
GetArgumentDescriptionAsCString (const lldb::CommandArgumentType arg_type);
|
||||
|
||||
bool
|
||||
IsValid() const;
|
||||
|
||||
bool
|
||||
CommandExists (const char *cmd);
|
||||
|
||||
bool
|
||||
AliasExists (const char *cmd);
|
||||
|
||||
lldb::SBBroadcaster
|
||||
GetBroadcaster ();
|
||||
|
||||
static const char *
|
||||
GetBroadcasterClass ();
|
||||
|
||||
bool
|
||||
HasCommands ();
|
||||
|
||||
bool
|
||||
HasAliases ();
|
||||
|
||||
bool
|
||||
HasAliasOptions ();
|
||||
|
||||
lldb::SBProcess
|
||||
GetProcess ();
|
||||
|
||||
lldb::SBDebugger
|
||||
GetDebugger ();
|
||||
|
||||
lldb::SBCommand
|
||||
AddMultiwordCommand (const char* name, const char* help);
|
||||
|
||||
lldb::SBCommand
|
||||
AddCommand (const char* name, lldb::SBCommandPluginInterface *impl, const char* help);
|
||||
|
||||
void
|
||||
SourceInitFileInHomeDirectory (lldb::SBCommandReturnObject &result);
|
||||
|
||||
void
|
||||
SourceInitFileInCurrentWorkingDirectory (lldb::SBCommandReturnObject &result);
|
||||
|
||||
lldb::ReturnStatus
|
||||
HandleCommand (const char *command_line, lldb::SBCommandReturnObject &result, bool add_to_history = false);
|
||||
|
||||
// The pointer based interface is not useful in SWIG, since the cursor & last_char arguments are string pointers INTO current_line
|
||||
// and you can't do that in a scripting language interface in general...
|
||||
|
||||
// In either case, the way this works is that the you give it a line and cursor position in the line. The function
|
||||
// will return the number of completions. The matches list will contain number_of_completions + 1 elements. The first
|
||||
// element is the common substring after the cursor position for all the matches. The rest of the elements are the
|
||||
// matches. The first element is useful if you are emulating the common shell behavior where the tab completes
|
||||
// to the string that is common among all the matches, then you should first check if the first element is non-empty,
|
||||
// and if so just insert it and move the cursor to the end of the insertion. The next tab will return an empty
|
||||
// common substring, and a list of choices (if any), at which point you should display the choices and let the user
|
||||
// type further to disambiguate.
|
||||
|
||||
int
|
||||
HandleCompletion (const char *current_line,
|
||||
const char *cursor,
|
||||
const char *last_char,
|
||||
int match_start_point,
|
||||
int max_return_elements,
|
||||
lldb::SBStringList &matches);
|
||||
|
||||
int
|
||||
HandleCompletion (const char *current_line,
|
||||
uint32_t cursor_pos,
|
||||
int match_start_point,
|
||||
int max_return_elements,
|
||||
lldb::SBStringList &matches);
|
||||
|
||||
// Catch commands before they execute by registering a callback that will
|
||||
// get called when the command gets executed. This allows GUI or command
|
||||
// line interfaces to intercept a command and stop it from happening
|
||||
bool
|
||||
SetCommandOverrideCallback (const char *command_name,
|
||||
lldb::CommandOverrideCallback callback,
|
||||
void *baton);
|
||||
|
||||
SBCommandInterpreter (lldb_private::CommandInterpreter *interpreter_ptr = NULL); // Access using SBDebugger::GetCommandInterpreter();
|
||||
|
||||
protected:
|
||||
|
||||
lldb_private::CommandInterpreter &
|
||||
ref ();
|
||||
|
||||
lldb_private::CommandInterpreter *
|
||||
get ();
|
||||
|
||||
void
|
||||
reset (lldb_private::CommandInterpreter *);
|
||||
private:
|
||||
friend class SBDebugger;
|
||||
|
||||
static void
|
||||
InitializeSWIG ();
|
||||
|
||||
lldb_private::CommandInterpreter *m_opaque_ptr;
|
||||
};
|
||||
|
||||
class SBCommandPluginInterface
|
||||
{
|
||||
public:
|
||||
virtual bool
|
||||
DoExecute (lldb::SBDebugger debugger,
|
||||
char** command,
|
||||
lldb::SBCommandReturnObject &result)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual
|
||||
~SBCommandPluginInterface ()
|
||||
{}
|
||||
};
|
||||
|
||||
class SBCommand
|
||||
{
|
||||
public:
|
||||
|
||||
SBCommand ();
|
||||
|
||||
bool
|
||||
IsValid ();
|
||||
|
||||
const char*
|
||||
GetName ();
|
||||
|
||||
const char*
|
||||
GetHelp ();
|
||||
|
||||
lldb::SBCommand
|
||||
AddMultiwordCommand (const char* name, const char* help = NULL);
|
||||
|
||||
lldb::SBCommand
|
||||
AddCommand (const char* name, lldb::SBCommandPluginInterface* impl, const char* help = NULL);
|
||||
|
||||
private:
|
||||
|
||||
friend class SBDebugger;
|
||||
friend class SBCommandInterpreter;
|
||||
|
||||
SBCommand (lldb::CommandObjectSP cmd_sp);
|
||||
|
||||
lldb::CommandObjectSP m_opaque_sp;
|
||||
};
|
||||
|
||||
} // namespace lldb
|
||||
|
||||
#endif // LLDB_SBCommandInterpreter_h_
|
133
include/lldb/API/SBCommandReturnObject.h
Normal file
133
include/lldb/API/SBCommandReturnObject.h
Normal file
@ -0,0 +1,133 @@
|
||||
//===-- SBCommandReturnObject.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_SBCommandReturnObject_h_
|
||||
#define LLDB_SBCommandReturnObject_h_
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "lldb/API/SBDefines.h"
|
||||
|
||||
namespace lldb {
|
||||
|
||||
class SBCommandReturnObject
|
||||
{
|
||||
public:
|
||||
|
||||
SBCommandReturnObject ();
|
||||
|
||||
SBCommandReturnObject (const lldb::SBCommandReturnObject &rhs);
|
||||
|
||||
const lldb::SBCommandReturnObject &
|
||||
operator = (const lldb::SBCommandReturnObject &rhs);
|
||||
|
||||
|
||||
SBCommandReturnObject (lldb_private::CommandReturnObject *ptr);
|
||||
|
||||
lldb_private::CommandReturnObject *
|
||||
Release ();
|
||||
|
||||
~SBCommandReturnObject ();
|
||||
|
||||
bool
|
||||
IsValid() const;
|
||||
|
||||
const char *
|
||||
GetOutput ();
|
||||
|
||||
const char *
|
||||
GetError ();
|
||||
|
||||
size_t
|
||||
PutOutput (FILE *fh);
|
||||
|
||||
size_t
|
||||
GetOutputSize ();
|
||||
|
||||
size_t
|
||||
GetErrorSize ();
|
||||
|
||||
size_t
|
||||
PutError (FILE *fh);
|
||||
|
||||
void
|
||||
Clear();
|
||||
|
||||
lldb::ReturnStatus
|
||||
GetStatus();
|
||||
|
||||
void
|
||||
SetStatus (lldb::ReturnStatus status);
|
||||
|
||||
bool
|
||||
Succeeded ();
|
||||
|
||||
bool
|
||||
HasResult ();
|
||||
|
||||
void
|
||||
AppendMessage (const char *message);
|
||||
|
||||
void
|
||||
AppendWarning (const char *message);
|
||||
|
||||
bool
|
||||
GetDescription (lldb::SBStream &description);
|
||||
|
||||
void
|
||||
SetImmediateOutputFile (FILE *fh);
|
||||
|
||||
void
|
||||
SetImmediateErrorFile (FILE *fh);
|
||||
|
||||
void
|
||||
PutCString(const char* string, int len = -1);
|
||||
|
||||
size_t
|
||||
Printf(const char* format, ...) __attribute__ ((format (printf, 2, 3)));
|
||||
|
||||
const char *
|
||||
GetOutput (bool only_if_no_immediate);
|
||||
|
||||
const char *
|
||||
GetError (bool only_if_no_immediate);
|
||||
|
||||
void
|
||||
SetError (lldb::SBError &error,
|
||||
const char *fallback_error_cstr = NULL);
|
||||
|
||||
void
|
||||
SetError (const char* error_cstr);
|
||||
|
||||
protected:
|
||||
friend class SBCommandInterpreter;
|
||||
friend class SBOptions;
|
||||
|
||||
lldb_private::CommandReturnObject *
|
||||
operator->() const;
|
||||
|
||||
lldb_private::CommandReturnObject *
|
||||
get() const;
|
||||
|
||||
lldb_private::CommandReturnObject &
|
||||
operator*() const;
|
||||
|
||||
lldb_private::CommandReturnObject &
|
||||
ref() const;
|
||||
|
||||
void
|
||||
SetLLDBObjectPtr (lldb_private::CommandReturnObject *ptr);
|
||||
|
||||
private:
|
||||
std::unique_ptr<lldb_private::CommandReturnObject> m_opaque_ap;
|
||||
};
|
||||
|
||||
} // namespace lldb
|
||||
|
||||
#endif // LLDB_SBCommandReturnObject_h_
|
99
include/lldb/API/SBCommunication.h
Normal file
99
include/lldb/API/SBCommunication.h
Normal file
@ -0,0 +1,99 @@
|
||||
//===-- SBCommunication.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_SBCommunication_h_
|
||||
#define LLDB_SBCommunication_h_
|
||||
|
||||
#include "lldb/API/SBDefines.h"
|
||||
#include "lldb/API/SBError.h"
|
||||
|
||||
namespace lldb {
|
||||
|
||||
class SBCommunication
|
||||
{
|
||||
public:
|
||||
enum {
|
||||
eBroadcastBitDisconnected = (1 << 0), ///< Sent when the communications connection is lost.
|
||||
eBroadcastBitReadThreadGotBytes = (1 << 1), ///< Sent by the read thread when bytes become available.
|
||||
eBroadcastBitReadThreadDidExit = (1 << 2), ///< Sent by the read thread when it exits to inform clients.
|
||||
eBroadcastBitReadThreadShouldExit = (1 << 3), ///< Sent by clients that need to cancel the read thread.
|
||||
eBroadcastBitPacketAvailable = (1 << 4), ///< Sent when data received makes a complete packet.
|
||||
eAllEventBits = 0xffffffff
|
||||
};
|
||||
|
||||
typedef void (*ReadThreadBytesReceived) (void *baton, const void *src, size_t src_len);
|
||||
|
||||
SBCommunication ();
|
||||
SBCommunication (const char * broadcaster_name);
|
||||
~SBCommunication ();
|
||||
|
||||
|
||||
bool
|
||||
IsValid () const;
|
||||
|
||||
lldb::SBBroadcaster
|
||||
GetBroadcaster ();
|
||||
|
||||
static const char *GetBroadcasterClass();
|
||||
|
||||
lldb::ConnectionStatus
|
||||
AdoptFileDesriptor (int fd, bool owns_fd);
|
||||
|
||||
lldb::ConnectionStatus
|
||||
Connect (const char *url);
|
||||
|
||||
lldb::ConnectionStatus
|
||||
Disconnect ();
|
||||
|
||||
bool
|
||||
IsConnected () const;
|
||||
|
||||
bool
|
||||
GetCloseOnEOF ();
|
||||
|
||||
void
|
||||
SetCloseOnEOF (bool b);
|
||||
|
||||
size_t
|
||||
Read (void *dst,
|
||||
size_t dst_len,
|
||||
uint32_t timeout_usec,
|
||||
lldb::ConnectionStatus &status);
|
||||
|
||||
size_t
|
||||
Write (const void *src,
|
||||
size_t src_len,
|
||||
lldb::ConnectionStatus &status);
|
||||
|
||||
bool
|
||||
ReadThreadStart ();
|
||||
|
||||
bool
|
||||
ReadThreadStop ();
|
||||
|
||||
bool
|
||||
ReadThreadIsRunning ();
|
||||
|
||||
bool
|
||||
SetReadThreadBytesReceivedCallback (ReadThreadBytesReceived callback,
|
||||
void *callback_baton);
|
||||
|
||||
|
||||
private:
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN (SBCommunication);
|
||||
|
||||
lldb_private::Communication *m_opaque;
|
||||
bool m_opaque_owned;
|
||||
};
|
||||
|
||||
|
||||
} // namespace lldb
|
||||
|
||||
#endif // LLDB_SBCommunication_h_
|
116
include/lldb/API/SBCompileUnit.h
Normal file
116
include/lldb/API/SBCompileUnit.h
Normal file
@ -0,0 +1,116 @@
|
||||
//===-- SBCompileUnit.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_SBCompileUnit_h_
|
||||
#define LLDB_SBCompileUnit_h_
|
||||
|
||||
#include "lldb/API/SBDefines.h"
|
||||
#include "lldb/API/SBFileSpec.h"
|
||||
|
||||
namespace lldb {
|
||||
|
||||
class SBCompileUnit
|
||||
{
|
||||
public:
|
||||
|
||||
SBCompileUnit ();
|
||||
|
||||
SBCompileUnit (const lldb::SBCompileUnit &rhs);
|
||||
|
||||
~SBCompileUnit ();
|
||||
|
||||
const lldb::SBCompileUnit &
|
||||
operator = (const lldb::SBCompileUnit &rhs);
|
||||
|
||||
bool
|
||||
IsValid () const;
|
||||
|
||||
lldb::SBFileSpec
|
||||
GetFileSpec () const;
|
||||
|
||||
uint32_t
|
||||
GetNumLineEntries () const;
|
||||
|
||||
lldb::SBLineEntry
|
||||
GetLineEntryAtIndex (uint32_t idx) const;
|
||||
|
||||
uint32_t
|
||||
FindLineEntryIndex (uint32_t start_idx,
|
||||
uint32_t line,
|
||||
lldb::SBFileSpec *inline_file_spec) const;
|
||||
|
||||
uint32_t
|
||||
FindLineEntryIndex (uint32_t start_idx,
|
||||
uint32_t line,
|
||||
lldb::SBFileSpec *inline_file_spec,
|
||||
bool exact) const;
|
||||
|
||||
SBFileSpec
|
||||
GetSupportFileAtIndex (uint32_t idx) const;
|
||||
|
||||
uint32_t
|
||||
GetNumSupportFiles () const;
|
||||
|
||||
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
|
||||
/// 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 compile
|
||||
/// unit.
|
||||
///
|
||||
/// @return
|
||||
/// A list of types in this compile unit that match \a type_mask
|
||||
//------------------------------------------------------------------
|
||||
lldb::SBTypeList
|
||||
GetTypes (uint32_t type_mask = lldb::eTypeClassAny);
|
||||
|
||||
bool
|
||||
operator == (const lldb::SBCompileUnit &rhs) const;
|
||||
|
||||
bool
|
||||
operator != (const lldb::SBCompileUnit &rhs) const;
|
||||
|
||||
bool
|
||||
GetDescription (lldb::SBStream &description);
|
||||
|
||||
private:
|
||||
friend class SBAddress;
|
||||
friend class SBFrame;
|
||||
friend class SBSymbolContext;
|
||||
friend class SBModule;
|
||||
|
||||
SBCompileUnit (lldb_private::CompileUnit *lldb_object_ptr);
|
||||
|
||||
const lldb_private::CompileUnit *
|
||||
operator->() const;
|
||||
|
||||
const lldb_private::CompileUnit &
|
||||
operator*() const;
|
||||
|
||||
lldb_private::CompileUnit *
|
||||
get ();
|
||||
|
||||
void
|
||||
reset (lldb_private::CompileUnit *lldb_object_ptr);
|
||||
|
||||
lldb_private::CompileUnit *m_opaque_ptr;
|
||||
};
|
||||
|
||||
|
||||
} // namespace lldb
|
||||
|
||||
#endif // LLDB_SBCompileUnit_h_
|
180
include/lldb/API/SBData.h
Normal file
180
include/lldb/API/SBData.h
Normal file
@ -0,0 +1,180 @@
|
||||
//===-- SBData.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_SBData_h_
|
||||
#define LLDB_SBData_h_
|
||||
|
||||
#include "lldb/API/SBDefines.h"
|
||||
|
||||
namespace lldb {
|
||||
|
||||
class SBData
|
||||
{
|
||||
public:
|
||||
|
||||
SBData ();
|
||||
|
||||
SBData (const SBData &rhs);
|
||||
|
||||
const SBData &
|
||||
operator = (const SBData &rhs);
|
||||
|
||||
~SBData ();
|
||||
|
||||
uint8_t
|
||||
GetAddressByteSize ();
|
||||
|
||||
void
|
||||
SetAddressByteSize (uint8_t addr_byte_size);
|
||||
|
||||
void
|
||||
Clear ();
|
||||
|
||||
bool
|
||||
IsValid();
|
||||
|
||||
size_t
|
||||
GetByteSize ();
|
||||
|
||||
lldb::ByteOrder
|
||||
GetByteOrder();
|
||||
|
||||
void
|
||||
SetByteOrder (lldb::ByteOrder endian);
|
||||
|
||||
float
|
||||
GetFloat (lldb::SBError& error, lldb::offset_t offset);
|
||||
|
||||
double
|
||||
GetDouble (lldb::SBError& error, lldb::offset_t offset);
|
||||
|
||||
long double
|
||||
GetLongDouble (lldb::SBError& error, lldb::offset_t offset);
|
||||
|
||||
lldb::addr_t
|
||||
GetAddress (lldb::SBError& error, lldb::offset_t offset);
|
||||
|
||||
uint8_t
|
||||
GetUnsignedInt8 (lldb::SBError& error, lldb::offset_t offset);
|
||||
|
||||
uint16_t
|
||||
GetUnsignedInt16 (lldb::SBError& error, lldb::offset_t offset);
|
||||
|
||||
uint32_t
|
||||
GetUnsignedInt32 (lldb::SBError& error, lldb::offset_t offset);
|
||||
|
||||
uint64_t
|
||||
GetUnsignedInt64 (lldb::SBError& error, lldb::offset_t offset);
|
||||
|
||||
int8_t
|
||||
GetSignedInt8 (lldb::SBError& error, lldb::offset_t offset);
|
||||
|
||||
int16_t
|
||||
GetSignedInt16 (lldb::SBError& error, lldb::offset_t offset);
|
||||
|
||||
int32_t
|
||||
GetSignedInt32 (lldb::SBError& error, lldb::offset_t offset);
|
||||
|
||||
int64_t
|
||||
GetSignedInt64 (lldb::SBError& error, lldb::offset_t offset);
|
||||
|
||||
const char*
|
||||
GetString (lldb::SBError& error, lldb::offset_t offset);
|
||||
|
||||
size_t
|
||||
ReadRawData (lldb::SBError& error,
|
||||
lldb::offset_t offset,
|
||||
void *buf,
|
||||
size_t size);
|
||||
|
||||
bool
|
||||
GetDescription (lldb::SBStream &description, lldb::addr_t base_addr = LLDB_INVALID_ADDRESS);
|
||||
|
||||
// it would be nice to have SetData(SBError, const void*, size_t) when endianness and address size can be
|
||||
// inferred from the existing DataExtractor, but having two SetData() signatures triggers a SWIG bug where
|
||||
// the typemap isn't applied before resolving the overload, and thus the right function never gets called
|
||||
void
|
||||
SetData (lldb::SBError& error, const void *buf, size_t size, lldb::ByteOrder endian, uint8_t addr_size);
|
||||
|
||||
// see SetData() for why we don't have Append(const void* buf, size_t size)
|
||||
bool
|
||||
Append (const SBData& rhs);
|
||||
|
||||
static lldb::SBData
|
||||
CreateDataFromCString (lldb::ByteOrder endian, uint32_t addr_byte_size, const char* data);
|
||||
|
||||
// in the following CreateData*() and SetData*() prototypes, the two parameters array and array_len
|
||||
// should not be renamed or rearranged, because doing so will break the SWIG typemap
|
||||
static lldb::SBData
|
||||
CreateDataFromUInt64Array (lldb::ByteOrder endian, uint32_t addr_byte_size, uint64_t* array, size_t array_len);
|
||||
|
||||
static lldb::SBData
|
||||
CreateDataFromUInt32Array (lldb::ByteOrder endian, uint32_t addr_byte_size, uint32_t* array, size_t array_len);
|
||||
|
||||
static lldb::SBData
|
||||
CreateDataFromSInt64Array (lldb::ByteOrder endian, uint32_t addr_byte_size, int64_t* array, size_t array_len);
|
||||
|
||||
static lldb::SBData
|
||||
CreateDataFromSInt32Array (lldb::ByteOrder endian, uint32_t addr_byte_size, int32_t* array, size_t array_len);
|
||||
|
||||
static lldb::SBData
|
||||
CreateDataFromDoubleArray (lldb::ByteOrder endian, uint32_t addr_byte_size, double* array, size_t array_len);
|
||||
|
||||
bool
|
||||
SetDataFromCString (const char* data);
|
||||
|
||||
bool
|
||||
SetDataFromUInt64Array (uint64_t* array, size_t array_len);
|
||||
|
||||
bool
|
||||
SetDataFromUInt32Array (uint32_t* array, size_t array_len);
|
||||
|
||||
bool
|
||||
SetDataFromSInt64Array (int64_t* array, size_t array_len);
|
||||
|
||||
bool
|
||||
SetDataFromSInt32Array (int32_t* array, size_t array_len);
|
||||
|
||||
bool
|
||||
SetDataFromDoubleArray (double* array, size_t array_len);
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Mimic shared pointer...
|
||||
lldb_private::DataExtractor *
|
||||
get() const;
|
||||
|
||||
lldb_private::DataExtractor *
|
||||
operator->() const;
|
||||
|
||||
lldb::DataExtractorSP &
|
||||
operator*();
|
||||
|
||||
const lldb::DataExtractorSP &
|
||||
operator*() const;
|
||||
|
||||
SBData (const lldb::DataExtractorSP &data_sp);
|
||||
|
||||
void
|
||||
SetOpaque (const lldb::DataExtractorSP &data_sp);
|
||||
|
||||
private:
|
||||
friend class SBInstruction;
|
||||
friend class SBProcess;
|
||||
friend class SBSection;
|
||||
friend class SBValue;
|
||||
|
||||
lldb::DataExtractorSP m_opaque_sp;
|
||||
};
|
||||
|
||||
|
||||
} // namespace lldb
|
||||
|
||||
#endif // LLDB_SBData_h_
|
339
include/lldb/API/SBDebugger.h
Normal file
339
include/lldb/API/SBDebugger.h
Normal file
@ -0,0 +1,339 @@
|
||||
//===-- SBDebugger.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_SBDebugger_h_
|
||||
#define LLDB_SBDebugger_h_
|
||||
|
||||
#include "lldb/API/SBDefines.h"
|
||||
#include <stdio.h>
|
||||
|
||||
namespace lldb {
|
||||
|
||||
class SBDebugger
|
||||
{
|
||||
public:
|
||||
|
||||
static void
|
||||
Initialize();
|
||||
|
||||
static void
|
||||
Terminate();
|
||||
|
||||
// Deprecated, use the one that takes a source_init_files bool.
|
||||
static lldb::SBDebugger
|
||||
Create();
|
||||
|
||||
static lldb::SBDebugger
|
||||
Create(bool source_init_files);
|
||||
|
||||
static lldb::SBDebugger
|
||||
Create(bool source_init_files, lldb::LogOutputCallback log_callback, void *baton);
|
||||
|
||||
static void
|
||||
Destroy (lldb::SBDebugger &debugger);
|
||||
|
||||
static void
|
||||
MemoryPressureDetected ();
|
||||
|
||||
SBDebugger();
|
||||
|
||||
SBDebugger(const lldb::SBDebugger &rhs);
|
||||
|
||||
SBDebugger(const lldb::DebuggerSP &debugger_sp);
|
||||
|
||||
lldb::SBDebugger &
|
||||
operator = (const lldb::SBDebugger &rhs);
|
||||
|
||||
~SBDebugger();
|
||||
|
||||
bool
|
||||
IsValid() const;
|
||||
|
||||
void
|
||||
Clear ();
|
||||
|
||||
void
|
||||
SetAsync (bool b);
|
||||
|
||||
bool
|
||||
GetAsync ();
|
||||
|
||||
void
|
||||
SkipLLDBInitFiles (bool b);
|
||||
|
||||
void
|
||||
SkipAppInitFiles (bool b);
|
||||
|
||||
void
|
||||
SetInputFileHandle (FILE *f, bool transfer_ownership);
|
||||
|
||||
void
|
||||
SetOutputFileHandle (FILE *f, bool transfer_ownership);
|
||||
|
||||
void
|
||||
SetErrorFileHandle (FILE *f, bool transfer_ownership);
|
||||
|
||||
FILE *
|
||||
GetInputFileHandle ();
|
||||
|
||||
FILE *
|
||||
GetOutputFileHandle ();
|
||||
|
||||
FILE *
|
||||
GetErrorFileHandle ();
|
||||
|
||||
void
|
||||
SaveInputTerminalState();
|
||||
|
||||
void
|
||||
RestoreInputTerminalState();
|
||||
|
||||
lldb::SBCommandInterpreter
|
||||
GetCommandInterpreter ();
|
||||
|
||||
void
|
||||
HandleCommand (const char *command);
|
||||
|
||||
lldb::SBListener
|
||||
GetListener ();
|
||||
|
||||
void
|
||||
HandleProcessEvent (const lldb::SBProcess &process,
|
||||
const lldb::SBEvent &event,
|
||||
FILE *out,
|
||||
FILE *err);
|
||||
|
||||
lldb::SBTarget
|
||||
CreateTarget (const char *filename,
|
||||
const char *target_triple,
|
||||
const char *platform_name,
|
||||
bool add_dependent_modules,
|
||||
lldb::SBError& error);
|
||||
|
||||
lldb::SBTarget
|
||||
CreateTargetWithFileAndTargetTriple (const char *filename,
|
||||
const char *target_triple);
|
||||
|
||||
lldb::SBTarget
|
||||
CreateTargetWithFileAndArch (const char *filename,
|
||||
const char *archname);
|
||||
|
||||
lldb::SBTarget
|
||||
CreateTarget (const char *filename);
|
||||
|
||||
// Return true if target is deleted from the target list of the debugger.
|
||||
bool
|
||||
DeleteTarget (lldb::SBTarget &target);
|
||||
|
||||
lldb::SBTarget
|
||||
GetTargetAtIndex (uint32_t idx);
|
||||
|
||||
uint32_t
|
||||
GetIndexOfTarget (lldb::SBTarget target);
|
||||
|
||||
lldb::SBTarget
|
||||
FindTargetWithProcessID (pid_t pid);
|
||||
|
||||
lldb::SBTarget
|
||||
FindTargetWithFileAndArch (const char *filename,
|
||||
const char *arch);
|
||||
|
||||
uint32_t
|
||||
GetNumTargets ();
|
||||
|
||||
lldb::SBTarget
|
||||
GetSelectedTarget ();
|
||||
|
||||
void
|
||||
SetSelectedTarget (SBTarget& target);
|
||||
|
||||
lldb::SBSourceManager
|
||||
GetSourceManager ();
|
||||
|
||||
// REMOVE: just for a quick fix, need to expose platforms through
|
||||
// SBPlatform from this class.
|
||||
lldb::SBError
|
||||
SetCurrentPlatform (const char *platform_name);
|
||||
|
||||
bool
|
||||
SetCurrentPlatformSDKRoot (const char *sysroot);
|
||||
|
||||
// FIXME: Once we get the set show stuff in place, the driver won't need
|
||||
// an interface to the Set/Get UseExternalEditor.
|
||||
bool
|
||||
SetUseExternalEditor (bool input);
|
||||
|
||||
bool
|
||||
GetUseExternalEditor ();
|
||||
|
||||
bool
|
||||
SetUseColor (bool use_color);
|
||||
|
||||
bool
|
||||
GetUseColor () const;
|
||||
|
||||
static bool
|
||||
GetDefaultArchitecture (char *arch_name, size_t arch_name_len);
|
||||
|
||||
static bool
|
||||
SetDefaultArchitecture (const char *arch_name);
|
||||
|
||||
lldb::ScriptLanguage
|
||||
GetScriptingLanguage (const char *script_language_name);
|
||||
|
||||
static const char *
|
||||
GetVersionString ();
|
||||
|
||||
static const char *
|
||||
StateAsCString (lldb::StateType state);
|
||||
|
||||
static bool
|
||||
StateIsRunningState (lldb::StateType state);
|
||||
|
||||
static bool
|
||||
StateIsStoppedState (lldb::StateType state);
|
||||
|
||||
bool
|
||||
EnableLog (const char *channel, const char **categories);
|
||||
|
||||
void
|
||||
SetLoggingCallback (lldb::LogOutputCallback log_callback, void *baton);
|
||||
|
||||
// DEPRECATED
|
||||
void
|
||||
DispatchInput (void* baton,
|
||||
const void* data,
|
||||
size_t data_len);
|
||||
|
||||
void
|
||||
DispatchInput (const void *data, size_t data_len);
|
||||
|
||||
void
|
||||
DispatchInputInterrupt ();
|
||||
|
||||
void
|
||||
DispatchInputEndOfFile ();
|
||||
|
||||
void
|
||||
PushInputReader (lldb::SBInputReader &reader);
|
||||
|
||||
void
|
||||
NotifyTopInputReader (lldb::InputReaderAction notification);
|
||||
|
||||
bool
|
||||
InputReaderIsTopReader (const lldb::SBInputReader &reader);
|
||||
|
||||
const char *
|
||||
GetInstanceName ();
|
||||
|
||||
static SBDebugger
|
||||
FindDebuggerWithID (int id);
|
||||
|
||||
static lldb::SBError
|
||||
SetInternalVariable (const char *var_name, const char *value, const char *debugger_instance_name);
|
||||
|
||||
static lldb::SBStringList
|
||||
GetInternalVariableValue (const char *var_name, const char *debugger_instance_name);
|
||||
|
||||
bool
|
||||
GetDescription (lldb::SBStream &description);
|
||||
|
||||
uint32_t
|
||||
GetTerminalWidth () const;
|
||||
|
||||
void
|
||||
SetTerminalWidth (uint32_t term_width);
|
||||
|
||||
lldb::user_id_t
|
||||
GetID ();
|
||||
|
||||
const char *
|
||||
GetPrompt() const;
|
||||
|
||||
void
|
||||
SetPrompt (const char *prompt);
|
||||
|
||||
lldb::ScriptLanguage
|
||||
GetScriptLanguage() const;
|
||||
|
||||
void
|
||||
SetScriptLanguage (lldb::ScriptLanguage script_lang);
|
||||
|
||||
bool
|
||||
GetCloseInputOnEOF () const;
|
||||
|
||||
void
|
||||
SetCloseInputOnEOF (bool b);
|
||||
|
||||
SBTypeCategory
|
||||
GetCategory (const char* category_name);
|
||||
|
||||
SBTypeCategory
|
||||
CreateCategory (const char* category_name);
|
||||
|
||||
bool
|
||||
DeleteCategory (const char* category_name);
|
||||
|
||||
uint32_t
|
||||
GetNumCategories ();
|
||||
|
||||
SBTypeCategory
|
||||
GetCategoryAtIndex (uint32_t);
|
||||
|
||||
SBTypeCategory
|
||||
GetDefaultCategory();
|
||||
|
||||
SBTypeFormat
|
||||
GetFormatForType (SBTypeNameSpecifier);
|
||||
|
||||
#ifndef LLDB_DISABLE_PYTHON
|
||||
SBTypeSummary
|
||||
GetSummaryForType (SBTypeNameSpecifier);
|
||||
#endif
|
||||
|
||||
SBTypeFilter
|
||||
GetFilterForType (SBTypeNameSpecifier);
|
||||
|
||||
#ifndef LLDB_DISABLE_PYTHON
|
||||
SBTypeSynthetic
|
||||
GetSyntheticForType (SBTypeNameSpecifier);
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
||||
friend class SBCommandInterpreter;
|
||||
friend class SBInputReader;
|
||||
friend class SBListener;
|
||||
friend class SBProcess;
|
||||
friend class SBSourceManager;
|
||||
friend class SBTarget;
|
||||
|
||||
lldb::SBTarget
|
||||
FindTargetWithLLDBProcess (const lldb::ProcessSP &processSP);
|
||||
|
||||
void
|
||||
reset (const lldb::DebuggerSP &debugger_sp);
|
||||
|
||||
lldb_private::Debugger *
|
||||
get () const;
|
||||
|
||||
lldb_private::Debugger &
|
||||
ref () const;
|
||||
|
||||
const lldb::DebuggerSP &
|
||||
get_sp () const;
|
||||
|
||||
lldb::DebuggerSP m_opaque_sp;
|
||||
|
||||
}; // class SBDebugger
|
||||
|
||||
|
||||
} // namespace lldb
|
||||
|
||||
#endif // LLDB_SBDebugger_h_
|
89
include/lldb/API/SBDeclaration.h
Normal file
89
include/lldb/API/SBDeclaration.h
Normal file
@ -0,0 +1,89 @@
|
||||
//===-- SBDeclaration.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_SBDeclaration_h_
|
||||
#define LLDB_SBDeclaration_h_
|
||||
|
||||
#include "lldb/API/SBDefines.h"
|
||||
#include "lldb/API/SBFileSpec.h"
|
||||
|
||||
namespace lldb {
|
||||
|
||||
class SBDeclaration
|
||||
{
|
||||
public:
|
||||
|
||||
SBDeclaration ();
|
||||
|
||||
SBDeclaration (const lldb::SBDeclaration &rhs);
|
||||
|
||||
~SBDeclaration ();
|
||||
|
||||
const lldb::SBDeclaration &
|
||||
operator = (const lldb::SBDeclaration &rhs);
|
||||
|
||||
bool
|
||||
IsValid () const;
|
||||
|
||||
lldb::SBFileSpec
|
||||
GetFileSpec () const;
|
||||
|
||||
uint32_t
|
||||
GetLine () const;
|
||||
|
||||
uint32_t
|
||||
GetColumn () const;
|
||||
|
||||
void
|
||||
SetFileSpec (lldb::SBFileSpec filespec);
|
||||
|
||||
void
|
||||
SetLine (uint32_t line);
|
||||
|
||||
void
|
||||
SetColumn (uint32_t column);
|
||||
|
||||
bool
|
||||
operator == (const lldb::SBDeclaration &rhs) const;
|
||||
|
||||
bool
|
||||
operator != (const lldb::SBDeclaration &rhs) const;
|
||||
|
||||
bool
|
||||
GetDescription (lldb::SBStream &description);
|
||||
|
||||
protected:
|
||||
|
||||
lldb_private::Declaration *
|
||||
get ();
|
||||
|
||||
private:
|
||||
friend class SBValue;
|
||||
|
||||
const lldb_private::Declaration *
|
||||
operator->() const;
|
||||
|
||||
lldb_private::Declaration &
|
||||
ref();
|
||||
|
||||
const lldb_private::Declaration &
|
||||
ref() const;
|
||||
|
||||
SBDeclaration (const lldb_private::Declaration *lldb_object_ptr);
|
||||
|
||||
void
|
||||
SetDeclaration (const lldb_private::Declaration &lldb_object_ref);
|
||||
|
||||
std::unique_ptr<lldb_private::Declaration> m_opaque_ap;
|
||||
};
|
||||
|
||||
|
||||
} // namespace lldb
|
||||
|
||||
#endif // LLDB_SBDeclaration_h_
|
84
include/lldb/API/SBDefines.h
Normal file
84
include/lldb/API/SBDefines.h
Normal file
@ -0,0 +1,84 @@
|
||||
//===-- SBDefines.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_SBDefines_h_
|
||||
#define LLDB_SBDefines_h_
|
||||
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
|
||||
#include "lldb/lldb-defines.h"
|
||||
#include "lldb/lldb-enumerations.h"
|
||||
#include "lldb/lldb-forward.h"
|
||||
#include "lldb/lldb-types.h"
|
||||
#include "lldb/lldb-versioning.h"
|
||||
|
||||
// Forward Declarations
|
||||
|
||||
namespace lldb {
|
||||
|
||||
class SBAddress;
|
||||
class SBBlock;
|
||||
class SBBreakpoint;
|
||||
class SBBreakpointLocation;
|
||||
class SBBroadcaster;
|
||||
class SBCommand;
|
||||
class SBCommandInterpreter;
|
||||
class SBCommandPluginInterface;
|
||||
class SBCommandReturnObject;
|
||||
class SBCommunication;
|
||||
class SBCompileUnit;
|
||||
class SBData;
|
||||
class SBDebugger;
|
||||
class SBDeclaration;
|
||||
class SBError;
|
||||
class SBEvent;
|
||||
class SBEventList;
|
||||
class SBExpressionOptions;
|
||||
class SBFileSpec;
|
||||
class SBFileSpecList;
|
||||
class SBFrame;
|
||||
class SBFunction;
|
||||
class SBHostOS;
|
||||
class SBInputReader;
|
||||
class SBInstruction;
|
||||
class SBInstructionList;
|
||||
class SBLineEntry;
|
||||
class SBListener;
|
||||
class SBModule;
|
||||
class SBModuleSpec;
|
||||
class SBModuleSpecList;
|
||||
class SBProcess;
|
||||
class SBSourceManager;
|
||||
class SBStream;
|
||||
class SBStringList;
|
||||
class SBSymbol;
|
||||
class SBSymbolContext;
|
||||
class SBSymbolContextList;
|
||||
class SBTarget;
|
||||
class SBThread;
|
||||
class SBType;
|
||||
class SBTypeCategory;
|
||||
class SBTypeFilter;
|
||||
class SBTypeFormat;
|
||||
class SBTypeNameSpecifier;
|
||||
class SBTypeSummary;
|
||||
#ifndef LLDB_DISABLE_PYTHON
|
||||
class SBTypeSynthetic;
|
||||
#endif
|
||||
class SBTypeList;
|
||||
class SBValue;
|
||||
class SBValueList;
|
||||
class SBWatchpoint;
|
||||
|
||||
}
|
||||
|
||||
#endif // LLDB_SBDefines_h_
|
106
include/lldb/API/SBError.h
Normal file
106
include/lldb/API/SBError.h
Normal file
@ -0,0 +1,106 @@
|
||||
//===-- SBError.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_SBError_h_
|
||||
#define LLDB_SBError_h_
|
||||
|
||||
#include "lldb/API/SBDefines.h"
|
||||
|
||||
namespace lldb {
|
||||
|
||||
class SBError {
|
||||
public:
|
||||
SBError ();
|
||||
|
||||
SBError (const lldb::SBError &rhs);
|
||||
|
||||
~SBError();
|
||||
|
||||
const SBError &
|
||||
operator =(const lldb::SBError &rhs);
|
||||
|
||||
const char *
|
||||
GetCString () const;
|
||||
|
||||
void
|
||||
Clear ();
|
||||
|
||||
bool
|
||||
Fail () const;
|
||||
|
||||
bool
|
||||
Success () const;
|
||||
|
||||
uint32_t
|
||||
GetError () const;
|
||||
|
||||
lldb::ErrorType
|
||||
GetType () const;
|
||||
|
||||
void
|
||||
SetError (uint32_t err, lldb::ErrorType type);
|
||||
|
||||
void
|
||||
SetErrorToErrno ();
|
||||
|
||||
void
|
||||
SetErrorToGenericError ();
|
||||
|
||||
void
|
||||
SetErrorString (const char *err_str);
|
||||
|
||||
int
|
||||
SetErrorStringWithFormat (const char *format, ...) __attribute__ ((format (printf, 2, 3)));
|
||||
|
||||
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 SBInputReader;
|
||||
friend class SBProcess;
|
||||
friend class SBThread;
|
||||
friend class SBTarget;
|
||||
friend class SBValue;
|
||||
friend class SBWatchpoint;
|
||||
|
||||
lldb_private::Error *
|
||||
get();
|
||||
|
||||
lldb_private::Error *
|
||||
operator->();
|
||||
|
||||
const lldb_private::Error &
|
||||
operator*() const;
|
||||
|
||||
lldb_private::Error &
|
||||
ref();
|
||||
|
||||
void
|
||||
SetError (const lldb_private::Error &lldb_error);
|
||||
|
||||
private:
|
||||
std::unique_ptr<lldb_private::Error> m_opaque_ap;
|
||||
|
||||
void
|
||||
CreateIfNeeded ();
|
||||
};
|
||||
|
||||
|
||||
} // namespace lldb
|
||||
|
||||
#endif // LLDB_SBError_h_
|
102
include/lldb/API/SBEvent.h
Normal file
102
include/lldb/API/SBEvent.h
Normal file
@ -0,0 +1,102 @@
|
||||
//===-- SBEvent.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_SBEvent_h_
|
||||
#define LLDB_SBEvent_h_
|
||||
|
||||
#include "lldb/API/SBDefines.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <vector>
|
||||
|
||||
|
||||
namespace lldb {
|
||||
|
||||
class SBBroadcaster;
|
||||
|
||||
class SBEvent
|
||||
{
|
||||
public:
|
||||
SBEvent();
|
||||
|
||||
SBEvent (const lldb::SBEvent &rhs);
|
||||
|
||||
// Make an event that contains a C string.
|
||||
SBEvent (uint32_t event, const char *cstr, uint32_t cstr_len);
|
||||
|
||||
~SBEvent();
|
||||
|
||||
const SBEvent &
|
||||
operator = (const lldb::SBEvent &rhs);
|
||||
|
||||
bool
|
||||
IsValid() const;
|
||||
|
||||
const char *
|
||||
GetDataFlavor ();
|
||||
|
||||
uint32_t
|
||||
GetType () const;
|
||||
|
||||
lldb::SBBroadcaster
|
||||
GetBroadcaster () const;
|
||||
|
||||
const char *
|
||||
GetBroadcasterClass () const;
|
||||
|
||||
bool
|
||||
BroadcasterMatchesPtr (const lldb::SBBroadcaster *broadcaster);
|
||||
|
||||
bool
|
||||
BroadcasterMatchesRef (const lldb::SBBroadcaster &broadcaster);
|
||||
|
||||
void
|
||||
Clear();
|
||||
|
||||
static const char *
|
||||
GetCStringFromEvent (const lldb::SBEvent &event);
|
||||
|
||||
bool
|
||||
GetDescription (lldb::SBStream &description);
|
||||
|
||||
bool
|
||||
GetDescription (lldb::SBStream &description) const;
|
||||
|
||||
protected:
|
||||
friend class SBListener;
|
||||
friend class SBBroadcaster;
|
||||
friend class SBBreakpoint;
|
||||
friend class SBDebugger;
|
||||
friend class SBProcess;
|
||||
friend class SBThread;
|
||||
friend class SBWatchpoint;
|
||||
|
||||
SBEvent (lldb::EventSP &event_sp);
|
||||
|
||||
lldb::EventSP &
|
||||
GetSP () const;
|
||||
|
||||
void
|
||||
reset (lldb::EventSP &event_sp);
|
||||
|
||||
void
|
||||
reset (lldb_private::Event* event);
|
||||
|
||||
lldb_private::Event *
|
||||
get () const;
|
||||
|
||||
private:
|
||||
|
||||
mutable lldb::EventSP m_event_sp;
|
||||
mutable lldb_private::Event *m_opaque_ptr;
|
||||
};
|
||||
|
||||
} // namespace lldb
|
||||
|
||||
#endif // LLDB_SBEvent_h_
|
89
include/lldb/API/SBExpressionOptions.h
Normal file
89
include/lldb/API/SBExpressionOptions.h
Normal file
@ -0,0 +1,89 @@
|
||||
//===-- SBEvent.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_SBExpressionOptions_h_
|
||||
#define LLDB_SBExpressionOptions_h_
|
||||
|
||||
#include "lldb/API/SBDefines.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace lldb {
|
||||
|
||||
|
||||
class SBExpressionOptions
|
||||
{
|
||||
public:
|
||||
SBExpressionOptions();
|
||||
|
||||
SBExpressionOptions (const lldb::SBExpressionOptions &rhs);
|
||||
|
||||
~SBExpressionOptions();
|
||||
|
||||
const SBExpressionOptions &
|
||||
operator = (const lldb::SBExpressionOptions &rhs);
|
||||
|
||||
bool
|
||||
GetCoerceResultToId () const;
|
||||
|
||||
void
|
||||
SetCoerceResultToId (bool coerce = true);
|
||||
|
||||
bool
|
||||
GetUnwindOnError () const;
|
||||
|
||||
void
|
||||
SetUnwindOnError (bool unwind = true);
|
||||
|
||||
bool
|
||||
GetIgnoreBreakpoints () const;
|
||||
|
||||
void
|
||||
SetIgnoreBreakpoints (bool ignore = true);
|
||||
|
||||
lldb::DynamicValueType
|
||||
GetFetchDynamicValue () const;
|
||||
|
||||
void
|
||||
SetFetchDynamicValue (lldb::DynamicValueType dynamic = lldb::eDynamicCanRunTarget);
|
||||
|
||||
uint32_t
|
||||
GetTimeoutInMicroSeconds () const;
|
||||
|
||||
void
|
||||
SetTimeoutInMicroSeconds (uint32_t timeout = 0);
|
||||
|
||||
bool
|
||||
GetTryAllThreads () const;
|
||||
|
||||
void
|
||||
SetTryAllThreads (bool run_others = true);
|
||||
|
||||
protected:
|
||||
|
||||
SBExpressionOptions (lldb_private::EvaluateExpressionOptions &expression_options);
|
||||
|
||||
lldb_private::EvaluateExpressionOptions *
|
||||
get () const;
|
||||
|
||||
lldb_private::EvaluateExpressionOptions &
|
||||
ref () const;
|
||||
|
||||
friend class SBFrame;
|
||||
friend class SBValue;
|
||||
friend class SBTarget;
|
||||
|
||||
private:
|
||||
// This auto_pointer is made in the constructor and is always valid.
|
||||
mutable std::unique_ptr<lldb_private::EvaluateExpressionOptions> m_opaque_ap;
|
||||
};
|
||||
|
||||
} // namespace lldb
|
||||
|
||||
#endif // LLDB_SBExpressionOptions_h_
|
96
include/lldb/API/SBFileSpec.h
Normal file
96
include/lldb/API/SBFileSpec.h
Normal file
@ -0,0 +1,96 @@
|
||||
//===-- SBFileSpec.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_SBFileSpec_h_
|
||||
#define LLDB_SBFileSpec_h_
|
||||
|
||||
#include "lldb/API/SBDefines.h"
|
||||
|
||||
namespace lldb {
|
||||
|
||||
class SBFileSpec
|
||||
{
|
||||
public:
|
||||
SBFileSpec ();
|
||||
|
||||
SBFileSpec (const lldb::SBFileSpec &rhs);
|
||||
|
||||
SBFileSpec (const char *path);// Deprected, use SBFileSpec (const char *path, bool resolve)
|
||||
|
||||
SBFileSpec (const char *path, bool resolve);
|
||||
|
||||
~SBFileSpec ();
|
||||
|
||||
const SBFileSpec &
|
||||
operator = (const lldb::SBFileSpec &rhs);
|
||||
|
||||
bool
|
||||
IsValid() const;
|
||||
|
||||
bool
|
||||
Exists () const;
|
||||
|
||||
bool
|
||||
ResolveExecutableLocation ();
|
||||
|
||||
const char *
|
||||
GetFilename() const;
|
||||
|
||||
const char *
|
||||
GetDirectory() const;
|
||||
|
||||
uint32_t
|
||||
GetPath (char *dst_path, size_t dst_len) const;
|
||||
|
||||
static int
|
||||
ResolvePath (const char *src_path, char *dst_path, size_t dst_len);
|
||||
|
||||
bool
|
||||
GetDescription (lldb::SBStream &description) const;
|
||||
|
||||
private:
|
||||
friend class SBAttachInfo;
|
||||
friend class SBBlock;
|
||||
friend class SBCompileUnit;
|
||||
friend class SBDeclaration;
|
||||
friend class SBFileSpecList;
|
||||
friend class SBHostOS;
|
||||
friend class SBLaunchInfo;
|
||||
friend class SBLineEntry;
|
||||
friend class SBModule;
|
||||
friend class SBModuleSpec;
|
||||
friend class SBProcess;
|
||||
friend class SBSourceManager;
|
||||
friend class SBThread;
|
||||
friend class SBTarget;
|
||||
|
||||
SBFileSpec (const lldb_private::FileSpec& fspec);
|
||||
|
||||
void
|
||||
SetFileSpec (const lldb_private::FileSpec& fspec);
|
||||
|
||||
const lldb_private::FileSpec *
|
||||
operator->() const;
|
||||
|
||||
const lldb_private::FileSpec *
|
||||
get() const;
|
||||
|
||||
const lldb_private::FileSpec &
|
||||
operator*() const;
|
||||
|
||||
const lldb_private::FileSpec &
|
||||
ref() const;
|
||||
|
||||
std::unique_ptr<lldb_private::FileSpec> m_opaque_ap;
|
||||
};
|
||||
|
||||
|
||||
} // namespace lldb
|
||||
|
||||
#endif // LLDB_SBFileSpec_h_
|
72
include/lldb/API/SBFileSpecList.h
Normal file
72
include/lldb/API/SBFileSpecList.h
Normal file
@ -0,0 +1,72 @@
|
||||
//===-- SBFileSpecList.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_SBFileSpecList_h_
|
||||
#define LLDB_SBFileSpecList_h_
|
||||
|
||||
#include "lldb/API/SBDefines.h"
|
||||
|
||||
namespace lldb {
|
||||
|
||||
class SBFileSpecList
|
||||
{
|
||||
public:
|
||||
SBFileSpecList ();
|
||||
|
||||
SBFileSpecList (const lldb::SBFileSpecList &rhs);
|
||||
|
||||
~SBFileSpecList ();
|
||||
|
||||
const SBFileSpecList &
|
||||
operator = (const lldb::SBFileSpecList &rhs);
|
||||
|
||||
uint32_t
|
||||
GetSize () const;
|
||||
|
||||
bool
|
||||
GetDescription (SBStream &description) const;
|
||||
|
||||
void
|
||||
Append (const SBFileSpec &sb_file);
|
||||
|
||||
bool
|
||||
AppendIfUnique (const SBFileSpec &sb_file);
|
||||
|
||||
void
|
||||
Clear();
|
||||
|
||||
uint32_t
|
||||
FindFileIndex (uint32_t idx, const SBFileSpec &sb_file, bool full);
|
||||
|
||||
const SBFileSpec
|
||||
GetFileSpecAtIndex (uint32_t idx) const;
|
||||
|
||||
private:
|
||||
|
||||
friend class SBTarget;
|
||||
|
||||
const lldb_private::FileSpecList *
|
||||
operator->() const;
|
||||
|
||||
const lldb_private::FileSpecList *
|
||||
get() const;
|
||||
|
||||
const lldb_private::FileSpecList &
|
||||
operator*() const;
|
||||
|
||||
const lldb_private::FileSpecList &
|
||||
ref() const;
|
||||
|
||||
std::unique_ptr<lldb_private::FileSpecList> m_opaque_ap;
|
||||
};
|
||||
|
||||
|
||||
} // namespace lldb
|
||||
|
||||
#endif // LLDB_SBFileSpecList_h_
|
242
include/lldb/API/SBFrame.h
Normal file
242
include/lldb/API/SBFrame.h
Normal file
@ -0,0 +1,242 @@
|
||||
//===-- SBFrame.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_SBFrame_h_
|
||||
#define LLDB_SBFrame_h_
|
||||
|
||||
#include "lldb/API/SBDefines.h"
|
||||
#include "lldb/API/SBValueList.h"
|
||||
|
||||
namespace lldb {
|
||||
|
||||
class SBFrame
|
||||
{
|
||||
public:
|
||||
SBFrame ();
|
||||
|
||||
SBFrame (const lldb::SBFrame &rhs);
|
||||
|
||||
const lldb::SBFrame &
|
||||
operator =(const lldb::SBFrame &rhs);
|
||||
|
||||
~SBFrame();
|
||||
|
||||
bool
|
||||
IsEqual (const lldb::SBFrame &that) const;
|
||||
|
||||
bool
|
||||
IsValid() const;
|
||||
|
||||
uint32_t
|
||||
GetFrameID () const;
|
||||
|
||||
lldb::addr_t
|
||||
GetPC () const;
|
||||
|
||||
bool
|
||||
SetPC (lldb::addr_t new_pc);
|
||||
|
||||
lldb::addr_t
|
||||
GetSP () const;
|
||||
|
||||
lldb::addr_t
|
||||
GetFP () const;
|
||||
|
||||
lldb::SBAddress
|
||||
GetPCAddress () const;
|
||||
|
||||
lldb::SBSymbolContext
|
||||
GetSymbolContext (uint32_t resolve_scope) const;
|
||||
|
||||
lldb::SBModule
|
||||
GetModule () const;
|
||||
|
||||
lldb::SBCompileUnit
|
||||
GetCompileUnit () const;
|
||||
|
||||
lldb::SBFunction
|
||||
GetFunction () const;
|
||||
|
||||
lldb::SBSymbol
|
||||
GetSymbol () const;
|
||||
|
||||
/// Gets the deepest block that contains the frame PC.
|
||||
///
|
||||
/// See also GetFrameBlock().
|
||||
lldb::SBBlock
|
||||
GetBlock () const;
|
||||
|
||||
/// Get the appropriate function name for this frame. Inlined functions in
|
||||
/// LLDB are represented by Blocks that have inlined function information, so
|
||||
/// just looking at the SBFunction or SBSymbol for a frame isn't enough.
|
||||
/// This function will return the appriopriate function, symbol or inlined
|
||||
/// function name for the frame.
|
||||
///
|
||||
/// This function returns:
|
||||
/// - the name of the inlined function (if there is one)
|
||||
/// - the name of the concrete function (if there is one)
|
||||
/// - the name of the symbol (if there is one)
|
||||
/// - NULL
|
||||
///
|
||||
/// See also IsInlined().
|
||||
const char *
|
||||
GetFunctionName();
|
||||
|
||||
/// Return true if this frame represents an inlined function.
|
||||
///
|
||||
/// See also GetFunctionName().
|
||||
bool
|
||||
IsInlined();
|
||||
|
||||
/// The version that doesn't supply a 'use_dynamic' value will use the
|
||||
/// target's default.
|
||||
lldb::SBValue
|
||||
EvaluateExpression (const char *expr);
|
||||
|
||||
lldb::SBValue
|
||||
EvaluateExpression (const char *expr, lldb::DynamicValueType use_dynamic);
|
||||
|
||||
lldb::SBValue
|
||||
EvaluateExpression (const char *expr, lldb::DynamicValueType use_dynamic, bool unwind_on_error);
|
||||
|
||||
lldb::SBValue
|
||||
EvaluateExpression (const char *expr, const SBExpressionOptions &options);
|
||||
|
||||
/// Gets the lexical block that defines the stack frame. Another way to think
|
||||
/// of this is it will return the block that contains all of the variables
|
||||
/// for a stack frame. Inlined functions are represented as SBBlock objects
|
||||
/// that have inlined function information: the name of the inlined function,
|
||||
/// where it was called from. The block that is returned will be the first
|
||||
/// block at or above the block for the PC (SBFrame::GetBlock()) that defines
|
||||
/// the scope of the frame. When a function contains no inlined functions,
|
||||
/// this will be the top most lexical block that defines the function.
|
||||
/// When a function has inlined functions and the PC is currently
|
||||
/// in one of those inlined functions, this method will return the inlined
|
||||
/// block that defines this frame. If the PC isn't currently in an inlined
|
||||
/// function, the lexical block that defines the function is returned.
|
||||
lldb::SBBlock
|
||||
GetFrameBlock () const;
|
||||
|
||||
lldb::SBLineEntry
|
||||
GetLineEntry () const;
|
||||
|
||||
lldb::SBThread
|
||||
GetThread () const;
|
||||
|
||||
const char *
|
||||
Disassemble () const;
|
||||
|
||||
void
|
||||
Clear();
|
||||
|
||||
bool
|
||||
operator == (const lldb::SBFrame &rhs) const;
|
||||
|
||||
bool
|
||||
operator != (const lldb::SBFrame &rhs) const;
|
||||
|
||||
/// The version that doesn't supply a 'use_dynamic' value will use the
|
||||
/// target's default.
|
||||
lldb::SBValueList
|
||||
GetVariables (bool arguments,
|
||||
bool locals,
|
||||
bool statics,
|
||||
bool in_scope_only);
|
||||
|
||||
lldb::SBValueList
|
||||
GetVariables (bool arguments,
|
||||
bool locals,
|
||||
bool statics,
|
||||
bool in_scope_only,
|
||||
lldb::DynamicValueType use_dynamic);
|
||||
|
||||
lldb::SBValueList
|
||||
GetRegisters ();
|
||||
|
||||
lldb::SBValue
|
||||
FindRegister (const char *name);
|
||||
|
||||
/// The version that doesn't supply a 'use_dynamic' value will use the
|
||||
/// target's default.
|
||||
lldb::SBValue
|
||||
FindVariable (const char *var_name);
|
||||
|
||||
lldb::SBValue
|
||||
FindVariable (const char *var_name, lldb::DynamicValueType use_dynamic);
|
||||
|
||||
// Find a value for a variable expression path like "rect.origin.x" or
|
||||
// "pt_ptr->x", "*self", "*this->obj_ptr". The returned value is _not_
|
||||
// and expression result and is not a constant object like
|
||||
// SBFrame::EvaluateExpression(...) returns, but a child object of
|
||||
// the variable value.
|
||||
lldb::SBValue
|
||||
GetValueForVariablePath (const char *var_expr_cstr,
|
||||
DynamicValueType use_dynamic);
|
||||
|
||||
/// The version that doesn't supply a 'use_dynamic' value will use the
|
||||
/// target's default.
|
||||
lldb::SBValue
|
||||
GetValueForVariablePath (const char *var_path);
|
||||
|
||||
/// Find variables, register sets, registers, or persistent variables using
|
||||
/// the frame as the scope.
|
||||
///
|
||||
/// NB. This function does not look up ivars in the function object pointer.
|
||||
/// To do that use GetValueForVariablePath.
|
||||
///
|
||||
/// The version that doesn't supply a 'use_dynamic' value will use the
|
||||
/// target's default.
|
||||
lldb::SBValue
|
||||
FindValue (const char *name, ValueType value_type);
|
||||
|
||||
lldb::SBValue
|
||||
FindValue (const char *name, ValueType value_type, lldb::DynamicValueType use_dynamic);
|
||||
|
||||
/// Find and watch a variable using the frame as the scope.
|
||||
/// It returns an SBValue, similar to FindValue() method, if find-and-watch
|
||||
/// operation succeeds. Otherwise, an invalid SBValue is returned.
|
||||
/// You can use LLDB_WATCH_TYPE_READ | LLDB_WATCH_TYPE_WRITE for 'rw' watch.
|
||||
lldb::SBValue
|
||||
WatchValue (const char *name, ValueType value_type, uint32_t watch_type);
|
||||
|
||||
/// Find and watch the location pointed to by a variable using the frame as
|
||||
/// the scope.
|
||||
/// It returns an SBValue, similar to FindValue() method, if find-and-watch
|
||||
/// operation succeeds. Otherwise, an invalid SBValue is returned.
|
||||
/// You can use LLDB_WATCH_TYPE_READ | LLDB_WATCH_TYPE_WRITE for 'rw' watch.
|
||||
lldb::SBValue
|
||||
WatchLocation (const char *name, ValueType value_type, uint32_t watch_type, size_t size);
|
||||
|
||||
bool
|
||||
GetDescription (lldb::SBStream &description);
|
||||
|
||||
SBFrame (const lldb::StackFrameSP &lldb_object_sp);
|
||||
|
||||
protected:
|
||||
|
||||
friend class SBBlock;
|
||||
friend class SBInstruction;
|
||||
friend class SBThread;
|
||||
friend class SBValue;
|
||||
#ifndef LLDB_DISABLE_PYTHON
|
||||
friend class lldb_private::ScriptInterpreterPython;
|
||||
#endif
|
||||
|
||||
lldb::StackFrameSP
|
||||
GetFrameSP() const;
|
||||
|
||||
void
|
||||
SetFrameSP (const lldb::StackFrameSP &lldb_object_sp);
|
||||
|
||||
lldb::ExecutionContextRefSP m_opaque_sp;
|
||||
};
|
||||
|
||||
} // namespace lldb
|
||||
|
||||
#endif // LLDB_SBFrame_h_
|
93
include/lldb/API/SBFunction.h
Normal file
93
include/lldb/API/SBFunction.h
Normal file
@ -0,0 +1,93 @@
|
||||
//===-- SBFunction.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_SBFunction_h_
|
||||
#define LLDB_SBFunction_h_
|
||||
|
||||
#include "lldb/API/SBDefines.h"
|
||||
#include "lldb/API/SBAddress.h"
|
||||
#include "lldb/API/SBInstructionList.h"
|
||||
|
||||
namespace lldb {
|
||||
|
||||
class SBFunction
|
||||
{
|
||||
public:
|
||||
|
||||
SBFunction ();
|
||||
|
||||
SBFunction (const lldb::SBFunction &rhs);
|
||||
|
||||
const lldb::SBFunction &
|
||||
operator = (const lldb::SBFunction &rhs);
|
||||
|
||||
~SBFunction ();
|
||||
|
||||
bool
|
||||
IsValid () const;
|
||||
|
||||
const char *
|
||||
GetName() const;
|
||||
|
||||
const char *
|
||||
GetMangledName () const;
|
||||
|
||||
lldb::SBInstructionList
|
||||
GetInstructions (lldb::SBTarget target);
|
||||
|
||||
lldb::SBInstructionList
|
||||
GetInstructions (lldb::SBTarget target, const char *flavor);
|
||||
|
||||
lldb::SBAddress
|
||||
GetStartAddress ();
|
||||
|
||||
lldb::SBAddress
|
||||
GetEndAddress ();
|
||||
|
||||
uint32_t
|
||||
GetPrologueByteSize ();
|
||||
|
||||
lldb::SBType
|
||||
GetType ();
|
||||
|
||||
lldb::SBBlock
|
||||
GetBlock ();
|
||||
|
||||
bool
|
||||
operator == (const lldb::SBFunction &rhs) const;
|
||||
|
||||
bool
|
||||
operator != (const lldb::SBFunction &rhs) const;
|
||||
|
||||
bool
|
||||
GetDescription (lldb::SBStream &description);
|
||||
|
||||
protected:
|
||||
|
||||
lldb_private::Function *
|
||||
get ();
|
||||
|
||||
void
|
||||
reset (lldb_private::Function *lldb_object_ptr);
|
||||
|
||||
private:
|
||||
friend class SBAddress;
|
||||
friend class SBFrame;
|
||||
friend class SBSymbolContext;
|
||||
|
||||
SBFunction (lldb_private::Function *lldb_object_ptr);
|
||||
|
||||
|
||||
lldb_private::Function *m_opaque_ptr;
|
||||
};
|
||||
|
||||
|
||||
} // namespace lldb
|
||||
|
||||
#endif // LLDB_SBFunction_h_
|
57
include/lldb/API/SBHostOS.h
Normal file
57
include/lldb/API/SBHostOS.h
Normal file
@ -0,0 +1,57 @@
|
||||
//===-- SBHostOS.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_SBHostOS_h_
|
||||
#define LLDB_SBHostOS_h_
|
||||
|
||||
#include "lldb/API/SBDefines.h"
|
||||
#include "lldb/API/SBFileSpec.h"
|
||||
|
||||
namespace lldb {
|
||||
|
||||
class SBHostOS
|
||||
{
|
||||
public:
|
||||
|
||||
static lldb::SBFileSpec
|
||||
GetProgramFileSpec ();
|
||||
|
||||
static lldb::SBFileSpec
|
||||
GetLLDBPythonPath ();
|
||||
|
||||
static void
|
||||
ThreadCreated (const char *name);
|
||||
|
||||
static lldb::thread_t
|
||||
ThreadCreate (const char *name,
|
||||
void *(*thread_function)(void *),
|
||||
void *thread_arg,
|
||||
lldb::SBError *err);
|
||||
|
||||
static bool
|
||||
ThreadCancel (lldb::thread_t thread,
|
||||
lldb::SBError *err);
|
||||
|
||||
static bool
|
||||
ThreadDetach (lldb::thread_t thread,
|
||||
lldb::SBError *err);
|
||||
static bool
|
||||
ThreadJoin (lldb::thread_t thread,
|
||||
void **result,
|
||||
lldb::SBError *err);
|
||||
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
|
||||
} // namespace lldb
|
||||
|
||||
#endif // LLDB_SBHostOS_h_
|
97
include/lldb/API/SBInputReader.h
Normal file
97
include/lldb/API/SBInputReader.h
Normal file
@ -0,0 +1,97 @@
|
||||
//===-- SBInputReader.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_SBInputReader_h_
|
||||
#define LLDB_SBInputReader_h_
|
||||
|
||||
#include "lldb/API/SBDefines.h"
|
||||
|
||||
namespace lldb {
|
||||
|
||||
class SBInputReader
|
||||
{
|
||||
public:
|
||||
|
||||
typedef size_t (*Callback) (void *baton,
|
||||
SBInputReader *reader,
|
||||
InputReaderAction notification,
|
||||
const char *bytes,
|
||||
size_t bytes_len);
|
||||
|
||||
SBInputReader ();
|
||||
|
||||
SBInputReader (const lldb::InputReaderSP &reader_sp);
|
||||
|
||||
SBInputReader (const lldb::SBInputReader &rhs);
|
||||
|
||||
~SBInputReader ();
|
||||
|
||||
|
||||
SBError
|
||||
Initialize (SBDebugger &debugger,
|
||||
Callback callback,
|
||||
void *callback_baton,
|
||||
lldb::InputReaderGranularity granularity,
|
||||
const char *end_token,
|
||||
const char *prompt,
|
||||
bool echo);
|
||||
|
||||
bool
|
||||
IsValid () const;
|
||||
|
||||
const lldb::SBInputReader &
|
||||
operator = (const lldb::SBInputReader &rhs);
|
||||
|
||||
bool
|
||||
IsActive () const;
|
||||
|
||||
bool
|
||||
IsDone () const;
|
||||
|
||||
void
|
||||
SetIsDone (bool value);
|
||||
|
||||
InputReaderGranularity
|
||||
GetGranularity ();
|
||||
|
||||
protected:
|
||||
friend class SBDebugger;
|
||||
|
||||
lldb_private::InputReader *
|
||||
operator->() const;
|
||||
|
||||
lldb::InputReaderSP &
|
||||
operator *();
|
||||
|
||||
const lldb::InputReaderSP &
|
||||
operator *() const;
|
||||
|
||||
lldb_private::InputReader *
|
||||
get() const;
|
||||
|
||||
lldb_private::InputReader &
|
||||
ref() const;
|
||||
|
||||
private:
|
||||
|
||||
static size_t
|
||||
PrivateCallback (void *baton,
|
||||
lldb_private::InputReader &reader,
|
||||
lldb::InputReaderAction notification,
|
||||
const char *bytes,
|
||||
size_t bytes_len);
|
||||
|
||||
lldb::InputReaderSP m_opaque_sp;
|
||||
Callback m_callback_function;
|
||||
void *m_callback_baton;
|
||||
};
|
||||
|
||||
} // namespace lldb
|
||||
|
||||
#endif // LLDB_SBInputReader_h_
|
94
include/lldb/API/SBInstruction.h
Normal file
94
include/lldb/API/SBInstruction.h
Normal file
@ -0,0 +1,94 @@
|
||||
//===-- SBInstruction.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_SBInstruction_h_
|
||||
#define LLDB_SBInstruction_h_
|
||||
|
||||
#include "lldb/API/SBDefines.h"
|
||||
#include "lldb/API/SBData.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
// There's a lot to be fixed here, but need to wait for underlying insn implementation
|
||||
// to be revised & settle down first.
|
||||
|
||||
namespace lldb {
|
||||
|
||||
class SBInstruction
|
||||
{
|
||||
public:
|
||||
|
||||
SBInstruction ();
|
||||
|
||||
SBInstruction (const SBInstruction &rhs);
|
||||
|
||||
const SBInstruction &
|
||||
operator = (const SBInstruction &rhs);
|
||||
|
||||
~SBInstruction ();
|
||||
|
||||
bool
|
||||
IsValid();
|
||||
|
||||
SBAddress
|
||||
GetAddress();
|
||||
|
||||
lldb::AddressClass
|
||||
GetAddressClass ();
|
||||
|
||||
const char *
|
||||
GetMnemonic (lldb::SBTarget target);
|
||||
|
||||
const char *
|
||||
GetOperands (lldb::SBTarget target);
|
||||
|
||||
const char *
|
||||
GetComment (lldb::SBTarget target);
|
||||
|
||||
lldb::SBData
|
||||
GetData (lldb::SBTarget target);
|
||||
|
||||
size_t
|
||||
GetByteSize ();
|
||||
|
||||
bool
|
||||
DoesBranch ();
|
||||
|
||||
void
|
||||
Print (FILE *out);
|
||||
|
||||
bool
|
||||
GetDescription (lldb::SBStream &description);
|
||||
|
||||
bool
|
||||
EmulateWithFrame (lldb::SBFrame &frame, uint32_t evaluate_options);
|
||||
|
||||
bool
|
||||
DumpEmulation (const char * triple); // triple is to specify the architecture, e.g. 'armv6' or 'armv7-apple-ios'
|
||||
|
||||
bool
|
||||
TestEmulation (lldb::SBStream &output_stream, const char *test_file);
|
||||
|
||||
protected:
|
||||
friend class SBInstructionList;
|
||||
|
||||
SBInstruction (const lldb::InstructionSP &inst_sp);
|
||||
|
||||
void
|
||||
SetOpaque (const lldb::InstructionSP &inst_sp);
|
||||
|
||||
private:
|
||||
|
||||
lldb::InstructionSP m_opaque_sp;
|
||||
};
|
||||
|
||||
|
||||
} // namespace lldb
|
||||
|
||||
#endif // LLDB_SBInstruction_h_
|
71
include/lldb/API/SBInstructionList.h
Normal file
71
include/lldb/API/SBInstructionList.h
Normal file
@ -0,0 +1,71 @@
|
||||
//===-- SBInstructionList.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_SBInstructionList_h_
|
||||
#define LLDB_SBInstructionList_h_
|
||||
|
||||
#include "lldb/API/SBDefines.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
namespace lldb {
|
||||
|
||||
class SBInstructionList
|
||||
{
|
||||
public:
|
||||
|
||||
SBInstructionList ();
|
||||
|
||||
SBInstructionList (const SBInstructionList &rhs);
|
||||
|
||||
const SBInstructionList &
|
||||
operator = (const SBInstructionList &rhs);
|
||||
|
||||
~SBInstructionList ();
|
||||
|
||||
bool
|
||||
IsValid () const;
|
||||
|
||||
size_t
|
||||
GetSize ();
|
||||
|
||||
lldb::SBInstruction
|
||||
GetInstructionAtIndex (uint32_t idx);
|
||||
|
||||
void
|
||||
Clear ();
|
||||
|
||||
void
|
||||
AppendInstruction (lldb::SBInstruction inst);
|
||||
|
||||
void
|
||||
Print (FILE *out);
|
||||
|
||||
bool
|
||||
GetDescription (lldb::SBStream &description);
|
||||
|
||||
bool
|
||||
DumpEmulationForAllInstructions (const char *triple);
|
||||
|
||||
protected:
|
||||
friend class SBFunction;
|
||||
friend class SBSymbol;
|
||||
friend class SBTarget;
|
||||
|
||||
void
|
||||
SetDisassembler (const lldb::DisassemblerSP &opaque_sp);
|
||||
|
||||
private:
|
||||
lldb::DisassemblerSP m_opaque_sp;
|
||||
};
|
||||
|
||||
|
||||
} // namespace lldb
|
||||
|
||||
#endif // LLDB_SBInstructionList_h_
|
99
include/lldb/API/SBLineEntry.h
Normal file
99
include/lldb/API/SBLineEntry.h
Normal file
@ -0,0 +1,99 @@
|
||||
//===-- SBLineEntry.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_SBLineEntry_h_
|
||||
#define LLDB_SBLineEntry_h_
|
||||
|
||||
#include "lldb/API/SBDefines.h"
|
||||
#include "lldb/API/SBAddress.h"
|
||||
#include "lldb/API/SBFileSpec.h"
|
||||
|
||||
namespace lldb {
|
||||
|
||||
class SBLineEntry
|
||||
{
|
||||
public:
|
||||
|
||||
SBLineEntry ();
|
||||
|
||||
SBLineEntry (const lldb::SBLineEntry &rhs);
|
||||
|
||||
~SBLineEntry ();
|
||||
|
||||
const lldb::SBLineEntry &
|
||||
operator = (const lldb::SBLineEntry &rhs);
|
||||
|
||||
lldb::SBAddress
|
||||
GetStartAddress () const;
|
||||
|
||||
lldb::SBAddress
|
||||
GetEndAddress () const;
|
||||
|
||||
bool
|
||||
IsValid () const;
|
||||
|
||||
lldb::SBFileSpec
|
||||
GetFileSpec () const;
|
||||
|
||||
uint32_t
|
||||
GetLine () const;
|
||||
|
||||
uint32_t
|
||||
GetColumn () const;
|
||||
|
||||
void
|
||||
SetFileSpec (lldb::SBFileSpec filespec);
|
||||
|
||||
void
|
||||
SetLine (uint32_t line);
|
||||
|
||||
void
|
||||
SetColumn (uint32_t column);
|
||||
|
||||
bool
|
||||
operator == (const lldb::SBLineEntry &rhs) const;
|
||||
|
||||
bool
|
||||
operator != (const lldb::SBLineEntry &rhs) const;
|
||||
|
||||
bool
|
||||
GetDescription (lldb::SBStream &description);
|
||||
|
||||
protected:
|
||||
|
||||
lldb_private::LineEntry *
|
||||
get ();
|
||||
|
||||
private:
|
||||
friend class SBAddress;
|
||||
friend class SBCompileUnit;
|
||||
friend class SBFrame;
|
||||
friend class SBSymbolContext;
|
||||
|
||||
const lldb_private::LineEntry *
|
||||
operator->() const;
|
||||
|
||||
lldb_private::LineEntry &
|
||||
ref();
|
||||
|
||||
const lldb_private::LineEntry &
|
||||
ref() const;
|
||||
|
||||
SBLineEntry (const lldb_private::LineEntry *lldb_object_ptr);
|
||||
|
||||
void
|
||||
SetLineEntry (const lldb_private::LineEntry &lldb_object_ref);
|
||||
|
||||
std::unique_ptr<lldb_private::LineEntry> m_opaque_ap;
|
||||
};
|
||||
|
||||
|
||||
} // namespace lldb
|
||||
|
||||
#endif // LLDB_SBLineEntry_h_
|
135
include/lldb/API/SBListener.h
Normal file
135
include/lldb/API/SBListener.h
Normal file
@ -0,0 +1,135 @@
|
||||
//===-- SBListener.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_SBListener_h_
|
||||
#define LLDB_SBListener_h_
|
||||
|
||||
#include "lldb/API/SBDefines.h"
|
||||
|
||||
namespace lldb {
|
||||
|
||||
class SBListener
|
||||
{
|
||||
public:
|
||||
SBListener ();
|
||||
|
||||
SBListener (const char *name);
|
||||
|
||||
SBListener (const SBListener &rhs);
|
||||
|
||||
~SBListener ();
|
||||
|
||||
const lldb::SBListener &
|
||||
operator = (const lldb::SBListener &rhs);
|
||||
|
||||
void
|
||||
AddEvent (const lldb::SBEvent &event);
|
||||
|
||||
void
|
||||
Clear ();
|
||||
|
||||
bool
|
||||
IsValid () const;
|
||||
|
||||
uint32_t
|
||||
StartListeningForEventClass (SBDebugger &debugger,
|
||||
const char *broadcaster_class,
|
||||
uint32_t event_mask);
|
||||
|
||||
bool
|
||||
StopListeningForEventClass (SBDebugger &debugger,
|
||||
const char *broadcaster_class,
|
||||
uint32_t event_mask);
|
||||
|
||||
uint32_t
|
||||
StartListeningForEvents (const lldb::SBBroadcaster& broadcaster,
|
||||
uint32_t event_mask);
|
||||
|
||||
bool
|
||||
StopListeningForEvents (const lldb::SBBroadcaster& broadcaster,
|
||||
uint32_t event_mask);
|
||||
|
||||
// Returns true if an event was recieved, false if we timed out.
|
||||
bool
|
||||
WaitForEvent (uint32_t num_seconds,
|
||||
lldb::SBEvent &event);
|
||||
|
||||
bool
|
||||
WaitForEventForBroadcaster (uint32_t num_seconds,
|
||||
const lldb::SBBroadcaster &broadcaster,
|
||||
lldb::SBEvent &sb_event);
|
||||
|
||||
bool
|
||||
WaitForEventForBroadcasterWithType (uint32_t num_seconds,
|
||||
const lldb::SBBroadcaster &broadcaster,
|
||||
uint32_t event_type_mask,
|
||||
lldb::SBEvent &sb_event);
|
||||
|
||||
bool
|
||||
PeekAtNextEvent (lldb::SBEvent &sb_event);
|
||||
|
||||
bool
|
||||
PeekAtNextEventForBroadcaster (const lldb::SBBroadcaster &broadcaster,
|
||||
lldb::SBEvent &sb_event);
|
||||
|
||||
bool
|
||||
PeekAtNextEventForBroadcasterWithType (const lldb::SBBroadcaster &broadcaster,
|
||||
uint32_t event_type_mask,
|
||||
lldb::SBEvent &sb_event);
|
||||
|
||||
bool
|
||||
GetNextEvent (lldb::SBEvent &sb_event);
|
||||
|
||||
bool
|
||||
GetNextEventForBroadcaster (const lldb::SBBroadcaster &broadcaster,
|
||||
lldb::SBEvent &sb_event);
|
||||
|
||||
bool
|
||||
GetNextEventForBroadcasterWithType (const lldb::SBBroadcaster &broadcaster,
|
||||
uint32_t event_type_mask,
|
||||
lldb::SBEvent &sb_event);
|
||||
|
||||
bool
|
||||
HandleBroadcastEvent (const lldb::SBEvent &event);
|
||||
|
||||
protected:
|
||||
friend class SBBroadcaster;
|
||||
friend class SBCommandInterpreter;
|
||||
friend class SBDebugger;
|
||||
friend class SBTarget;
|
||||
|
||||
SBListener (lldb_private::Listener &listener);
|
||||
|
||||
private:
|
||||
|
||||
lldb_private::Listener *
|
||||
operator->() const;
|
||||
|
||||
lldb_private::Listener *
|
||||
get() const;
|
||||
|
||||
lldb_private::Listener &
|
||||
ref() const;
|
||||
|
||||
lldb_private::Listener &
|
||||
operator *();
|
||||
|
||||
const lldb_private::Listener &
|
||||
operator *() const;
|
||||
|
||||
void
|
||||
reset(lldb_private::Listener *listener, bool transfer_ownership);
|
||||
|
||||
lldb::ListenerSP m_opaque_sp;
|
||||
lldb_private::Listener *m_opaque_ptr;
|
||||
};
|
||||
|
||||
} // namespace lldb
|
||||
|
||||
#endif // LLDB_SBListener_h_
|
287
include/lldb/API/SBModule.h
Normal file
287
include/lldb/API/SBModule.h
Normal file
@ -0,0 +1,287 @@
|
||||
//===-- SBModule.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_SBModule_h_
|
||||
#define LLDB_SBModule_h_
|
||||
|
||||
#include "lldb/API/SBDefines.h"
|
||||
#include "lldb/API/SBError.h"
|
||||
#include "lldb/API/SBSection.h"
|
||||
#include "lldb/API/SBSymbolContext.h"
|
||||
#include "lldb/API/SBValueList.h"
|
||||
|
||||
namespace lldb {
|
||||
|
||||
class SBModule
|
||||
{
|
||||
public:
|
||||
|
||||
SBModule ();
|
||||
|
||||
SBModule (const SBModule &rhs);
|
||||
|
||||
SBModule (const SBModuleSpec &module_spec);
|
||||
|
||||
const SBModule &
|
||||
operator = (const SBModule &rhs);
|
||||
|
||||
SBModule (lldb::SBProcess &process,
|
||||
lldb::addr_t header_addr);
|
||||
|
||||
~SBModule ();
|
||||
|
||||
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
|
||||
/// 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
|
||||
/// the remote system on which it is being debugged. For local
|
||||
/// debugging this is always the same as Module::GetFileSpec(). But
|
||||
/// remote debugging might mention a file '/usr/lib/liba.dylib'
|
||||
/// which might be locally downloaded and cached. In this case the
|
||||
/// platform file could be something like:
|
||||
/// '/tmp/lldb/platform-cache/remote.host.computer/usr/lib/liba.dylib'
|
||||
/// The file could also be cached in a local developer kit directory.
|
||||
///
|
||||
/// @return
|
||||
/// A const reference to the file specification object.
|
||||
//------------------------------------------------------------------
|
||||
lldb::SBFileSpec
|
||||
GetPlatformFileSpec () const;
|
||||
|
||||
bool
|
||||
SetPlatformFileSpec (const lldb::SBFileSpec &platform_file);
|
||||
|
||||
lldb::ByteOrder
|
||||
GetByteOrder ();
|
||||
|
||||
uint32_t
|
||||
GetAddressByteSize();
|
||||
|
||||
const char *
|
||||
GetTriple ();
|
||||
|
||||
const uint8_t *
|
||||
GetUUIDBytes () const;
|
||||
|
||||
const char *
|
||||
GetUUIDString () const;
|
||||
|
||||
bool
|
||||
operator == (const lldb::SBModule &rhs) const;
|
||||
|
||||
bool
|
||||
operator != (const lldb::SBModule &rhs) const;
|
||||
|
||||
lldb::SBSection
|
||||
FindSection (const char *sect_name);
|
||||
|
||||
lldb::SBAddress
|
||||
ResolveFileAddress (lldb::addr_t vm_addr);
|
||||
|
||||
lldb::SBSymbolContext
|
||||
ResolveSymbolContextForAddress (const lldb::SBAddress& addr,
|
||||
uint32_t resolve_scope);
|
||||
|
||||
bool
|
||||
GetDescription (lldb::SBStream &description);
|
||||
|
||||
uint32_t
|
||||
GetNumCompileUnits();
|
||||
|
||||
lldb::SBCompileUnit
|
||||
GetCompileUnitAtIndex (uint32_t);
|
||||
|
||||
size_t
|
||||
GetNumSymbols ();
|
||||
|
||||
lldb::SBSymbol
|
||||
GetSymbolAtIndex (size_t idx);
|
||||
|
||||
lldb::SBSymbol
|
||||
FindSymbol (const char *name,
|
||||
lldb::SymbolType type = eSymbolTypeAny);
|
||||
|
||||
lldb::SBSymbolContextList
|
||||
FindSymbols (const char *name,
|
||||
lldb::SymbolType type = eSymbolTypeAny);
|
||||
|
||||
size_t
|
||||
GetNumSections ();
|
||||
|
||||
lldb::SBSection
|
||||
GetSectionAtIndex (size_t idx);
|
||||
//------------------------------------------------------------------
|
||||
/// Find functions by name.
|
||||
///
|
||||
/// @param[in] name
|
||||
/// The name of the function we are looking for.
|
||||
///
|
||||
/// @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
|
||||
/// 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
|
||||
/// A valid SBTarget instance representing the debuggee.
|
||||
///
|
||||
/// @param[in] name
|
||||
/// The name of the global or static variable we are looking
|
||||
/// for.
|
||||
///
|
||||
/// @param[in] max_matches
|
||||
/// Allow the number of matches to be limited to \a max_matches.
|
||||
///
|
||||
/// @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
|
||||
/// A valid SBTarget instance representing the debuggee.
|
||||
///
|
||||
/// @param[in] name
|
||||
/// The name of the global or static variable we are looking
|
||||
/// for.
|
||||
///
|
||||
/// @return
|
||||
/// An SBValue that gets filled in with the found variable (if any).
|
||||
//------------------------------------------------------------------
|
||||
lldb::SBValue
|
||||
FindFirstGlobalVariable (lldb::SBTarget &target, const char *name);
|
||||
|
||||
lldb::SBType
|
||||
FindFirstType (const char* name);
|
||||
|
||||
lldb::SBTypeList
|
||||
FindTypes (const char* type);
|
||||
|
||||
lldb::SBType
|
||||
GetBasicType(lldb::BasicType type);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Get all types matching \a type_mask from debug info in this
|
||||
/// module.
|
||||
///
|
||||
/// @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
|
||||
/// 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
|
||||
/// the version of the executable or shared library. Typically there
|
||||
/// are major, minor and build, but there may be more. This function
|
||||
/// will extract the versions from object files if they are available.
|
||||
///
|
||||
/// If \a versions is NULL, or if \a num_versions is 0, the return
|
||||
/// value will indicate how many version numbers are available in
|
||||
/// this object file. Then a subsequent call can be made to this
|
||||
/// 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
|
||||
/// 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
|
||||
/// to this function so that all versions can be retrieved. If
|
||||
/// the value is non-NULL, then at most \a num_versions of the
|
||||
/// existing versions numbers will be filled into \a versions.
|
||||
/// If there is no version information available, \a versions
|
||||
/// will be filled with \a num_versions UINT32_MAX values
|
||||
/// and zero will be returned.
|
||||
///
|
||||
/// @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
|
||||
/// to this function can be make with adequate storage in
|
||||
/// \a versions to get all of the version numbers. If \a
|
||||
/// num_versions is less than the actual number of version
|
||||
/// numbers in this object file, only \a num_versions will be
|
||||
/// filled into \a versions (if \a versions is non-NULL).
|
||||
///
|
||||
/// @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);
|
||||
|
||||
private:
|
||||
friend class SBAddress;
|
||||
friend class SBFrame;
|
||||
friend class SBSection;
|
||||
friend class SBSymbolContext;
|
||||
friend class SBTarget;
|
||||
|
||||
explicit SBModule (const lldb::ModuleSP& module_sp);
|
||||
|
||||
ModuleSP
|
||||
GetSP () const;
|
||||
|
||||
void
|
||||
SetSP (const ModuleSP &module_sp);
|
||||
|
||||
lldb::ModuleSP m_opaque_sp;
|
||||
};
|
||||
|
||||
|
||||
} // namespace lldb
|
||||
|
||||
#endif // LLDB_SBModule_h_
|
154
include/lldb/API/SBModuleSpec.h
Normal file
154
include/lldb/API/SBModuleSpec.h
Normal file
@ -0,0 +1,154 @@
|
||||
//===-- SBModuleSpec.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_SBModuleSpec_h_
|
||||
#define LLDB_SBModuleSpec_h_
|
||||
|
||||
#include "lldb/API/SBDefines.h"
|
||||
#include "lldb/API/SBFileSpec.h"
|
||||
|
||||
namespace lldb {
|
||||
|
||||
class SBModuleSpec
|
||||
{
|
||||
public:
|
||||
|
||||
SBModuleSpec ();
|
||||
|
||||
SBModuleSpec (const SBModuleSpec &rhs);
|
||||
|
||||
~SBModuleSpec ();
|
||||
|
||||
const SBModuleSpec &
|
||||
operator = (const SBModuleSpec &rhs);
|
||||
|
||||
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
|
||||
/// 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
|
||||
/// the remote system on which it is being debugged. For local
|
||||
/// debugging this is always the same as Module::GetFileSpec(). But
|
||||
/// remote debugging might mention a file '/usr/lib/liba.dylib'
|
||||
/// which might be locally downloaded and cached. In this case the
|
||||
/// platform file could be something like:
|
||||
/// '/tmp/lldb/platform-cache/remote.host.computer/usr/lib/liba.dylib'
|
||||
/// The file could also be cached in a local developer kit directory.
|
||||
///
|
||||
/// @return
|
||||
/// A const reference to the file specification object.
|
||||
//------------------------------------------------------------------
|
||||
lldb::SBFileSpec
|
||||
GetPlatformFileSpec ();
|
||||
|
||||
void
|
||||
SetPlatformFileSpec (const lldb::SBFileSpec &fspec);
|
||||
|
||||
lldb::SBFileSpec
|
||||
GetSymbolFileSpec ();
|
||||
|
||||
void
|
||||
SetSymbolFileSpec (const lldb::SBFileSpec &fspec);
|
||||
|
||||
const char *
|
||||
GetObjectName ();
|
||||
|
||||
void
|
||||
SetObjectName (const char *name);
|
||||
|
||||
const char *
|
||||
GetTriple ();
|
||||
|
||||
void
|
||||
SetTriple (const char *triple);
|
||||
|
||||
const uint8_t *
|
||||
GetUUIDBytes ();
|
||||
|
||||
size_t
|
||||
GetUUIDLength ();
|
||||
|
||||
bool
|
||||
SetUUIDBytes (const uint8_t *uuid, size_t uuid_len);
|
||||
|
||||
bool
|
||||
GetDescription (lldb::SBStream &description);
|
||||
|
||||
private:
|
||||
friend class SBModuleSpecList;
|
||||
friend class SBModule;
|
||||
friend class SBTarget;
|
||||
|
||||
std::unique_ptr<lldb_private::ModuleSpec> m_opaque_ap;
|
||||
};
|
||||
|
||||
class SBModuleSpecList
|
||||
{
|
||||
public:
|
||||
SBModuleSpecList();
|
||||
|
||||
SBModuleSpecList (const SBModuleSpecList &rhs);
|
||||
|
||||
~SBModuleSpecList();
|
||||
|
||||
SBModuleSpecList &
|
||||
operator = (const SBModuleSpecList &rhs);
|
||||
|
||||
static SBModuleSpecList
|
||||
GetModuleSpecifications (const char *path);
|
||||
|
||||
void
|
||||
Append (const SBModuleSpec &spec);
|
||||
|
||||
void
|
||||
Append (const SBModuleSpecList &spec_list);
|
||||
|
||||
SBModuleSpec
|
||||
FindFirstMatchingSpec (const SBModuleSpec &match_spec);
|
||||
|
||||
SBModuleSpecList
|
||||
FindMatchingSpecs (const SBModuleSpec &match_spec);
|
||||
|
||||
size_t
|
||||
GetSize();
|
||||
|
||||
SBModuleSpec
|
||||
GetSpecAtIndex (size_t i);
|
||||
|
||||
bool
|
||||
GetDescription (lldb::SBStream &description);
|
||||
|
||||
private:
|
||||
std::unique_ptr<lldb_private::ModuleSpecList> m_opaque_ap;
|
||||
};
|
||||
|
||||
} // namespace lldb
|
||||
|
||||
#endif // LLDB_SBModuleSpec_h_
|
295
include/lldb/API/SBProcess.h
Normal file
295
include/lldb/API/SBProcess.h
Normal file
@ -0,0 +1,295 @@
|
||||
//===-- SBProcess.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_SBProcess_h_
|
||||
#define LLDB_SBProcess_h_
|
||||
|
||||
#include "lldb/API/SBDefines.h"
|
||||
#include "lldb/API/SBError.h"
|
||||
#include "lldb/API/SBTarget.h"
|
||||
#include <stdio.h>
|
||||
|
||||
namespace lldb {
|
||||
|
||||
class SBEvent;
|
||||
|
||||
class SBProcess
|
||||
{
|
||||
public:
|
||||
//------------------------------------------------------------------
|
||||
/// Broadcaster event bits definitions.
|
||||
//------------------------------------------------------------------
|
||||
enum
|
||||
{
|
||||
eBroadcastBitStateChanged = (1 << 0),
|
||||
eBroadcastBitInterrupt = (1 << 1),
|
||||
eBroadcastBitSTDOUT = (1 << 2),
|
||||
eBroadcastBitSTDERR = (1 << 3),
|
||||
eBroadcastBitProfileData = (1 << 4)
|
||||
};
|
||||
|
||||
SBProcess ();
|
||||
|
||||
SBProcess (const lldb::SBProcess& rhs);
|
||||
|
||||
const lldb::SBProcess&
|
||||
operator = (const lldb::SBProcess& rhs);
|
||||
|
||||
SBProcess (const lldb::ProcessSP &process_sp);
|
||||
|
||||
~SBProcess();
|
||||
|
||||
static const char *
|
||||
GetBroadcasterClassName ();
|
||||
|
||||
const char *
|
||||
GetPluginName ();
|
||||
|
||||
// DEPRECATED: use GetPluginName()
|
||||
const char *
|
||||
GetShortPluginName ();
|
||||
|
||||
void
|
||||
Clear ();
|
||||
|
||||
bool
|
||||
IsValid() const;
|
||||
|
||||
lldb::SBTarget
|
||||
GetTarget() const;
|
||||
|
||||
lldb::ByteOrder
|
||||
GetByteOrder() const;
|
||||
|
||||
size_t
|
||||
PutSTDIN (const char *src, size_t src_len);
|
||||
|
||||
size_t
|
||||
GetSTDOUT (char *dst, size_t dst_len) const;
|
||||
|
||||
size_t
|
||||
GetSTDERR (char *dst, size_t dst_len) const;
|
||||
|
||||
size_t
|
||||
GetAsyncProfileData(char *dst, size_t dst_len) const;
|
||||
|
||||
void
|
||||
ReportEventState (const lldb::SBEvent &event, FILE *out) const;
|
||||
|
||||
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,
|
||||
const char *stdin_path,
|
||||
const char *stdout_path,
|
||||
const char *stderr_path,
|
||||
const char *working_directory,
|
||||
uint32_t launch_flags,
|
||||
bool stop_at_entry,
|
||||
lldb::SBError& error);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// Thread related functions
|
||||
//------------------------------------------------------------------
|
||||
uint32_t
|
||||
GetNumThreads ();
|
||||
|
||||
lldb::SBThread
|
||||
GetThreadAtIndex (size_t index);
|
||||
|
||||
lldb::SBThread
|
||||
GetThreadByID (lldb::tid_t sb_thread_id);
|
||||
|
||||
lldb::SBThread
|
||||
GetThreadByIndexID (uint32_t index_id);
|
||||
|
||||
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);
|
||||
|
||||
bool
|
||||
SetSelectedThreadByID (lldb::tid_t tid);
|
||||
|
||||
bool
|
||||
SetSelectedThreadByIndexID (uint32_t index_id);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// Stepping related functions
|
||||
//------------------------------------------------------------------
|
||||
|
||||
lldb::StateType
|
||||
GetState ();
|
||||
|
||||
int
|
||||
GetExitStatus ();
|
||||
|
||||
const char *
|
||||
GetExitDescription ();
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Gets the process ID
|
||||
///
|
||||
/// Returns the process identifier for the process as it is known
|
||||
/// on the system on which the process is running. For unix systems
|
||||
/// this is typically the same as if you called "getpid()" in the
|
||||
/// process.
|
||||
///
|
||||
/// @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
|
||||
/// instance. Since starting a process on a system might always
|
||||
/// create a process with the same process ID, there needs to be a
|
||||
/// way to tell two process instances apart.
|
||||
///
|
||||
/// @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;
|
||||
|
||||
lldb::SBError
|
||||
Destroy ();
|
||||
|
||||
lldb::SBError
|
||||
Continue ();
|
||||
|
||||
lldb::SBError
|
||||
Stop ();
|
||||
|
||||
lldb::SBError
|
||||
Kill ();
|
||||
|
||||
lldb::SBError
|
||||
Detach ();
|
||||
|
||||
lldb::SBError
|
||||
Detach (bool keep_stopped);
|
||||
|
||||
lldb::SBError
|
||||
Signal (int signal);
|
||||
|
||||
void
|
||||
SendAsyncInterrupt();
|
||||
|
||||
uint32_t
|
||||
GetStopID(bool include_expression_stops = false);
|
||||
|
||||
size_t
|
||||
ReadMemory (addr_t addr, void *buf, size_t size, lldb::SBError &error);
|
||||
|
||||
size_t
|
||||
WriteMemory (addr_t addr, const void *buf, size_t size, lldb::SBError &error);
|
||||
|
||||
size_t
|
||||
ReadCStringFromMemory (addr_t addr, void *buf, size_t size, lldb::SBError &error);
|
||||
|
||||
uint64_t
|
||||
ReadUnsignedFromMemory (addr_t addr, uint32_t byte_size, lldb::SBError &error);
|
||||
|
||||
lldb::addr_t
|
||||
ReadPointerFromMemory (addr_t addr, lldb::SBError &error);
|
||||
|
||||
// Events
|
||||
static lldb::StateType
|
||||
GetStateFromEvent (const lldb::SBEvent &event);
|
||||
|
||||
static bool
|
||||
GetRestartedFromEvent (const lldb::SBEvent &event);
|
||||
|
||||
static size_t
|
||||
GetNumRestartedReasonsFromEvent (const lldb::SBEvent &event);
|
||||
|
||||
static const char *
|
||||
GetRestartedReasonAtIndexFromEvent (const lldb::SBEvent &event, size_t idx);
|
||||
|
||||
static lldb::SBProcess
|
||||
GetProcessFromEvent (const lldb::SBEvent &event);
|
||||
|
||||
static bool
|
||||
EventIsProcessEvent (const lldb::SBEvent &event);
|
||||
|
||||
lldb::SBBroadcaster
|
||||
GetBroadcaster () const;
|
||||
|
||||
static const char *
|
||||
GetBroadcasterClass ();
|
||||
|
||||
bool
|
||||
GetDescription (lldb::SBStream &description);
|
||||
|
||||
uint32_t
|
||||
GetNumSupportedHardwareWatchpoints (lldb::SBError &error) const;
|
||||
|
||||
uint32_t
|
||||
LoadImage (lldb::SBFileSpec &image_spec, lldb::SBError &error);
|
||||
|
||||
lldb::SBError
|
||||
UnloadImage (uint32_t image_token);
|
||||
|
||||
protected:
|
||||
friend class SBAddress;
|
||||
friend class SBBreakpoint;
|
||||
friend class SBBreakpointLocation;
|
||||
friend class SBCommandInterpreter;
|
||||
friend class SBDebugger;
|
||||
friend class SBFunction;
|
||||
friend class SBModule;
|
||||
friend class SBTarget;
|
||||
friend class SBThread;
|
||||
friend class SBValue;
|
||||
|
||||
lldb::ProcessSP
|
||||
GetSP() const;
|
||||
|
||||
void
|
||||
SetSP (const lldb::ProcessSP &process_sp);
|
||||
|
||||
lldb::ProcessWP m_opaque_wp;
|
||||
};
|
||||
|
||||
} // namespace lldb
|
||||
|
||||
#endif // LLDB_SBProcess_h_
|
104
include/lldb/API/SBSection.h
Normal file
104
include/lldb/API/SBSection.h
Normal file
@ -0,0 +1,104 @@
|
||||
//===-- SBSection.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_SBSection_h_
|
||||
#define LLDB_SBSection_h_
|
||||
|
||||
#include "lldb/API/SBDefines.h"
|
||||
#include "lldb/API/SBData.h"
|
||||
|
||||
namespace lldb {
|
||||
|
||||
class SBSection
|
||||
{
|
||||
public:
|
||||
|
||||
SBSection ();
|
||||
|
||||
SBSection (const lldb::SBSection &rhs);
|
||||
|
||||
~SBSection ();
|
||||
|
||||
const lldb::SBSection &
|
||||
operator = (const lldb::SBSection &rhs);
|
||||
|
||||
bool
|
||||
IsValid () const;
|
||||
|
||||
const char *
|
||||
GetName ();
|
||||
|
||||
lldb::SBSection
|
||||
GetParent();
|
||||
|
||||
lldb::SBSection
|
||||
FindSubSection (const char *sect_name);
|
||||
|
||||
size_t
|
||||
GetNumSubSections ();
|
||||
|
||||
lldb::SBSection
|
||||
GetSubSectionAtIndex (size_t idx);
|
||||
|
||||
lldb::addr_t
|
||||
GetFileAddress ();
|
||||
|
||||
lldb::addr_t
|
||||
GetLoadAddress (lldb::SBTarget &target);
|
||||
|
||||
lldb::addr_t
|
||||
GetByteSize ();
|
||||
|
||||
uint64_t
|
||||
GetFileOffset ();
|
||||
|
||||
uint64_t
|
||||
GetFileByteSize ();
|
||||
|
||||
lldb::SBData
|
||||
GetSectionData ();
|
||||
|
||||
lldb::SBData
|
||||
GetSectionData (uint64_t offset,
|
||||
uint64_t size);
|
||||
|
||||
SectionType
|
||||
GetSectionType ();
|
||||
|
||||
bool
|
||||
operator == (const lldb::SBSection &rhs);
|
||||
|
||||
bool
|
||||
operator != (const lldb::SBSection &rhs);
|
||||
|
||||
bool
|
||||
GetDescription (lldb::SBStream &description);
|
||||
|
||||
|
||||
private:
|
||||
|
||||
friend class SBAddress;
|
||||
friend class SBModule;
|
||||
friend class SBTarget;
|
||||
|
||||
SBSection (const lldb::SectionSP §ion_sp);
|
||||
|
||||
lldb::SectionSP
|
||||
GetSP() const;
|
||||
|
||||
void
|
||||
SetSP(const lldb::SectionSP §ion_sp);
|
||||
|
||||
lldb::SectionWP m_opaque_wp;
|
||||
};
|
||||
|
||||
|
||||
} // namespace lldb
|
||||
|
||||
#endif // LLDB_SBSection_h_
|
53
include/lldb/API/SBSourceManager.h
Normal file
53
include/lldb/API/SBSourceManager.h
Normal file
@ -0,0 +1,53 @@
|
||||
//===-- SBSourceManager.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_SBSourceManager_h_
|
||||
#define LLDB_SBSourceManager_h_
|
||||
|
||||
#include "lldb/API/SBDefines.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
namespace lldb {
|
||||
|
||||
class SBSourceManager
|
||||
{
|
||||
public:
|
||||
SBSourceManager (const SBDebugger &debugger);
|
||||
SBSourceManager (const SBTarget &target);
|
||||
SBSourceManager (const SBSourceManager &rhs);
|
||||
|
||||
~SBSourceManager();
|
||||
|
||||
const lldb::SBSourceManager &
|
||||
operator = (const lldb::SBSourceManager &rhs);
|
||||
|
||||
size_t
|
||||
DisplaySourceLinesWithLineNumbers (const lldb::SBFileSpec &file,
|
||||
uint32_t line,
|
||||
uint32_t context_before,
|
||||
uint32_t context_after,
|
||||
const char* current_line_cstr,
|
||||
lldb::SBStream &s);
|
||||
|
||||
|
||||
protected:
|
||||
friend class SBCommandInterpreter;
|
||||
friend class SBDebugger;
|
||||
|
||||
SBSourceManager(lldb_private::SourceManager *source_manager);
|
||||
|
||||
private:
|
||||
|
||||
std::unique_ptr<lldb_private::SourceManagerImpl> m_opaque_ap;
|
||||
};
|
||||
|
||||
} // namespace lldb
|
||||
|
||||
#endif // LLDB_SBSourceManager_h_
|
111
include/lldb/API/SBStream.h
Normal file
111
include/lldb/API/SBStream.h
Normal file
@ -0,0 +1,111 @@
|
||||
//===-- SBStream.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_SBStream_h_
|
||||
#define LLDB_SBStream_h_
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "lldb/API/SBDefines.h"
|
||||
|
||||
namespace lldb {
|
||||
|
||||
class SBStream
|
||||
{
|
||||
public:
|
||||
|
||||
SBStream ();
|
||||
|
||||
~SBStream ();
|
||||
|
||||
bool
|
||||
IsValid() const;
|
||||
|
||||
// If this stream is not redirected to a file, it will maintain a local
|
||||
// cache for the stream data which can be accessed using this accessor.
|
||||
const char *
|
||||
GetData ();
|
||||
|
||||
// If this stream is not redirected to a file, it will maintain a local
|
||||
// cache for the stream output whose length can be accessed using this
|
||||
// accessor.
|
||||
size_t
|
||||
GetSize();
|
||||
|
||||
void
|
||||
Printf (const char *format, ...) __attribute__ ((format (printf, 2, 3)));
|
||||
|
||||
void
|
||||
RedirectToFile (const char *path, bool append);
|
||||
|
||||
void
|
||||
RedirectToFileHandle (FILE *fh, bool transfer_fh_ownership);
|
||||
|
||||
void
|
||||
RedirectToFileDescriptor (int fd, bool transfer_fh_ownership);
|
||||
|
||||
// If the stream is redirected to a file, forget about the file and if
|
||||
// ownership of the file was transfered to this object, close the file.
|
||||
// If the stream is backed by a local cache, clear this cache.
|
||||
void
|
||||
Clear ();
|
||||
|
||||
protected:
|
||||
friend class SBAddress;
|
||||
friend class SBBlock;
|
||||
friend class SBBreakpoint;
|
||||
friend class SBBreakpointLocation;
|
||||
friend class SBCommandReturnObject;
|
||||
friend class SBCompileUnit;
|
||||
friend class SBData;
|
||||
friend class SBDebugger;
|
||||
friend class SBDeclaration;
|
||||
friend class SBEvent;
|
||||
friend class SBFileSpec;
|
||||
friend class SBFileSpecList;
|
||||
friend class SBFrame;
|
||||
friend class SBFunction;
|
||||
friend class SBInstruction;
|
||||
friend class SBInstructionList;
|
||||
friend class SBLineEntry;
|
||||
friend class SBModule;
|
||||
friend class SBModuleSpec;
|
||||
friend class SBModuleSpecList;
|
||||
friend class SBProcess;
|
||||
friend class SBSection;
|
||||
friend class SBSourceManager;
|
||||
friend class SBSymbol;
|
||||
friend class SBSymbolContext;
|
||||
friend class SBSymbolContextList;
|
||||
friend class SBTarget;
|
||||
friend class SBThread;
|
||||
friend class SBType;
|
||||
friend class SBTypeMember;
|
||||
friend class SBValue;
|
||||
friend class SBWatchpoint;
|
||||
|
||||
lldb_private::Stream *
|
||||
operator->();
|
||||
|
||||
lldb_private::Stream *
|
||||
get();
|
||||
|
||||
lldb_private::Stream &
|
||||
ref();
|
||||
|
||||
private:
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN (SBStream);
|
||||
std::unique_ptr<lldb_private::Stream> m_opaque_ap;
|
||||
bool m_is_file;
|
||||
};
|
||||
|
||||
} // namespace lldb
|
||||
|
||||
#endif // LLDB_SBStream_h_
|
71
include/lldb/API/SBStringList.h
Normal file
71
include/lldb/API/SBStringList.h
Normal file
@ -0,0 +1,71 @@
|
||||
//===-- SBStringList.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_SBStringList_h_
|
||||
#define LLDB_SBStringList_h_
|
||||
|
||||
#include "lldb/API/SBDefines.h"
|
||||
|
||||
namespace lldb {
|
||||
|
||||
class SBStringList
|
||||
{
|
||||
public:
|
||||
|
||||
SBStringList ();
|
||||
|
||||
SBStringList (const lldb::SBStringList &rhs);
|
||||
|
||||
const SBStringList &
|
||||
operator = (const SBStringList &rhs);
|
||||
|
||||
~SBStringList ();
|
||||
|
||||
bool
|
||||
IsValid() const;
|
||||
|
||||
void
|
||||
AppendString (const char *str);
|
||||
|
||||
void
|
||||
AppendList (const char **strv, int strc);
|
||||
|
||||
void
|
||||
AppendList (const lldb::SBStringList &strings);
|
||||
|
||||
uint32_t
|
||||
GetSize () const;
|
||||
|
||||
const char *
|
||||
GetStringAtIndex (size_t idx);
|
||||
|
||||
void
|
||||
Clear ();
|
||||
|
||||
protected:
|
||||
friend class SBCommandInterpreter;
|
||||
friend class SBDebugger;
|
||||
|
||||
SBStringList (const lldb_private::StringList *lldb_strings);
|
||||
|
||||
const lldb_private::StringList *
|
||||
operator->() const;
|
||||
|
||||
const lldb_private::StringList &
|
||||
operator*() const;
|
||||
|
||||
private:
|
||||
|
||||
std::unique_ptr<lldb_private::StringList> m_opaque_ap;
|
||||
|
||||
};
|
||||
|
||||
} // namespace lldb
|
||||
|
||||
#endif // LLDB_SBStringList_h_
|
109
include/lldb/API/SBSymbol.h
Normal file
109
include/lldb/API/SBSymbol.h
Normal file
@ -0,0 +1,109 @@
|
||||
//===-- SBSymbol.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_SBSymbol_h_
|
||||
#define LLDB_SBSymbol_h_
|
||||
|
||||
#include "lldb/API/SBDefines.h"
|
||||
#include "lldb/API/SBAddress.h"
|
||||
#include "lldb/API/SBInstructionList.h"
|
||||
#include "lldb/API/SBTarget.h"
|
||||
|
||||
namespace lldb {
|
||||
|
||||
class SBSymbol
|
||||
{
|
||||
public:
|
||||
|
||||
SBSymbol ();
|
||||
|
||||
~SBSymbol ();
|
||||
|
||||
SBSymbol (const lldb::SBSymbol &rhs);
|
||||
|
||||
const lldb::SBSymbol &
|
||||
operator = (const lldb::SBSymbol &rhs);
|
||||
|
||||
bool
|
||||
IsValid () const;
|
||||
|
||||
|
||||
const char *
|
||||
GetName() const;
|
||||
|
||||
const char *
|
||||
GetMangledName () const;
|
||||
|
||||
lldb::SBInstructionList
|
||||
GetInstructions (lldb::SBTarget target);
|
||||
|
||||
lldb::SBInstructionList
|
||||
GetInstructions (lldb::SBTarget target, const char *flavor_string);
|
||||
|
||||
SBAddress
|
||||
GetStartAddress ();
|
||||
|
||||
SBAddress
|
||||
GetEndAddress ();
|
||||
|
||||
uint32_t
|
||||
GetPrologueByteSize ();
|
||||
|
||||
SymbolType
|
||||
GetType ();
|
||||
|
||||
bool
|
||||
operator == (const lldb::SBSymbol &rhs) const;
|
||||
|
||||
bool
|
||||
operator != (const lldb::SBSymbol &rhs) const;
|
||||
|
||||
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:
|
||||
|
||||
lldb_private::Symbol *
|
||||
get ();
|
||||
|
||||
void
|
||||
reset (lldb_private::Symbol *);
|
||||
|
||||
private:
|
||||
friend class SBAddress;
|
||||
friend class SBFrame;
|
||||
friend class SBModule;
|
||||
friend class SBSymbolContext;
|
||||
|
||||
SBSymbol (lldb_private::Symbol *lldb_object_ptr);
|
||||
|
||||
void
|
||||
SetSymbol (lldb_private::Symbol *lldb_object_ptr);
|
||||
|
||||
lldb_private::Symbol *m_opaque_ptr;
|
||||
};
|
||||
|
||||
|
||||
} // namespace lldb
|
||||
|
||||
#endif // LLDB_SBSymbol_h_
|
94
include/lldb/API/SBSymbolContext.h
Normal file
94
include/lldb/API/SBSymbolContext.h
Normal file
@ -0,0 +1,94 @@
|
||||
//===-- SBSymbolContext.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_SBSymbolContext_h_
|
||||
#define LLDB_SBSymbolContext_h_
|
||||
|
||||
#include "lldb/API/SBDefines.h"
|
||||
#include "lldb/API/SBBlock.h"
|
||||
#include "lldb/API/SBCompileUnit.h"
|
||||
#include "lldb/API/SBFunction.h"
|
||||
#include "lldb/API/SBLineEntry.h"
|
||||
#include "lldb/API/SBModule.h"
|
||||
#include "lldb/API/SBSymbol.h"
|
||||
|
||||
namespace lldb {
|
||||
|
||||
class SBSymbolContext
|
||||
{
|
||||
public:
|
||||
SBSymbolContext ();
|
||||
|
||||
SBSymbolContext (const lldb::SBSymbolContext& rhs);
|
||||
|
||||
~SBSymbolContext ();
|
||||
|
||||
bool
|
||||
IsValid () const;
|
||||
|
||||
const lldb::SBSymbolContext &
|
||||
operator = (const lldb::SBSymbolContext &rhs);
|
||||
|
||||
lldb::SBModule GetModule ();
|
||||
lldb::SBCompileUnit GetCompileUnit ();
|
||||
lldb::SBFunction GetFunction ();
|
||||
lldb::SBBlock GetBlock ();
|
||||
lldb::SBLineEntry GetLineEntry ();
|
||||
lldb::SBSymbol GetSymbol ();
|
||||
|
||||
void SetModule (lldb::SBModule module);
|
||||
void SetCompileUnit (lldb::SBCompileUnit compile_unit);
|
||||
void SetFunction (lldb::SBFunction function);
|
||||
void SetBlock (lldb::SBBlock block);
|
||||
void SetLineEntry (lldb::SBLineEntry line_entry);
|
||||
void SetSymbol (lldb::SBSymbol symbol);
|
||||
|
||||
SBSymbolContext
|
||||
GetParentOfInlinedScope (const SBAddress &curr_frame_pc,
|
||||
SBAddress &parent_frame_addr) const;
|
||||
|
||||
bool
|
||||
GetDescription (lldb::SBStream &description);
|
||||
|
||||
protected:
|
||||
friend class SBAddress;
|
||||
friend class SBFrame;
|
||||
friend class SBModule;
|
||||
friend class SBThread;
|
||||
friend class SBTarget;
|
||||
friend class SBSymbolContextList;
|
||||
|
||||
lldb_private::SymbolContext*
|
||||
operator->() const;
|
||||
|
||||
lldb_private::SymbolContext&
|
||||
operator*();
|
||||
|
||||
lldb_private::SymbolContext&
|
||||
ref();
|
||||
|
||||
const lldb_private::SymbolContext&
|
||||
operator*() const;
|
||||
|
||||
lldb_private::SymbolContext *
|
||||
get() const;
|
||||
|
||||
SBSymbolContext (const lldb_private::SymbolContext *sc_ptr);
|
||||
|
||||
void
|
||||
SetSymbolContext (const lldb_private::SymbolContext *sc_ptr);
|
||||
|
||||
private:
|
||||
std::unique_ptr<lldb_private::SymbolContext> m_opaque_ap;
|
||||
};
|
||||
|
||||
|
||||
} // namespace lldb
|
||||
|
||||
#endif // LLDB_SBSymbolContext_h_
|
69
include/lldb/API/SBSymbolContextList.h
Normal file
69
include/lldb/API/SBSymbolContextList.h
Normal file
@ -0,0 +1,69 @@
|
||||
//===-- SBSymbolContextList.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_SBSymbolContextList_h_
|
||||
#define LLDB_SBSymbolContextList_h_
|
||||
|
||||
#include "lldb/API/SBDefines.h"
|
||||
#include "lldb/API/SBSymbolContext.h"
|
||||
|
||||
namespace lldb {
|
||||
|
||||
class SBSymbolContextList
|
||||
{
|
||||
public:
|
||||
SBSymbolContextList ();
|
||||
|
||||
SBSymbolContextList (const lldb::SBSymbolContextList& rhs);
|
||||
|
||||
~SBSymbolContextList ();
|
||||
|
||||
const lldb::SBSymbolContextList &
|
||||
operator = (const lldb::SBSymbolContextList &rhs);
|
||||
|
||||
bool
|
||||
IsValid () const;
|
||||
|
||||
uint32_t
|
||||
GetSize() const;
|
||||
|
||||
lldb::SBSymbolContext
|
||||
GetContextAtIndex (uint32_t idx);
|
||||
|
||||
bool
|
||||
GetDescription (lldb::SBStream &description);
|
||||
|
||||
void
|
||||
Append (lldb::SBSymbolContext &sc);
|
||||
|
||||
void
|
||||
Append (lldb::SBSymbolContextList &sc_list);
|
||||
|
||||
void
|
||||
Clear();
|
||||
|
||||
protected:
|
||||
|
||||
friend class SBModule;
|
||||
friend class SBTarget;
|
||||
|
||||
lldb_private::SymbolContextList*
|
||||
operator->() const;
|
||||
|
||||
lldb_private::SymbolContextList&
|
||||
operator*() const;
|
||||
|
||||
private:
|
||||
std::unique_ptr<lldb_private::SymbolContextList> m_opaque_ap;
|
||||
};
|
||||
|
||||
|
||||
} // namespace lldb
|
||||
|
||||
#endif // LLDB_SBSymbolContextList_h_
|
828
include/lldb/API/SBTarget.h
Normal file
828
include/lldb/API/SBTarget.h
Normal file
@ -0,0 +1,828 @@
|
||||
//===-- SBTarget.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_SBTarget_h_
|
||||
#define LLDB_SBTarget_h_
|
||||
|
||||
#include "lldb/API/SBDefines.h"
|
||||
#include "lldb/API/SBAddress.h"
|
||||
#include "lldb/API/SBBroadcaster.h"
|
||||
#include "lldb/API/SBFileSpec.h"
|
||||
#include "lldb/API/SBFileSpecList.h"
|
||||
#include "lldb/API/SBSymbolContextList.h"
|
||||
#include "lldb/API/SBType.h"
|
||||
#include "lldb/API/SBValue.h"
|
||||
#include "lldb/API/SBWatchpoint.h"
|
||||
|
||||
namespace lldb {
|
||||
|
||||
class SBLaunchInfo
|
||||
{
|
||||
public:
|
||||
SBLaunchInfo (const char **argv);
|
||||
|
||||
~SBLaunchInfo();
|
||||
|
||||
uint32_t
|
||||
GetUserID();
|
||||
|
||||
uint32_t
|
||||
GetGroupID();
|
||||
|
||||
bool
|
||||
UserIDIsValid ();
|
||||
|
||||
bool
|
||||
GroupIDIsValid ();
|
||||
|
||||
void
|
||||
SetUserID (uint32_t uid);
|
||||
|
||||
void
|
||||
SetGroupID (uint32_t gid);
|
||||
|
||||
uint32_t
|
||||
GetNumArguments ();
|
||||
|
||||
const char *
|
||||
GetArgumentAtIndex (uint32_t idx);
|
||||
|
||||
void
|
||||
SetArguments (const char **argv, bool append);
|
||||
|
||||
uint32_t
|
||||
GetNumEnvironmentEntries ();
|
||||
|
||||
const char *
|
||||
GetEnvironmentEntryAtIndex (uint32_t idx);
|
||||
|
||||
void
|
||||
SetEnvironmentEntries (const char **envp, bool append);
|
||||
|
||||
void
|
||||
Clear ();
|
||||
|
||||
const char *
|
||||
GetWorkingDirectory () const;
|
||||
|
||||
void
|
||||
SetWorkingDirectory (const char *working_dir);
|
||||
|
||||
uint32_t
|
||||
GetLaunchFlags ();
|
||||
|
||||
void
|
||||
SetLaunchFlags (uint32_t flags);
|
||||
|
||||
const char *
|
||||
GetProcessPluginName ();
|
||||
|
||||
void
|
||||
SetProcessPluginName (const char *plugin_name);
|
||||
|
||||
const char *
|
||||
GetShell ();
|
||||
|
||||
void
|
||||
SetShell (const char * path);
|
||||
|
||||
uint32_t
|
||||
GetResumeCount ();
|
||||
|
||||
void
|
||||
SetResumeCount (uint32_t c);
|
||||
|
||||
bool
|
||||
AddCloseFileAction (int fd);
|
||||
|
||||
bool
|
||||
AddDuplicateFileAction (int fd, int dup_fd);
|
||||
|
||||
bool
|
||||
AddOpenFileAction (int fd, const char *path, bool read, bool write);
|
||||
|
||||
bool
|
||||
AddSuppressFileAction (int fd, bool read, bool write);
|
||||
|
||||
protected:
|
||||
friend class SBTarget;
|
||||
|
||||
lldb_private::ProcessLaunchInfo &
|
||||
ref ();
|
||||
|
||||
ProcessLaunchInfoSP m_opaque_sp;
|
||||
};
|
||||
|
||||
class SBAttachInfo
|
||||
{
|
||||
public:
|
||||
SBAttachInfo ();
|
||||
|
||||
SBAttachInfo (lldb::pid_t pid);
|
||||
|
||||
SBAttachInfo (const char *path, bool wait_for);
|
||||
|
||||
SBAttachInfo (const SBAttachInfo &rhs);
|
||||
|
||||
~SBAttachInfo();
|
||||
|
||||
SBAttachInfo &
|
||||
operator = (const SBAttachInfo &rhs);
|
||||
|
||||
lldb::pid_t
|
||||
GetProcessID ();
|
||||
|
||||
void
|
||||
SetProcessID (lldb::pid_t pid);
|
||||
|
||||
void
|
||||
SetExecutable (const char *path);
|
||||
|
||||
void
|
||||
SetExecutable (lldb::SBFileSpec exe_file);
|
||||
|
||||
bool
|
||||
GetWaitForLaunch ();
|
||||
|
||||
void
|
||||
SetWaitForLaunch (bool b);
|
||||
|
||||
bool
|
||||
GetIgnoreExisting ();
|
||||
|
||||
void
|
||||
SetIgnoreExisting (bool b);
|
||||
|
||||
uint32_t
|
||||
GetResumeCount ();
|
||||
|
||||
void
|
||||
SetResumeCount (uint32_t c);
|
||||
|
||||
const char *
|
||||
GetProcessPluginName ();
|
||||
|
||||
void
|
||||
SetProcessPluginName (const char *plugin_name);
|
||||
|
||||
uint32_t
|
||||
GetUserID();
|
||||
|
||||
uint32_t
|
||||
GetGroupID();
|
||||
|
||||
bool
|
||||
UserIDIsValid ();
|
||||
|
||||
bool
|
||||
GroupIDIsValid ();
|
||||
|
||||
void
|
||||
SetUserID (uint32_t uid);
|
||||
|
||||
void
|
||||
SetGroupID (uint32_t gid);
|
||||
|
||||
uint32_t
|
||||
GetEffectiveUserID();
|
||||
|
||||
uint32_t
|
||||
GetEffectiveGroupID();
|
||||
|
||||
bool
|
||||
EffectiveUserIDIsValid ();
|
||||
|
||||
bool
|
||||
EffectiveGroupIDIsValid ();
|
||||
|
||||
void
|
||||
SetEffectiveUserID (uint32_t uid);
|
||||
|
||||
void
|
||||
SetEffectiveGroupID (uint32_t gid);
|
||||
|
||||
lldb::pid_t
|
||||
GetParentProcessID ();
|
||||
|
||||
void
|
||||
SetParentProcessID (lldb::pid_t pid);
|
||||
|
||||
bool
|
||||
ParentProcessIDIsValid();
|
||||
|
||||
|
||||
protected:
|
||||
friend class SBTarget;
|
||||
|
||||
lldb_private::ProcessAttachInfo &
|
||||
ref ();
|
||||
|
||||
ProcessAttachInfoSP m_opaque_sp;
|
||||
};
|
||||
|
||||
class SBTarget
|
||||
{
|
||||
public:
|
||||
//------------------------------------------------------------------
|
||||
// Broadcaster bits.
|
||||
//------------------------------------------------------------------
|
||||
enum
|
||||
{
|
||||
eBroadcastBitBreakpointChanged = (1 << 0),
|
||||
eBroadcastBitModulesLoaded = (1 << 1),
|
||||
eBroadcastBitModulesUnloaded = (1 << 2),
|
||||
eBroadcastBitWatchpointChanged = (1 << 3),
|
||||
eBroadcastBitSymbolsLoaded = (1 << 4)
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// Constructors
|
||||
//------------------------------------------------------------------
|
||||
SBTarget ();
|
||||
|
||||
SBTarget (const lldb::SBTarget& rhs);
|
||||
|
||||
SBTarget (const lldb::TargetSP& target_sp);
|
||||
|
||||
const lldb::SBTarget&
|
||||
operator = (const lldb::SBTarget& rhs);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// Destructor
|
||||
//------------------------------------------------------------------
|
||||
~SBTarget();
|
||||
|
||||
bool
|
||||
IsValid() const;
|
||||
|
||||
static const char *
|
||||
GetBroadcasterClassName ();
|
||||
|
||||
lldb::SBProcess
|
||||
GetProcess ();
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Launch a new process.
|
||||
///
|
||||
/// Launch a new process by spawning a new process using the
|
||||
/// target object's executable module's file as the file to launch.
|
||||
/// Arguments are given in \a argv, and the environment variables
|
||||
/// are in \a envp. Standard input and output files can be
|
||||
/// optionally re-directed to \a stdin_path, \a stdout_path, and
|
||||
/// \a stderr_path.
|
||||
///
|
||||
/// @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
|
||||
/// The argument array.
|
||||
///
|
||||
/// @param[in] envp
|
||||
/// The environment array.
|
||||
///
|
||||
/// @param[in] launch_flags
|
||||
/// Flags to modify the launch (@see lldb::LaunchFlags)
|
||||
///
|
||||
/// @param[in] stdin_path
|
||||
/// The path to use when re-directing the STDIN of the new
|
||||
/// process. If all stdXX_path arguments are NULL, a pseudo
|
||||
/// terminal will be used.
|
||||
///
|
||||
/// @param[in] stdout_path
|
||||
/// The path to use when re-directing the STDOUT of the new
|
||||
/// process. If all stdXX_path arguments are NULL, a pseudo
|
||||
/// terminal will be used.
|
||||
///
|
||||
/// @param[in] stderr_path
|
||||
/// The path to use when re-directing the STDERR of the new
|
||||
/// process. If all stdXX_path arguments are NULL, a pseudo
|
||||
/// terminal will be used.
|
||||
///
|
||||
/// @param[in] working_directory
|
||||
/// The working directory to have the child process run in
|
||||
///
|
||||
/// @param[in] launch_flags
|
||||
/// Some launch options specified by logical OR'ing
|
||||
/// lldb::LaunchFlags enumeration values together.
|
||||
///
|
||||
/// @param[in] stop_at_endtry
|
||||
/// If false do not stop the inferior at the entry point.
|
||||
///
|
||||
/// @param[out]
|
||||
/// An error object. Contains the reason if there is some failure.
|
||||
///
|
||||
/// @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,
|
||||
const char *working_directory,
|
||||
uint32_t launch_flags, // See LaunchFlags
|
||||
bool stop_at_entry,
|
||||
lldb::SBError& error);
|
||||
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Launch a new process with sensible defaults.
|
||||
///
|
||||
/// @param[in] argv
|
||||
/// The argument array.
|
||||
///
|
||||
/// @param[in] envp
|
||||
/// The environment array.
|
||||
///
|
||||
/// @param[in] working_directory
|
||||
/// The working directory to have the child process run in
|
||||
///
|
||||
/// Default: listener
|
||||
/// Set to the target's debugger (SBTarget::GetDebugger())
|
||||
///
|
||||
/// Default: launch_flags
|
||||
/// Empty launch flags
|
||||
///
|
||||
/// Default: stdin_path
|
||||
/// Default: stdout_path
|
||||
/// Default: stderr_path
|
||||
/// A pseudo terminal will be used.
|
||||
///
|
||||
/// @return
|
||||
/// A process object for the newly created process.
|
||||
//------------------------------------------------------------------
|
||||
SBProcess
|
||||
LaunchSimple (const char **argv,
|
||||
const char **envp,
|
||||
const char *working_directory);
|
||||
|
||||
SBProcess
|
||||
Launch (SBLaunchInfo &launch_info, SBError& error);
|
||||
|
||||
SBProcess
|
||||
LoadCore (const char *core_file);
|
||||
|
||||
SBProcess
|
||||
Attach (SBAttachInfo &attach_info, SBError& error);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Attach to process with pid.
|
||||
///
|
||||
/// @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
|
||||
/// The process ID to attach to.
|
||||
///
|
||||
/// @param[out]
|
||||
/// An error explaining what went wrong if attach fails.
|
||||
///
|
||||
/// @return
|
||||
/// A process object for the attached process.
|
||||
//------------------------------------------------------------------
|
||||
lldb::SBProcess
|
||||
AttachToProcessWithID (SBListener &listener,
|
||||
lldb::pid_t pid,
|
||||
lldb::SBError& error);
|
||||
|
||||
#if defined(__APPLE__)
|
||||
// We need to keep this around for a build or two since Xcode links
|
||||
// to the 32 bit version of this function. We will take it out soon.
|
||||
lldb::SBProcess
|
||||
AttachToProcessWithID (SBListener &listener,
|
||||
::pid_t pid, // 32 bit int process ID
|
||||
lldb::SBError& error); // DEPRECATED
|
||||
#endif
|
||||
//------------------------------------------------------------------
|
||||
/// Attach to process with name.
|
||||
///
|
||||
/// @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
|
||||
/// Basename of process to attach to.
|
||||
///
|
||||
/// @param[in] wait_for
|
||||
/// If true wait for a new instance of 'name' to be launched.
|
||||
///
|
||||
/// @param[out]
|
||||
/// An error explaining what went wrong if attach fails.
|
||||
///
|
||||
/// @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
|
||||
/// 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
|
||||
/// The url to connect to, e.g., 'connect://localhost:12345'.
|
||||
///
|
||||
/// @param[in] plugin_name
|
||||
/// The plugin name to be used; can be NULL.
|
||||
///
|
||||
/// @param[out]
|
||||
/// An error explaining what went wrong if the connect fails.
|
||||
///
|
||||
/// @return
|
||||
/// A process object for the connected process.
|
||||
//------------------------------------------------------------------
|
||||
lldb::SBProcess
|
||||
ConnectRemote (SBListener &listener,
|
||||
const char *url,
|
||||
const char *plugin_name,
|
||||
SBError& error);
|
||||
|
||||
lldb::SBFileSpec
|
||||
GetExecutable ();
|
||||
|
||||
bool
|
||||
AddModule (lldb::SBModule &module);
|
||||
|
||||
lldb::SBModule
|
||||
AddModule (const char *path,
|
||||
const char *triple,
|
||||
const char *uuid);
|
||||
|
||||
lldb::SBModule
|
||||
AddModule (const char *path,
|
||||
const char *triple,
|
||||
const char *uuid_cstr,
|
||||
const char *symfile);
|
||||
|
||||
lldb::SBModule
|
||||
AddModule (const SBModuleSpec &module_spec);
|
||||
|
||||
uint32_t
|
||||
GetNumModules () const;
|
||||
|
||||
lldb::SBModule
|
||||
GetModuleAtIndex (uint32_t idx);
|
||||
|
||||
bool
|
||||
RemoveModule (lldb::SBModule module);
|
||||
|
||||
lldb::SBDebugger
|
||||
GetDebugger() const;
|
||||
|
||||
lldb::SBModule
|
||||
FindModule (const lldb::SBFileSpec &file_spec);
|
||||
|
||||
lldb::ByteOrder
|
||||
GetByteOrder ();
|
||||
|
||||
uint32_t
|
||||
GetAddressByteSize();
|
||||
|
||||
const char *
|
||||
GetTriple ();
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Set the base load address for a module section.
|
||||
///
|
||||
/// @param[in] section
|
||||
/// The section whose base load address will be set within this
|
||||
/// target.
|
||||
///
|
||||
/// @param[in] section_base_addr
|
||||
/// The base address for the section.
|
||||
///
|
||||
/// @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
|
||||
/// The section whose base load address will be cleared within
|
||||
/// this target.
|
||||
///
|
||||
/// @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.
|
||||
///
|
||||
/// When you need all sections within a module to be loaded at a
|
||||
/// rigid slide from the addresses found in the module object file,
|
||||
/// this function will allow you to easily and quickly slide all
|
||||
/// module sections.
|
||||
///
|
||||
/// @param[in] module
|
||||
/// The module to load.
|
||||
///
|
||||
/// @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
|
||||
/// An error to indicate success, fail, and any reason for
|
||||
/// failure.
|
||||
//------------------------------------------------------------------
|
||||
lldb::SBError
|
||||
SetModuleLoadAddress (lldb::SBModule module,
|
||||
int64_t sections_offset);
|
||||
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// The the section base load addresses for all sections in a module.
|
||||
///
|
||||
/// @param[in] module
|
||||
/// The module to unload.
|
||||
///
|
||||
/// @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
|
||||
/// The name of the function we are looking for.
|
||||
///
|
||||
/// @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
|
||||
/// 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
|
||||
/// The name of the global or static variable we are looking
|
||||
/// for.
|
||||
///
|
||||
/// @param[in] max_matches
|
||||
/// Allow the number of matches to be limited to \a max_matches.
|
||||
///
|
||||
/// @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
|
||||
/// The name of the global or static variable we are looking
|
||||
/// for.
|
||||
///
|
||||
/// @return
|
||||
/// An SBValue that gets filled in with the found variable (if any).
|
||||
//------------------------------------------------------------------
|
||||
lldb::SBValue
|
||||
FindFirstGlobalVariable (const char* name);
|
||||
|
||||
void
|
||||
Clear ();
|
||||
|
||||
lldb::SBAddress
|
||||
ResolveLoadAddress (lldb::addr_t vm_addr);
|
||||
|
||||
SBSymbolContext
|
||||
ResolveSymbolContextForAddress (const SBAddress& addr,
|
||||
uint32_t resolve_scope);
|
||||
|
||||
lldb::SBBreakpoint
|
||||
BreakpointCreateByLocation (const char *file, uint32_t line);
|
||||
|
||||
lldb::SBBreakpoint
|
||||
BreakpointCreateByLocation (const lldb::SBFileSpec &file_spec, uint32_t line);
|
||||
|
||||
lldb::SBBreakpoint
|
||||
BreakpointCreateByName (const char *symbol_name, const char *module_name = NULL);
|
||||
|
||||
// This version uses name_type_mask = eFunctionNameTypeAuto
|
||||
lldb::SBBreakpoint
|
||||
BreakpointCreateByName (const char *symbol_name,
|
||||
const SBFileSpecList &module_list,
|
||||
const SBFileSpecList &comp_unit_list);
|
||||
|
||||
lldb::SBBreakpoint
|
||||
BreakpointCreateByName (const char *symbol_name,
|
||||
uint32_t name_type_mask, // Logical OR one or more FunctionNameType enum bits
|
||||
const SBFileSpecList &module_list,
|
||||
const SBFileSpecList &comp_unit_list);
|
||||
|
||||
lldb::SBBreakpoint
|
||||
BreakpointCreateByNames (const char *symbol_name[],
|
||||
uint32_t num_names,
|
||||
uint32_t name_type_mask, // Logical OR one or more FunctionNameType enum bits
|
||||
const SBFileSpecList &module_list,
|
||||
const SBFileSpecList &comp_unit_list);
|
||||
|
||||
lldb::SBBreakpoint
|
||||
BreakpointCreateByRegex (const char *symbol_name_regex, const char *module_name = NULL);
|
||||
|
||||
lldb::SBBreakpoint
|
||||
BreakpointCreateByRegex (const char *symbol_name_regex,
|
||||
const SBFileSpecList &module_list,
|
||||
const SBFileSpecList &comp_unit_list);
|
||||
|
||||
lldb::SBBreakpoint
|
||||
BreakpointCreateBySourceRegex (const char *source_regex,
|
||||
const lldb::SBFileSpec &source_file,
|
||||
const char *module_name = NULL);
|
||||
|
||||
lldb::SBBreakpoint
|
||||
BreakpointCreateBySourceRegex (const char *source_regex,
|
||||
const SBFileSpecList &module_list,
|
||||
const lldb::SBFileSpecList &source_file);
|
||||
|
||||
lldb::SBBreakpoint
|
||||
BreakpointCreateForException (lldb::LanguageType language,
|
||||
bool catch_bp,
|
||||
bool throw_bp);
|
||||
|
||||
lldb::SBBreakpoint
|
||||
BreakpointCreateByAddress (addr_t address);
|
||||
|
||||
uint32_t
|
||||
GetNumBreakpoints () const;
|
||||
|
||||
lldb::SBBreakpoint
|
||||
GetBreakpointAtIndex (uint32_t idx) const;
|
||||
|
||||
bool
|
||||
BreakpointDelete (break_id_t break_id);
|
||||
|
||||
lldb::SBBreakpoint
|
||||
FindBreakpointByID (break_id_t break_id);
|
||||
|
||||
bool
|
||||
EnableAllBreakpoints ();
|
||||
|
||||
bool
|
||||
DisableAllBreakpoints ();
|
||||
|
||||
bool
|
||||
DeleteAllBreakpoints ();
|
||||
|
||||
uint32_t
|
||||
GetNumWatchpoints () const;
|
||||
|
||||
lldb::SBWatchpoint
|
||||
GetWatchpointAtIndex (uint32_t idx) const;
|
||||
|
||||
bool
|
||||
DeleteWatchpoint (lldb::watch_id_t watch_id);
|
||||
|
||||
lldb::SBWatchpoint
|
||||
FindWatchpointByID (lldb::watch_id_t watch_id);
|
||||
|
||||
lldb::SBWatchpoint
|
||||
WatchAddress (lldb::addr_t addr, size_t size, bool read, bool write, SBError& error);
|
||||
|
||||
bool
|
||||
EnableAllWatchpoints ();
|
||||
|
||||
bool
|
||||
DisableAllWatchpoints ();
|
||||
|
||||
bool
|
||||
DeleteAllWatchpoints ();
|
||||
|
||||
lldb::SBBroadcaster
|
||||
GetBroadcaster () const;
|
||||
|
||||
lldb::SBType
|
||||
FindFirstType (const char* type);
|
||||
|
||||
lldb::SBTypeList
|
||||
FindTypes (const char* type);
|
||||
|
||||
lldb::SBType
|
||||
GetBasicType(lldb::BasicType type);
|
||||
|
||||
SBSourceManager
|
||||
GetSourceManager();
|
||||
|
||||
lldb::SBInstructionList
|
||||
ReadInstructions (lldb::SBAddress base_addr, uint32_t count);
|
||||
|
||||
lldb::SBInstructionList
|
||||
ReadInstructions (lldb::SBAddress base_addr, uint32_t count, const char *flavor_string);
|
||||
|
||||
lldb::SBInstructionList
|
||||
GetInstructions (lldb::SBAddress base_addr, const void *buf, size_t size);
|
||||
|
||||
// The "WithFlavor" is necessary to keep SWIG from getting confused about overloaded arguments when
|
||||
// using the buf + size -> Python Object magic.
|
||||
|
||||
lldb::SBInstructionList
|
||||
GetInstructionsWithFlavor (lldb::SBAddress base_addr, const char *flavor_string, const void *buf, size_t size);
|
||||
|
||||
lldb::SBInstructionList
|
||||
GetInstructions (lldb::addr_t base_addr, const void *buf, size_t size);
|
||||
|
||||
lldb::SBInstructionList
|
||||
GetInstructionsWithFlavor (lldb::addr_t base_addr, const char *flavor_string, const void *buf, size_t size);
|
||||
|
||||
lldb::SBSymbolContextList
|
||||
FindSymbols (const char *name,
|
||||
lldb::SymbolType type = eSymbolTypeAny);
|
||||
|
||||
bool
|
||||
operator == (const lldb::SBTarget &rhs) const;
|
||||
|
||||
bool
|
||||
operator != (const lldb::SBTarget &rhs) const;
|
||||
|
||||
bool
|
||||
GetDescription (lldb::SBStream &description, lldb::DescriptionLevel description_level);
|
||||
|
||||
lldb::SBValue
|
||||
EvaluateExpression (const char *expr, const SBExpressionOptions &options);
|
||||
|
||||
lldb::addr_t
|
||||
GetStackRedZoneSize();
|
||||
|
||||
protected:
|
||||
friend class SBAddress;
|
||||
friend class SBBlock;
|
||||
friend class SBDebugger;
|
||||
friend class SBFunction;
|
||||
friend class SBInstruction;
|
||||
friend class SBModule;
|
||||
friend class SBProcess;
|
||||
friend class SBSection;
|
||||
friend class SBSourceManager;
|
||||
friend class SBSymbol;
|
||||
friend class SBValue;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// Constructors are private, use static Target::Create function to
|
||||
// create an instance of this class.
|
||||
//------------------------------------------------------------------
|
||||
|
||||
lldb::TargetSP
|
||||
GetSP () const;
|
||||
|
||||
void
|
||||
SetSP (const lldb::TargetSP& target_sp);
|
||||
|
||||
|
||||
private:
|
||||
//------------------------------------------------------------------
|
||||
// For Target only
|
||||
//------------------------------------------------------------------
|
||||
|
||||
lldb::TargetSP m_opaque_sp;
|
||||
};
|
||||
|
||||
} // namespace lldb
|
||||
|
||||
#endif // LLDB_SBTarget_h_
|
220
include/lldb/API/SBThread.h
Normal file
220
include/lldb/API/SBThread.h
Normal file
@ -0,0 +1,220 @@
|
||||
//===-- SBThread.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_SBThread_h_
|
||||
#define LLDB_SBThread_h_
|
||||
|
||||
#include "lldb/API/SBDefines.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
namespace lldb {
|
||||
|
||||
class SBFrame;
|
||||
|
||||
class SBThread
|
||||
{
|
||||
public:
|
||||
enum
|
||||
{
|
||||
eBroadcastBitStackChanged = (1 << 0),
|
||||
eBroadcastBitThreadSuspended = (1 << 1),
|
||||
eBroadcastBitThreadResumed = (1 << 2),
|
||||
eBroadcastBitSelectedFrameChanged = (1 << 3),
|
||||
eBroadcastBitThreadSelected = (1 << 4)
|
||||
};
|
||||
|
||||
static const char *
|
||||
GetBroadcasterClassName ();
|
||||
|
||||
SBThread ();
|
||||
|
||||
SBThread (const lldb::SBThread &thread);
|
||||
|
||||
SBThread (const lldb::ThreadSP& lldb_object_sp);
|
||||
|
||||
~SBThread();
|
||||
|
||||
bool
|
||||
IsValid() const;
|
||||
|
||||
void
|
||||
Clear ();
|
||||
|
||||
lldb::StopReason
|
||||
GetStopReason();
|
||||
|
||||
/// Get the number of words associated with the stop reason.
|
||||
/// See also GetStopReasonDataAtIndex().
|
||||
size_t
|
||||
GetStopReasonDataCount();
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
/// Get information associated with a stop reason.
|
||||
///
|
||||
/// Breakpoint stop reasons will have data that consists of pairs of
|
||||
/// breakpoint IDs followed by the breakpoint location IDs (they always come
|
||||
/// in pairs).
|
||||
///
|
||||
/// Stop Reason Count Data Type
|
||||
/// ======================== ===== =========================================
|
||||
/// eStopReasonNone 0
|
||||
/// eStopReasonTrace 0
|
||||
/// eStopReasonBreakpoint N duple: {breakpoint id, location id}
|
||||
/// eStopReasonWatchpoint 1 watchpoint id
|
||||
/// eStopReasonSignal 1 unix signal number
|
||||
/// eStopReasonException N exception data
|
||||
/// eStopReasonExec 0
|
||||
/// eStopReasonPlanComplete 0
|
||||
//--------------------------------------------------------------------------
|
||||
uint64_t
|
||||
GetStopReasonDataAtIndex(uint32_t idx);
|
||||
|
||||
size_t
|
||||
GetStopDescription (char *dst, size_t dst_len);
|
||||
|
||||
SBValue
|
||||
GetStopReturnValue ();
|
||||
|
||||
lldb::tid_t
|
||||
GetThreadID () const;
|
||||
|
||||
uint32_t
|
||||
GetIndexID () const;
|
||||
|
||||
const char *
|
||||
GetName () const;
|
||||
|
||||
const char *
|
||||
GetQueueName() const;
|
||||
|
||||
void
|
||||
StepOver (lldb::RunMode stop_other_threads = lldb::eOnlyDuringStepping);
|
||||
|
||||
void
|
||||
StepInto (lldb::RunMode stop_other_threads = lldb::eOnlyDuringStepping);
|
||||
|
||||
void
|
||||
StepInto (const char *target_name, lldb::RunMode stop_other_threads = lldb::eOnlyDuringStepping);
|
||||
|
||||
void
|
||||
StepOut ();
|
||||
|
||||
void
|
||||
StepOutOfFrame (lldb::SBFrame &frame);
|
||||
|
||||
void
|
||||
StepInstruction(bool step_over);
|
||||
|
||||
SBError
|
||||
StepOverUntil (lldb::SBFrame &frame,
|
||||
lldb::SBFileSpec &file_spec,
|
||||
uint32_t line);
|
||||
|
||||
void
|
||||
RunToAddress (lldb::addr_t addr);
|
||||
|
||||
SBError
|
||||
ReturnFromFrame (SBFrame &frame, SBValue &return_value);
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
/// 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
|
||||
/// the other threads in a process are allowed to run. So when
|
||||
/// SBProcess::Continue() is called, any threads that aren't suspended will
|
||||
/// be allowed to run. If any of the SBThread functions for stepping are
|
||||
/// called (StepOver, StepInto, StepOut, StepInstruction, RunToAddres), the
|
||||
/// thread will not be allowed to run and these funtions will simply return.
|
||||
///
|
||||
/// Eventually we plan to add support for thread centric debugging where
|
||||
/// each thread is controlled individually and each thread would broadcast
|
||||
/// its state, but we haven't implemented this yet.
|
||||
///
|
||||
/// Likewise the SBThread::Resume() call will again allow the thread to run
|
||||
/// when the process is continued.
|
||||
///
|
||||
/// 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
|
||||
Resume ();
|
||||
|
||||
bool
|
||||
IsSuspended();
|
||||
|
||||
bool
|
||||
IsStopped();
|
||||
|
||||
uint32_t
|
||||
GetNumFrames ();
|
||||
|
||||
lldb::SBFrame
|
||||
GetFrameAtIndex (uint32_t idx);
|
||||
|
||||
lldb::SBFrame
|
||||
GetSelectedFrame ();
|
||||
|
||||
lldb::SBFrame
|
||||
SetSelectedFrame (uint32_t frame_idx);
|
||||
|
||||
static bool
|
||||
EventIsThreadEvent (const SBEvent &event);
|
||||
|
||||
static SBFrame
|
||||
GetStackFrameFromEvent (const SBEvent &event);
|
||||
|
||||
static SBThread
|
||||
GetThreadFromEvent (const SBEvent &event);
|
||||
|
||||
lldb::SBProcess
|
||||
GetProcess ();
|
||||
|
||||
const lldb::SBThread &
|
||||
operator = (const lldb::SBThread &rhs);
|
||||
|
||||
bool
|
||||
operator == (const lldb::SBThread &rhs) const;
|
||||
|
||||
bool
|
||||
operator != (const lldb::SBThread &rhs) const;
|
||||
|
||||
bool
|
||||
GetDescription (lldb::SBStream &description) const;
|
||||
|
||||
bool
|
||||
GetStatus (lldb::SBStream &status) const;
|
||||
|
||||
protected:
|
||||
friend class SBBreakpoint;
|
||||
friend class SBBreakpointLocation;
|
||||
friend class SBFrame;
|
||||
friend class SBProcess;
|
||||
friend class SBDebugger;
|
||||
friend class SBValue;
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
} // namespace lldb
|
||||
|
||||
#endif // LLDB_SBThread_h_
|
244
include/lldb/API/SBType.h
Normal file
244
include/lldb/API/SBType.h
Normal file
@ -0,0 +1,244 @@
|
||||
//===-- SBType.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_SBType_h_
|
||||
#define LLDB_SBType_h_
|
||||
|
||||
#include "lldb/API/SBDefines.h"
|
||||
|
||||
namespace lldb {
|
||||
|
||||
class SBTypeList;
|
||||
|
||||
class SBTypeMember
|
||||
{
|
||||
public:
|
||||
SBTypeMember ();
|
||||
|
||||
SBTypeMember (const lldb::SBTypeMember& rhs);
|
||||
|
||||
~SBTypeMember();
|
||||
|
||||
lldb::SBTypeMember&
|
||||
operator = (const lldb::SBTypeMember& rhs);
|
||||
|
||||
bool
|
||||
IsValid() const;
|
||||
|
||||
const char *
|
||||
GetName ();
|
||||
|
||||
lldb::SBType
|
||||
GetType ();
|
||||
|
||||
uint64_t
|
||||
GetOffsetInBytes();
|
||||
|
||||
uint64_t
|
||||
GetOffsetInBits();
|
||||
|
||||
bool
|
||||
IsBitfield();
|
||||
|
||||
uint32_t
|
||||
GetBitfieldSizeInBits();
|
||||
|
||||
bool
|
||||
GetDescription (lldb::SBStream &description,
|
||||
lldb::DescriptionLevel description_level);
|
||||
|
||||
protected:
|
||||
friend class SBType;
|
||||
|
||||
void
|
||||
reset (lldb_private::TypeMemberImpl *);
|
||||
|
||||
lldb_private::TypeMemberImpl &
|
||||
ref ();
|
||||
|
||||
const lldb_private::TypeMemberImpl &
|
||||
ref () const;
|
||||
|
||||
std::unique_ptr<lldb_private::TypeMemberImpl> m_opaque_ap;
|
||||
};
|
||||
|
||||
class SBType
|
||||
{
|
||||
public:
|
||||
|
||||
SBType();
|
||||
|
||||
SBType (const lldb::SBType &rhs);
|
||||
|
||||
~SBType ();
|
||||
|
||||
bool
|
||||
IsValid() const;
|
||||
|
||||
uint64_t
|
||||
GetByteSize();
|
||||
|
||||
bool
|
||||
IsPointerType();
|
||||
|
||||
bool
|
||||
IsReferenceType();
|
||||
|
||||
bool
|
||||
IsFunctionType ();
|
||||
|
||||
bool
|
||||
IsPolymorphicClass ();
|
||||
|
||||
lldb::SBType
|
||||
GetPointerType();
|
||||
|
||||
lldb::SBType
|
||||
GetPointeeType();
|
||||
|
||||
lldb::SBType
|
||||
GetReferenceType();
|
||||
|
||||
lldb::SBType
|
||||
GetDereferencedType();
|
||||
|
||||
lldb::SBType
|
||||
GetUnqualifiedType();
|
||||
|
||||
lldb::SBType
|
||||
GetCanonicalType();
|
||||
// Get the "lldb::BasicType" enumeration for a type. If a type is not a basic
|
||||
// type eBasicTypeInvalid will be returned
|
||||
lldb::BasicType
|
||||
GetBasicType();
|
||||
|
||||
// The call below confusing and should really be renamed to "CreateBasicType"
|
||||
lldb::SBType
|
||||
GetBasicType(lldb::BasicType type);
|
||||
|
||||
uint32_t
|
||||
GetNumberOfFields ();
|
||||
|
||||
uint32_t
|
||||
GetNumberOfDirectBaseClasses ();
|
||||
|
||||
uint32_t
|
||||
GetNumberOfVirtualBaseClasses ();
|
||||
|
||||
lldb::SBTypeMember
|
||||
GetFieldAtIndex (uint32_t idx);
|
||||
|
||||
lldb::SBTypeMember
|
||||
GetDirectBaseClassAtIndex (uint32_t idx);
|
||||
|
||||
lldb::SBTypeMember
|
||||
GetVirtualBaseClassAtIndex (uint32_t idx);
|
||||
|
||||
uint32_t
|
||||
GetNumberOfTemplateArguments ();
|
||||
|
||||
lldb::SBType
|
||||
GetTemplateArgumentType (uint32_t idx);
|
||||
|
||||
lldb::TemplateArgumentKind
|
||||
GetTemplateArgumentKind (uint32_t idx);
|
||||
|
||||
lldb::SBType
|
||||
GetFunctionReturnType ();
|
||||
|
||||
lldb::SBTypeList
|
||||
GetFunctionArgumentTypes ();
|
||||
|
||||
const char*
|
||||
GetName();
|
||||
|
||||
lldb::TypeClass
|
||||
GetTypeClass ();
|
||||
|
||||
bool
|
||||
IsTypeComplete ();
|
||||
|
||||
bool
|
||||
GetDescription (lldb::SBStream &description,
|
||||
lldb::DescriptionLevel description_level);
|
||||
|
||||
lldb::SBType &
|
||||
operator = (const lldb::SBType &rhs);
|
||||
|
||||
bool
|
||||
operator == (lldb::SBType &rhs);
|
||||
|
||||
bool
|
||||
operator != (lldb::SBType &rhs);
|
||||
|
||||
protected:
|
||||
|
||||
lldb_private::TypeImpl &
|
||||
ref ();
|
||||
|
||||
const lldb_private::TypeImpl &
|
||||
ref () const;
|
||||
|
||||
lldb::TypeImplSP
|
||||
GetSP ();
|
||||
|
||||
void
|
||||
SetSP (const lldb::TypeImplSP &type_impl_sp);
|
||||
|
||||
lldb::TypeImplSP m_opaque_sp;
|
||||
|
||||
friend class SBFunction;
|
||||
friend class SBModule;
|
||||
friend class SBTarget;
|
||||
friend class SBTypeNameSpecifier;
|
||||
friend class SBTypeMember;
|
||||
friend class SBTypeList;
|
||||
friend class SBValue;
|
||||
|
||||
SBType (const lldb_private::ClangASTType &);
|
||||
SBType (const lldb::TypeSP &);
|
||||
SBType (const lldb::TypeImplSP &);
|
||||
|
||||
};
|
||||
|
||||
class SBTypeList
|
||||
{
|
||||
public:
|
||||
SBTypeList();
|
||||
|
||||
SBTypeList(const lldb::SBTypeList& rhs);
|
||||
|
||||
~SBTypeList();
|
||||
|
||||
lldb::SBTypeList&
|
||||
operator = (const lldb::SBTypeList& rhs);
|
||||
|
||||
bool
|
||||
IsValid();
|
||||
|
||||
void
|
||||
Append (lldb::SBType type);
|
||||
|
||||
lldb::SBType
|
||||
GetTypeAtIndex (uint32_t index);
|
||||
|
||||
uint32_t
|
||||
GetSize();
|
||||
|
||||
|
||||
private:
|
||||
std::unique_ptr<lldb_private::TypeListImpl> m_opaque_ap;
|
||||
friend class SBModule;
|
||||
friend class SBCompileUnit;
|
||||
};
|
||||
|
||||
|
||||
} // namespace lldb
|
||||
|
||||
#endif // LLDB_SBType_h_
|
168
include/lldb/API/SBTypeCategory.h
Normal file
168
include/lldb/API/SBTypeCategory.h
Normal file
@ -0,0 +1,168 @@
|
||||
//===-- SBTypeCategory.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_SBTypeCategory_h_
|
||||
#define LLDB_SBTypeCategory_h_
|
||||
|
||||
#include "lldb/API/SBDefines.h"
|
||||
|
||||
namespace lldb {
|
||||
|
||||
class SBTypeCategory
|
||||
{
|
||||
public:
|
||||
|
||||
SBTypeCategory();
|
||||
|
||||
SBTypeCategory (const lldb::SBTypeCategory &rhs);
|
||||
|
||||
~SBTypeCategory ();
|
||||
|
||||
bool
|
||||
IsValid() const;
|
||||
|
||||
bool
|
||||
GetEnabled ();
|
||||
|
||||
void
|
||||
SetEnabled (bool);
|
||||
|
||||
const char*
|
||||
GetName();
|
||||
|
||||
bool
|
||||
GetDescription (lldb::SBStream &description,
|
||||
lldb::DescriptionLevel description_level);
|
||||
|
||||
uint32_t
|
||||
GetNumFormats ();
|
||||
|
||||
uint32_t
|
||||
GetNumSummaries ();
|
||||
|
||||
uint32_t
|
||||
GetNumFilters ();
|
||||
|
||||
#ifndef LLDB_DISABLE_PYTHON
|
||||
uint32_t
|
||||
GetNumSynthetics ();
|
||||
#endif
|
||||
|
||||
SBTypeNameSpecifier
|
||||
GetTypeNameSpecifierForFilterAtIndex (uint32_t);
|
||||
|
||||
SBTypeNameSpecifier
|
||||
GetTypeNameSpecifierForFormatAtIndex (uint32_t);
|
||||
|
||||
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);
|
||||
|
||||
bool
|
||||
AddTypeFilter (SBTypeNameSpecifier,
|
||||
SBTypeFilter);
|
||||
|
||||
bool
|
||||
DeleteTypeFilter (SBTypeNameSpecifier);
|
||||
|
||||
#ifndef LLDB_DISABLE_PYTHON
|
||||
bool
|
||||
AddTypeSynthetic (SBTypeNameSpecifier,
|
||||
SBTypeSynthetic);
|
||||
|
||||
bool
|
||||
DeleteTypeSynthetic (SBTypeNameSpecifier);
|
||||
#endif
|
||||
|
||||
lldb::SBTypeCategory &
|
||||
operator = (const lldb::SBTypeCategory &rhs);
|
||||
|
||||
bool
|
||||
operator == (lldb::SBTypeCategory &rhs);
|
||||
|
||||
bool
|
||||
operator != (lldb::SBTypeCategory &rhs);
|
||||
|
||||
protected:
|
||||
friend class SBDebugger;
|
||||
|
||||
lldb::TypeCategoryImplSP
|
||||
GetSP ();
|
||||
|
||||
void
|
||||
SetSP (const lldb::TypeCategoryImplSP &typecategory_impl_sp);
|
||||
|
||||
TypeCategoryImplSP m_opaque_sp;
|
||||
|
||||
SBTypeCategory (const lldb::TypeCategoryImplSP &);
|
||||
|
||||
SBTypeCategory (const char*);
|
||||
|
||||
bool
|
||||
IsDefaultCategory();
|
||||
|
||||
};
|
||||
|
||||
} // namespace lldb
|
||||
|
||||
#endif // LLDB_SBTypeCategory_h_
|
92
include/lldb/API/SBTypeFilter.h
Normal file
92
include/lldb/API/SBTypeFilter.h
Normal file
@ -0,0 +1,92 @@
|
||||
//===-- SBTypeFilter.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_SBTypeFilter_h_
|
||||
#define LLDB_SBTypeFilter_h_
|
||||
|
||||
#include "lldb/API/SBDefines.h"
|
||||
|
||||
namespace lldb {
|
||||
|
||||
class SBTypeFilter
|
||||
{
|
||||
public:
|
||||
|
||||
SBTypeFilter();
|
||||
|
||||
SBTypeFilter (uint32_t options); // see lldb::eTypeOption values
|
||||
|
||||
SBTypeFilter (const lldb::SBTypeFilter &rhs);
|
||||
|
||||
~SBTypeFilter ();
|
||||
|
||||
bool
|
||||
IsValid() const;
|
||||
|
||||
uint32_t
|
||||
GetNumberOfExpressionPaths ();
|
||||
|
||||
const char*
|
||||
GetExpressionPathAtIndex (uint32_t i);
|
||||
|
||||
bool
|
||||
ReplaceExpressionPathAtIndex (uint32_t i, const char* item);
|
||||
|
||||
void
|
||||
AppendExpressionPath (const char* item);
|
||||
|
||||
void
|
||||
Clear();
|
||||
|
||||
uint32_t
|
||||
GetOptions();
|
||||
|
||||
void
|
||||
SetOptions (uint32_t);
|
||||
|
||||
bool
|
||||
GetDescription (lldb::SBStream &description,
|
||||
lldb::DescriptionLevel description_level);
|
||||
|
||||
lldb::SBTypeFilter &
|
||||
operator = (const lldb::SBTypeFilter &rhs);
|
||||
|
||||
bool
|
||||
IsEqualTo (lldb::SBTypeFilter &rhs);
|
||||
|
||||
bool
|
||||
operator == (lldb::SBTypeFilter &rhs);
|
||||
|
||||
bool
|
||||
operator != (lldb::SBTypeFilter &rhs);
|
||||
|
||||
protected:
|
||||
friend class SBDebugger;
|
||||
friend class SBTypeCategory;
|
||||
friend class SBValue;
|
||||
|
||||
lldb::TypeFilterImplSP
|
||||
GetSP ();
|
||||
|
||||
void
|
||||
SetSP (const lldb::TypeFilterImplSP &typefilter_impl_sp);
|
||||
|
||||
lldb::TypeFilterImplSP m_opaque_sp;
|
||||
|
||||
SBTypeFilter (const lldb::TypeFilterImplSP &);
|
||||
|
||||
bool
|
||||
CopyOnWrite_Impl();
|
||||
|
||||
};
|
||||
|
||||
|
||||
} // namespace lldb
|
||||
|
||||
#endif // LLDB_SBTypeFilter_h_
|
84
include/lldb/API/SBTypeFormat.h
Normal file
84
include/lldb/API/SBTypeFormat.h
Normal file
@ -0,0 +1,84 @@
|
||||
//===-- SBTypeFormat.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_SBTypeFormat_h_
|
||||
#define LLDB_SBTypeFormat_h_
|
||||
|
||||
#include "lldb/API/SBDefines.h"
|
||||
|
||||
namespace lldb {
|
||||
|
||||
class SBTypeFormat
|
||||
{
|
||||
public:
|
||||
|
||||
SBTypeFormat();
|
||||
|
||||
SBTypeFormat (lldb::Format format,
|
||||
uint32_t options = 0); // see lldb::eTypeOption values
|
||||
|
||||
SBTypeFormat (const lldb::SBTypeFormat &rhs);
|
||||
|
||||
~SBTypeFormat ();
|
||||
|
||||
bool
|
||||
IsValid() const;
|
||||
|
||||
lldb::Format
|
||||
GetFormat ();
|
||||
|
||||
uint32_t
|
||||
GetOptions();
|
||||
|
||||
void
|
||||
SetFormat (lldb::Format);
|
||||
|
||||
void
|
||||
SetOptions (uint32_t);
|
||||
|
||||
bool
|
||||
GetDescription (lldb::SBStream &description,
|
||||
lldb::DescriptionLevel description_level);
|
||||
|
||||
lldb::SBTypeFormat &
|
||||
operator = (const lldb::SBTypeFormat &rhs);
|
||||
|
||||
bool
|
||||
IsEqualTo (lldb::SBTypeFormat &rhs);
|
||||
|
||||
bool
|
||||
operator == (lldb::SBTypeFormat &rhs);
|
||||
|
||||
bool
|
||||
operator != (lldb::SBTypeFormat &rhs);
|
||||
|
||||
protected:
|
||||
friend class SBDebugger;
|
||||
friend class SBTypeCategory;
|
||||
friend class SBValue;
|
||||
|
||||
lldb::TypeFormatImplSP
|
||||
GetSP ();
|
||||
|
||||
void
|
||||
SetSP (const lldb::TypeFormatImplSP &typeformat_impl_sp);
|
||||
|
||||
lldb::TypeFormatImplSP m_opaque_sp;
|
||||
|
||||
SBTypeFormat (const lldb::TypeFormatImplSP &);
|
||||
|
||||
bool
|
||||
CopyOnWrite_Impl();
|
||||
|
||||
};
|
||||
|
||||
|
||||
} // namespace lldb
|
||||
|
||||
#endif // LLDB_SBTypeFormat_h_
|
77
include/lldb/API/SBTypeNameSpecifier.h
Normal file
77
include/lldb/API/SBTypeNameSpecifier.h
Normal file
@ -0,0 +1,77 @@
|
||||
//===-- SBTypeNameSpecifier.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_SBTypeNameSpecifier_h_
|
||||
#define LLDB_SBTypeNameSpecifier_h_
|
||||
|
||||
#include "lldb/API/SBDefines.h"
|
||||
|
||||
namespace lldb {
|
||||
|
||||
class SBTypeNameSpecifier
|
||||
{
|
||||
public:
|
||||
|
||||
SBTypeNameSpecifier();
|
||||
|
||||
SBTypeNameSpecifier (const char* name,
|
||||
bool is_regex = false);
|
||||
|
||||
SBTypeNameSpecifier (SBType type);
|
||||
|
||||
SBTypeNameSpecifier (const lldb::SBTypeNameSpecifier &rhs);
|
||||
|
||||
~SBTypeNameSpecifier ();
|
||||
|
||||
bool
|
||||
IsValid() const;
|
||||
|
||||
const char*
|
||||
GetName();
|
||||
|
||||
SBType
|
||||
GetType ();
|
||||
|
||||
bool
|
||||
IsRegex();
|
||||
|
||||
bool
|
||||
GetDescription (lldb::SBStream &description,
|
||||
lldb::DescriptionLevel description_level);
|
||||
|
||||
lldb::SBTypeNameSpecifier &
|
||||
operator = (const lldb::SBTypeNameSpecifier &rhs);
|
||||
|
||||
bool
|
||||
IsEqualTo (lldb::SBTypeNameSpecifier &rhs);
|
||||
|
||||
bool
|
||||
operator == (lldb::SBTypeNameSpecifier &rhs);
|
||||
|
||||
bool
|
||||
operator != (lldb::SBTypeNameSpecifier &rhs);
|
||||
|
||||
protected:
|
||||
friend class SBDebugger;
|
||||
friend class SBTypeCategory;
|
||||
|
||||
lldb::TypeNameSpecifierImplSP
|
||||
GetSP ();
|
||||
|
||||
void
|
||||
SetSP (const lldb::TypeNameSpecifierImplSP &type_namespec_sp);
|
||||
|
||||
lldb::TypeNameSpecifierImplSP m_opaque_sp;
|
||||
|
||||
SBTypeNameSpecifier (const lldb::TypeNameSpecifierImplSP &);
|
||||
};
|
||||
|
||||
} // namespace lldb
|
||||
|
||||
#endif // LLDB_SBTypeNameSpecifier_h_
|
115
include/lldb/API/SBTypeSummary.h
Normal file
115
include/lldb/API/SBTypeSummary.h
Normal file
@ -0,0 +1,115 @@
|
||||
//===-- SBTypeSummary.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_SBTypeSummary_h_
|
||||
#define LLDB_SBTypeSummary_h_
|
||||
|
||||
#include "lldb/API/SBDefines.h"
|
||||
|
||||
#ifndef LLDB_DISABLE_PYTHON
|
||||
|
||||
namespace lldb {
|
||||
|
||||
class SBTypeSummary
|
||||
{
|
||||
public:
|
||||
|
||||
SBTypeSummary();
|
||||
|
||||
static SBTypeSummary
|
||||
CreateWithSummaryString (const char* data,
|
||||
uint32_t options = 0); // see lldb::eTypeOption values
|
||||
|
||||
static SBTypeSummary
|
||||
CreateWithFunctionName (const char* data,
|
||||
uint32_t options = 0); // see lldb::eTypeOption values
|
||||
|
||||
static SBTypeSummary
|
||||
CreateWithScriptCode (const char* data,
|
||||
uint32_t options = 0); // see lldb::eTypeOption values
|
||||
|
||||
SBTypeSummary (const lldb::SBTypeSummary &rhs);
|
||||
|
||||
~SBTypeSummary ();
|
||||
|
||||
bool
|
||||
IsValid() const;
|
||||
|
||||
bool
|
||||
IsFunctionCode();
|
||||
|
||||
bool
|
||||
IsFunctionName();
|
||||
|
||||
bool
|
||||
IsSummaryString();
|
||||
|
||||
const char*
|
||||
GetData ();
|
||||
|
||||
void
|
||||
SetSummaryString (const char* data);
|
||||
|
||||
void
|
||||
SetFunctionName (const char* data);
|
||||
|
||||
void
|
||||
SetFunctionCode (const char* data);
|
||||
|
||||
uint32_t
|
||||
GetOptions ();
|
||||
|
||||
void
|
||||
SetOptions (uint32_t);
|
||||
|
||||
bool
|
||||
GetDescription (lldb::SBStream &description,
|
||||
lldb::DescriptionLevel description_level);
|
||||
|
||||
lldb::SBTypeSummary &
|
||||
operator = (const lldb::SBTypeSummary &rhs);
|
||||
|
||||
bool
|
||||
IsEqualTo (lldb::SBTypeSummary &rhs);
|
||||
|
||||
bool
|
||||
operator == (lldb::SBTypeSummary &rhs);
|
||||
|
||||
bool
|
||||
operator != (lldb::SBTypeSummary &rhs);
|
||||
|
||||
protected:
|
||||
friend class SBDebugger;
|
||||
friend class SBTypeCategory;
|
||||
friend class SBValue;
|
||||
|
||||
lldb::TypeSummaryImplSP
|
||||
GetSP ();
|
||||
|
||||
void
|
||||
SetSP (const lldb::TypeSummaryImplSP &typefilter_impl_sp);
|
||||
|
||||
lldb::TypeSummaryImplSP m_opaque_sp;
|
||||
|
||||
SBTypeSummary (const lldb::TypeSummaryImplSP &);
|
||||
|
||||
bool
|
||||
CopyOnWrite_Impl();
|
||||
|
||||
bool
|
||||
ChangeSummaryType (bool want_script);
|
||||
|
||||
};
|
||||
|
||||
|
||||
} // namespace lldb
|
||||
|
||||
#endif // LLDB_DISABLE_PYTHON
|
||||
|
||||
#endif // LLDB_SBTypeSummary_h_
|
102
include/lldb/API/SBTypeSynthetic.h
Normal file
102
include/lldb/API/SBTypeSynthetic.h
Normal file
@ -0,0 +1,102 @@
|
||||
//===-- SBTypeSynthetic.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_SBTypeSynthetic_h_
|
||||
#define LLDB_SBTypeSynthetic_h_
|
||||
|
||||
#include "lldb/API/SBDefines.h"
|
||||
|
||||
#ifndef LLDB_DISABLE_PYTHON
|
||||
|
||||
namespace lldb {
|
||||
|
||||
class SBTypeSynthetic
|
||||
{
|
||||
public:
|
||||
|
||||
SBTypeSynthetic();
|
||||
|
||||
static SBTypeSynthetic
|
||||
CreateWithClassName (const char* data,
|
||||
uint32_t options = 0); // see lldb::eTypeOption values
|
||||
|
||||
static SBTypeSynthetic
|
||||
CreateWithScriptCode (const char* data,
|
||||
uint32_t options = 0); // see lldb::eTypeOption values
|
||||
|
||||
SBTypeSynthetic (const lldb::SBTypeSynthetic &rhs);
|
||||
|
||||
~SBTypeSynthetic ();
|
||||
|
||||
bool
|
||||
IsValid() const;
|
||||
|
||||
bool
|
||||
IsClassCode();
|
||||
|
||||
bool
|
||||
IsClassName();
|
||||
|
||||
const char*
|
||||
GetData ();
|
||||
|
||||
void
|
||||
SetClassName (const char* data);
|
||||
|
||||
void
|
||||
SetClassCode (const char* data);
|
||||
|
||||
uint32_t
|
||||
GetOptions ();
|
||||
|
||||
void
|
||||
SetOptions (uint32_t);
|
||||
|
||||
bool
|
||||
GetDescription (lldb::SBStream &description,
|
||||
lldb::DescriptionLevel description_level);
|
||||
|
||||
lldb::SBTypeSynthetic &
|
||||
operator = (const lldb::SBTypeSynthetic &rhs);
|
||||
|
||||
bool
|
||||
IsEqualTo (lldb::SBTypeSynthetic &rhs);
|
||||
|
||||
bool
|
||||
operator == (lldb::SBTypeSynthetic &rhs);
|
||||
|
||||
bool
|
||||
operator != (lldb::SBTypeSynthetic &rhs);
|
||||
|
||||
protected:
|
||||
friend class SBDebugger;
|
||||
friend class SBTypeCategory;
|
||||
friend class SBValue;
|
||||
|
||||
lldb::ScriptedSyntheticChildrenSP
|
||||
GetSP ();
|
||||
|
||||
void
|
||||
SetSP (const lldb::ScriptedSyntheticChildrenSP &typefilter_impl_sp);
|
||||
|
||||
lldb::ScriptedSyntheticChildrenSP m_opaque_sp;
|
||||
|
||||
SBTypeSynthetic (const lldb::ScriptedSyntheticChildrenSP &);
|
||||
|
||||
bool
|
||||
CopyOnWrite_Impl();
|
||||
|
||||
};
|
||||
|
||||
|
||||
} // namespace lldb
|
||||
|
||||
#endif // LLDB_DISABLE_PYTHON
|
||||
|
||||
#endif // LLDB_SBTypeSynthetic_h_
|
488
include/lldb/API/SBValue.h
Normal file
488
include/lldb/API/SBValue.h
Normal file
@ -0,0 +1,488 @@
|
||||
//===-- SBValue.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_SBValue_h_
|
||||
#define LLDB_SBValue_h_
|
||||
|
||||
#include "lldb/API/SBData.h"
|
||||
#include "lldb/API/SBDefines.h"
|
||||
#include "lldb/API/SBType.h"
|
||||
|
||||
class ValueImpl;
|
||||
class ValueLocker;
|
||||
|
||||
namespace lldb {
|
||||
|
||||
class SBValue
|
||||
{
|
||||
friend class ValueLocker;
|
||||
|
||||
public:
|
||||
SBValue ();
|
||||
|
||||
SBValue (const lldb::SBValue &rhs);
|
||||
|
||||
lldb::SBValue &
|
||||
operator =(const lldb::SBValue &rhs);
|
||||
|
||||
~SBValue ();
|
||||
|
||||
bool
|
||||
IsValid();
|
||||
|
||||
void
|
||||
Clear();
|
||||
|
||||
SBError
|
||||
GetError();
|
||||
|
||||
lldb::user_id_t
|
||||
GetID ();
|
||||
|
||||
const char *
|
||||
GetName();
|
||||
|
||||
const char *
|
||||
GetTypeName ();
|
||||
|
||||
size_t
|
||||
GetByteSize ();
|
||||
|
||||
bool
|
||||
IsInScope ();
|
||||
|
||||
lldb::Format
|
||||
GetFormat ();
|
||||
|
||||
void
|
||||
SetFormat (lldb::Format format);
|
||||
|
||||
const char *
|
||||
GetValue ();
|
||||
|
||||
int64_t
|
||||
GetValueAsSigned (lldb::SBError& error, int64_t fail_value=0);
|
||||
|
||||
uint64_t
|
||||
GetValueAsUnsigned (lldb::SBError& error, uint64_t fail_value=0);
|
||||
|
||||
int64_t
|
||||
GetValueAsSigned(int64_t fail_value=0);
|
||||
|
||||
uint64_t
|
||||
GetValueAsUnsigned(uint64_t fail_value=0);
|
||||
|
||||
ValueType
|
||||
GetValueType ();
|
||||
|
||||
bool
|
||||
GetValueDidChange ();
|
||||
|
||||
const char *
|
||||
GetSummary ();
|
||||
|
||||
const char *
|
||||
GetObjectDescription ();
|
||||
|
||||
lldb::SBValue
|
||||
GetDynamicValue (lldb::DynamicValueType use_dynamic);
|
||||
|
||||
lldb::SBValue
|
||||
GetStaticValue ();
|
||||
|
||||
lldb::SBValue
|
||||
GetNonSyntheticValue ();
|
||||
|
||||
lldb::DynamicValueType
|
||||
GetPreferDynamicValue ();
|
||||
|
||||
void
|
||||
SetPreferDynamicValue (lldb::DynamicValueType use_dynamic);
|
||||
|
||||
bool
|
||||
GetPreferSyntheticValue ();
|
||||
|
||||
void
|
||||
SetPreferSyntheticValue (bool use_synthetic);
|
||||
|
||||
bool
|
||||
IsDynamic ();
|
||||
|
||||
bool
|
||||
IsSynthetic ();
|
||||
|
||||
const char *
|
||||
GetLocation ();
|
||||
|
||||
// Deprecated - use the one that takes SBError&
|
||||
bool
|
||||
SetValueFromCString (const char *value_str);
|
||||
|
||||
bool
|
||||
SetValueFromCString (const char *value_str, lldb::SBError& error);
|
||||
|
||||
lldb::SBTypeFormat
|
||||
GetTypeFormat ();
|
||||
|
||||
#ifndef LLDB_DISABLE_PYTHON
|
||||
lldb::SBTypeSummary
|
||||
GetTypeSummary ();
|
||||
#endif
|
||||
|
||||
lldb::SBTypeFilter
|
||||
GetTypeFilter ();
|
||||
|
||||
#ifndef LLDB_DISABLE_PYTHON
|
||||
lldb::SBTypeSynthetic
|
||||
GetTypeSynthetic ();
|
||||
#endif
|
||||
|
||||
lldb::SBValue
|
||||
GetChildAtIndex (uint32_t idx);
|
||||
|
||||
lldb::SBValue
|
||||
CreateChildAtOffset (const char *name, uint32_t offset, lldb::SBType type);
|
||||
|
||||
lldb::SBValue
|
||||
Cast (lldb::SBType type);
|
||||
|
||||
lldb::SBValue
|
||||
CreateValueFromExpression (const char *name, const char* expression);
|
||||
|
||||
lldb::SBValue
|
||||
CreateValueFromExpression (const char *name, const char* expression, SBExpressionOptions &options);
|
||||
|
||||
lldb::SBValue
|
||||
CreateValueFromAddress (const char* name,
|
||||
lldb::addr_t address,
|
||||
lldb::SBType type);
|
||||
|
||||
// this has no address! GetAddress() and GetLoadAddress() as well as AddressOf()
|
||||
// on the return of this call all return invalid
|
||||
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 and pointers have child
|
||||
/// values that can be access by index.
|
||||
///
|
||||
/// Structs and unions access child members using a zero based index
|
||||
/// for each child member. For
|
||||
///
|
||||
/// Classes reserve the first indexes for base classes that have
|
||||
/// members (empty base classes are omitted), and all members of the
|
||||
/// current class will then follow the base classes.
|
||||
///
|
||||
/// Pointers differ depending on what they point to. If the pointer
|
||||
/// points to a simple type, the child at index zero
|
||||
/// is the only child value available, unless \a synthetic_allowed
|
||||
/// is \b true, in which case the pointer will be used as an array
|
||||
/// and can create 'synthetic' child values using positive or
|
||||
/// negative indexes. If the pointer points to an aggregate type
|
||||
/// (an array, class, union, struct), then the pointee is
|
||||
/// transparently skipped and any children are going to be the indexes
|
||||
/// of the child values within the aggregate type. For example if
|
||||
/// we have a 'Point' type and we have a SBValue that contains a
|
||||
/// pointer to a 'Point' type, then the child at index zero will be
|
||||
/// the 'x' member, and the child at index 1 will be the 'y' member
|
||||
/// (the child at index zero won't be a 'Point' instance).
|
||||
///
|
||||
/// Arrays have a preset number of children that can be accessed by
|
||||
/// index and will returns invalid child values for indexes that are
|
||||
/// out of bounds unless the \a synthetic_allowed is \b true. In this
|
||||
/// case the array can create 'synthetic' child values for indexes
|
||||
/// that aren't in the array bounds using positive or negative
|
||||
/// indexes.
|
||||
///
|
||||
/// @param[in] idx
|
||||
/// The index of the child value to get
|
||||
///
|
||||
/// @param[in] use_dynamic
|
||||
/// An enumeration that specifies wether to get dynamic values,
|
||||
/// and also if the target can be run to figure out the dynamic
|
||||
/// type of the child value.
|
||||
///
|
||||
/// @param[in] synthetic_allowed
|
||||
/// 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
|
||||
/// A new SBValue object that represents the child member value.
|
||||
//------------------------------------------------------------------
|
||||
lldb::SBValue
|
||||
GetChildAtIndex (uint32_t idx,
|
||||
lldb::DynamicValueType use_dynamic,
|
||||
bool can_create_synthetic);
|
||||
|
||||
// Matches children of this object only and will match base classes and
|
||||
// member names if this is a clang typed object.
|
||||
uint32_t
|
||||
GetIndexOfChildWithName (const char *name);
|
||||
|
||||
// Matches child members of this object and child members of any base
|
||||
// classes.
|
||||
lldb::SBValue
|
||||
GetChildMemberWithName (const char *name);
|
||||
|
||||
// Matches child members of this object and child members of any base
|
||||
// classes.
|
||||
lldb::SBValue
|
||||
GetChildMemberWithName (const char *name, lldb::DynamicValueType use_dynamic);
|
||||
|
||||
// Expands nested expressions like .a->b[0].c[1]->d
|
||||
lldb::SBValue
|
||||
GetValueForExpressionPath(const char* expr_path);
|
||||
|
||||
lldb::SBValue
|
||||
AddressOf();
|
||||
|
||||
lldb::addr_t
|
||||
GetLoadAddress();
|
||||
|
||||
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
|
||||
/// 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
|
||||
/// How many items should be copied into the output. By default
|
||||
/// only one item is copied, but more can be asked for.
|
||||
///
|
||||
/// @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
|
||||
/// 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
|
||||
/// doesn't need to complete the underlying type. This is designed
|
||||
/// to be used in a UI environment in order to detect if the
|
||||
/// disclosure triangle should be displayed or not.
|
||||
///
|
||||
/// This function returns true for class, union, structure,
|
||||
/// pointers, references, arrays and more. Again, it does so without
|
||||
/// doing any expensive type completion.
|
||||
///
|
||||
/// @return
|
||||
/// Returns \b true if the SBValue might have children, or \b
|
||||
/// false otherwise.
|
||||
//------------------------------------------------------------------
|
||||
bool
|
||||
MightHaveChildren ();
|
||||
|
||||
uint32_t
|
||||
GetNumChildren ();
|
||||
|
||||
void *
|
||||
GetOpaqueType();
|
||||
|
||||
lldb::SBTarget
|
||||
GetTarget();
|
||||
|
||||
lldb::SBProcess
|
||||
GetProcess();
|
||||
|
||||
lldb::SBThread
|
||||
GetThread();
|
||||
|
||||
lldb::SBFrame
|
||||
GetFrame();
|
||||
|
||||
lldb::SBValue
|
||||
Dereference ();
|
||||
|
||||
bool
|
||||
TypeIsPointerType ();
|
||||
|
||||
lldb::SBType
|
||||
GetType();
|
||||
|
||||
bool
|
||||
GetDescription (lldb::SBStream &description);
|
||||
|
||||
bool
|
||||
GetExpressionPath (lldb::SBStream &description);
|
||||
|
||||
bool
|
||||
GetExpressionPath (lldb::SBStream &description,
|
||||
bool qualify_cxx_base_classes);
|
||||
|
||||
SBValue (const lldb::ValueObjectSP &value_sp);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Watch this value if it resides in memory.
|
||||
///
|
||||
/// Sets a watchpoint on the value.
|
||||
///
|
||||
/// @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
|
||||
/// Stop when this value is accessed.
|
||||
///
|
||||
/// @param[in] write
|
||||
/// Stop when this value is modified
|
||||
///
|
||||
/// @param[out]
|
||||
/// An error object. Contains the reason if there is some failure.
|
||||
///
|
||||
/// @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
|
||||
/// 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
|
||||
/// Stop when this value is accessed.
|
||||
///
|
||||
/// @param[in] write
|
||||
/// Stop when this value is modified
|
||||
///
|
||||
/// @param[out]
|
||||
/// An error object. Contains the reason if there is some failure.
|
||||
///
|
||||
/// @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, and the
|
||||
/// StopLocker is a read lock, you can call this function even if you are already
|
||||
/// holding the two above-mentioned locks.
|
||||
///
|
||||
/// @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:
|
||||
friend class SBBlock;
|
||||
friend class SBFrame;
|
||||
friend class SBTarget;
|
||||
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,
|
||||
/// and maybe even running code, it needs to acquire the Target API and Process StopLock.
|
||||
/// Those are held in an opaque class ValueLocker which is currently local to SBValue.cpp.
|
||||
/// So you don't have to get these yourself just default construct a ValueLocker, and pass it into this.
|
||||
/// If we need to make a ValueLocker and use it in some other .cpp file, we'll have to move it to
|
||||
/// ValueObject.h/cpp or somewhere else convenient. We haven't needed to so far.
|
||||
///
|
||||
/// @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
|
||||
/// 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 the target's preferences
|
||||
void
|
||||
SetSP (const lldb::ValueObjectSP &sp);
|
||||
|
||||
void
|
||||
SetSP (const lldb::ValueObjectSP &sp, bool use_synthetic);
|
||||
|
||||
void
|
||||
SetSP (const lldb::ValueObjectSP &sp, lldb::DynamicValueType use_dynamic);
|
||||
|
||||
void
|
||||
SetSP (const lldb::ValueObjectSP &sp, lldb::DynamicValueType use_dynamic, bool use_synthetic);
|
||||
|
||||
void
|
||||
SetSP (const lldb::ValueObjectSP &sp, lldb::DynamicValueType use_dynamic, bool use_synthetic, const char *name);
|
||||
|
||||
private:
|
||||
typedef std::shared_ptr<ValueImpl> ValueImplSP;
|
||||
ValueImplSP m_opaque_sp;
|
||||
|
||||
void
|
||||
SetSP (ValueImplSP impl_sp);
|
||||
};
|
||||
|
||||
} // namespace lldb
|
||||
|
||||
#endif // LLDB_SBValue_h_
|
93
include/lldb/API/SBValueList.h
Normal file
93
include/lldb/API/SBValueList.h
Normal file
@ -0,0 +1,93 @@
|
||||
//===-- SBValueList.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_SBValueList_h_
|
||||
#define LLDB_SBValueList_h_
|
||||
|
||||
#include "lldb/API/SBDefines.h"
|
||||
|
||||
class ValueListImpl;
|
||||
|
||||
namespace lldb {
|
||||
|
||||
class SBValueList
|
||||
{
|
||||
public:
|
||||
|
||||
SBValueList ();
|
||||
|
||||
SBValueList (const lldb::SBValueList &rhs);
|
||||
|
||||
~SBValueList();
|
||||
|
||||
bool
|
||||
IsValid() const;
|
||||
|
||||
void
|
||||
Clear();
|
||||
|
||||
void
|
||||
Append (const lldb::SBValue &val_obj);
|
||||
|
||||
void
|
||||
Append (const lldb::SBValueList& value_list);
|
||||
|
||||
uint32_t
|
||||
GetSize() const;
|
||||
|
||||
lldb::SBValue
|
||||
GetValueAtIndex (uint32_t idx) const;
|
||||
|
||||
lldb::SBValue
|
||||
FindValueObjectByUID (lldb::user_id_t uid);
|
||||
|
||||
const lldb::SBValueList &
|
||||
operator = (const lldb::SBValueList &rhs);
|
||||
|
||||
protected:
|
||||
|
||||
// only useful for visualizing the pointer or comparing two SBValueLists
|
||||
// to see if they are backed by the same underlying Impl.
|
||||
void *
|
||||
opaque_ptr ();
|
||||
|
||||
private:
|
||||
friend class SBFrame;
|
||||
|
||||
SBValueList (const ValueListImpl *lldb_object_ptr);
|
||||
|
||||
void
|
||||
Append (lldb::ValueObjectSP& val_obj_sp);
|
||||
|
||||
void
|
||||
CreateIfNeeded ();
|
||||
|
||||
ValueListImpl *
|
||||
operator -> ();
|
||||
|
||||
ValueListImpl &
|
||||
operator* ();
|
||||
|
||||
const ValueListImpl *
|
||||
operator -> () const;
|
||||
|
||||
const ValueListImpl &
|
||||
operator* () const;
|
||||
|
||||
|
||||
ValueListImpl &
|
||||
ref ();
|
||||
|
||||
std::unique_ptr<ValueListImpl> m_opaque_ap;
|
||||
};
|
||||
|
||||
|
||||
} // namespace lldb
|
||||
|
||||
#endif // LLDB_SBValueList_h_
|
104
include/lldb/API/SBWatchpoint.h
Normal file
104
include/lldb/API/SBWatchpoint.h
Normal file
@ -0,0 +1,104 @@
|
||||
//===-- SBWatchpoint.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_SBWatchpoint_h_
|
||||
#define LLDB_SBWatchpoint_h_
|
||||
|
||||
#include "lldb/API/SBDefines.h"
|
||||
|
||||
namespace lldb {
|
||||
|
||||
class SBWatchpoint
|
||||
{
|
||||
public:
|
||||
|
||||
SBWatchpoint ();
|
||||
|
||||
SBWatchpoint (const lldb::SBWatchpoint &rhs);
|
||||
|
||||
SBWatchpoint (const lldb::WatchpointSP &wp_sp);
|
||||
|
||||
~SBWatchpoint ();
|
||||
|
||||
const lldb::SBWatchpoint &
|
||||
operator = (const lldb::SBWatchpoint &rhs);
|
||||
|
||||
bool
|
||||
IsValid() const;
|
||||
|
||||
SBError
|
||||
GetError();
|
||||
|
||||
watch_id_t
|
||||
GetID ();
|
||||
|
||||
/// With -1 representing an invalid hardware index.
|
||||
int32_t
|
||||
GetHardwareIndex ();
|
||||
|
||||
lldb::addr_t
|
||||
GetWatchAddress ();
|
||||
|
||||
size_t
|
||||
GetWatchSize();
|
||||
|
||||
void
|
||||
SetEnabled(bool enabled);
|
||||
|
||||
bool
|
||||
IsEnabled ();
|
||||
|
||||
uint32_t
|
||||
GetHitCount ();
|
||||
|
||||
uint32_t
|
||||
GetIgnoreCount ();
|
||||
|
||||
void
|
||||
SetIgnoreCount (uint32_t n);
|
||||
|
||||
const char *
|
||||
GetCondition ();
|
||||
|
||||
void
|
||||
SetCondition (const char *condition);
|
||||
|
||||
bool
|
||||
GetDescription (lldb::SBStream &description, DescriptionLevel level);
|
||||
|
||||
void
|
||||
Clear ();
|
||||
|
||||
lldb::WatchpointSP
|
||||
GetSP () const;
|
||||
|
||||
void
|
||||
SetSP (const lldb::WatchpointSP &sp);
|
||||
|
||||
static bool
|
||||
EventIsWatchpointEvent (const lldb::SBEvent &event);
|
||||
|
||||
static lldb::WatchpointEventType
|
||||
GetWatchpointEventTypeFromEvent (const lldb::SBEvent& event);
|
||||
|
||||
static lldb::SBWatchpoint
|
||||
GetWatchpointFromEvent (const lldb::SBEvent& event);
|
||||
|
||||
private:
|
||||
friend class SBTarget;
|
||||
friend class SBValue;
|
||||
|
||||
|
||||
lldb::WatchpointSP m_opaque_sp;
|
||||
|
||||
};
|
||||
|
||||
} // namespace lldb
|
||||
|
||||
#endif // LLDB_SBWatchpoint_h_
|
630
include/lldb/Breakpoint/Breakpoint.h
Normal file
630
include/lldb/Breakpoint/Breakpoint.h
Normal file
@ -0,0 +1,630 @@
|
||||
//===-- Breakpoint.h --------------------------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef liblldb_Breakpoint_h_
|
||||
#define liblldb_Breakpoint_h_
|
||||
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/Breakpoint/BreakpointLocationList.h"
|
||||
#include "lldb/Breakpoint/BreakpointOptions.h"
|
||||
#include "lldb/Breakpoint/BreakpointLocationCollection.h"
|
||||
#include "lldb/Breakpoint/Stoppoint.h"
|
||||
#include "lldb/Core/SearchFilter.h"
|
||||
#include "lldb/Core/Event.h"
|
||||
#include "lldb/Core/StringList.h"
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
/// @class Breakpoint Breakpoint.h "lldb/Breakpoint/Breakpoint.h"
|
||||
/// @brief Class that manages logical breakpoint setting.
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
/// General Outline:
|
||||
/// A breakpoint has four main parts, a filter, a resolver, the list of breakpoint
|
||||
/// locations that have been determined for the filter/resolver pair, and finally
|
||||
/// a set of options for the breakpoint.
|
||||
///
|
||||
/// \b Filter:
|
||||
/// This is an object derived from SearchFilter. It manages the search
|
||||
/// for breakpoint location matches through the symbols in the module list of the target
|
||||
/// that owns it. It also filters out locations based on whatever logic it wants.
|
||||
///
|
||||
/// \b Resolver:
|
||||
/// This is an object derived from BreakpointResolver. It provides a
|
||||
/// callback to the filter that will find breakpoint locations. How it does this is
|
||||
/// determined by what kind of resolver it is.
|
||||
///
|
||||
/// The Breakpoint class also provides constructors for the common breakpoint cases
|
||||
/// which make the appropriate filter and resolver for you.
|
||||
///
|
||||
/// \b Location List:
|
||||
/// This stores the breakpoint locations that have been determined
|
||||
/// to date. For a given breakpoint, there will be only one location with a given
|
||||
/// address. Adding a location at an already taken address will just return the location
|
||||
/// already at that address. Locations can be looked up by ID, or by address.
|
||||
///
|
||||
/// \b Options:
|
||||
/// This includes:
|
||||
/// \b Enabled/Disabled
|
||||
/// \b Ignore Count
|
||||
/// \b Callback
|
||||
/// \b Condition
|
||||
/// Note, these options can be set on the breakpoint, and they can also be set on the
|
||||
/// individual locations. The options set on the breakpoint take precedence over the
|
||||
/// options set on the individual location.
|
||||
/// So for instance disabling the breakpoint will cause NONE of the locations to get hit.
|
||||
/// But if the breakpoint is enabled, then the location's enabled state will be checked
|
||||
/// to determine whether to insert that breakpoint location.
|
||||
/// Similarly, if the breakpoint condition says "stop", we won't check the location's condition.
|
||||
/// But if the breakpoint condition says "continue", then we will check the location for whether
|
||||
/// to actually stop or not.
|
||||
/// One 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 ();
|
||||
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// An enum specifying the match style for breakpoint settings. At
|
||||
/// present only used for function name style breakpoints.
|
||||
//------------------------------------------------------------------
|
||||
typedef enum
|
||||
{
|
||||
Exact,
|
||||
Regexp,
|
||||
Glob
|
||||
} MatchType;
|
||||
|
||||
class BreakpointEventData :
|
||||
public EventData
|
||||
{
|
||||
public:
|
||||
|
||||
static const ConstString &
|
||||
GetFlavorString ();
|
||||
|
||||
virtual const ConstString &
|
||||
GetFlavor () const;
|
||||
|
||||
BreakpointEventData (lldb::BreakpointEventType sub_type,
|
||||
const lldb::BreakpointSP &new_breakpoint_sp);
|
||||
|
||||
virtual
|
||||
~BreakpointEventData();
|
||||
|
||||
lldb::BreakpointEventType
|
||||
GetBreakpointEventType () const;
|
||||
|
||||
lldb::BreakpointSP &
|
||||
GetBreakpoint ();
|
||||
|
||||
BreakpointLocationCollection &
|
||||
GetBreakpointLocationCollection()
|
||||
{
|
||||
return m_locations;
|
||||
}
|
||||
|
||||
|
||||
virtual void
|
||||
Dump (Stream *s) const;
|
||||
|
||||
static lldb::BreakpointEventType
|
||||
GetBreakpointEventTypeFromEvent (const lldb::EventSP &event_sp);
|
||||
|
||||
static lldb::BreakpointSP
|
||||
GetBreakpointFromEvent (const lldb::EventSP &event_sp);
|
||||
|
||||
static lldb::BreakpointLocationSP
|
||||
GetBreakpointLocationAtIndexFromEvent (const lldb::EventSP &event_sp, uint32_t loc_idx);
|
||||
|
||||
static size_t
|
||||
GetNumBreakpointLocationsFromEvent (const lldb::EventSP &event_sp);
|
||||
|
||||
static const BreakpointEventData *
|
||||
GetEventDataFromEvent (const Event *event_sp);
|
||||
|
||||
private:
|
||||
|
||||
lldb::BreakpointEventType m_breakpoint_event;
|
||||
lldb::BreakpointSP m_new_breakpoint_sp;
|
||||
BreakpointLocationCollection m_locations;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN (BreakpointEventData);
|
||||
};
|
||||
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// 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();
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// Methods
|
||||
//------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Tell whether this breakpoint is an "internal" breakpoint.
|
||||
/// @return
|
||||
/// Returns \b true if this is an internal breakpoint, \b false otherwise.
|
||||
//------------------------------------------------------------------
|
||||
bool
|
||||
IsInternal () const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Standard "Dump" method. At present it does nothing.
|
||||
//------------------------------------------------------------------
|
||||
void
|
||||
Dump (Stream *s);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// 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] changed_modules
|
||||
/// The list of modules to look in for new locations.
|
||||
//------------------------------------------------------------------
|
||||
void
|
||||
ResolveBreakpointInModules (ModuleList &changed_modules);
|
||||
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// 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
|
||||
/// The list of modules to look in for new locations.
|
||||
/// @param[in] load_event
|
||||
/// If \b true then the modules were loaded, if \b false, unloaded.
|
||||
/// @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
|
||||
/// The old module that is going away.
|
||||
/// @param[in] new_module_sp
|
||||
/// The new module that is replacing it.
|
||||
//------------------------------------------------------------------
|
||||
void
|
||||
ModuleReplaced (lldb::ModuleSP old_module_sp, lldb::ModuleSP new_module_sp);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// The next set of methods provide access to the breakpoint locations
|
||||
// for this breakpoint.
|
||||
//------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Add a location to the breakpoint's location list. This is only meant
|
||||
/// to be called by the breakpoint's resolver. FIXME: how do I ensure that?
|
||||
///
|
||||
/// @param[in] addr
|
||||
/// The Address specifying the 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
|
||||
/// Returns a pointer to the new location.
|
||||
//------------------------------------------------------------------
|
||||
lldb::BreakpointLocationSP
|
||||
AddLocation (const Address &addr,
|
||||
bool *new_location = NULL);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Find a breakpoint location by Address.
|
||||
///
|
||||
/// @param[in] addr
|
||||
/// The Address specifying the location.
|
||||
/// @return
|
||||
/// Returns a shared pointer to the location at \a addr. The pointer
|
||||
/// in the shared pointer will be NULL if there is no location at that address.
|
||||
//------------------------------------------------------------------
|
||||
lldb::BreakpointLocationSP
|
||||
FindLocationByAddress (const Address &addr);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Find a breakpoint location ID by Address.
|
||||
///
|
||||
/// @param[in] addr
|
||||
/// The Address specifying the location.
|
||||
/// @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
|
||||
/// The ID specifying the location.
|
||||
/// @return
|
||||
/// Returns a shared pointer to the location with ID \a bp_loc_id. The pointer
|
||||
/// in the shared pointer will be NULL 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
|
||||
/// The location index.
|
||||
///
|
||||
/// @return
|
||||
/// Returns a shared pointer to the location with index \a
|
||||
/// index. The shared pointer might contain NULL if \a index is
|
||||
/// greater than then number of actual locations.
|
||||
//------------------------------------------------------------------
|
||||
lldb::BreakpointLocationSP
|
||||
GetLocationAtIndex (size_t index);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// 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);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Check the Enable/Disable state.
|
||||
/// @return
|
||||
/// \b true if the breakpoint is enabled, \b false if disabled.
|
||||
//------------------------------------------------------------------
|
||||
bool
|
||||
IsEnabled ();
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Set the breakpoint to ignore the next \a count breakpoint hits.
|
||||
/// @param[in] count
|
||||
/// The number of breakpoint hits to ignore.
|
||||
//------------------------------------------------------------------
|
||||
void
|
||||
SetIgnoreCount (uint32_t count);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Return the current ignore count/
|
||||
/// @return
|
||||
/// The number of breakpoint hits to be ignored.
|
||||
//------------------------------------------------------------------
|
||||
uint32_t
|
||||
GetIgnoreCount () const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Return the current hit count for all locations.
|
||||
/// @return
|
||||
/// The current hit count for all locations.
|
||||
//------------------------------------------------------------------
|
||||
uint32_t
|
||||
GetHitCount () const;
|
||||
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// If \a one_shot is \b true, breakpoint will be deleted on first hit.
|
||||
//------------------------------------------------------------------
|
||||
void
|
||||
SetOneShot (bool one_shot);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Check the OneShot state.
|
||||
/// @return
|
||||
/// \b true if the breakpoint is one shot, \b false otherwise.
|
||||
//------------------------------------------------------------------
|
||||
bool
|
||||
IsOneShot () const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Set the valid thread to be checked when the breakpoint is hit.
|
||||
/// @param[in] thread_id
|
||||
/// If this thread hits the breakpoint, we stop, otherwise not.
|
||||
//------------------------------------------------------------------
|
||||
void
|
||||
SetThreadID (lldb::tid_t thread_id);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Return the current stop thread value.
|
||||
/// @return
|
||||
/// The thread id for which the breakpoint hit will stop, LLDB_INVALID_THREAD_ID for all threads.
|
||||
//------------------------------------------------------------------
|
||||
lldb::tid_t
|
||||
GetThreadID () const;
|
||||
|
||||
void
|
||||
SetThreadIndex (uint32_t index);
|
||||
|
||||
uint32_t
|
||||
GetThreadIndex() const;
|
||||
|
||||
void
|
||||
SetThreadName (const char *thread_name);
|
||||
|
||||
const char *
|
||||
GetThreadName () const;
|
||||
|
||||
void
|
||||
SetQueueName (const char *queue_name);
|
||||
|
||||
const char *
|
||||
GetQueueName () const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Set the callback action invoked when the breakpoint is hit.
|
||||
///
|
||||
/// @param[in] callback
|
||||
/// The method that will get called when the breakpoint is hit.
|
||||
/// @param[in] baton
|
||||
/// A void * pointer that will get passed back to the callback function.
|
||||
/// @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 thead after the stop has been posted.
|
||||
///
|
||||
/// @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);
|
||||
|
||||
void
|
||||
SetCallback (BreakpointHitCallback callback,
|
||||
const lldb::BatonSP &callback_baton_sp,
|
||||
bool is_synchronous = false);
|
||||
|
||||
void
|
||||
ClearCallback ();
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Set the breakpoint's condition.
|
||||
///
|
||||
/// @param[in] condition
|
||||
/// The condition expression to evaluate when the breakpoint is hit.
|
||||
/// Pass in NULL to clear the condition.
|
||||
//------------------------------------------------------------------
|
||||
void SetCondition (const char *condition);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Return a pointer to the text of the condition expression.
|
||||
///
|
||||
/// @return
|
||||
/// A pointer to the condition expression text, or NULL if no
|
||||
// condition has been set.
|
||||
//------------------------------------------------------------------
|
||||
const char *GetConditionText () const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// The next section are various utility functions.
|
||||
//------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Return the number of breakpoint locations that have resolved to
|
||||
/// actual breakpoint sites.
|
||||
///
|
||||
/// @return
|
||||
/// The number locations resolved breakpoint sites.
|
||||
//------------------------------------------------------------------
|
||||
size_t
|
||||
GetNumResolvedLocations() const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Return the number of breakpoint locations.
|
||||
///
|
||||
/// @return
|
||||
/// The number breakpoint locations.
|
||||
//------------------------------------------------------------------
|
||||
size_t
|
||||
GetNumLocations() const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Put a description of this breakpoint into the stream \a s.
|
||||
///
|
||||
/// @param[in] s
|
||||
/// Stream into which to dump the description.
|
||||
///
|
||||
/// @param[in] level
|
||||
/// The description level that indicates the detail level to
|
||||
/// provide.
|
||||
///
|
||||
/// @see lldb::DescriptionLevel
|
||||
//------------------------------------------------------------------
|
||||
void
|
||||
GetDescription (Stream *s, lldb::DescriptionLevel level, bool show_locations = false);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Set the "kind" description for a breakpoint. If the breakpoint is hit
|
||||
/// the stop info will show this "kind" description instead of the breakpoint
|
||||
/// number. Mostly useful for internal breakpoints, where the breakpoint number
|
||||
/// doesn't have meaning to the user.
|
||||
///
|
||||
/// @param[in] kind
|
||||
/// New "kind" description.
|
||||
//------------------------------------------------------------------
|
||||
void
|
||||
SetBreakpointKind (const char *kind)
|
||||
{
|
||||
m_kind_description.assign (kind);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Return the "kind" description for a breakpoint.
|
||||
///
|
||||
/// @return
|
||||
/// The breakpoint kind, or NULL if none is set.
|
||||
//------------------------------------------------------------------
|
||||
const char *GetBreakpointKind () const
|
||||
{
|
||||
return m_kind_description.c_str();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Accessor for the breakpoint Target.
|
||||
/// @return
|
||||
/// This breakpoint's Target.
|
||||
//------------------------------------------------------------------
|
||||
Target &
|
||||
GetTarget ();
|
||||
|
||||
const Target &
|
||||
GetTarget () const;
|
||||
|
||||
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
|
||||
/// True if there is a match
|
||||
///
|
||||
/// The locations which match the filename and line_number in loc_coll. If its
|
||||
/// size is 0 and true is returned, it means the breakpoint fully matches the
|
||||
/// description.
|
||||
//------------------------------------------------------------------
|
||||
bool GetMatchingFileLine(const ConstString &filename, uint32_t line_number,
|
||||
BreakpointLocationCollection &loc_coll);
|
||||
|
||||
void
|
||||
GetFilterDescription (Stream *s);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Returns the BreakpointOptions structure set at the breakpoint level.
|
||||
///
|
||||
/// Meant to be used by the BreakpointLocation class.
|
||||
///
|
||||
/// @return
|
||||
/// A pointer to this breakpoint's BreakpointOptions.
|
||||
//------------------------------------------------------------------
|
||||
BreakpointOptions *
|
||||
GetOptions ();
|
||||
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Invoke the callback action when the breakpoint is hit.
|
||||
///
|
||||
/// Meant to be used by the BreakpointLocation class.
|
||||
///
|
||||
/// @param[in] context
|
||||
/// Described the breakpoint event.
|
||||
///
|
||||
/// @param[in] bp_loc_id
|
||||
/// Which breakpoint location hit this breakpoint.
|
||||
///
|
||||
/// @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);
|
||||
|
||||
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.
|
||||
//------------------------------------------------------------------
|
||||
// This is the generic constructor
|
||||
Breakpoint(Target &target, lldb::SearchFilterSP &filter_sp, lldb::BreakpointResolverSP &resolver_sp);
|
||||
|
||||
friend class BreakpointLocation; // To call the following two when determining whether to stop.
|
||||
|
||||
void
|
||||
DecrementIgnoreCount();
|
||||
|
||||
// BreakpointLocation::IgnoreCountShouldStop & Breakpoint::IgnoreCountShouldStop can only be called once per stop,
|
||||
// and BreakpointLocation::IgnoreCountShouldStop should be tested first, and if it returns false we should
|
||||
// continue, otherwise we should test Breakpoint::IgnoreCountShouldStop.
|
||||
|
||||
bool
|
||||
IgnoreCountShouldStop ();
|
||||
|
||||
private:
|
||||
//------------------------------------------------------------------
|
||||
// For Breakpoint only
|
||||
//------------------------------------------------------------------
|
||||
bool m_being_created;
|
||||
Target &m_target; // The target that holds this breakpoint.
|
||||
lldb::SearchFilterSP m_filter_sp; // The filter that constrains the breakpoint's domain.
|
||||
lldb::BreakpointResolverSP m_resolver_sp; // The resolver that defines this breakpoint.
|
||||
BreakpointOptions m_options; // Settable breakpoint options
|
||||
BreakpointLocationList m_locations; // The list of locations currently found for this breakpoint.
|
||||
std::string m_kind_description;
|
||||
|
||||
void
|
||||
SendBreakpointChangedEvent (lldb::BreakpointEventType eventKind);
|
||||
|
||||
void
|
||||
SendBreakpointChangedEvent (BreakpointEventData *data);
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(Breakpoint);
|
||||
};
|
||||
|
||||
} // namespace lldb_private
|
||||
|
||||
#endif // liblldb_Breakpoint_h_
|
117
include/lldb/Breakpoint/BreakpointID.h
Normal file
117
include/lldb/Breakpoint/BreakpointID.h
Normal file
@ -0,0 +1,117 @@
|
||||
//===-- BreakpointID.h ------------------------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef liblldb_BreakpointID_h_
|
||||
#define liblldb_BreakpointID_h_
|
||||
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
|
||||
#include "lldb/lldb-private.h"
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// class BreakpointID
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
class BreakpointID
|
||||
{
|
||||
public:
|
||||
|
||||
BreakpointID (lldb::break_id_t bp_id = LLDB_INVALID_BREAK_ID,
|
||||
lldb::break_id_t loc_id = LLDB_INVALID_BREAK_ID);
|
||||
|
||||
virtual
|
||||
~BreakpointID ();
|
||||
|
||||
lldb::break_id_t
|
||||
GetBreakpointID ()
|
||||
{
|
||||
return m_break_id;
|
||||
}
|
||||
|
||||
lldb::break_id_t
|
||||
GetLocationID ()
|
||||
{
|
||||
return m_location_id;
|
||||
}
|
||||
|
||||
void
|
||||
SetID (lldb::break_id_t bp_id, lldb::break_id_t loc_id)
|
||||
{
|
||||
m_break_id = bp_id;
|
||||
m_location_id = loc_id;
|
||||
}
|
||||
|
||||
void
|
||||
SetBreakpointID (lldb::break_id_t bp_id)
|
||||
{
|
||||
m_break_id = bp_id;
|
||||
}
|
||||
|
||||
void
|
||||
SetBreakpointLocationID (lldb::break_id_t loc_id)
|
||||
{
|
||||
m_location_id = loc_id;
|
||||
}
|
||||
|
||||
void
|
||||
GetDescription (Stream *s, lldb::DescriptionLevel level);
|
||||
|
||||
static bool
|
||||
IsRangeIdentifier (const char *str);
|
||||
|
||||
static bool
|
||||
IsValidIDExpression (const char *str);
|
||||
|
||||
static const char *g_range_specifiers[];
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Takes an input string containing the description of a breakpoint or breakpoint and location
|
||||
/// and returns the breakpoint ID and the breakpoint location id.
|
||||
///
|
||||
/// @param[in] input
|
||||
/// A string containing JUST the breakpoint description.
|
||||
/// @param[out] break_id
|
||||
/// This is the break id.
|
||||
/// @param[out] break_loc_id
|
||||
/// This is breakpoint location id, or LLDB_INVALID_BREAK_ID is no location was specified.
|
||||
/// @return
|
||||
/// \b true if the call was able to extract a breakpoint location from the string. \b false otherwise.
|
||||
//------------------------------------------------------------------
|
||||
static bool
|
||||
ParseCanonicalReference (const char *input, lldb::break_id_t *break_id, lldb::break_id_t *break_loc_id);
|
||||
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// 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
|
||||
/// This is the break 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);
|
||||
|
||||
protected:
|
||||
lldb::break_id_t m_break_id;
|
||||
lldb::break_id_t m_location_id;
|
||||
};
|
||||
|
||||
} // namespace lldb_private
|
||||
|
||||
#endif // liblldb_BreakpointID_h_
|
82
include/lldb/Breakpoint/BreakpointIDList.h
Normal file
82
include/lldb/Breakpoint/BreakpointIDList.h
Normal file
@ -0,0 +1,82 @@
|
||||
//===-- BreakpointIDList.h --------------------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef liblldb_BreakpointIDList_h_
|
||||
#define liblldb_BreakpointIDList_h_
|
||||
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
#include <vector>
|
||||
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
|
||||
#include "lldb/lldb-private.h"
|
||||
#include "lldb/Breakpoint/BreakpointID.h"
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// class BreakpointIDList
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
|
||||
class BreakpointIDList
|
||||
{
|
||||
public:
|
||||
typedef std::vector<BreakpointID> BreakpointIDArray;
|
||||
|
||||
BreakpointIDList ();
|
||||
|
||||
virtual
|
||||
~BreakpointIDList ();
|
||||
|
||||
size_t
|
||||
GetSize();
|
||||
|
||||
BreakpointID &
|
||||
GetBreakpointIDAtIndex (size_t index);
|
||||
|
||||
bool
|
||||
RemoveBreakpointIDAtIndex (size_t index);
|
||||
|
||||
void
|
||||
Clear();
|
||||
|
||||
bool
|
||||
AddBreakpointID (BreakpointID bp_id);
|
||||
|
||||
bool
|
||||
AddBreakpointID (const char *bp_id);
|
||||
|
||||
bool
|
||||
FindBreakpointID (BreakpointID &bp_id, size_t *position);
|
||||
|
||||
bool
|
||||
FindBreakpointID (const char *bp_id, size_t *position);
|
||||
|
||||
void
|
||||
InsertStringArray (const char **string_array, size_t array_size, CommandReturnObject &result);
|
||||
|
||||
static bool
|
||||
StringContainsIDRangeExpression (const char *in_string, size_t *range_start_len, size_t *range_end_pos);
|
||||
|
||||
static void
|
||||
FindAndReplaceIDRanges (Args &old_args, Target *target, CommandReturnObject &result, Args &new_args);
|
||||
|
||||
private:
|
||||
BreakpointIDArray m_breakpoint_ids;
|
||||
BreakpointID m_invalid_id;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(BreakpointIDList);
|
||||
};
|
||||
|
||||
} // namespace lldb_private
|
||||
|
||||
#endif // liblldb_BreakpointIDList_h_
|
193
include/lldb/Breakpoint/BreakpointList.h
Normal file
193
include/lldb/Breakpoint/BreakpointList.h
Normal file
@ -0,0 +1,193 @@
|
||||
//===-- BreakpointList.h ----------------------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef liblldb_BreakpointList_h_
|
||||
#define liblldb_BreakpointList_h_
|
||||
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
#include <list>
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/Breakpoint/Breakpoint.h"
|
||||
#include "lldb/Host/Mutex.h"
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
/// @class BreakpointList BreakpointList.h "lldb/Breakpoint/BreakpointList.h"
|
||||
/// @brief This class manages a list of breakpoints.
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
/// General Outline:
|
||||
/// Allows adding and removing breakpoints and find by ID and index.
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
class BreakpointList
|
||||
{
|
||||
public:
|
||||
BreakpointList (bool is_internal);
|
||||
|
||||
~BreakpointList();
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Add the breakpoint \a bp_sp to the list.
|
||||
///
|
||||
/// @param[in] bp_sp
|
||||
/// Shared pointer to the breakpoint that will get added to the list.
|
||||
///
|
||||
/// @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.
|
||||
///
|
||||
/// @param[in] breakID
|
||||
/// The breakpoint ID to seek for.
|
||||
///
|
||||
/// @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);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Returns a shared pointer to the breakpoint with id \a breakID. Const version.
|
||||
///
|
||||
/// @param[in] breakID
|
||||
/// The breakpoint ID to seek for.
|
||||
///
|
||||
/// @result
|
||||
/// A shared pointer to the breakpoint. May contain a NULL pointer if the
|
||||
/// breakpoint doesn't exist.
|
||||
//------------------------------------------------------------------
|
||||
const lldb::BreakpointSP
|
||||
FindBreakpointByID (lldb::break_id_t breakID) const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Returns a shared pointer to the breakpoint with index \a i.
|
||||
///
|
||||
/// @param[in] i
|
||||
/// The breakpoint index to seek for.
|
||||
///
|
||||
/// @result
|
||||
/// A shared pointer to the breakpoint. May contain a NULL pointer if the
|
||||
/// breakpoint doesn't exist.
|
||||
//------------------------------------------------------------------
|
||||
lldb::BreakpointSP
|
||||
GetBreakpointAtIndex (size_t i);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Returns a shared pointer to the breakpoint with index \a i, const version
|
||||
///
|
||||
/// @param[in] i
|
||||
/// The breakpoint index to seek for.
|
||||
///
|
||||
/// @result
|
||||
/// A shared pointer to the breakpoint. May contain a NULL pointer if the
|
||||
/// breakpoint doesn't exist.
|
||||
//------------------------------------------------------------------
|
||||
const lldb::BreakpointSP
|
||||
GetBreakpointAtIndex (size_t i) const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Returns the number of elements in this breakpoint list.
|
||||
///
|
||||
/// @result
|
||||
/// The number of elements.
|
||||
//------------------------------------------------------------------
|
||||
size_t
|
||||
GetSize() const
|
||||
{
|
||||
Mutex::Locker locker(m_mutex);
|
||||
return m_breakpoints.size();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Removes the breakpoint given by \b breakID from this list.
|
||||
///
|
||||
/// @param[in] breakID
|
||||
/// The breakpoint index to remove.
|
||||
///
|
||||
/// @result
|
||||
/// \b true if the breakpoint \a breakID was in the list.
|
||||
//------------------------------------------------------------------
|
||||
bool
|
||||
Remove (lldb::break_id_t breakID, bool notify);
|
||||
|
||||
void
|
||||
SetEnabledAll (bool enabled);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Removes all the breakpoints from this list.
|
||||
//------------------------------------------------------------------
|
||||
void
|
||||
RemoveAll (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
|
||||
/// The module list that has changed.
|
||||
///
|
||||
/// @param[in] added
|
||||
/// \b true if the modules are loaded, \b false if unloaded.
|
||||
//------------------------------------------------------------------
|
||||
void
|
||||
UpdateBreakpoints (ModuleList &module_list, bool added);
|
||||
|
||||
void
|
||||
UpdateBreakpointsWhenModuleIsReplaced (lldb::ModuleSP old_module_sp, lldb::ModuleSP new_module_sp);
|
||||
|
||||
void
|
||||
ClearAllBreakpointSites ();
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Sets the passed in Locker to hold the Breakpoint List mutex.
|
||||
///
|
||||
/// @param[in] locker
|
||||
/// The locker object that is set.
|
||||
//------------------------------------------------------------------
|
||||
void
|
||||
GetListMutex (lldb_private::Mutex::Locker &locker);
|
||||
|
||||
protected:
|
||||
typedef std::list<lldb::BreakpointSP> bp_collection;
|
||||
|
||||
bp_collection::iterator
|
||||
GetBreakpointIDIterator(lldb::break_id_t breakID);
|
||||
|
||||
bp_collection::const_iterator
|
||||
GetBreakpointIDConstIterator(lldb::break_id_t breakID) const;
|
||||
|
||||
mutable Mutex m_mutex;
|
||||
bp_collection m_breakpoints; // The breakpoint list, currently a list.
|
||||
lldb::break_id_t m_next_break_id;
|
||||
bool m_is_internal;
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN (BreakpointList);
|
||||
};
|
||||
|
||||
} // namespace lldb_private
|
||||
|
||||
#endif // liblldb_BreakpointList_h_
|
401
include/lldb/Breakpoint/BreakpointLocation.h
Normal file
401
include/lldb/Breakpoint/BreakpointLocation.h
Normal file
@ -0,0 +1,401 @@
|
||||
//===-- BreakpointLocation.h ------------------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef liblldb_BreakpointLocation_h_
|
||||
#define liblldb_BreakpointLocation_h_
|
||||
|
||||
// C Includes
|
||||
|
||||
// C++ Includes
|
||||
#include <list>
|
||||
|
||||
// Other libraries and framework includes
|
||||
|
||||
// Project includes
|
||||
#include "lldb/lldb-private.h"
|
||||
#include "lldb/Breakpoint/StoppointLocation.h"
|
||||
#include "lldb/Core/Address.h"
|
||||
#include "lldb/Core/StringList.h"
|
||||
#include "lldb/Core/UserID.h"
|
||||
#include "lldb/Host/Mutex.h"
|
||||
#include "lldb/Target/Process.h"
|
||||
#include "lldb/Expression/ClangUserExpression.h"
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
/// @class BreakpointLocation BreakpointLocation.h "lldb/Breakpoint/BreakpointLocation.h"
|
||||
/// @brief 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 breakpoint location also may have a breakpoint site if its
|
||||
/// address has been loaded into the program.
|
||||
/// Finally it has a settable options object.
|
||||
///
|
||||
/// 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>,
|
||||
public StoppointLocation
|
||||
{
|
||||
public:
|
||||
|
||||
~BreakpointLocation ();
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// 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;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Gets the Address for this breakpoint location
|
||||
/// @return
|
||||
/// Returns breakpoint location Address.
|
||||
//------------------------------------------------------------------
|
||||
Address &
|
||||
GetAddress ();
|
||||
//------------------------------------------------------------------
|
||||
/// Gets the Breakpoint that created this breakpoint location
|
||||
/// @return
|
||||
/// Returns the owning breakpoint.
|
||||
//------------------------------------------------------------------
|
||||
Breakpoint &
|
||||
GetBreakpoint ();
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// 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
|
||||
/// \b true if this breakpoint location thinks we should stop,
|
||||
/// \b false otherwise.
|
||||
//------------------------------------------------------------------
|
||||
bool
|
||||
ShouldStop (StoppointCallbackContext *context);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// The next section deals with various breakpoint options.
|
||||
//------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// If \a enable is \b true, enable the breakpoint, if \b false
|
||||
/// disable it.
|
||||
//------------------------------------------------------------------
|
||||
void
|
||||
SetEnabled(bool enabled);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Check the Enable/Disable state.
|
||||
///
|
||||
/// @return
|
||||
/// \b true if the breakpoint is enabled, \b false if disabled.
|
||||
//------------------------------------------------------------------
|
||||
bool
|
||||
IsEnabled () const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Return the current Ignore Count.
|
||||
///
|
||||
/// @return
|
||||
/// The number of breakpoint hits to be ignored.
|
||||
//------------------------------------------------------------------
|
||||
uint32_t
|
||||
GetIgnoreCount ();
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Set the breakpoint to ignore the next \a count breakpoint hits.
|
||||
///
|
||||
/// @param[in] count
|
||||
/// The number of breakpoint hits to ignore.
|
||||
//------------------------------------------------------------------
|
||||
void
|
||||
SetIgnoreCount (uint32_t n);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Set the callback action invoked when the breakpoint is hit.
|
||||
///
|
||||
/// The callback will return a bool indicating whether the target
|
||||
/// should stop at this breakpoint or not.
|
||||
///
|
||||
/// @param[in] callback
|
||||
/// The method that will get called when the breakpoint is hit.
|
||||
///
|
||||
/// @param[in] callback_baton_sp
|
||||
/// A shared pointer to a Baton that provides the void * needed
|
||||
/// for the callback.
|
||||
///
|
||||
/// @see lldb_private::Baton
|
||||
//------------------------------------------------------------------
|
||||
void
|
||||
SetCallback (BreakpointHitCallback callback,
|
||||
const lldb::BatonSP &callback_baton_sp,
|
||||
bool is_synchronous);
|
||||
|
||||
void
|
||||
SetCallback (BreakpointHitCallback callback,
|
||||
void *baton,
|
||||
bool is_synchronous);
|
||||
|
||||
void
|
||||
ClearCallback ();
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Set the breakpoint location's condition.
|
||||
///
|
||||
/// @param[in] condition
|
||||
/// The condition expression to evaluate when the breakpoint is hit.
|
||||
//------------------------------------------------------------------
|
||||
void
|
||||
SetCondition (const char *condition);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Return a pointer to the text of the condition expression.
|
||||
///
|
||||
/// @return
|
||||
/// A pointer to the condition expression text, or NULL if no
|
||||
// condition has been set.
|
||||
//------------------------------------------------------------------
|
||||
const char *
|
||||
GetConditionText (size_t *hash = NULL) const;
|
||||
|
||||
bool
|
||||
ConditionSaysStop (ExecutionContext &exe_ctx, Error &error);
|
||||
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Set the valid thread to be checked when the breakpoint is hit.
|
||||
///
|
||||
/// @param[in] thread_id
|
||||
/// If this thread hits the breakpoint, we stop, otherwise not.
|
||||
//------------------------------------------------------------------
|
||||
void
|
||||
SetThreadID (lldb::tid_t thread_id);
|
||||
|
||||
lldb::tid_t
|
||||
GetThreadID ();
|
||||
|
||||
void
|
||||
SetThreadIndex (uint32_t index);
|
||||
|
||||
uint32_t
|
||||
GetThreadIndex() const;
|
||||
|
||||
void
|
||||
SetThreadName (const char *thread_name);
|
||||
|
||||
const char *
|
||||
GetThreadName () const;
|
||||
|
||||
void
|
||||
SetQueueName (const char *queue_name);
|
||||
|
||||
const char *
|
||||
GetQueueName () const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// The next section deals with this location's breakpoint sites.
|
||||
//------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Try to resolve the breakpoint site for this location.
|
||||
///
|
||||
/// @return
|
||||
/// \b true if we were successful at setting a breakpoint site,
|
||||
/// \b false otherwise.
|
||||
//------------------------------------------------------------------
|
||||
bool
|
||||
ResolveBreakpointSite ();
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Clear this breakpoint location's breakpoint site - for instance
|
||||
/// when disabling the breakpoint.
|
||||
///
|
||||
/// @return
|
||||
/// \b true if there was a breakpoint site to be cleared, \b false
|
||||
/// otherwise.
|
||||
//------------------------------------------------------------------
|
||||
bool
|
||||
ClearBreakpointSite ();
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Return whether this breakpoint location has a breakpoint site.
|
||||
/// @return
|
||||
/// \b true if there was a breakpoint site for this breakpoint
|
||||
/// location, \b false otherwise.
|
||||
//------------------------------------------------------------------
|
||||
bool
|
||||
IsResolved () const;
|
||||
|
||||
lldb::BreakpointSiteSP
|
||||
GetBreakpointSite() const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// The next section are generic report functions.
|
||||
//------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Print a description of this breakpoint location to the stream
|
||||
/// \a s.
|
||||
///
|
||||
/// @param[in] s
|
||||
/// The stream to which to print the description.
|
||||
///
|
||||
/// @param[in] level
|
||||
/// The description level that indicates the detail level to
|
||||
/// provide.
|
||||
///
|
||||
/// @see lldb::DescriptionLevel
|
||||
//------------------------------------------------------------------
|
||||
void
|
||||
GetDescription (Stream *s, lldb::DescriptionLevel level);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Standard "Dump" method. At present it does nothing.
|
||||
//------------------------------------------------------------------
|
||||
void
|
||||
Dump (Stream *s) const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// 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
|
||||
/// A pointer to the breakpoint options.
|
||||
//------------------------------------------------------------------
|
||||
BreakpointOptions *
|
||||
GetLocationOptions ();
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Use this to access breakpoint options from this breakpoint location.
|
||||
/// This will point to the owning breakpoint's options unless options have
|
||||
/// been set specifically on this location.
|
||||
///
|
||||
/// @return
|
||||
/// A pointer to the containing breakpoint's options if this
|
||||
/// location doesn't have its own copy.
|
||||
//------------------------------------------------------------------
|
||||
const BreakpointOptions *
|
||||
GetOptionsNoCreate () 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
|
||||
/// Described the breakpoint event.
|
||||
///
|
||||
/// @param[in] bp_loc_id
|
||||
/// Which breakpoint location hit this breakpoint.
|
||||
///
|
||||
/// @return
|
||||
/// \b true if the target should stop at this breakpoint and \b
|
||||
/// false not.
|
||||
//------------------------------------------------------------------
|
||||
bool
|
||||
InvokeCallback (StoppointCallbackContext *context);
|
||||
|
||||
protected:
|
||||
friend class BreakpointLocationList;
|
||||
friend class CommandObjectBreakpointCommandAdd;
|
||||
friend class Process;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Set the breakpoint site for this location to \a bp_site_sp.
|
||||
///
|
||||
/// @param[in] bp_site_sp
|
||||
/// The breakpoint site we are setting for this location.
|
||||
///
|
||||
/// @return
|
||||
/// \b true if we were successful at setting the breakpoint site,
|
||||
/// \b false otherwise.
|
||||
//------------------------------------------------------------------
|
||||
bool
|
||||
SetBreakpointSite (lldb::BreakpointSiteSP& bp_site_sp);
|
||||
|
||||
void
|
||||
DecrementIgnoreCount();
|
||||
|
||||
bool
|
||||
IgnoreCountShouldStop();
|
||||
|
||||
private:
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// Constructors and Destructors
|
||||
//
|
||||
// Only the Breakpoint can make breakpoint locations, and it owns
|
||||
// them.
|
||||
//------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Constructor.
|
||||
///
|
||||
/// @param[in] owner
|
||||
/// A back pointer to the breakpoint that owns this location.
|
||||
///
|
||||
/// @param[in] addr
|
||||
/// The Address defining this location.
|
||||
///
|
||||
/// @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
|
||||
/// \b true if a hardware breakpoint is requested.
|
||||
//------------------------------------------------------------------
|
||||
|
||||
BreakpointLocation (lldb::break_id_t bid,
|
||||
Breakpoint &owner,
|
||||
const Address &addr,
|
||||
lldb::tid_t tid = LLDB_INVALID_THREAD_ID,
|
||||
bool hardware = false);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// Data members:
|
||||
//------------------------------------------------------------------
|
||||
bool m_being_created;
|
||||
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, NULL 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.)
|
||||
ClangUserExpression::ClangUserExpressionSP m_user_expression_sp; ///< The compiled expression to use in testing our condition.
|
||||
Mutex m_condition_mutex; ///< Guards parsing and evaluation of the condition, which could be evaluated by multiple processes.
|
||||
size_t m_condition_hash; ///< For testing whether the condition source code changed.
|
||||
|
||||
void
|
||||
SendBreakpointLocationChangedEvent (lldb::BreakpointEventType eventKind);
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN (BreakpointLocation);
|
||||
};
|
||||
|
||||
} // namespace lldb_private
|
||||
|
||||
#endif // liblldb_BreakpointLocation_h_
|
209
include/lldb/Breakpoint/BreakpointLocationCollection.h
Normal file
209
include/lldb/Breakpoint/BreakpointLocationCollection.h
Normal file
@ -0,0 +1,209 @@
|
||||
//===-- BreakpointLocationCollection.h --------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef liblldb_BreakpointLocationCollection_h_
|
||||
#define liblldb_BreakpointLocationCollection_h_
|
||||
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
#include <vector>
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/lldb-private.h"
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
class BreakpointLocationCollection
|
||||
{
|
||||
public:
|
||||
BreakpointLocationCollection();
|
||||
|
||||
~BreakpointLocationCollection();
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Add the breakpoint \a bp_loc_sp to the list.
|
||||
///
|
||||
/// @param[in] bp_sp
|
||||
/// Shared pointer to the breakpoint location that will get added
|
||||
/// to the list.
|
||||
///
|
||||
/// @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
|
||||
/// The breakpoint index to remove.
|
||||
///
|
||||
/// @param[in] break_loc_id
|
||||
/// The breakpoint location index in break_id to remove.
|
||||
///
|
||||
/// @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
|
||||
/// The breakpoint ID to seek for.
|
||||
///
|
||||
/// @param[in] break_loc_id
|
||||
/// The breakpoint location ID in \a break_id to seek for.
|
||||
///
|
||||
/// @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
|
||||
/// The breakpoint location ID to seek for.
|
||||
///
|
||||
/// @param[in] break_loc_id
|
||||
/// The breakpoint location ID in \a break_id to seek for.
|
||||
///
|
||||
/// @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
|
||||
/// The breakpoint location index to seek for.
|
||||
///
|
||||
/// @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
|
||||
/// The breakpoint location index to seek for.
|
||||
///
|
||||
/// @result
|
||||
/// A shared pointer to the breakpoint. May contain a NULL
|
||||
/// pointer if the breakpoint doesn't exist.
|
||||
//------------------------------------------------------------------
|
||||
const lldb::BreakpointLocationSP
|
||||
GetByIndex (size_t i) const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Returns the number of elements in this breakpoint location list.
|
||||
///
|
||||
/// @result
|
||||
/// The number of elements.
|
||||
//------------------------------------------------------------------
|
||||
size_t
|
||||
GetSize() const { return m_break_loc_collection.size(); }
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Enquires of all the breakpoint locations in this list whether
|
||||
/// we should stop at a hit at \a breakID.
|
||||
///
|
||||
/// @param[in] context
|
||||
/// This contains the information about this stop.
|
||||
///
|
||||
/// @param[in] breakID
|
||||
/// This break ID that we hit.
|
||||
///
|
||||
/// @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
|
||||
/// The stream to which to print the description.
|
||||
///
|
||||
/// @param[in] level
|
||||
/// The description level that indicates the detail level to
|
||||
/// provide.
|
||||
///
|
||||
/// @see lldb::DescriptionLevel
|
||||
//------------------------------------------------------------------
|
||||
void GetDescription (Stream *s, lldb::DescriptionLevel level);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Check whether this collection of breakpoint locations have any
|
||||
/// thread specifiers, and if yes, is \a thread_id contained in any
|
||||
/// of these specifiers.
|
||||
///
|
||||
/// @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
|
||||
/// \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;
|
||||
|
||||
collection::iterator
|
||||
GetIDPairIterator(lldb::break_id_t break_id, lldb::break_id_t break_loc_id);
|
||||
|
||||
collection::const_iterator
|
||||
GetIDPairConstIterator(lldb::break_id_t break_id, lldb::break_id_t break_loc_id) const;
|
||||
|
||||
collection m_break_loc_collection;
|
||||
|
||||
};
|
||||
|
||||
} // namespace lldb_private
|
||||
|
||||
#endif // liblldb_BreakpointLocationCollection_h_
|
269
include/lldb/Breakpoint/BreakpointLocationList.h
Normal file
269
include/lldb/Breakpoint/BreakpointLocationList.h
Normal file
@ -0,0 +1,269 @@
|
||||
//===-- BreakpointLocationList.h --------------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef liblldb_BreakpointLocationList_h_
|
||||
#define liblldb_BreakpointLocationList_h_
|
||||
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
#include <vector>
|
||||
#include <map>
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/lldb-private.h"
|
||||
#include "lldb/Core/Address.h"
|
||||
#include "lldb/Host/Mutex.h"
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
/// @class BreakpointLocationList BreakpointLocationList.h "lldb/Breakpoint/BreakpointLocationList.h"
|
||||
/// @brief 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 adding the location
|
||||
// to this list sets its ID, and implicitly all the locations have the same breakpoint ID as
|
||||
// well. If you need a generic container for breakpoint locations, use BreakpointLocationCollection.
|
||||
friend class Breakpoint;
|
||||
|
||||
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
|
||||
/// The address to look for.
|
||||
///
|
||||
/// @result
|
||||
/// A shared pointer to the breakpoint. May contain a NULL
|
||||
/// 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
|
||||
/// The breakpoint location ID to seek for.
|
||||
///
|
||||
/// @result
|
||||
/// A shared pointer to the breakpoint. May contain a NULL
|
||||
/// 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
|
||||
/// The address to match.
|
||||
///
|
||||
/// @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
|
||||
/// The module to seek in.
|
||||
///
|
||||
/// @param[in]
|
||||
/// A breakpoint collection that gets any breakpoint locations
|
||||
/// that match \a module appended to.
|
||||
///
|
||||
/// @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
|
||||
/// The breakpoint location index to seek for.
|
||||
///
|
||||
/// @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
|
||||
/// The breakpoint location index to seek for.
|
||||
///
|
||||
/// @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;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Removes all the locations in this list from their breakpoint site
|
||||
/// owners list.
|
||||
//------------------------------------------------------------------
|
||||
void
|
||||
ClearAllBreakpointSites ();
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Tells all the breakopint locations in this list to attempt to
|
||||
/// resolve any possible breakpoint sites.
|
||||
//------------------------------------------------------------------
|
||||
void
|
||||
ResolveAllBreakpointSites ();
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Returns the number of breakpoint locations in this list with
|
||||
/// resolved breakpoints.
|
||||
///
|
||||
/// @result
|
||||
/// Number of qualifying breakpoint locations.
|
||||
//------------------------------------------------------------------
|
||||
size_t
|
||||
GetNumResolvedLocations() const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Returns the number hit count of all locations in this list.
|
||||
///
|
||||
/// @result
|
||||
/// Hit count of all locations in this list.
|
||||
//------------------------------------------------------------------
|
||||
uint32_t
|
||||
GetHitCount () const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Enquires of the breakpoint location in this list with ID \a
|
||||
/// breakID whether we should stop.
|
||||
///
|
||||
/// @param[in] context
|
||||
/// This contains the information about this stop.
|
||||
///
|
||||
/// @param[in] breakID
|
||||
/// This break ID that we hit.
|
||||
///
|
||||
/// @return
|
||||
/// \b true if we should stop, \b false otherwise.
|
||||
//------------------------------------------------------------------
|
||||
bool
|
||||
ShouldStop (StoppointCallbackContext *context,
|
||||
lldb::break_id_t breakID);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Returns the number of elements in this breakpoint location list.
|
||||
///
|
||||
/// @result
|
||||
/// The number of elements.
|
||||
//------------------------------------------------------------------
|
||||
size_t
|
||||
GetSize() const
|
||||
{
|
||||
return m_locations.size();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Print a description of the breakpoint locations in this list to
|
||||
/// the stream \a s.
|
||||
///
|
||||
/// @param[in] s
|
||||
/// The stream to which to print the description.
|
||||
///
|
||||
/// @param[in] level
|
||||
/// The description level that indicates the detail level to
|
||||
/// provide.
|
||||
///
|
||||
/// @see lldb::DescriptionLevel
|
||||
//------------------------------------------------------------------
|
||||
void
|
||||
GetDescription (Stream *s,
|
||||
lldb::DescriptionLevel level);
|
||||
|
||||
protected:
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// This is the standard constructor.
|
||||
///
|
||||
/// It creates an empty breakpoint location list. It is protected
|
||||
/// here because only Breakpoints are allowed to create the
|
||||
/// breakpoint location list.
|
||||
//------------------------------------------------------------------
|
||||
BreakpointLocationList(Breakpoint &owner);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Add the breakpoint \a bp_loc_sp to the list.
|
||||
///
|
||||
/// @param[in] bp_sp
|
||||
/// Shared pointer to the breakpoint location that will get
|
||||
/// added to the list.
|
||||
///
|
||||
/// @result
|
||||
/// Returns breakpoint location id.
|
||||
//------------------------------------------------------------------
|
||||
lldb::BreakpointLocationSP
|
||||
Create (const Address &addr);
|
||||
|
||||
void
|
||||
StartRecordingNewLocations(BreakpointLocationCollection &new_locations);
|
||||
|
||||
void
|
||||
StopRecordingNewLocations();
|
||||
|
||||
lldb::BreakpointLocationSP
|
||||
AddLocation (const Address &addr,
|
||||
bool *new_location = NULL);
|
||||
|
||||
bool
|
||||
RemoveLocation (const lldb::BreakpointLocationSP &bp_loc_sp);
|
||||
|
||||
typedef std::vector<lldb::BreakpointLocationSP> collection;
|
||||
typedef std::map<lldb_private::Address,
|
||||
lldb::BreakpointLocationSP,
|
||||
Address::ModulePointerAndOffsetLessThanFunctionObject> addr_map;
|
||||
|
||||
Breakpoint &m_owner;
|
||||
collection m_locations;
|
||||
addr_map m_address_to_location;
|
||||
mutable Mutex m_mutex;
|
||||
lldb::break_id_t m_next_id;
|
||||
BreakpointLocationCollection *m_new_location_recorder;
|
||||
};
|
||||
|
||||
} // namespace lldb_private
|
||||
|
||||
#endif // liblldb_BreakpointLocationList_h_
|
358
include/lldb/Breakpoint/BreakpointOptions.h
Normal file
358
include/lldb/Breakpoint/BreakpointOptions.h
Normal file
@ -0,0 +1,358 @@
|
||||
//===-- BreakpointOptions.h -------------------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef liblldb_BreakpointOptions_h_
|
||||
#define liblldb_BreakpointOptions_h_
|
||||
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/lldb-private.h"
|
||||
#include "lldb/Core/Baton.h"
|
||||
#include "lldb/Core/StringList.h"
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
/// @class BreakpointOptions BreakpointOptions.h "lldb/Breakpoint/BreakpointOptions.h"
|
||||
/// @brief Class that manages the options on a breakpoint or breakpoint location.
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
class BreakpointOptions
|
||||
{
|
||||
public:
|
||||
//------------------------------------------------------------------
|
||||
// Constructors and Destructors
|
||||
//------------------------------------------------------------------
|
||||
//------------------------------------------------------------------
|
||||
/// Default constructor. The breakpoint is enabled, and has no condition,
|
||||
/// callback, ignore count, etc...
|
||||
//------------------------------------------------------------------
|
||||
BreakpointOptions();
|
||||
BreakpointOptions(const BreakpointOptions& rhs);
|
||||
|
||||
static BreakpointOptions *
|
||||
CopyOptionsNoCallback (BreakpointOptions &rhs);
|
||||
//------------------------------------------------------------------
|
||||
/// This constructor allows you to specify all the breakpoint options.
|
||||
///
|
||||
/// @param[in] condition
|
||||
/// The expression which if it evaluates to \b true if we are to stop
|
||||
///
|
||||
/// @param[in] callback
|
||||
/// This is the plugin for some code that gets run, returns \b true if we are to stop.
|
||||
///
|
||||
/// @param[in] baton
|
||||
/// Client data that will get passed to the callback.
|
||||
///
|
||||
/// @param[in] enabled
|
||||
/// Is this breakpoint enabled.
|
||||
///
|
||||
/// @param[in] ignore
|
||||
/// How many breakpoint hits we should ignore before stopping.
|
||||
///
|
||||
/// @param[in] thread_id
|
||||
/// Only stop if \a thread_id hits the breakpoint.
|
||||
//------------------------------------------------------------------
|
||||
BreakpointOptions(void *condition,
|
||||
BreakpointHitCallback callback,
|
||||
void *baton,
|
||||
bool enabled = true,
|
||||
int32_t ignore = 0,
|
||||
lldb::tid_t thread_id = LLDB_INVALID_THREAD_ID,
|
||||
bool one_shot = false);
|
||||
|
||||
virtual ~BreakpointOptions();
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// Operators
|
||||
//------------------------------------------------------------------
|
||||
const BreakpointOptions&
|
||||
operator=(const BreakpointOptions& rhs);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// Callbacks
|
||||
//
|
||||
// Breakpoint callbacks come in two forms, synchronous and asynchronous. Synchronous callbacks will get
|
||||
// run before any of the thread plans are consulted, and if they return false the target will continue
|
||||
// "under the radar" of the thread plans. There are a couple of restrictions to synchronous callbacks:
|
||||
// 1) They should NOT resume the target themselves. Just return false if you want the target to restart.
|
||||
// 2) Breakpoints with synchronous callbacks can't have conditions (or rather, they can have them, but they
|
||||
// won't do anything. Ditto with ignore counts, etc... You are supposed to control that all through the
|
||||
// callback.
|
||||
// Asynchronous callbacks get run as part of the "ShouldStop" logic in the thread plan. The logic there is:
|
||||
// a) If the breakpoint is thread specific and not for this thread, continue w/o running the callback.
|
||||
// b) If the ignore count says we shouldn't stop, then ditto.
|
||||
// c) If the condition says we shouldn't stop, then ditto.
|
||||
// d) Otherwise, the callback will get run, and if it returns true we will stop, and if false we won't.
|
||||
// The asynchronous callback can run the target itself, but at present that 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
|
||||
/// The function to be called when the breakpoint gets hit.
|
||||
///
|
||||
/// @param[in] baton_sp
|
||||
/// A baton which will get passed back to the callback when it is invoked.
|
||||
///
|
||||
/// @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);
|
||||
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// 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
|
||||
/// 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 on multiple threads) and
|
||||
/// whether we are currently executing synchronous or asynchronous callbacks.
|
||||
///
|
||||
/// @param[in] break_id
|
||||
/// The breakpoint ID that owns this option set.
|
||||
///
|
||||
/// @param[in] break_loc_id
|
||||
/// The breakpoint location ID that owns this option set.
|
||||
///
|
||||
/// @return
|
||||
/// The callback return value.
|
||||
//------------------------------------------------------------------
|
||||
bool InvokeCallback (StoppointCallbackContext *context, lldb::user_id_t break_id, lldb::user_id_t break_loc_id);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Used in InvokeCallback to tell whether it is the right time to run this kind of callback.
|
||||
///
|
||||
/// @return
|
||||
/// The synchronicity of our callback.
|
||||
//------------------------------------------------------------------
|
||||
bool IsCallbackSynchronous () {
|
||||
return m_callback_is_synchronous;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Fetch the baton from the callback.
|
||||
///
|
||||
/// @return
|
||||
/// The baton.
|
||||
//------------------------------------------------------------------
|
||||
Baton *GetBaton ();
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Fetch a const version of the baton from the callback.
|
||||
///
|
||||
/// @return
|
||||
/// The baton.
|
||||
//------------------------------------------------------------------
|
||||
const Baton *GetBaton () const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// Condition
|
||||
//------------------------------------------------------------------
|
||||
//------------------------------------------------------------------
|
||||
/// Set the breakpoint option's condition.
|
||||
///
|
||||
/// @param[in] condition
|
||||
/// The condition expression to evaluate when the breakpoint is hit.
|
||||
//------------------------------------------------------------------
|
||||
void SetCondition (const char *condition);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Return a pointer to the text of the condition expression.
|
||||
///
|
||||
/// @return
|
||||
/// A pointer to the condition expression text, or NULL if no
|
||||
// condition has been set.
|
||||
//------------------------------------------------------------------
|
||||
const char *GetConditionText (size_t *hash = NULL) const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// Enabled/Ignore Count
|
||||
//------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Check the Enable/Disable state.
|
||||
/// @return
|
||||
/// \b true if the breakpoint is enabled, \b false if disabled.
|
||||
//------------------------------------------------------------------
|
||||
bool
|
||||
IsEnabled () const
|
||||
{
|
||||
return m_enabled;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// If \a enable is \b true, enable the breakpoint, if \b false disable it.
|
||||
//------------------------------------------------------------------
|
||||
void
|
||||
SetEnabled (bool enabled)
|
||||
{
|
||||
m_enabled = enabled;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Check the One-shot state.
|
||||
/// @return
|
||||
/// \b true if the breakpoint is one-shot, \b false otherwise.
|
||||
//------------------------------------------------------------------
|
||||
bool
|
||||
IsOneShot () const
|
||||
{
|
||||
return m_one_shot;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// If \a enable is \b true, enable the breakpoint, if \b false disable it.
|
||||
//------------------------------------------------------------------
|
||||
void
|
||||
SetOneShot (bool one_shot)
|
||||
{
|
||||
m_one_shot = one_shot;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Set the breakpoint to ignore the next \a count breakpoint hits.
|
||||
/// @param[in] count
|
||||
/// The number of breakpoint hits to ignore.
|
||||
//------------------------------------------------------------------
|
||||
|
||||
void
|
||||
SetIgnoreCount (uint32_t n)
|
||||
{
|
||||
m_ignore_count = n;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Return the current Ignore Count.
|
||||
/// @return
|
||||
/// The number of breakpoint hits to be ignored.
|
||||
//------------------------------------------------------------------
|
||||
uint32_t
|
||||
GetIgnoreCount () const
|
||||
{
|
||||
return m_ignore_count;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Return the current thread spec for this option. This will return NULL if the no thread
|
||||
/// specifications have been set for this Option yet.
|
||||
/// @return
|
||||
/// The thread specification pointer for this option, or NULL 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();
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// This is the default empty callback.
|
||||
/// @return
|
||||
/// The thread id for which the breakpoint hit will stop,
|
||||
/// LLDB_INVALID_THREAD_ID for all threads.
|
||||
//------------------------------------------------------------------
|
||||
static bool
|
||||
NullCallback (void *baton,
|
||||
StoppointCallbackContext *context,
|
||||
lldb::user_id_t break_id,
|
||||
lldb::user_id_t break_loc_id);
|
||||
|
||||
|
||||
struct CommandData
|
||||
{
|
||||
CommandData () :
|
||||
user_source(),
|
||||
script_source(),
|
||||
stop_on_error(true)
|
||||
{
|
||||
}
|
||||
|
||||
~CommandData ()
|
||||
{
|
||||
}
|
||||
|
||||
StringList user_source;
|
||||
std::string script_source;
|
||||
bool stop_on_error;
|
||||
};
|
||||
|
||||
class CommandBaton : public Baton
|
||||
{
|
||||
public:
|
||||
CommandBaton (CommandData *data) :
|
||||
Baton (data)
|
||||
{
|
||||
}
|
||||
|
||||
virtual
|
||||
~CommandBaton ()
|
||||
{
|
||||
delete ((CommandData *)m_data);
|
||||
m_data = NULL;
|
||||
}
|
||||
|
||||
virtual void
|
||||
GetDescription (Stream *s, lldb::DescriptionLevel level) const;
|
||||
|
||||
};
|
||||
|
||||
protected:
|
||||
//------------------------------------------------------------------
|
||||
// Classes that inherit from BreakpointOptions can see and modify these
|
||||
//------------------------------------------------------------------
|
||||
|
||||
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_callback_is_synchronous;
|
||||
bool m_enabled;
|
||||
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
|
||||
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.
|
||||
};
|
||||
|
||||
} // namespace lldb_private
|
||||
|
||||
#endif // liblldb_BreakpointOptions_h_
|
147
include/lldb/Breakpoint/BreakpointResolver.h
Normal file
147
include/lldb/Breakpoint/BreakpointResolver.h
Normal file
@ -0,0 +1,147 @@
|
||||
//===-- BreakpointResolver.h ------------------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef liblldb_BreakpointResolver_h_
|
||||
#define liblldb_BreakpointResolver_h_
|
||||
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/lldb-private.h"
|
||||
#include "lldb/Core/Address.h"
|
||||
#include "lldb/Breakpoint/Breakpoint.h"
|
||||
#include "lldb/Breakpoint/BreakpointResolver.h"
|
||||
#include "lldb/Host/FileSpec.h"
|
||||
#include "lldb/Core/RegularExpression.h"
|
||||
#include "lldb/Core/SearchFilter.h"
|
||||
#include "lldb/Core/ConstString.h"
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
/// @class BreakpointResolver BreakpointResolver.h "lldb/Breakpoint/BreakpointResolver.h"
|
||||
/// @brief 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 your callback to get called?" of the filter. The resolver
|
||||
/// answers this question (in the GetDepth method) and provides the resolution callback.
|
||||
/// 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
|
||||
{
|
||||
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
|
||||
/// The breakpoint that owns this resolver.
|
||||
/// @param[in] resolverType
|
||||
/// The concrete breakpoint resolver type for this breakpoint.
|
||||
///
|
||||
/// @result
|
||||
/// Returns breakpoint location id.
|
||||
//------------------------------------------------------------------
|
||||
BreakpointResolver (Breakpoint *bkpt, unsigned char resolverType);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// The Destructor is virtual, all significant breakpoint resolvers derive
|
||||
/// from this class.
|
||||
//------------------------------------------------------------------
|
||||
virtual
|
||||
~BreakpointResolver ();
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// This sets the breakpoint for this resolver.
|
||||
///
|
||||
/// @param[in] bkpt
|
||||
/// The breakpoint that owns this resolver.
|
||||
//------------------------------------------------------------------
|
||||
void
|
||||
SetBreakpoint (Breakpoint *bkpt);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// In response to this method the resolver scans all the modules in the breakpoint's
|
||||
/// target, and adds any new locations it finds.
|
||||
///
|
||||
/// @param[in] filter
|
||||
/// The filter that will manage the search for this resolver.
|
||||
//------------------------------------------------------------------
|
||||
virtual void
|
||||
ResolveBreakpoint (SearchFilter &filter);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// In response to this method the resolver scans the modules in the module list
|
||||
/// \a modules, and adds any new locations it finds.
|
||||
///
|
||||
/// @param[in] filter
|
||||
/// The filter that will manage the search for this resolver.
|
||||
//------------------------------------------------------------------
|
||||
virtual void
|
||||
ResolveBreakpointInModules (SearchFilter &filter,
|
||||
ModuleList &modules);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Prints a canonical description for the breakpoint to the stream \a s.
|
||||
///
|
||||
/// @param[in] s
|
||||
/// Stream to which the output is copied.
|
||||
//------------------------------------------------------------------
|
||||
virtual void
|
||||
GetDescription (Stream *s) = 0;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Standard "Dump" method. At present it does nothing.
|
||||
//------------------------------------------------------------------
|
||||
virtual void
|
||||
Dump (Stream *s) const = 0;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// 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
|
||||
/// identification.
|
||||
enum ResolverTy {
|
||||
FileLineResolver, // This is an instance of BreakpointResolverFileLine
|
||||
AddressResolver, // This is an instance of BreakpointResolverAddress
|
||||
NameResolver, // This is an instance of BreakpointResolverName
|
||||
FileRegexResolver,
|
||||
ExceptionResolver
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// 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.
|
||||
unsigned getResolverID() const {
|
||||
return SubclassID;
|
||||
}
|
||||
|
||||
protected:
|
||||
Breakpoint *m_breakpoint; // This is the breakpoint we add locations to.
|
||||
|
||||
private:
|
||||
// Subclass identifier (for llvm isa/dyn_cast)
|
||||
const unsigned char SubclassID;
|
||||
DISALLOW_COPY_AND_ASSIGN(BreakpointResolver);
|
||||
};
|
||||
|
||||
} // namespace lldb_private
|
||||
|
||||
#endif // liblldb_BreakpointResolver_h_
|
74
include/lldb/Breakpoint/BreakpointResolverAddress.h
Normal file
74
include/lldb/Breakpoint/BreakpointResolverAddress.h
Normal file
@ -0,0 +1,74 @@
|
||||
//===-- BreakpointResolverAddress.h -----------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef liblldb_BreakpointResolverAddress_h_
|
||||
#define liblldb_BreakpointResolverAddress_h_
|
||||
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/Breakpoint/BreakpointResolver.h"
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
/// @class BreakpointResolverAddress BreakpointResolverAddress.h "lldb/Breakpoint/BreakpointResolverAddress.h"
|
||||
/// @brief 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:
|
||||
BreakpointResolverAddress (Breakpoint *bkpt,
|
||||
const Address &addr);
|
||||
|
||||
virtual
|
||||
~BreakpointResolverAddress ();
|
||||
|
||||
virtual void
|
||||
ResolveBreakpoint (SearchFilter &filter);
|
||||
|
||||
virtual void
|
||||
ResolveBreakpointInModules (SearchFilter &filter,
|
||||
ModuleList &modules);
|
||||
|
||||
virtual Searcher::CallbackReturn
|
||||
SearchCallback (SearchFilter &filter,
|
||||
SymbolContext &context,
|
||||
Address *addr,
|
||||
bool containing);
|
||||
|
||||
virtual Searcher::Depth
|
||||
GetDepth ();
|
||||
|
||||
virtual void
|
||||
GetDescription (Stream *s);
|
||||
|
||||
virtual void
|
||||
Dump (Stream *s) const;
|
||||
|
||||
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
||||
static inline bool classof(const BreakpointResolverAddress *) { return true; }
|
||||
static inline bool classof(const BreakpointResolver *V) {
|
||||
return V->getResolverID() == BreakpointResolver::AddressResolver;
|
||||
}
|
||||
|
||||
protected:
|
||||
Address m_addr;
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(BreakpointResolverAddress);
|
||||
};
|
||||
|
||||
} // namespace lldb_private
|
||||
|
||||
#endif // liblldb_BreakpointResolverAddress_h_
|
74
include/lldb/Breakpoint/BreakpointResolverFileLine.h
Normal file
74
include/lldb/Breakpoint/BreakpointResolverFileLine.h
Normal file
@ -0,0 +1,74 @@
|
||||
//===-- BreakpointResolverFileLine.h ----------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef liblldb_BreakpointResolverFileLine_h_
|
||||
#define liblldb_BreakpointResolverFileLine_h_
|
||||
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/Breakpoint/BreakpointResolver.h"
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
/// @class BreakpointResolverFileLine BreakpointResolverFileLine.h "lldb/Breakpoint/BreakpointResolverFileLine.h"
|
||||
/// @brief 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:
|
||||
BreakpointResolverFileLine (Breakpoint *bkpt,
|
||||
const FileSpec &resolver,
|
||||
uint32_t line_no,
|
||||
bool check_inlines,
|
||||
bool skip_prologue);
|
||||
|
||||
virtual
|
||||
~BreakpointResolverFileLine ();
|
||||
|
||||
virtual Searcher::CallbackReturn
|
||||
SearchCallback (SearchFilter &filter,
|
||||
SymbolContext &context,
|
||||
Address *addr,
|
||||
bool containing);
|
||||
|
||||
virtual Searcher::Depth
|
||||
GetDepth ();
|
||||
|
||||
virtual void
|
||||
GetDescription (Stream *s);
|
||||
|
||||
virtual void
|
||||
Dump (Stream *s) const;
|
||||
|
||||
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
||||
static inline bool classof(const BreakpointResolverFileLine *) { return true; }
|
||||
static inline bool classof(const BreakpointResolver *V) {
|
||||
return V->getResolverID() == BreakpointResolver::FileLineResolver;
|
||||
}
|
||||
|
||||
protected:
|
||||
friend class Breakpoint;
|
||||
FileSpec m_file_spec; // This is the file spec we are looking for.
|
||||
uint32_t m_line_number; // This is the line number that we are looking for.
|
||||
bool m_inlines; // This determines whether the resolver looks for inlined functions or not.
|
||||
bool m_skip_prologue;
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(BreakpointResolverFileLine);
|
||||
};
|
||||
|
||||
} // namespace lldb_private
|
||||
|
||||
#endif // liblldb_BreakpointResolverFileLine_h_
|
68
include/lldb/Breakpoint/BreakpointResolverFileRegex.h
Normal file
68
include/lldb/Breakpoint/BreakpointResolverFileRegex.h
Normal file
@ -0,0 +1,68 @@
|
||||
//===-- BreakpointResolverFileRegex.h ----------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef liblldb_BreakpointResolverFileRegex_h_
|
||||
#define liblldb_BreakpointResolverFileRegex_h_
|
||||
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/Breakpoint/BreakpointResolver.h"
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
/// @class BreakpointResolverFileRegex BreakpointResolverFileRegex.h "lldb/Breakpoint/BreakpointResolverFileRegex.h"
|
||||
/// @brief 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:
|
||||
BreakpointResolverFileRegex (Breakpoint *bkpt,
|
||||
RegularExpression ®ex);
|
||||
|
||||
virtual
|
||||
~BreakpointResolverFileRegex ();
|
||||
|
||||
virtual Searcher::CallbackReturn
|
||||
SearchCallback (SearchFilter &filter,
|
||||
SymbolContext &context,
|
||||
Address *addr,
|
||||
bool containing);
|
||||
|
||||
virtual Searcher::Depth
|
||||
GetDepth ();
|
||||
|
||||
virtual void
|
||||
GetDescription (Stream *s);
|
||||
|
||||
virtual void
|
||||
Dump (Stream *s) const;
|
||||
|
||||
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
||||
static inline bool classof(const BreakpointResolverFileRegex *) { return true; }
|
||||
static inline bool classof(const BreakpointResolver *V) {
|
||||
return V->getResolverID() == BreakpointResolver::FileRegexResolver;
|
||||
}
|
||||
|
||||
protected:
|
||||
friend class Breakpoint;
|
||||
RegularExpression m_regex; // This is the line expression that we are looking for.
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(BreakpointResolverFileRegex);
|
||||
};
|
||||
|
||||
} // namespace lldb_private
|
||||
|
||||
#endif // liblldb_BreakpointResolverFileRegex_h_
|
122
include/lldb/Breakpoint/BreakpointResolverName.h
Normal file
122
include/lldb/Breakpoint/BreakpointResolverName.h
Normal file
@ -0,0 +1,122 @@
|
||||
//===-- BreakpointResolverName.h --------------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef liblldb_BreakpointResolverName_h_
|
||||
#define liblldb_BreakpointResolverName_h_
|
||||
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
#include <vector>
|
||||
#include <string>
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/Breakpoint/BreakpointResolver.h"
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
/// @class BreakpointResolverName BreakpointResolverName.h "lldb/Breakpoint/BreakpointResolverName.h"
|
||||
/// @brief This class sets breakpoints on a given function name, either by exact match
|
||||
/// or by regular expression.
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
class BreakpointResolverName:
|
||||
public BreakpointResolver
|
||||
{
|
||||
public:
|
||||
|
||||
BreakpointResolverName (Breakpoint *bkpt,
|
||||
const char *name,
|
||||
uint32_t name_type_mask,
|
||||
Breakpoint::MatchType type,
|
||||
bool skip_prologue);
|
||||
|
||||
// This one takes an array of names. It is always MatchType = Exact.
|
||||
BreakpointResolverName (Breakpoint *bkpt,
|
||||
const char *names[],
|
||||
size_t num_names,
|
||||
uint32_t name_type_mask,
|
||||
bool skip_prologue);
|
||||
|
||||
// This one takes a C++ array of names. It is always MatchType = Exact.
|
||||
BreakpointResolverName (Breakpoint *bkpt,
|
||||
std::vector<std::string> names,
|
||||
uint32_t name_type_mask,
|
||||
bool skip_prologue);
|
||||
|
||||
// Creates a function breakpoint by regular expression. Takes over control of the lifespan of func_regex.
|
||||
BreakpointResolverName (Breakpoint *bkpt,
|
||||
RegularExpression &func_regex,
|
||||
bool skip_prologue);
|
||||
|
||||
BreakpointResolverName (Breakpoint *bkpt,
|
||||
const char *class_name,
|
||||
const char *method,
|
||||
Breakpoint::MatchType type,
|
||||
bool skip_prologue);
|
||||
|
||||
virtual
|
||||
~BreakpointResolverName ();
|
||||
|
||||
virtual Searcher::CallbackReturn
|
||||
SearchCallback (SearchFilter &filter,
|
||||
SymbolContext &context,
|
||||
Address *addr,
|
||||
bool containing);
|
||||
|
||||
virtual Searcher::Depth
|
||||
GetDepth ();
|
||||
|
||||
virtual void
|
||||
GetDescription (Stream *s);
|
||||
|
||||
virtual void
|
||||
Dump (Stream *s) const;
|
||||
|
||||
/// Methods for support type inquiry through isa, cast, and dyn_cast:
|
||||
static inline bool classof(const BreakpointResolverName *) { return true; }
|
||||
static inline bool classof(const BreakpointResolver *V) {
|
||||
return V->getResolverID() == BreakpointResolver::NameResolver;
|
||||
}
|
||||
|
||||
protected:
|
||||
struct LookupInfo
|
||||
{
|
||||
ConstString name;
|
||||
ConstString lookup_name;
|
||||
uint32_t name_type_mask; // See FunctionNameType
|
||||
bool match_name_after_lookup;
|
||||
|
||||
LookupInfo () :
|
||||
name(),
|
||||
lookup_name(),
|
||||
name_type_mask (0),
|
||||
match_name_after_lookup (false)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
Prune (SymbolContextList &sc_list,
|
||||
size_t start_idx) const;
|
||||
};
|
||||
std::vector<LookupInfo> m_lookups;
|
||||
ConstString m_class_name;
|
||||
RegularExpression m_regex;
|
||||
Breakpoint::MatchType m_match_type;
|
||||
bool m_skip_prologue;
|
||||
|
||||
void
|
||||
AddNameLookup (const ConstString &name, uint32_t name_type_mask);
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(BreakpointResolverName);
|
||||
};
|
||||
|
||||
} // namespace lldb_private
|
||||
|
||||
#endif // liblldb_BreakpointResolverName_h_
|
295
include/lldb/Breakpoint/BreakpointSite.h
Normal file
295
include/lldb/Breakpoint/BreakpointSite.h
Normal file
@ -0,0 +1,295 @@
|
||||
//===-- BreakpointSite.h ----------------------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef liblldb_BreakpointSite_h_
|
||||
#define liblldb_BreakpointSite_h_
|
||||
|
||||
// C Includes
|
||||
|
||||
// C++ Includes
|
||||
#include <list>
|
||||
|
||||
// Other libraries and framework includes
|
||||
|
||||
// Project includes
|
||||
#include "lldb/lldb-private.h"
|
||||
#include "lldb/Core/UserID.h"
|
||||
#include "lldb/Breakpoint/StoppointLocation.h"
|
||||
#include "lldb/Breakpoint/BreakpointLocationCollection.h"
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
/// @class BreakpointSite BreakpointSite.h "lldb/Breakpoint/BreakpointSite.h"
|
||||
/// @brief Class that manages the actual breakpoint that will be inserted
|
||||
/// into the running program.
|
||||
///
|
||||
/// The BreakpointSite class handles the physical breakpoint that is
|
||||
/// actually inserted in the target program. As such, it is also the
|
||||
/// one that gets hit, when the program stops. It keeps a list of all
|
||||
/// BreakpointLocations that share this phsyical 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
|
||||
{
|
||||
public:
|
||||
|
||||
enum Type
|
||||
{
|
||||
eSoftware, // Breakpoint opcode has been written to memory and m_saved_opcode
|
||||
// and m_trap_opcode contain the saved and written opcode.
|
||||
eHardware, // Breakpoint site is set as a hardware breakpoint
|
||||
eExternal // Breakpoint site is managed by an external debug nub or
|
||||
// debug interface where memory reads trasparently will not
|
||||
// display any breakpoint opcodes.
|
||||
};
|
||||
|
||||
virtual ~BreakpointSite ();
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// This section manages the breakpoint traps
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Returns the Opcode Bytes for this breakpoint
|
||||
//------------------------------------------------------------------
|
||||
uint8_t *
|
||||
GetTrapOpcodeBytes ();
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Returns the Opcode Bytes for this breakpoint - const version
|
||||
//------------------------------------------------------------------
|
||||
const uint8_t *
|
||||
GetTrapOpcodeBytes () const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Get the size of the trap opcode for this address
|
||||
//------------------------------------------------------------------
|
||||
size_t
|
||||
GetTrapOpcodeMaxByteSize () const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Sets the trap opcode
|
||||
//------------------------------------------------------------------
|
||||
bool
|
||||
SetTrapOpcode (const uint8_t *trap_opcode,
|
||||
uint32_t trap_opcode_size);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Gets the original instruction bytes that were overwritten by the trap
|
||||
//------------------------------------------------------------------
|
||||
uint8_t *
|
||||
GetSavedOpcodeBytes ();
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Gets the original instruction bytes that were overwritten by the trap const version
|
||||
//------------------------------------------------------------------
|
||||
const uint8_t *
|
||||
GetSavedOpcodeBytes () const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Says whether \a addr and size \a size intersects with the address \a intersect_addr
|
||||
//------------------------------------------------------------------
|
||||
bool
|
||||
IntersectsRange (lldb::addr_t addr,
|
||||
size_t size,
|
||||
lldb::addr_t *intersect_addr,
|
||||
size_t *intersect_size,
|
||||
size_t *opcode_offset) const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Tells whether the current breakpoint site is enabled or not
|
||||
///
|
||||
/// This is a low-level enable bit for the breakpoint sites. If a
|
||||
/// breakpoint site has no enabled owners, it should just get
|
||||
/// removed. This enable/disable is for the low-level target code
|
||||
/// to enable and disable breakpoint sites when single stepping,
|
||||
/// etc.
|
||||
//------------------------------------------------------------------
|
||||
bool
|
||||
IsEnabled () const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Sets whether the current breakpoint site is enabled or not
|
||||
///
|
||||
/// @param[in] enabled
|
||||
/// \b true if the breakoint 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
|
||||
/// This contains the information about this stop.
|
||||
///
|
||||
/// @return
|
||||
/// \b true if we should stop, \b false otherwise.
|
||||
//------------------------------------------------------------------
|
||||
virtual bool
|
||||
ShouldStop (StoppointCallbackContext *context);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Standard Dump method
|
||||
///
|
||||
/// @param[in] context
|
||||
/// The stream to dump this output.
|
||||
//------------------------------------------------------------------
|
||||
void
|
||||
Dump (Stream *s) const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// The "Owners" are the breakpoint locations that share this
|
||||
/// breakpoint site. The method adds the \a owner to this breakpoint
|
||||
/// site's owner list.
|
||||
///
|
||||
/// @param[in] context
|
||||
/// \a owner is the Breakpoint Location to add.
|
||||
//------------------------------------------------------------------
|
||||
void
|
||||
AddOwner (const lldb::BreakpointLocationSP &owner);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// This method returns the number of breakpoint locations currently
|
||||
/// located at this breakpoint site.
|
||||
///
|
||||
/// @return
|
||||
/// The number of owners.
|
||||
//------------------------------------------------------------------
|
||||
size_t
|
||||
GetNumberOfOwners ();
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// This method returns the 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
|
||||
/// The index in the list of owners for which you wish the owner location.
|
||||
/// @return
|
||||
/// A shared pointer to the breakpoint location at that index.
|
||||
//------------------------------------------------------------------
|
||||
lldb::BreakpointLocationSP
|
||||
GetOwnerAtIndex (size_t idx);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// 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
|
||||
/// 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
|
||||
/// The stream to which to print the description.
|
||||
///
|
||||
/// @param[in] level
|
||||
/// The description level that indicates the detail level to
|
||||
/// provide.
|
||||
///
|
||||
/// @see lldb::DescriptionLevel
|
||||
//------------------------------------------------------------------
|
||||
void
|
||||
GetDescription (Stream *s,
|
||||
lldb::DescriptionLevel level);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Tell whether a breakpoint has a location at this site.
|
||||
///
|
||||
/// @param[in] bp_id
|
||||
/// The breakpoint id to query.
|
||||
///
|
||||
/// @result
|
||||
/// \b true if bp_id has a location that is at this site,
|
||||
/// \b false otherwise.
|
||||
//------------------------------------------------------------------
|
||||
bool
|
||||
IsBreakpointAtThisSite (lldb::break_id_t bp_id);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Tell whether ALL the breakpoints in the location collection are internal.
|
||||
///
|
||||
/// @result
|
||||
/// \b true if all breakpoint locations are owned by internal breakpoints,
|
||||
/// \b false otherwise.
|
||||
//------------------------------------------------------------------
|
||||
bool
|
||||
IsInternal () const;
|
||||
|
||||
BreakpointSite::Type
|
||||
GetType () const
|
||||
{
|
||||
return m_type;
|
||||
}
|
||||
|
||||
void
|
||||
SetType (BreakpointSite::Type type)
|
||||
{
|
||||
m_type = type;
|
||||
}
|
||||
|
||||
private:
|
||||
friend class Process;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// The method removes the owner at \a break_loc_id from this breakpoint list.
|
||||
///
|
||||
/// @param[in] context
|
||||
/// \a break_loc_id is the Breakpoint Location to remove.
|
||||
//------------------------------------------------------------------
|
||||
size_t
|
||||
RemoveOwner (lldb::break_id_t break_id,
|
||||
lldb::break_id_t break_loc_id);
|
||||
|
||||
BreakpointSite::Type m_type;///< The type of this breakpoint site.
|
||||
uint8_t m_saved_opcode[8]; ///< The saved opcode bytes if this breakpoint site uses trap opcodes.
|
||||
uint8_t m_trap_opcode[8]; ///< The opcode that was used to create the breakpoint if it is a software breakpoint site.
|
||||
bool m_enabled; ///< Boolean indicating if this breakpoint site enabled or not.
|
||||
|
||||
// Consider adding an optimization where if there is only one
|
||||
// owner, we don't store a list. The usual case will be only one owner...
|
||||
BreakpointLocationCollection m_owners; ///< This has the BreakpointLocations that share this breakpoint site.
|
||||
|
||||
static lldb::break_id_t
|
||||
GetNextID();
|
||||
|
||||
// Only the Process can create breakpoint sites in
|
||||
// Process::CreateBreakpointSite (lldb::BreakpointLocationSP &, bool).
|
||||
BreakpointSite (BreakpointSiteList *list,
|
||||
const lldb::BreakpointLocationSP& owner,
|
||||
lldb::addr_t m_addr,
|
||||
bool use_hardware);
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(BreakpointSite);
|
||||
};
|
||||
|
||||
} // namespace lldb_private
|
||||
|
||||
#endif // liblldb_BreakpointSite_h_
|
216
include/lldb/Breakpoint/BreakpointSiteList.h
Normal file
216
include/lldb/Breakpoint/BreakpointSiteList.h
Normal file
@ -0,0 +1,216 @@
|
||||
//===-- BreakpointSiteList.h ------------------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef liblldb_BreakpointSiteList_h_
|
||||
#define liblldb_BreakpointSiteList_h_
|
||||
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
#include <map>
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/Breakpoint/BreakpointSite.h"
|
||||
#include "lldb/Host/Mutex.h"
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
/// @class BreakpointSiteList BreakpointSiteList.h "lldb/Breakpoint/BreakpointSiteList.h"
|
||||
/// @brief 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).
|
||||
// FIXME: Find a better interface for this.
|
||||
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
|
||||
/// A shared pointer to a breakpoint site being added to the list.
|
||||
///
|
||||
/// @return
|
||||
/// The ID of the BreakpointSite in the list.
|
||||
//------------------------------------------------------------------
|
||||
lldb::break_id_t
|
||||
Add (const lldb::BreakpointSiteSP& bp_site_sp);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Standard Dump routine, doesn't do anything at present.
|
||||
/// @param[in] s
|
||||
/// Stream into which to dump the description.
|
||||
//------------------------------------------------------------------
|
||||
void
|
||||
Dump (Stream *s) const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Returns a shared pointer to the breakpoint site at address
|
||||
/// \a addr.
|
||||
///
|
||||
/// @param[in] addr
|
||||
/// The address to look for.
|
||||
///
|
||||
/// @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
|
||||
/// The breakpoint site ID to seek for.
|
||||
///
|
||||
/// @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
|
||||
/// The breakpoint site ID to seek for.
|
||||
///
|
||||
/// @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
|
||||
/// The address to match.
|
||||
///
|
||||
/// @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
|
||||
/// The breakpoint site id to query.
|
||||
///
|
||||
/// @param[in] bp_id
|
||||
/// The breakpoint id to look for in \a bp_site_id.
|
||||
///
|
||||
/// @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
|
||||
/// The breakpoint site index to remove.
|
||||
///
|
||||
/// @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
|
||||
/// The address from which to remove a breakpoint site.
|
||||
///
|
||||
/// @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, BreakpointSiteList &bp_site_list) const;
|
||||
|
||||
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
|
||||
/// This contains the information about this stop.
|
||||
///
|
||||
/// @param[in] breakID
|
||||
/// This break ID that we hit.
|
||||
///
|
||||
/// @return
|
||||
/// \b true if we should stop, \b false otherwise.
|
||||
//------------------------------------------------------------------
|
||||
bool
|
||||
ShouldStop (StoppointCallbackContext *context, lldb::break_id_t breakID);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Returns the number of elements in the list.
|
||||
///
|
||||
/// @result
|
||||
/// The number of elements.
|
||||
//------------------------------------------------------------------
|
||||
size_t
|
||||
GetSize() const
|
||||
{
|
||||
Mutex::Locker locker(m_mutex);
|
||||
return m_bp_site_list.size();
|
||||
}
|
||||
|
||||
bool
|
||||
IsEmpty() const
|
||||
{
|
||||
Mutex::Locker locker(m_mutex);
|
||||
return m_bp_site_list.empty();
|
||||
}
|
||||
protected:
|
||||
typedef std::map<lldb::addr_t, lldb::BreakpointSiteSP> collection;
|
||||
|
||||
collection::iterator
|
||||
GetIDIterator(lldb::break_id_t breakID);
|
||||
|
||||
collection::const_iterator
|
||||
GetIDConstIterator(lldb::break_id_t breakID) const;
|
||||
|
||||
mutable Mutex m_mutex;
|
||||
collection m_bp_site_list; // The breakpoint site list.
|
||||
};
|
||||
|
||||
} // namespace lldb_private
|
||||
|
||||
#endif // liblldb_BreakpointSiteList_h_
|
63
include/lldb/Breakpoint/Stoppoint.h
Normal file
63
include/lldb/Breakpoint/Stoppoint.h
Normal file
@ -0,0 +1,63 @@
|
||||
//===-- Stoppoint.h ---------------------------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef liblldb_Stoppoint_h_
|
||||
#define liblldb_Stoppoint_h_
|
||||
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/lldb-private.h"
|
||||
#include "lldb/Core/UserID.h"
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
class Stoppoint
|
||||
{
|
||||
public:
|
||||
//------------------------------------------------------------------
|
||||
// Constructors and Destructors
|
||||
//------------------------------------------------------------------
|
||||
Stoppoint();
|
||||
|
||||
virtual
|
||||
~Stoppoint();
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// Methods
|
||||
//------------------------------------------------------------------
|
||||
virtual void
|
||||
Dump (Stream *) = 0;
|
||||
|
||||
virtual bool
|
||||
IsEnabled () = 0;
|
||||
|
||||
virtual void
|
||||
SetEnabled (bool enable) = 0;
|
||||
|
||||
lldb::break_id_t
|
||||
GetID () const;
|
||||
|
||||
void
|
||||
SetID (lldb::break_id_t bid);
|
||||
|
||||
protected:
|
||||
lldb::break_id_t m_bid;
|
||||
|
||||
private:
|
||||
//------------------------------------------------------------------
|
||||
// For Stoppoint only
|
||||
//------------------------------------------------------------------
|
||||
DISALLOW_COPY_AND_ASSIGN (Stoppoint);
|
||||
};
|
||||
|
||||
} // namespace lldb_private
|
||||
|
||||
#endif // liblldb_Stoppoint_h_
|
58
include/lldb/Breakpoint/StoppointCallbackContext.h
Normal file
58
include/lldb/Breakpoint/StoppointCallbackContext.h
Normal file
@ -0,0 +1,58 @@
|
||||
//===-- StoppointCallbackContext.h ------------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef liblldb_StoppointCallbackContext_h_
|
||||
#define liblldb_StoppointCallbackContext_h_
|
||||
|
||||
#include "lldb/lldb-private.h"
|
||||
#include "lldb/Target/ExecutionContext.h"
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
/// @class StoppointCallbackContext StoppointCallbackContext.h "lldb/Breakpoint/StoppointCallbackContext.h"
|
||||
/// @brief 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:
|
||||
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 exe_ctx_ref; // This tells us where we have stopped, what thread.
|
||||
bool is_synchronous; // Is the callback being executed synchronously with the breakpoint,
|
||||
// or asynchronously as the event is retrieved?
|
||||
};
|
||||
|
||||
} // namespace lldb_private
|
||||
|
||||
#endif // liblldb_StoppointCallbackContext_h_
|
147
include/lldb/Breakpoint/StoppointLocation.h
Normal file
147
include/lldb/Breakpoint/StoppointLocation.h
Normal file
@ -0,0 +1,147 @@
|
||||
//===-- StoppointLocation.h -------------------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef liblldb_StoppointLocation_h_
|
||||
#define liblldb_StoppointLocation_h_
|
||||
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/lldb-private.h"
|
||||
#include "lldb/Core/UserID.h"
|
||||
// #include "lldb/Breakpoint/BreakpointOptions.h"
|
||||
|
||||
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,
|
||||
uint32_t byte_size,
|
||||
bool hardware);
|
||||
|
||||
virtual
|
||||
~StoppointLocation ();
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// Operators
|
||||
//------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// Methods
|
||||
//------------------------------------------------------------------
|
||||
virtual lldb::addr_t
|
||||
GetLoadAddress() const
|
||||
{
|
||||
return m_addr;
|
||||
}
|
||||
|
||||
virtual void
|
||||
SetLoadAddress (lldb::addr_t addr)
|
||||
{
|
||||
m_addr = addr;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
GetByteSize () const
|
||||
{
|
||||
return m_byte_size;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
GetHitCount () const
|
||||
{
|
||||
return m_hit_count;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
GetHardwareIndex () const
|
||||
{
|
||||
return m_hw_index;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
HardwarePreferred () const
|
||||
{
|
||||
return m_hw_preferred;
|
||||
}
|
||||
|
||||
virtual bool
|
||||
IsHardware () const
|
||||
{
|
||||
return m_hw_index != LLDB_INVALID_INDEX32;
|
||||
}
|
||||
|
||||
|
||||
virtual bool
|
||||
ShouldStop (StoppointCallbackContext *context)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual void
|
||||
Dump (Stream *stream) const
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
SetHardwareIndex (uint32_t index)
|
||||
{
|
||||
m_hw_index = index;
|
||||
}
|
||||
|
||||
|
||||
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
|
||||
// store a full Address since that's not needed for the breakpoint sites.
|
||||
bool m_hw_preferred; // 1 if this point has been requested to be set using hardware (which may fail due to lack of resources)
|
||||
uint32_t m_hw_index; // The hardware resource index for this breakpoint/watchpoint
|
||||
uint32_t m_byte_size; // The size in bytes of stop location. e.g. the length of the trap opcode for
|
||||
// software breakpoints, or the optional length in bytes for
|
||||
// hardware breakpoints, or the length of the watchpoint.
|
||||
uint32_t m_hit_count; // Number of times this breakpoint/watchpoint has been hit
|
||||
|
||||
// If you override this, be sure to call the base class to increment the internal counter.
|
||||
void
|
||||
IncrementHitCount ()
|
||||
{
|
||||
++m_hit_count;
|
||||
}
|
||||
|
||||
private:
|
||||
//------------------------------------------------------------------
|
||||
// For StoppointLocation only
|
||||
//------------------------------------------------------------------
|
||||
DISALLOW_COPY_AND_ASSIGN(StoppointLocation);
|
||||
StoppointLocation(); // Disallow default constructor
|
||||
};
|
||||
|
||||
} // namespace lldb_private
|
||||
|
||||
#endif // liblldb_StoppointLocation_h_
|
252
include/lldb/Breakpoint/Watchpoint.h
Normal file
252
include/lldb/Breakpoint/Watchpoint.h
Normal file
@ -0,0 +1,252 @@
|
||||
//===-- Watchpoint.h --------------------------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef liblldb_Watchpoint_h_
|
||||
#define liblldb_Watchpoint_h_
|
||||
|
||||
// C Includes
|
||||
|
||||
// C++ Includes
|
||||
#include <list>
|
||||
#include <string>
|
||||
|
||||
// Other libraries and framework includes
|
||||
|
||||
// Project includes
|
||||
#include "lldb/lldb-private.h"
|
||||
#include "lldb/Target/Target.h"
|
||||
#include "lldb/Core/UserID.h"
|
||||
#include "lldb/Breakpoint/WatchpointOptions.h"
|
||||
#include "lldb/Breakpoint/StoppointLocation.h"
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
class Watchpoint :
|
||||
public std::enable_shared_from_this<Watchpoint>,
|
||||
public StoppointLocation
|
||||
{
|
||||
public:
|
||||
|
||||
class WatchpointEventData :
|
||||
public EventData
|
||||
{
|
||||
public:
|
||||
|
||||
static const ConstString &
|
||||
GetFlavorString ();
|
||||
|
||||
virtual const ConstString &
|
||||
GetFlavor () const;
|
||||
|
||||
WatchpointEventData (lldb::WatchpointEventType sub_type,
|
||||
const lldb::WatchpointSP &new_watchpoint_sp);
|
||||
|
||||
virtual
|
||||
~WatchpointEventData();
|
||||
|
||||
lldb::WatchpointEventType
|
||||
GetWatchpointEventType () const;
|
||||
|
||||
lldb::WatchpointSP &
|
||||
GetWatchpoint ();
|
||||
|
||||
virtual void
|
||||
Dump (Stream *s) const;
|
||||
|
||||
static lldb::WatchpointEventType
|
||||
GetWatchpointEventTypeFromEvent (const lldb::EventSP &event_sp);
|
||||
|
||||
static lldb::WatchpointSP
|
||||
GetWatchpointFromEvent (const lldb::EventSP &event_sp);
|
||||
|
||||
static const WatchpointEventData *
|
||||
GetEventDataFromEvent (const Event *event_sp);
|
||||
|
||||
private:
|
||||
|
||||
lldb::WatchpointEventType m_watchpoint_event;
|
||||
lldb::WatchpointSP m_new_watchpoint_sp;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN (WatchpointEventData);
|
||||
};
|
||||
|
||||
Watchpoint (Target& target, lldb::addr_t addr, uint32_t size, const ClangASTType *type, bool hardware = true);
|
||||
~Watchpoint ();
|
||||
|
||||
void
|
||||
IncrementFalseAlarmsAndReviseHitCount();
|
||||
|
||||
bool
|
||||
IsEnabled () const;
|
||||
|
||||
void
|
||||
SetEnabled (bool enabled, bool notify = true);
|
||||
|
||||
virtual bool
|
||||
IsHardware () const;
|
||||
|
||||
virtual bool
|
||||
ShouldStop (StoppointCallbackContext *context);
|
||||
|
||||
bool WatchpointRead () const;
|
||||
bool WatchpointWrite () const;
|
||||
uint32_t GetIgnoreCount () const;
|
||||
void SetIgnoreCount (uint32_t n);
|
||||
void SetWatchpointType (uint32_t type, bool notify = true);
|
||||
void SetDeclInfo (const std::string &str);
|
||||
std::string GetWatchSpec();
|
||||
void SetWatchSpec (const std::string &str);
|
||||
|
||||
// Snapshot management interface.
|
||||
bool IsWatchVariable() const;
|
||||
void SetWatchVariable(bool val);
|
||||
bool CaptureWatchedValue (const ExecutionContext &exe_ctx);
|
||||
|
||||
void GetDescription (Stream *s, lldb::DescriptionLevel level);
|
||||
void Dump (Stream *s) const;
|
||||
void DumpSnapshots (Stream *s, const char * prefix = NULL) const;
|
||||
void DumpWithLevel (Stream *s, lldb::DescriptionLevel description_level) const;
|
||||
Target &GetTarget() { return m_target; }
|
||||
const Error &GetError() { return m_error; }
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Returns the WatchpointOptions structure set for this watchpoint.
|
||||
///
|
||||
/// @return
|
||||
/// A pointer to this watchpoint's WatchpointOptions.
|
||||
//------------------------------------------------------------------
|
||||
WatchpointOptions *
|
||||
GetOptions () { return &m_options; }
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Set the callback action invoked when the watchpoint is hit.
|
||||
///
|
||||
/// @param[in] callback
|
||||
/// The method that will get called when the watchpoint is hit.
|
||||
/// @param[in] callback_baton
|
||||
/// A void * pointer that will get passed back to the callback function.
|
||||
/// @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 thead after the stop has been posted.
|
||||
///
|
||||
/// @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);
|
||||
|
||||
void
|
||||
SetCallback (WatchpointHitCallback callback,
|
||||
const lldb::BatonSP &callback_baton_sp,
|
||||
bool is_synchronous = false);
|
||||
|
||||
void ClearCallback();
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Invoke the callback action when the watchpoint is hit.
|
||||
///
|
||||
/// @param[in] context
|
||||
/// Described the watchpoint event.
|
||||
///
|
||||
/// @return
|
||||
/// \b true if the target should stop at this watchpoint and \b false not.
|
||||
//------------------------------------------------------------------
|
||||
bool
|
||||
InvokeCallback (StoppointCallbackContext *context);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// Condition
|
||||
//------------------------------------------------------------------
|
||||
//------------------------------------------------------------------
|
||||
/// Set the watchpoint's condition.
|
||||
///
|
||||
/// @param[in] condition
|
||||
/// The condition expression to evaluate when the watchpoint is hit.
|
||||
/// Pass in NULL to clear the condition.
|
||||
//------------------------------------------------------------------
|
||||
void SetCondition (const char *condition);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Return a pointer to the text of the condition expression.
|
||||
///
|
||||
/// @return
|
||||
/// A pointer to the condition expression text, or NULL if no
|
||||
// condition has been set.
|
||||
//------------------------------------------------------------------
|
||||
const char *GetConditionText () const;
|
||||
|
||||
void
|
||||
TurnOnEphemeralMode();
|
||||
|
||||
void
|
||||
TurnOffEphemeralMode();
|
||||
|
||||
bool
|
||||
IsDisabledDuringEphemeralMode();
|
||||
|
||||
const ClangASTType &
|
||||
GetClangASTType()
|
||||
{
|
||||
return m_type;
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
friend class Target;
|
||||
friend class WatchpointList;
|
||||
|
||||
void ResetHitCount() { m_hit_count = 0; }
|
||||
|
||||
Target &m_target;
|
||||
bool m_enabled; // Is this watchpoint enabled
|
||||
bool m_is_hardware; // Is this a hardware watchpoint
|
||||
bool m_is_watch_variable; // True if set via 'watchpoint set variable'.
|
||||
bool m_is_ephemeral; // True if the watchpoint is in the ephemeral mode, meaning that it is
|
||||
// undergoing a pair of temporary disable/enable actions to avoid recursively
|
||||
// triggering further watchpoint events.
|
||||
uint32_t m_disabled_count; // Keep track of the count that the watchpoint is disabled while in ephemeral mode.
|
||||
// At the end of the ephemeral mode when the watchpoint is to be enabled agian,
|
||||
// we check the count, if it is more than 1, it means the user-supplied actions
|
||||
// actually want the watchpoint to be disabled!
|
||||
uint32_t m_watch_read:1, // 1 if we stop when the watched data is read from
|
||||
m_watch_write:1, // 1 if we stop when the watched data is written to
|
||||
m_watch_was_read:1, // Set to 1 when watchpoint is hit for a read access
|
||||
m_watch_was_written:1; // Set to 1 when watchpoint is hit for a write access
|
||||
uint32_t m_ignore_count; // Number of times to ignore this watchpoint
|
||||
uint32_t m_false_alarms; // Number of false alarms.
|
||||
std::string m_decl_str; // Declaration information, if any.
|
||||
std::string m_watch_spec_str; // Spec for the watchpoint.
|
||||
lldb::ValueObjectSP m_old_value_sp;
|
||||
lldb::ValueObjectSP m_new_value_sp;
|
||||
ClangASTType m_type;
|
||||
Error m_error; // An error object describing errors associated with this watchpoint.
|
||||
WatchpointOptions m_options; // Settable watchpoint options, which is a delegate to handle
|
||||
// the callback machinery.
|
||||
bool m_being_created;
|
||||
|
||||
std::unique_ptr<ClangUserExpression> m_condition_ap; // The condition to test.
|
||||
|
||||
void SetID(lldb::watch_id_t id) { m_loc_id = id; }
|
||||
|
||||
void
|
||||
SendWatchpointChangedEvent (lldb::WatchpointEventType eventKind);
|
||||
|
||||
void
|
||||
SendWatchpointChangedEvent (WatchpointEventData *data);
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN (Watchpoint);
|
||||
};
|
||||
|
||||
} // namespace lldb_private
|
||||
|
||||
#endif // liblldb_Watchpoint_h_
|
276
include/lldb/Breakpoint/WatchpointList.h
Normal file
276
include/lldb/Breakpoint/WatchpointList.h
Normal file
@ -0,0 +1,276 @@
|
||||
//===-- WatchpointList.h ----------------------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef liblldb_WatchpointList_h_
|
||||
#define liblldb_WatchpointList_h_
|
||||
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
#include <list>
|
||||
#include <vector>
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/lldb-private.h"
|
||||
#include "lldb/Core/Address.h"
|
||||
#include "lldb/Host/Mutex.h"
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
/// @class WatchpointList WatchpointList.h "lldb/Breakpoint/WatchpointList.h"
|
||||
/// @brief 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 not just some random collection of watchpoints. Rather, the act of
|
||||
// adding the watchpoint to this list sets its ID.
|
||||
friend class Watchpoint;
|
||||
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
|
||||
/// A shared pointer to a watchpoint being added to the list.
|
||||
///
|
||||
/// @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
|
||||
/// The address to look for.
|
||||
///
|
||||
/// @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
|
||||
/// The watchpoint spec to look for.
|
||||
///
|
||||
/// @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
|
||||
/// The watchpoint location ID to seek for.
|
||||
///
|
||||
/// @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
|
||||
/// The address to match.
|
||||
///
|
||||
/// @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
|
||||
/// The watchpoint spec to match.
|
||||
///
|
||||
/// @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
|
||||
/// The watchpoint index to seek for.
|
||||
///
|
||||
/// @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
|
||||
/// The watchpoint index to seek for.
|
||||
///
|
||||
/// @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
|
||||
/// The watchpoint ID to remove.
|
||||
///
|
||||
/// @result
|
||||
/// \b true if the watchpoint \a watchID was in the list.
|
||||
//------------------------------------------------------------------
|
||||
bool
|
||||
Remove (lldb::watch_id_t watchID, bool notify);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Returns the number hit count of all watchpoints in this list.
|
||||
///
|
||||
/// @result
|
||||
/// Hit count of all watchpoints in this list.
|
||||
//------------------------------------------------------------------
|
||||
uint32_t
|
||||
GetHitCount () const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Enquires of the watchpoint in this list with ID \a watchID whether we
|
||||
/// should stop.
|
||||
///
|
||||
/// @param[in] context
|
||||
/// This contains the information about this stop.
|
||||
///
|
||||
/// @param[in] watchID
|
||||
/// This watch ID that we hit.
|
||||
///
|
||||
/// @return
|
||||
/// \b true if we should stop, \b false otherwise.
|
||||
//------------------------------------------------------------------
|
||||
bool
|
||||
ShouldStop (StoppointCallbackContext *context,
|
||||
lldb::watch_id_t watchID);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Returns the number of elements in this watchpoint list.
|
||||
///
|
||||
/// @result
|
||||
/// The number of elements.
|
||||
//------------------------------------------------------------------
|
||||
size_t
|
||||
GetSize() const
|
||||
{
|
||||
Mutex::Locker locker(m_mutex);
|
||||
return m_watchpoints.size();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Print a description of the watchpoints in this list to the stream \a s.
|
||||
///
|
||||
/// @param[in] s
|
||||
/// The stream to which to print the description.
|
||||
///
|
||||
/// @param[in] level
|
||||
/// The description level that indicates the detail level to
|
||||
/// provide.
|
||||
///
|
||||
/// @see lldb::DescriptionLevel
|
||||
//------------------------------------------------------------------
|
||||
void
|
||||
GetDescription (Stream *s,
|
||||
lldb::DescriptionLevel level);
|
||||
|
||||
void
|
||||
SetEnabledAll (bool enabled);
|
||||
|
||||
void
|
||||
RemoveAll (bool notify);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Sets the passed in Locker to hold the Watchpoint List mutex.
|
||||
///
|
||||
/// @param[in] locker
|
||||
/// The locker object that is set.
|
||||
//------------------------------------------------------------------
|
||||
void
|
||||
GetListMutex (lldb_private::Mutex::Locker &locker);
|
||||
|
||||
protected:
|
||||
typedef std::list<lldb::WatchpointSP> wp_collection;
|
||||
typedef std::vector<lldb::watch_id_t> id_vector;
|
||||
|
||||
id_vector
|
||||
GetWatchpointIDs() const;
|
||||
|
||||
wp_collection::iterator
|
||||
GetIDIterator(lldb::watch_id_t watchID);
|
||||
|
||||
wp_collection::const_iterator
|
||||
GetIDConstIterator(lldb::watch_id_t watchID) const;
|
||||
|
||||
wp_collection m_watchpoints;
|
||||
mutable Mutex m_mutex;
|
||||
|
||||
lldb::watch_id_t m_next_wp_id;
|
||||
};
|
||||
|
||||
} // namespace lldb_private
|
||||
|
||||
#endif // liblldb_WatchpointList_h_
|
255
include/lldb/Breakpoint/WatchpointOptions.h
Normal file
255
include/lldb/Breakpoint/WatchpointOptions.h
Normal file
@ -0,0 +1,255 @@
|
||||
//===-- WatchpointOptions.h -------------------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef liblldb_WatchpointOptions_h_
|
||||
#define liblldb_WatchpointOptions_h_
|
||||
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/lldb-private.h"
|
||||
#include "lldb/Core/Baton.h"
|
||||
#include "lldb/Core/StringList.h"
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
/// @class WatchpointOptions WatchpointOptions.h "lldb/Breakpoint/WatchpointOptions.h"
|
||||
/// @brief 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
|
||||
/// This is the plugin for some code that gets run, returns \b true if we are to stop.
|
||||
///
|
||||
/// @param[in] baton
|
||||
/// Client data that will get passed to the callback.
|
||||
///
|
||||
/// @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. Synchronous callbacks will get
|
||||
// run before any of the thread plans are consulted, and if they return false the target will continue
|
||||
// "under the radar" of the thread plans. There are a couple of restrictions to synchronous callbacks:
|
||||
// 1) They should NOT resume the target themselves. Just return false if you want the target to restart.
|
||||
// 2) Watchpoints with synchronous callbacks can't have conditions (or rather, they can have them, but they
|
||||
// won't do anything. Ditto with ignore counts, etc... You are supposed to control that all through the
|
||||
// callback.
|
||||
// Asynchronous callbacks get run as part of the "ShouldStop" logic in the thread plan. The logic there is:
|
||||
// a) If the watchpoint is thread specific and not for this thread, continue w/o running the callback.
|
||||
// b) If the ignore count says we shouldn't stop, then ditto.
|
||||
// c) If the condition says we shouldn't stop, then ditto.
|
||||
// d) Otherwise, the callback will get run, and if it returns true we will stop, and if false we won't.
|
||||
// The asynchronous callback can run the target itself, but at present that 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 watchpoint option set.
|
||||
///
|
||||
/// @param[in] callback
|
||||
/// The function to be called when the watchpoint gets hit.
|
||||
///
|
||||
/// @param[in] baton_sp
|
||||
/// A baton which will get passed back to the callback when it is invoked.
|
||||
///
|
||||
/// @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
|
||||
/// 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 on multiple threads) and
|
||||
/// whether we are currently executing synchronous or asynchronous callbacks.
|
||||
///
|
||||
/// @param[in] watch_id
|
||||
/// The watchpoint ID that owns this option set.
|
||||
///
|
||||
/// @return
|
||||
/// The callback return value.
|
||||
//------------------------------------------------------------------
|
||||
bool InvokeCallback (StoppointCallbackContext *context, lldb::user_id_t watch_id);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Used in InvokeCallback to tell whether it is the right time to run this kind of callback.
|
||||
///
|
||||
/// @return
|
||||
/// The synchronicity of our callback.
|
||||
//------------------------------------------------------------------
|
||||
bool IsCallbackSynchronous () {
|
||||
return m_callback_is_synchronous;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Fetch the baton from the callback.
|
||||
///
|
||||
/// @return
|
||||
/// The baton.
|
||||
//------------------------------------------------------------------
|
||||
Baton *GetBaton ();
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Fetch a const version of the baton from the callback.
|
||||
///
|
||||
/// @return
|
||||
/// The baton.
|
||||
//------------------------------------------------------------------
|
||||
const Baton *GetBaton () const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Return the current thread spec for this option. This will return NULL if the no thread
|
||||
/// specifications have been set for this Option yet.
|
||||
/// @return
|
||||
/// The thread specification pointer for this option, or NULL if none has
|
||||
/// been set yet.
|
||||
//------------------------------------------------------------------
|
||||
const ThreadSpec *
|
||||
GetThreadSpecNoCreate () const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Returns a pointer to the ThreadSpec for this option, creating it.
|
||||
/// if it hasn't been created already. This API is used for setting the
|
||||
/// ThreadSpec items for this option.
|
||||
//------------------------------------------------------------------
|
||||
ThreadSpec *
|
||||
GetThreadSpec ();
|
||||
|
||||
void
|
||||
SetThreadID(lldb::tid_t thread_id);
|
||||
|
||||
void
|
||||
GetDescription (Stream *s, lldb::DescriptionLevel level) const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Get description for callback only.
|
||||
//------------------------------------------------------------------
|
||||
void
|
||||
GetCallbackDescription (Stream *s, lldb::DescriptionLevel level) const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Returns true if the watchpoint option has a callback set.
|
||||
//------------------------------------------------------------------
|
||||
bool
|
||||
HasCallback();
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// This is the default empty callback.
|
||||
/// @return
|
||||
/// The thread id for which the watchpoint hit will stop,
|
||||
/// LLDB_INVALID_THREAD_ID for all threads.
|
||||
//------------------------------------------------------------------
|
||||
static bool
|
||||
NullCallback (void *baton,
|
||||
StoppointCallbackContext *context,
|
||||
lldb::user_id_t watch_id);
|
||||
|
||||
|
||||
struct CommandData
|
||||
{
|
||||
CommandData () :
|
||||
user_source(),
|
||||
script_source(),
|
||||
stop_on_error(true)
|
||||
{
|
||||
}
|
||||
|
||||
~CommandData ()
|
||||
{
|
||||
}
|
||||
|
||||
StringList user_source;
|
||||
std::string script_source;
|
||||
bool stop_on_error;
|
||||
};
|
||||
|
||||
class CommandBaton : public Baton
|
||||
{
|
||||
public:
|
||||
CommandBaton (CommandData *data) :
|
||||
Baton (data)
|
||||
{
|
||||
}
|
||||
|
||||
virtual
|
||||
~CommandBaton ()
|
||||
{
|
||||
delete ((CommandData *)m_data);
|
||||
m_data = NULL;
|
||||
}
|
||||
|
||||
virtual void
|
||||
GetDescription (Stream *s, lldb::DescriptionLevel level) const;
|
||||
|
||||
};
|
||||
|
||||
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
|
||||
};
|
||||
|
||||
} // namespace lldb_private
|
||||
|
||||
#endif // liblldb_WatchpointOptions_h_
|
570
include/lldb/Core/Address.h
Normal file
570
include/lldb/Core/Address.h
Normal file
@ -0,0 +1,570 @@
|
||||
//===-- Address.h -----------------------------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef liblldb_Address_h_
|
||||
#define liblldb_Address_h_
|
||||
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
#include <atomic>
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/lldb-private.h"
|
||||
#include "lldb/Symbol/SymbolContextScope.h"
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
/// @class Address Address.h "lldb/Core/Address.h"
|
||||
/// @brief A section + offset based address class.
|
||||
///
|
||||
/// The Address class allows addresses to be relative to a section
|
||||
/// that can move during runtime due to images (executables, shared
|
||||
/// libraries, bundles, 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
|
||||
///
|
||||
/// File addresses represent the virtual addresses that are in the "on
|
||||
/// disk" object files. These virtual addresses are converted to be
|
||||
/// relative to unique sections scoped to the object file so that
|
||||
/// when/if the addresses slide when the images are loaded/unloaded
|
||||
/// in memory, we can easily track these changes without having to
|
||||
/// update every object (compile unit ranges, line tables, function
|
||||
/// address ranges, lexical block and inlined subroutine address
|
||||
/// ranges, global and static variables) each time an image is loaded or
|
||||
/// unloaded.
|
||||
///
|
||||
/// Load addresses represent the virtual addresses where each section
|
||||
/// ends up getting loaded at runtime. Before executing a program, it
|
||||
/// is common for all of the load addresses to be unresolved. When a
|
||||
/// DynamicLoader plug-in receives notification that shared libraries
|
||||
/// have been loaded/unloaded, the load addresses of the main executable
|
||||
/// and any images (shared libraries) will be resolved/unresolved. When
|
||||
/// this happens, breakpoints that are in one of these sections can be
|
||||
/// set/cleared.
|
||||
//----------------------------------------------------------------------
|
||||
class Address
|
||||
{
|
||||
public:
|
||||
//------------------------------------------------------------------
|
||||
/// Dump styles allow the Address::Dump(Stream *,DumpStyle) const
|
||||
/// function to display Address contents in a variety of ways.
|
||||
//------------------------------------------------------------------
|
||||
typedef enum {
|
||||
DumpStyleInvalid, ///< Invalid dump style
|
||||
DumpStyleSectionNameOffset, ///< Display as the section name + offset.
|
||||
///< \code
|
||||
/// // address for printf in libSystem.B.dylib as a section name + offset
|
||||
/// libSystem.B.dylib.__TEXT.__text + 0x0005cfdf
|
||||
/// \endcode
|
||||
DumpStyleSectionPointerOffset, ///< Display as the section pointer + offset (debug output).
|
||||
///< \code
|
||||
/// // address for printf in libSystem.B.dylib as a section pointer + offset
|
||||
/// (lldb::Section *)0x35cc50 + 0x000000000005cfdf \endcode
|
||||
DumpStyleFileAddress, ///< Display as the file address (if any).
|
||||
///< \code
|
||||
/// // 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).
|
||||
///< \code
|
||||
/// // address for printf in libSystem.B.dylib as a file address
|
||||
/// libSystem.B.dylib[0x000000000005dcff] \endcode
|
||||
DumpStyleLoadAddress, ///< Display as the load address (if resolved).
|
||||
///< \code
|
||||
/// // 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
|
||||
///< 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,
|
||||
DumpStyleDetailedSymbolContext, ///< Detailed symbol context information for an address for all symbol
|
||||
///< context members.
|
||||
DumpStyleResolvedPointerDescription ///< Dereference a pointer at 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
|
||||
/// A const Address object reference to copy.
|
||||
//------------------------------------------------------------------
|
||||
Address (const Address& rhs) :
|
||||
m_section_wp (rhs.m_section_wp),
|
||||
m_offset(rhs.m_offset.load())
|
||||
{
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Construct with a section pointer and offset.
|
||||
///
|
||||
/// Initialize the address with the supplied \a section and \a
|
||||
/// offset.
|
||||
///
|
||||
/// @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
|
||||
/// The offset in bytes into \a section.
|
||||
//------------------------------------------------------------------
|
||||
Address (const lldb::SectionSP §ion_sp, lldb::addr_t offset) :
|
||||
m_section_wp (), // Don't init with section_sp in case section_sp is invalid (the weak_ptr will throw)
|
||||
m_offset (offset)
|
||||
{
|
||||
if (section_sp)
|
||||
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
|
||||
/// A virtual file address.
|
||||
///
|
||||
/// @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
|
||||
/// A const Address object reference to copy.
|
||||
///
|
||||
/// @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
|
||||
/// The Left Hand Side const Address object reference.
|
||||
///
|
||||
/// @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
|
||||
//------------------------------------------------------------------
|
||||
static int
|
||||
CompareFileAddress (const Address& lhs, const Address& rhs);
|
||||
|
||||
static int
|
||||
CompareLoadAddress (const Address& lhs, const Address& rhs, Target *target);
|
||||
|
||||
static int
|
||||
CompareModulePointerAndOffset (const Address& lhs, const Address& rhs);
|
||||
|
||||
// For use with std::map, std::multi_map
|
||||
class ModulePointerAndOffsetLessThanFunctionObject
|
||||
{
|
||||
public:
|
||||
ModulePointerAndOffsetLessThanFunctionObject () {}
|
||||
|
||||
bool
|
||||
operator() (const Address& a, const Address& b) const
|
||||
{
|
||||
return Address::CompareModulePointerAndOffset(a, b) < 0;
|
||||
}
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// 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
|
||||
/// The stream to which to dump the object descripton.
|
||||
///
|
||||
/// @param[in] style
|
||||
/// The display style for the address.
|
||||
///
|
||||
/// @param[in] fallback_style
|
||||
/// The display style for the address.
|
||||
///
|
||||
/// @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
|
||||
//------------------------------------------------------------------
|
||||
bool
|
||||
Dump (Stream *s,
|
||||
ExecutionContextScope *exe_scope,
|
||||
DumpStyle style,
|
||||
DumpStyle fallback_style = DumpStyleInvalid,
|
||||
uint32_t addr_byte_size = UINT32_MAX) const;
|
||||
|
||||
lldb::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
|
||||
/// 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 addresses, then it has a virtual address that is
|
||||
/// relative to unique section in the object file. Sections get
|
||||
/// resolved at runtime by DynamicLoader plug-ins as images
|
||||
/// (executables and shared libraries) get loaded/unloaded. If a
|
||||
/// section is loaded, then the load address can be resolved.
|
||||
///
|
||||
/// @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 the address turns out to be in code address, return the
|
||||
/// load address that would be required to call or return to. The
|
||||
/// address might have extra bits set (bit zero will be set to Thumb
|
||||
/// functions for an ARM target) that are required when changing the
|
||||
/// program counter to setting a return address.
|
||||
///
|
||||
/// @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 the address turns out to be in code address, return the
|
||||
/// load address for a an opcode. This address object might have
|
||||
/// extra bits set (bit zero will be set to Thumb functions for an
|
||||
/// ARM target) that are required for changing the program counter
|
||||
/// and this function will remove any bits that are intended for
|
||||
/// these special purposes. The result of this function can be used
|
||||
/// to safely write a software breakpoint trap to memory.
|
||||
///
|
||||
/// @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) const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Get the section relative offset value.
|
||||
///
|
||||
/// @return
|
||||
/// The current offset, or LLDB_INVALID_ADDRESS if this address
|
||||
/// doesn't contain a valid offset.
|
||||
//------------------------------------------------------------------
|
||||
lldb::addr_t
|
||||
GetOffset () const { return m_offset; }
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Check if an address is section offset.
|
||||
///
|
||||
/// When converting a virtual file or load address into a section
|
||||
/// offset based address, we often need to know if, given a section
|
||||
/// list, if the address was able to be converted to section offset.
|
||||
/// This function returns true if the current value contained in
|
||||
/// this object is section offset based.
|
||||
///
|
||||
/// @return
|
||||
/// Returns \b true if the address has a valid section and
|
||||
/// offset, \b false otherwise.
|
||||
//------------------------------------------------------------------
|
||||
bool
|
||||
IsSectionOffset() const
|
||||
{
|
||||
return IsValid() && (GetSection().get() != NULL);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Check if the object state is valid.
|
||||
///
|
||||
/// A valid Address object contains either a section pointer and
|
||||
/// and offset (for section offset based addresses), or just a valid
|
||||
/// offset (for absolute addresses that have no section).
|
||||
///
|
||||
/// @return
|
||||
/// Returns \b true if the the offset is valid, \b false
|
||||
/// otherwise.
|
||||
//------------------------------------------------------------------
|
||||
bool
|
||||
IsValid() const
|
||||
{
|
||||
return m_offset != LLDB_INVALID_ADDRESS;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Get the memory cost of this object.
|
||||
///
|
||||
/// @return
|
||||
/// The number of bytes that this object occupies in memory.
|
||||
//------------------------------------------------------------------
|
||||
size_t
|
||||
MemorySize () const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Resolve a file virtual address using a section list.
|
||||
///
|
||||
/// Given a list of sections, attempt to resolve \a addr as a
|
||||
/// an offset into one of the file sections.
|
||||
///
|
||||
/// @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 contains \a load_addr. If successful, this
|
||||
/// address object will have a 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
|
||||
/// A load address from a current process.
|
||||
///
|
||||
/// @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.
|
||||
///
|
||||
/// @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
|
||||
/// happens for JIT'ed code, or any load addresses on the stack
|
||||
/// or heap.
|
||||
//------------------------------------------------------------------
|
||||
bool
|
||||
SetLoadAddress (lldb::addr_t load_addr, Target *target);
|
||||
|
||||
bool
|
||||
SetOpcodeLoadAddress (lldb::addr_t load_addr, Target *target);
|
||||
|
||||
bool
|
||||
SetCallableLoadAddress (lldb::addr_t load_addr, Target *target);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Get accessor for the module for this address.
|
||||
///
|
||||
/// @return
|
||||
/// Returns the Module pointer that this address is an offset
|
||||
/// in, or NULL if this address doesn't belong in a module, or
|
||||
/// isn't resolved yet.
|
||||
//------------------------------------------------------------------
|
||||
lldb::ModuleSP
|
||||
GetModule () const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Get const accessor for the section.
|
||||
///
|
||||
/// @return
|
||||
/// Returns the const lldb::Section pointer that this address is an
|
||||
/// offset in, or NULL if this address is absolute.
|
||||
//------------------------------------------------------------------
|
||||
lldb::SectionSP
|
||||
GetSection () const { return m_section_wp.lock(); }
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Set accessor for the offset.
|
||||
///
|
||||
/// @param[in] offset
|
||||
/// A new offset value for this object.
|
||||
///
|
||||
/// @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;
|
||||
return changed;
|
||||
}
|
||||
|
||||
void
|
||||
SetRawAddress (lldb::addr_t addr)
|
||||
{
|
||||
m_section_wp.reset();
|
||||
m_offset = addr;
|
||||
}
|
||||
|
||||
bool
|
||||
Slide (int64_t offset)
|
||||
{
|
||||
if (m_offset != LLDB_INVALID_ADDRESS)
|
||||
{
|
||||
m_offset += offset;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Set accessor for the section.
|
||||
///
|
||||
/// @param[in] section
|
||||
/// A new lldb::Section pointer to use as the section base. Can
|
||||
/// be NULL for absolute addresses that are not relative to
|
||||
/// any section.
|
||||
//------------------------------------------------------------------
|
||||
void
|
||||
SetSection (const lldb::SectionSP §ion_sp)
|
||||
{
|
||||
m_section_wp = section_sp;
|
||||
}
|
||||
|
||||
void
|
||||
ClearSection ()
|
||||
{
|
||||
m_section_wp.reset();
|
||||
}
|
||||
//------------------------------------------------------------------
|
||||
/// Reconstruct a symbol context from an address.
|
||||
///
|
||||
/// This class doesn't inherit from SymbolContextScope because many
|
||||
/// address objects have short lifespans. Address objects that are
|
||||
/// section offset can reconstruct their symbol context by looking
|
||||
/// up the address in the module found in the section.
|
||||
///
|
||||
/// @see SymbolContextScope::CalculateSymbolContext(SymbolContext*)
|
||||
//------------------------------------------------------------------
|
||||
uint32_t
|
||||
CalculateSymbolContext (SymbolContext *sc,
|
||||
uint32_t resolve_scope = lldb::eSymbolContextEverything) const;
|
||||
|
||||
lldb::ModuleSP
|
||||
CalculateSymbolContextModule () const;
|
||||
|
||||
CompileUnit *
|
||||
CalculateSymbolContextCompileUnit () const;
|
||||
|
||||
Function *
|
||||
CalculateSymbolContextFunction () const;
|
||||
|
||||
Block *
|
||||
CalculateSymbolContextBlock () const;
|
||||
|
||||
Symbol *
|
||||
CalculateSymbolContextSymbol () const;
|
||||
|
||||
bool
|
||||
CalculateSymbolContextLineEntry (LineEntry &line_entry) const;
|
||||
|
||||
protected:
|
||||
//------------------------------------------------------------------
|
||||
// Member variables.
|
||||
//------------------------------------------------------------------
|
||||
lldb::SectionWP m_section_wp; ///< The section for the address, can be NULL.
|
||||
std::atomic<lldb::addr_t> m_offset; ///< Offset into section if \a m_section_wp is valid...
|
||||
};
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// 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 pointers.
|
||||
//
|
||||
// To sum things up:
|
||||
// - works great for addresses within the same module
|
||||
// - it works for addresses across multiple modules, but don't expect the
|
||||
// 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);
|
||||
bool operator!= (const Address& lhs, const Address& rhs);
|
||||
|
||||
} // namespace lldb_private
|
||||
|
||||
#endif // liblldb_Address_h_
|
284
include/lldb/Core/AddressRange.h
Normal file
284
include/lldb/Core/AddressRange.h
Normal file
@ -0,0 +1,284 @@
|
||||
//===-- AddressRange.h ------------------------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef liblldb_AddressRange_h_
|
||||
#define liblldb_AddressRange_h_
|
||||
|
||||
#include "lldb/Core/Address.h"
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
/// @class AddressRange AddressRange.h "lldb/Core/AddressRange.h"
|
||||
/// @brief 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
|
||||
/// 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
|
||||
/// The offset in bytes into \a section.
|
||||
///
|
||||
/// @param[in] byte_size
|
||||
/// The size in bytes of the address range.
|
||||
//------------------------------------------------------------------
|
||||
AddressRange (const lldb::SectionSP §ion, lldb::addr_t offset, lldb::addr_t byte_size);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Construct with a virtual address, section list and byte size.
|
||||
///
|
||||
/// Initialize and resolve the address with the supplied virtual
|
||||
/// address \a file_addr, and byte size \a byte_size.
|
||||
///
|
||||
/// @param[in] file_addr
|
||||
/// A virtual address.
|
||||
///
|
||||
/// @param[in] byte_size
|
||||
/// The size in bytes of the address range.
|
||||
///
|
||||
/// @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 = NULL);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// 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
|
||||
/// A section offset address object.
|
||||
///
|
||||
/// @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
|
||||
/// A section offset address object reference.
|
||||
///
|
||||
/// @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
|
||||
/// A section offset address object pointer.
|
||||
///
|
||||
/// @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
|
||||
/// A section offset address object reference.
|
||||
///
|
||||
/// @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
|
||||
/// A section offset address object reference.
|
||||
///
|
||||
/// @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
|
||||
/// A section offset address object reference.
|
||||
///
|
||||
/// @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
|
||||
/// A section offset address object reference.
|
||||
///
|
||||
/// @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;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// 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 range, and \a style lets the user choose
|
||||
/// how the base address gets displayed.
|
||||
///
|
||||
/// @param[in] s
|
||||
/// The stream to which to dump the object descripton.
|
||||
///
|
||||
/// @param[in] style
|
||||
/// The display style for the address.
|
||||
///
|
||||
/// @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
|
||||
//------------------------------------------------------------------
|
||||
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 stream \a s.
|
||||
///
|
||||
/// The debug description contains verbose internal state such
|
||||
/// and pointer values, reference counts, etc.
|
||||
///
|
||||
/// @param[in] s
|
||||
/// The stream to which to dump the object descripton.
|
||||
//------------------------------------------------------------------
|
||||
void
|
||||
DumpDebug (Stream *s) const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Get accessor for the base address of the range.
|
||||
///
|
||||
/// @return
|
||||
/// A reference to the base address object.
|
||||
//------------------------------------------------------------------
|
||||
Address &
|
||||
GetBaseAddress() { return m_base_addr; }
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Get const accessor for the base address of the range.
|
||||
///
|
||||
/// @return
|
||||
/// A const reference to the base address object.
|
||||
//------------------------------------------------------------------
|
||||
const Address &
|
||||
GetBaseAddress() const { return m_base_addr; }
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Get accessor for the byte size of this range.
|
||||
///
|
||||
/// @return
|
||||
/// The size in bytes of this address range.
|
||||
//------------------------------------------------------------------
|
||||
lldb::addr_t
|
||||
GetByteSize () const { return m_byte_size; }
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Get the memory cost of this object.
|
||||
///
|
||||
/// @return
|
||||
/// The number of bytes that this object occupies in memory.
|
||||
//------------------------------------------------------------------
|
||||
size_t
|
||||
MemorySize () const {
|
||||
// Noting special for the memory size of a single AddressRange object,
|
||||
// it is just the size of itself.
|
||||
return sizeof(AddressRange);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Set accessor for the byte size of this range.
|
||||
///
|
||||
/// @param[in] byte_size
|
||||
/// The new size in bytes of this address range.
|
||||
//------------------------------------------------------------------
|
||||
void
|
||||
SetByteSize (lldb::addr_t byte_size) { m_byte_size = byte_size; }
|
||||
|
||||
protected:
|
||||
//------------------------------------------------------------------
|
||||
// Member variables
|
||||
//------------------------------------------------------------------
|
||||
Address m_base_addr; ///< The section offset base address of this range.
|
||||
lldb::addr_t m_byte_size; ///< The size in bytes of this address range.
|
||||
};
|
||||
|
||||
//bool operator== (const AddressRange& lhs, const AddressRange& rhs);
|
||||
|
||||
} // namespace lldb_private
|
||||
|
||||
#endif // liblldb_AddressRange_h_
|
89
include/lldb/Core/AddressResolver.h
Normal file
89
include/lldb/Core/AddressResolver.h
Normal file
@ -0,0 +1,89 @@
|
||||
//===-- AddressResolver.h ---------------------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef liblldb_AddressResolver_h_
|
||||
#define liblldb_AddressResolver_h_
|
||||
|
||||
#include <vector>
|
||||
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/lldb-private.h"
|
||||
#include "lldb/Core/Address.h"
|
||||
#include "lldb/Core/AddressRange.h"
|
||||
#include "lldb/Host/FileSpec.h"
|
||||
#include "lldb/Core/SearchFilter.h"
|
||||
#include "lldb/Core/ConstString.h"
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
/// @class AddressResolver AddressResolver.h "lldb/Core/AddressResolver.h"
|
||||
/// @brief 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;
|
||||
|
||||
|
||||
AddressResolver ();
|
||||
|
||||
virtual
|
||||
~AddressResolver ();
|
||||
|
||||
virtual void
|
||||
ResolveAddress (SearchFilter &filter);
|
||||
|
||||
virtual void
|
||||
ResolveAddressInModules (SearchFilter &filter,
|
||||
ModuleList &modules);
|
||||
|
||||
virtual void
|
||||
GetDescription (Stream *s) = 0;
|
||||
|
||||
std::vector<AddressRange> &
|
||||
GetAddressRanges ();
|
||||
|
||||
size_t
|
||||
GetNumberOfAddresses ();
|
||||
|
||||
AddressRange &
|
||||
GetAddressRangeAtIndex (size_t idx);
|
||||
|
||||
protected:
|
||||
|
||||
std::vector<AddressRange> m_address_ranges;
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(AddressResolver);
|
||||
};
|
||||
|
||||
} // namespace lldb_private
|
||||
|
||||
#endif // liblldb_AddressResolver_h_
|
59
include/lldb/Core/AddressResolverFileLine.h
Normal file
59
include/lldb/Core/AddressResolverFileLine.h
Normal file
@ -0,0 +1,59 @@
|
||||
//===-- AddressResolverFileLine.h -------------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef liblldb_AddressResolverFileLine_h_
|
||||
#define liblldb_AddressResolverFileLine_h_
|
||||
|
||||
// Project includes
|
||||
#include "lldb/Core/AddressResolver.h"
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
/// @class AddressResolverFileLine AddressResolverFileLine.h "lldb/Core/AddressResolverFileLine.h"
|
||||
/// @brief 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:
|
||||
|
||||
AddressResolverFileLine (const FileSpec &resolver,
|
||||
uint32_t line_no,
|
||||
bool check_inlines);
|
||||
|
||||
virtual
|
||||
~AddressResolverFileLine ();
|
||||
|
||||
virtual Searcher::CallbackReturn
|
||||
SearchCallback (SearchFilter &filter,
|
||||
SymbolContext &context,
|
||||
Address *addr,
|
||||
bool containing);
|
||||
|
||||
virtual Searcher::Depth
|
||||
GetDepth ();
|
||||
|
||||
virtual void
|
||||
GetDescription (Stream *s);
|
||||
|
||||
protected:
|
||||
FileSpec m_file_spec; // This is the file spec we are looking for.
|
||||
uint32_t m_line_number; // This is the line number that we are looking for.
|
||||
bool m_inlines; // This determines whether the resolver looks for inlined functions or not.
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(AddressResolverFileLine);
|
||||
};
|
||||
|
||||
} // namespace lldb_private
|
||||
|
||||
#endif // liblldb_AddressResolverFileLine_h_
|
68
include/lldb/Core/AddressResolverName.h
Normal file
68
include/lldb/Core/AddressResolverName.h
Normal file
@ -0,0 +1,68 @@
|
||||
//===-- AddressResolverName.h -----------------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef liblldb_AddressResolverName_h_
|
||||
#define liblldb_AddressResolverName_h_
|
||||
|
||||
// Project includes
|
||||
|
||||
#include "lldb/Core/AddressResolver.h"
|
||||
#include "lldb/Core/RegularExpression.h"
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
/// @class AddressResolverName AddressResolverName.h "lldb/Core/AddressResolverName.h"
|
||||
/// @brief This class finds addresses for a given function name, either by exact match
|
||||
/// or by regular expression.
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
class AddressResolverName:
|
||||
public AddressResolver
|
||||
{
|
||||
public:
|
||||
|
||||
AddressResolverName (const char *func_name,
|
||||
AddressResolver::MatchType type = Exact);
|
||||
|
||||
// Creates a function breakpoint by regular expression. Takes over control of the lifespan of func_regex.
|
||||
AddressResolverName (RegularExpression &func_regex);
|
||||
|
||||
AddressResolverName (const char *class_name,
|
||||
const char *method,
|
||||
AddressResolver::MatchType type);
|
||||
|
||||
virtual
|
||||
~AddressResolverName ();
|
||||
|
||||
virtual Searcher::CallbackReturn
|
||||
SearchCallback (SearchFilter &filter,
|
||||
SymbolContext &context,
|
||||
Address *addr,
|
||||
bool containing);
|
||||
|
||||
virtual Searcher::Depth
|
||||
GetDepth ();
|
||||
|
||||
virtual void
|
||||
GetDescription (Stream *s);
|
||||
|
||||
protected:
|
||||
ConstString m_func_name;
|
||||
ConstString m_class_name; // FIXME: Not used yet. The idea would be to stop on methods of this class.
|
||||
RegularExpression m_regex;
|
||||
AddressResolver::MatchType m_match_type;
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(AddressResolverName);
|
||||
};
|
||||
|
||||
} // namespace lldb_private
|
||||
|
||||
#endif // liblldb_AddressResolverName_h_
|
422
include/lldb/Core/ArchSpec.h
Normal file
422
include/lldb/Core/ArchSpec.h
Normal file
@ -0,0 +1,422 @@
|
||||
//===-- ArchSpec.h ----------------------------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef liblldb_ArchSpec_h_
|
||||
#define liblldb_ArchSpec_h_
|
||||
|
||||
#if defined(__cplusplus)
|
||||
|
||||
#include "lldb/lldb-private.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include "llvm/ADT/Triple.h"
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
struct CoreDefinition;
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
/// @class ArchSpec ArchSpec.h "lldb/Core/ArchSpec.h"
|
||||
/// @brief An architecture specification class.
|
||||
///
|
||||
/// A class designed to be created from a cpu type and subtype, a
|
||||
/// string representation, or an llvm::Triple. Keeping all of the
|
||||
/// conversions of strings to architecture enumeration values confined
|
||||
/// to this class allows new architecture support to be added easily.
|
||||
//----------------------------------------------------------------------
|
||||
class ArchSpec
|
||||
{
|
||||
public:
|
||||
enum Core
|
||||
{
|
||||
eCore_arm_generic,
|
||||
eCore_arm_armv4,
|
||||
eCore_arm_armv4t,
|
||||
eCore_arm_armv5,
|
||||
eCore_arm_armv5e,
|
||||
eCore_arm_armv5t,
|
||||
eCore_arm_armv6,
|
||||
eCore_arm_armv7,
|
||||
eCore_arm_armv7f,
|
||||
eCore_arm_armv7s,
|
||||
eCore_arm_armv7k,
|
||||
eCore_arm_armv7m,
|
||||
eCore_arm_armv7em,
|
||||
eCore_arm_xscale,
|
||||
eCore_thumb,
|
||||
eCore_thumbv4t,
|
||||
eCore_thumbv5,
|
||||
eCore_thumbv5e,
|
||||
eCore_thumbv6,
|
||||
eCore_thumbv7,
|
||||
eCore_thumbv7f,
|
||||
eCore_thumbv7s,
|
||||
eCore_thumbv7k,
|
||||
eCore_thumbv7m,
|
||||
eCore_thumbv7em,
|
||||
|
||||
eCore_ppc_generic,
|
||||
eCore_ppc_ppc601,
|
||||
eCore_ppc_ppc602,
|
||||
eCore_ppc_ppc603,
|
||||
eCore_ppc_ppc603e,
|
||||
eCore_ppc_ppc603ev,
|
||||
eCore_ppc_ppc604,
|
||||
eCore_ppc_ppc604e,
|
||||
eCore_ppc_ppc620,
|
||||
eCore_ppc_ppc750,
|
||||
eCore_ppc_ppc7400,
|
||||
eCore_ppc_ppc7450,
|
||||
eCore_ppc_ppc970,
|
||||
|
||||
eCore_ppc64_generic,
|
||||
eCore_ppc64_ppc970_64,
|
||||
|
||||
eCore_sparc_generic,
|
||||
|
||||
eCore_sparc9_generic,
|
||||
|
||||
eCore_x86_32_i386,
|
||||
eCore_x86_32_i486,
|
||||
eCore_x86_32_i486sx,
|
||||
|
||||
eCore_x86_64_x86_64,
|
||||
eCore_uknownMach32,
|
||||
eCore_uknownMach64,
|
||||
kNumCores,
|
||||
|
||||
kCore_invalid,
|
||||
// The following constants are used for wildcard matching only
|
||||
kCore_any,
|
||||
kCore_arm_any,
|
||||
kCore_ppc_any,
|
||||
kCore_ppc64_any,
|
||||
kCore_x86_32_any,
|
||||
|
||||
kCore_arm_first = eCore_arm_generic,
|
||||
kCore_arm_last = eCore_arm_xscale,
|
||||
|
||||
kCore_thumb_first = eCore_thumb,
|
||||
kCore_thumb_last = eCore_thumbv7em,
|
||||
|
||||
kCore_ppc_first = eCore_ppc_generic,
|
||||
kCore_ppc_last = eCore_ppc_ppc970,
|
||||
|
||||
kCore_ppc64_first = eCore_ppc64_generic,
|
||||
kCore_ppc64_last = eCore_ppc64_ppc970_64,
|
||||
|
||||
kCore_x86_32_first = eCore_x86_32_i386,
|
||||
kCore_x86_32_last = eCore_x86_32_i486sx
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Default constructor.
|
||||
///
|
||||
/// Default constructor that initializes the object with invalid
|
||||
/// cpu type and subtype values.
|
||||
//------------------------------------------------------------------
|
||||
ArchSpec ();
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Constructor over triple.
|
||||
///
|
||||
/// Constructs an ArchSpec with properties consistent with the given
|
||||
/// Triple.
|
||||
//------------------------------------------------------------------
|
||||
explicit
|
||||
ArchSpec (const llvm::Triple &triple);
|
||||
explicit
|
||||
ArchSpec (const char *triple_cstr);
|
||||
explicit
|
||||
ArchSpec (const char *triple_cstr, Platform *platform);
|
||||
//------------------------------------------------------------------
|
||||
/// Constructor over architecture name.
|
||||
///
|
||||
/// Constructs an ArchSpec with properties consistent with the given
|
||||
/// object type and architecture name.
|
||||
//------------------------------------------------------------------
|
||||
explicit
|
||||
ArchSpec (ArchitectureType arch_type,
|
||||
uint32_t cpu_type,
|
||||
uint32_t cpu_subtype);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Destructor.
|
||||
//------------------------------------------------------------------
|
||||
~ArchSpec ();
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Assignment operator.
|
||||
///
|
||||
/// @param[in] rhs another ArchSpec object to copy.
|
||||
///
|
||||
/// @return A const reference to this object.
|
||||
//------------------------------------------------------------------
|
||||
const ArchSpec&
|
||||
operator= (const ArchSpec& rhs);
|
||||
|
||||
static size_t
|
||||
AutoComplete (const char *name,
|
||||
StringList &matches);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Returns a static string representing the current architecture.
|
||||
///
|
||||
/// @return A static string correcponding to the current
|
||||
/// architecture.
|
||||
//------------------------------------------------------------------
|
||||
const char *
|
||||
GetArchitectureName () const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Clears the object state.
|
||||
///
|
||||
/// Clears the object state back to a default invalid state.
|
||||
//------------------------------------------------------------------
|
||||
void
|
||||
Clear ();
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Returns the size in bytes of an address of the current
|
||||
/// architecture.
|
||||
///
|
||||
/// @return The byte size of an address of the current architecture.
|
||||
//------------------------------------------------------------------
|
||||
uint32_t
|
||||
GetAddressByteSize () const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Returns a machine family for the current architecture.
|
||||
///
|
||||
/// @return An LLVM arch type.
|
||||
//------------------------------------------------------------------
|
||||
llvm::Triple::ArchType
|
||||
GetMachine () const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Tests if this ArchSpec is valid.
|
||||
///
|
||||
/// @return True if the current architecture is valid, false
|
||||
/// otherwise.
|
||||
//------------------------------------------------------------------
|
||||
bool
|
||||
IsValid () const
|
||||
{
|
||||
return m_core >= eCore_arm_generic && m_core < kNumCores;
|
||||
}
|
||||
|
||||
bool
|
||||
TripleVendorWasSpecified() const
|
||||
{
|
||||
return !m_triple.getVendorName().empty();
|
||||
}
|
||||
|
||||
bool
|
||||
TripleOSWasSpecified() const
|
||||
{
|
||||
return !m_triple.getOSName().empty();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Sets this ArchSpec according to the given architecture name.
|
||||
///
|
||||
/// The architecture name can be one of the generic system default
|
||||
/// values:
|
||||
///
|
||||
/// @li \c LLDB_ARCH_DEFAULT - The arch the current system defaults
|
||||
/// to when a program is launched without any extra
|
||||
/// attributes or settings.
|
||||
/// @li \c LLDB_ARCH_DEFAULT_32BIT - The default host architecture
|
||||
/// for 32 bit (if any).
|
||||
/// @li \c LLDB_ARCH_DEFAULT_64BIT - The default host architecture
|
||||
/// for 64 bit (if any).
|
||||
///
|
||||
/// Alternatively, if the object type of this ArchSpec has been
|
||||
/// configured, a concrete architecture can be specified to set
|
||||
/// the CPU type ("x86_64" for example).
|
||||
///
|
||||
/// Finally, an encoded object and archetecture format is accepted.
|
||||
/// The format contains an object type (like "macho" or "elf"),
|
||||
/// followed by a platform dependent encoding of CPU type and
|
||||
/// subtype. For example:
|
||||
///
|
||||
/// "macho" : Specifies an object type of MachO.
|
||||
/// "macho-16-6" : MachO specific encoding for ARMv6.
|
||||
/// "elf-43 : ELF specific encoding for Sparc V9.
|
||||
///
|
||||
/// @param[in] arch_name The name of an architecture.
|
||||
///
|
||||
/// @return True if @p arch_name was successfully translated, false
|
||||
/// otherwise.
|
||||
//------------------------------------------------------------------
|
||||
// bool
|
||||
// SetArchitecture (const llvm::StringRef& arch_name);
|
||||
//
|
||||
// bool
|
||||
// SetArchitecture (const char *arch_name);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Change the architecture object type and CPU type.
|
||||
///
|
||||
/// @param[in] arch_type The object type of this ArchSpec.
|
||||
///
|
||||
/// @param[in] cpu The required CPU type.
|
||||
///
|
||||
/// @return True if the object and CPU type were sucessfully set.
|
||||
//------------------------------------------------------------------
|
||||
bool
|
||||
SetArchitecture (ArchitectureType arch_type,
|
||||
uint32_t cpu,
|
||||
uint32_t sub);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Returns the byte order for the architecture specification.
|
||||
///
|
||||
/// @return The endian enumeration for the current endianness of
|
||||
/// the architecture specification
|
||||
//------------------------------------------------------------------
|
||||
lldb::ByteOrder
|
||||
GetByteOrder () const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Sets this ArchSpec's byte order.
|
||||
///
|
||||
/// In the common case there is no need to call this method as the
|
||||
/// byte order can almost always be determined by the architecture.
|
||||
/// However, many CPU's are bi-endian (ARM, Alpha, PowerPC, etc)
|
||||
/// and the default/assumed byte order may be incorrect.
|
||||
//------------------------------------------------------------------
|
||||
void
|
||||
SetByteOrder (lldb::ByteOrder byte_order)
|
||||
{
|
||||
m_byte_order = byte_order;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
GetMinimumOpcodeByteSize() const;
|
||||
|
||||
uint32_t
|
||||
GetMaximumOpcodeByteSize() const;
|
||||
|
||||
Core
|
||||
GetCore () const
|
||||
{
|
||||
return m_core;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
GetMachOCPUType () const;
|
||||
|
||||
uint32_t
|
||||
GetMachOCPUSubType () const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Architecture tripple accessor.
|
||||
///
|
||||
/// @return A triple describing this ArchSpec.
|
||||
//------------------------------------------------------------------
|
||||
llvm::Triple &
|
||||
GetTriple ()
|
||||
{
|
||||
return m_triple;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Architecture tripple accessor.
|
||||
///
|
||||
/// @return A triple describing this ArchSpec.
|
||||
//------------------------------------------------------------------
|
||||
const llvm::Triple &
|
||||
GetTriple () const
|
||||
{
|
||||
return m_triple;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Architecture tripple setter.
|
||||
///
|
||||
/// Configures this ArchSpec according to the given triple. If the
|
||||
/// triple has unknown components in all of the vendor, OS, and
|
||||
/// the optional environment field (i.e. "i386-unknown-unknown")
|
||||
/// then default values are taken from the host. Architecture and
|
||||
/// environment components are used to further resolve the CPU type
|
||||
/// and subtype, endian characteristics, etc.
|
||||
///
|
||||
/// @return A triple describing this ArchSpec.
|
||||
//------------------------------------------------------------------
|
||||
bool
|
||||
SetTriple (const llvm::Triple &triple);
|
||||
|
||||
bool
|
||||
SetTriple (const char *triple_cstr);
|
||||
|
||||
bool
|
||||
SetTriple (const char *triple_cstr,
|
||||
Platform *platform);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Returns the default endianness of the architecture.
|
||||
///
|
||||
/// @return The endian enumeration for the default endianness of
|
||||
/// the architecture.
|
||||
//------------------------------------------------------------------
|
||||
lldb::ByteOrder
|
||||
GetDefaultEndian () const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Compare an ArchSpec to another ArchSpec, requiring an exact cpu
|
||||
/// type match between them.
|
||||
/// e.g. armv7s is not an exact match with armv7 - this would return false
|
||||
///
|
||||
/// @return true if the two ArchSpecs match.
|
||||
//------------------------------------------------------------------
|
||||
bool
|
||||
IsExactMatch (const ArchSpec& rhs) const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Compare an ArchSpec to another ArchSpec, requiring a compatible
|
||||
/// cpu type match between them.
|
||||
/// e.g. armv7s is compatible with armv7 - this method would return true
|
||||
///
|
||||
/// @return true if the two ArchSpecs are compatible
|
||||
//------------------------------------------------------------------
|
||||
bool
|
||||
IsCompatibleMatch (const ArchSpec& rhs) const;
|
||||
|
||||
protected:
|
||||
bool
|
||||
IsEqualTo (const ArchSpec& rhs, bool exact_match) const;
|
||||
|
||||
llvm::Triple m_triple;
|
||||
Core m_core;
|
||||
lldb::ByteOrder m_byte_order;
|
||||
|
||||
// Called when m_def or m_entry are changed. Fills in all remaining
|
||||
// members with default values.
|
||||
void
|
||||
CoreUpdated (bool update_triple);
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// @fn bool operator< (const ArchSpec& lhs, const ArchSpec& rhs)
|
||||
/// @brief Less than operator.
|
||||
///
|
||||
/// Tests two ArchSpec objects to see if \a lhs is less than \a
|
||||
/// rhs.
|
||||
///
|
||||
/// @param[in] lhs The Left Hand Side ArchSpec object to compare.
|
||||
/// @param[in] rhs The Left Hand Side ArchSpec object to compare.
|
||||
///
|
||||
/// @return true if \a lhs is less than \a rhs
|
||||
//------------------------------------------------------------------
|
||||
bool operator< (const ArchSpec& lhs, const ArchSpec& rhs);
|
||||
|
||||
} // namespace lldb_private
|
||||
|
||||
#endif // #if defined(__cplusplus)
|
||||
#endif // #ifndef liblldb_ArchSpec_h_
|
62
include/lldb/Core/Baton.h
Normal file
62
include/lldb/Core/Baton.h
Normal file
@ -0,0 +1,62 @@
|
||||
//===-- Baton.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_Baton_h_
|
||||
#define lldb_Baton_h_
|
||||
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/lldb-public.h"
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
/// @class Baton Baton.h "lldb/Core/Baton.h"
|
||||
/// @brief A class designed to wrap callback batons so they can cleanup
|
||||
/// any acquired resources
|
||||
///
|
||||
/// This class is designed to be used by any objects that have a
|
||||
/// callback function that takes a baton where the baton might need to
|
||||
/// free/delete/close itself.
|
||||
///
|
||||
/// The default behavior is to not free anything. Subclasses can
|
||||
/// free any needed resources in their destructors.
|
||||
//----------------------------------------------------------------------
|
||||
class Baton
|
||||
{
|
||||
public:
|
||||
explicit Baton(void *p) :
|
||||
m_data (p)
|
||||
{
|
||||
}
|
||||
|
||||
virtual
|
||||
~Baton()
|
||||
{
|
||||
// The default destructor for a baton does NOT attempt to clean up
|
||||
// anything in m_baton
|
||||
}
|
||||
|
||||
virtual void
|
||||
GetDescription (Stream *s, lldb::DescriptionLevel level) const;
|
||||
|
||||
void *m_data; // Leave baton public for easy access
|
||||
|
||||
private:
|
||||
//------------------------------------------------------------------
|
||||
// For Baton only
|
||||
//------------------------------------------------------------------
|
||||
DISALLOW_COPY_AND_ASSIGN (Baton);
|
||||
};
|
||||
|
||||
} // namespace lldb_private
|
||||
|
||||
#endif // lldb_Baton_h_
|
475
include/lldb/Core/Broadcaster.h
Normal file
475
include/lldb/Core/Broadcaster.h
Normal file
@ -0,0 +1,475 @@
|
||||
//===-- Broadcaster.h -------------------------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef liblldb_Broadcaster_h_
|
||||
#define liblldb_Broadcaster_h_
|
||||
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/lldb-private.h"
|
||||
//#include "lldb/Core/Flags.h"
|
||||
#include "lldb/Core/ConstString.h"
|
||||
#include "lldb/Core/Listener.h"
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// lldb::BroadcastEventSpec
|
||||
//
|
||||
// This class is used to specify a kind of event to register for. The Debugger
|
||||
// maintains a list of BroadcastEventSpec's and when it is made
|
||||
//----------------------------------------------------------------------
|
||||
class BroadcastEventSpec
|
||||
{
|
||||
public:
|
||||
BroadcastEventSpec (const ConstString &broadcaster_class, uint32_t event_bits) :
|
||||
m_broadcaster_class (broadcaster_class),
|
||||
m_event_bits (event_bits)
|
||||
{
|
||||
}
|
||||
|
||||
BroadcastEventSpec (const BroadcastEventSpec &rhs);
|
||||
|
||||
~BroadcastEventSpec() {}
|
||||
|
||||
const ConstString &GetBroadcasterClass() const
|
||||
{
|
||||
return m_broadcaster_class;
|
||||
}
|
||||
|
||||
uint32_t GetEventBits () const
|
||||
{
|
||||
return m_event_bits;
|
||||
}
|
||||
|
||||
// Tell whether this BroadcastEventSpec is contained in in_spec.
|
||||
// That is:
|
||||
// (a) the two spec's share the same broadcaster class
|
||||
// (b) the event bits of this spec are wholly contained in those of in_spec.
|
||||
bool IsContainedIn (BroadcastEventSpec in_spec) const
|
||||
{
|
||||
if (m_broadcaster_class != in_spec.GetBroadcasterClass())
|
||||
return false;
|
||||
uint32_t in_bits = in_spec.GetEventBits();
|
||||
if (in_bits == m_event_bits)
|
||||
return true;
|
||||
else
|
||||
{
|
||||
if ((m_event_bits & in_bits) != 0
|
||||
&& (m_event_bits & ~in_bits) == 0)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool operator< (const BroadcastEventSpec &rhs) const;
|
||||
const BroadcastEventSpec &operator= (const BroadcastEventSpec &rhs);
|
||||
|
||||
private:
|
||||
ConstString m_broadcaster_class;
|
||||
uint32_t m_event_bits;
|
||||
};
|
||||
|
||||
class BroadcasterManager
|
||||
{
|
||||
public:
|
||||
friend class Listener;
|
||||
|
||||
BroadcasterManager ();
|
||||
|
||||
~BroadcasterManager () {}
|
||||
|
||||
uint32_t
|
||||
RegisterListenerForEvents (Listener &listener, BroadcastEventSpec event_spec);
|
||||
|
||||
bool
|
||||
UnregisterListenerForEvents (Listener &listener, BroadcastEventSpec event_spec);
|
||||
|
||||
Listener *
|
||||
GetListenerForEventSpec (BroadcastEventSpec event_spec) const;
|
||||
|
||||
void
|
||||
SignUpListenersForBroadcaster (Broadcaster &broadcaster);
|
||||
|
||||
void
|
||||
RemoveListener (Listener &Listener);
|
||||
|
||||
protected:
|
||||
void Clear();
|
||||
|
||||
private:
|
||||
typedef std::pair<BroadcastEventSpec, Listener *> event_listener_key;
|
||||
typedef std::map<BroadcastEventSpec, Listener *> collection;
|
||||
typedef std::set<Listener *> listener_collection;
|
||||
collection m_event_map;
|
||||
listener_collection m_listeners;
|
||||
|
||||
Mutex m_manager_mutex;
|
||||
|
||||
// A couple of comparator classes for find_if:
|
||||
|
||||
class BroadcasterClassMatches
|
||||
{
|
||||
public:
|
||||
BroadcasterClassMatches (const ConstString &broadcaster_class) :
|
||||
m_broadcaster_class (broadcaster_class)
|
||||
{
|
||||
}
|
||||
|
||||
~BroadcasterClassMatches () {}
|
||||
|
||||
bool operator() (const event_listener_key input) const
|
||||
{
|
||||
return (input.first.GetBroadcasterClass() == m_broadcaster_class);
|
||||
}
|
||||
|
||||
private:
|
||||
ConstString m_broadcaster_class;
|
||||
};
|
||||
|
||||
class BroadcastEventSpecMatches
|
||||
{
|
||||
public:
|
||||
BroadcastEventSpecMatches (BroadcastEventSpec broadcaster_spec) :
|
||||
m_broadcaster_spec (broadcaster_spec)
|
||||
{
|
||||
}
|
||||
|
||||
~BroadcastEventSpecMatches () {}
|
||||
|
||||
bool operator() (const event_listener_key input) const
|
||||
{
|
||||
return (input.first.IsContainedIn (m_broadcaster_spec));
|
||||
}
|
||||
|
||||
private:
|
||||
BroadcastEventSpec m_broadcaster_spec;
|
||||
};
|
||||
|
||||
class ListenerMatchesAndSharedBits
|
||||
{
|
||||
public:
|
||||
ListenerMatchesAndSharedBits (BroadcastEventSpec broadcaster_spec,
|
||||
const Listener &listener) :
|
||||
m_broadcaster_spec (broadcaster_spec),
|
||||
m_listener (&listener)
|
||||
{
|
||||
}
|
||||
|
||||
~ListenerMatchesAndSharedBits () {}
|
||||
|
||||
bool operator() (const event_listener_key input) const
|
||||
{
|
||||
return (input.first.GetBroadcasterClass() == m_broadcaster_spec.GetBroadcasterClass()
|
||||
&& (input.first.GetEventBits() & m_broadcaster_spec.GetEventBits()) != 0
|
||||
&& input.second == m_listener);
|
||||
}
|
||||
|
||||
private:
|
||||
BroadcastEventSpec m_broadcaster_spec;
|
||||
const Listener *m_listener;
|
||||
};
|
||||
|
||||
class ListenerMatches
|
||||
{
|
||||
public:
|
||||
ListenerMatches (const Listener &in_listener) :
|
||||
m_listener (&in_listener)
|
||||
{
|
||||
}
|
||||
|
||||
~ListenerMatches() {}
|
||||
|
||||
bool operator () (const event_listener_key input) const
|
||||
{
|
||||
if (input.second == m_listener)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
private:
|
||||
const Listener *m_listener;
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
/// @class Broadcaster Broadcaster.h "lldb/Core/Broadcaster.h"
|
||||
/// @brief An event broadcasting class.
|
||||
///
|
||||
/// The Broadcaster class is designed to be subclassed by objects that
|
||||
/// wish to vend events in a multi-threaded environment. Broadcaster
|
||||
/// objects can each vend 32 events. Each event is represented by a bit
|
||||
/// in a 32 bit value and these bits can be set:
|
||||
/// @see Broadcaster::SetEventBits(uint32_t)
|
||||
/// or cleared:
|
||||
/// @see Broadcaster::ResetEventBits(uint32_t)
|
||||
/// When an event gets set the Broadcaster object will notify the
|
||||
/// Listener object that is listening for the event (if there is one).
|
||||
///
|
||||
/// Subclasses should provide broadcast bit definitions for any events
|
||||
/// they vend, typically using an enumeration:
|
||||
/// \code
|
||||
/// class Foo : public Broadcaster
|
||||
/// {
|
||||
/// public:
|
||||
/// //----------------------------------------------------------
|
||||
/// // Broadcaster event bits definitions.
|
||||
/// //----------------------------------------------------------
|
||||
/// enum
|
||||
/// {
|
||||
/// eBroadcastBitStateChanged = (1 << 0),
|
||||
/// eBroadcastBitInterrupt = (1 << 1),
|
||||
/// eBroadcastBitSTDOUT = (1 << 2),
|
||||
/// eBroadcastBitSTDERR = (1 << 3),
|
||||
/// eBroadcastBitProfileData = (1 << 4)
|
||||
/// };
|
||||
/// \endcode
|
||||
//----------------------------------------------------------------------
|
||||
class Broadcaster
|
||||
{
|
||||
public:
|
||||
//------------------------------------------------------------------
|
||||
/// Construct with a broadcaster with a name.
|
||||
///
|
||||
/// @param[in] name
|
||||
/// A NULL terminated C string that contains the name of the
|
||||
/// broadcaster object.
|
||||
//------------------------------------------------------------------
|
||||
Broadcaster (BroadcasterManager *manager, const char *name);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Destructor.
|
||||
///
|
||||
/// The destructor is virtual since this class gets subclassed.
|
||||
//------------------------------------------------------------------
|
||||
virtual
|
||||
~Broadcaster();
|
||||
|
||||
void
|
||||
CheckInWithManager ();
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Broadcast an event which has no associated data.
|
||||
///
|
||||
/// @param[in] event_type
|
||||
/// The element from the enum defining this broadcaster's events
|
||||
/// that is being broadcast.
|
||||
///
|
||||
/// @param[in] event_data
|
||||
/// User event data that will be owned by the lldb::Event that
|
||||
/// is created internally.
|
||||
///
|
||||
/// @param[in] unique
|
||||
/// If true, then only add an event of this type if there isn't
|
||||
/// one already in the queue.
|
||||
///
|
||||
//------------------------------------------------------------------
|
||||
void
|
||||
BroadcastEvent (lldb::EventSP &event_sp);
|
||||
|
||||
void
|
||||
BroadcastEventIfUnique (lldb::EventSP &event_sp);
|
||||
|
||||
void
|
||||
BroadcastEvent (uint32_t event_type, EventData *event_data = NULL);
|
||||
|
||||
void
|
||||
BroadcastEventIfUnique (uint32_t event_type, EventData *event_data = NULL);
|
||||
|
||||
void
|
||||
Clear();
|
||||
|
||||
virtual void
|
||||
AddInitialEventsToListener (Listener *listener, uint32_t requested_events);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Listen for any events specified by \a event_mask.
|
||||
///
|
||||
/// Only one listener can listen to each event bit in a given
|
||||
/// Broadcaster. Once a listener has acquired an event bit, no
|
||||
/// other broadcaster will have access to it until it is
|
||||
/// relinquished by the first listener that gets it. The actual
|
||||
/// event bits that get acquired by \a listener may be different
|
||||
/// from what is requested in \a event_mask, and to track this the
|
||||
/// actual event bits that are acquired get returned.
|
||||
///
|
||||
/// @param[in] listener
|
||||
/// The Listener object that wants to monitor the events that
|
||||
/// get broadcast by this object.
|
||||
///
|
||||
/// @param[in] event_mask
|
||||
/// A bit mask that indicates which events the listener is
|
||||
/// asking to monitor.
|
||||
///
|
||||
/// @return
|
||||
/// The actual event bits that were acquired by \a listener.
|
||||
//------------------------------------------------------------------
|
||||
uint32_t
|
||||
AddListener (Listener* listener, uint32_t event_mask);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Get the NULL terminated C string name of this Broadcaster
|
||||
/// object.
|
||||
///
|
||||
/// @return
|
||||
/// The NULL terminated C string name of this Broadcaster.
|
||||
//------------------------------------------------------------------
|
||||
const ConstString &
|
||||
GetBroadcasterName ();
|
||||
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Get the event name(s) for one or more event bits.
|
||||
///
|
||||
/// @param[in] event_mask
|
||||
/// A bit mask that indicates which events to get names for.
|
||||
///
|
||||
/// @return
|
||||
/// The NULL terminated C string name of this Broadcaster.
|
||||
//------------------------------------------------------------------
|
||||
bool
|
||||
GetEventNames (Stream &s, const uint32_t event_mask, bool prefix_with_broadcaster_name) const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Set the name for an event bit.
|
||||
///
|
||||
/// @param[in] event_mask
|
||||
/// A bit mask that indicates which events the listener is
|
||||
/// asking to monitor.
|
||||
///
|
||||
/// @return
|
||||
/// The NULL terminated C string name of this Broadcaster.
|
||||
//------------------------------------------------------------------
|
||||
void
|
||||
SetEventName (uint32_t event_mask, const char *name)
|
||||
{
|
||||
m_event_names[event_mask] = name;
|
||||
}
|
||||
|
||||
const char *
|
||||
GetEventName (uint32_t event_mask) const
|
||||
{
|
||||
event_names_map::const_iterator pos = m_event_names.find (event_mask);
|
||||
if (pos != m_event_names.end())
|
||||
return pos->second.c_str();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool
|
||||
EventTypeHasListeners (uint32_t event_type);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Removes a Listener from this broadcasters list and frees the
|
||||
/// event bits specified by \a event_mask that were previously
|
||||
/// acquired by \a listener (assuming \a listener was listening to
|
||||
/// this object) for other listener objects to use.
|
||||
///
|
||||
/// @param[in] listener
|
||||
/// A Listener object that previously called AddListener.
|
||||
///
|
||||
/// @param[in] event_mask
|
||||
/// The event bits \a listener wishes to relinquish.
|
||||
///
|
||||
/// @return
|
||||
/// \b True if the listener was listening to this broadcaster
|
||||
/// and was removed, \b false otherwise.
|
||||
///
|
||||
/// @see uint32_t Broadcaster::AddListener (Listener*, uint32_t)
|
||||
//------------------------------------------------------------------
|
||||
bool
|
||||
RemoveListener (Listener* listener, uint32_t event_mask = UINT32_MAX);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Provides a simple mechanism to temporarily redirect events from
|
||||
/// broadcaster. When you call this function passing in a listener and
|
||||
/// event type mask, all events from the broadcaster matching the mask
|
||||
/// will now go to the hijacking listener.
|
||||
/// Only one hijack can occur at a time. If we need more than this we
|
||||
/// will have to implement a Listener stack.
|
||||
///
|
||||
/// @param[in] listener
|
||||
/// A Listener object. You do not need to call StartListeningForEvents
|
||||
/// for this broadcaster (that would fail anyway since the event bits
|
||||
/// would most likely be taken by the listener(s) you are usurping.
|
||||
///
|
||||
/// @param[in] event_mask
|
||||
/// The event bits \a listener wishes to hijack.
|
||||
///
|
||||
/// @return
|
||||
/// \b True if the event mask could be hijacked, \b false otherwise.
|
||||
///
|
||||
/// @see uint32_t Broadcaster::AddListener (Listener*, uint32_t)
|
||||
//------------------------------------------------------------------
|
||||
bool
|
||||
HijackBroadcaster (Listener *listener, uint32_t event_mask = UINT32_MAX);
|
||||
|
||||
bool
|
||||
IsHijackedForEvent (uint32_t event_mask)
|
||||
{
|
||||
if (m_hijacking_listeners.size() > 0)
|
||||
return (event_mask & m_hijacking_masks.back()) != 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Restore the state of the Broadcaster from a previous hijack attempt.
|
||||
///
|
||||
//------------------------------------------------------------------
|
||||
void
|
||||
RestoreBroadcaster ();
|
||||
|
||||
// This needs to be filled in if you are going to register the broadcaster with the broadcaster
|
||||
// manager and do broadcaster class matching.
|
||||
// FIXME: Probably should make a ManagedBroadcaster subclass with all the bits needed to work
|
||||
// with the BroadcasterManager, so that it is clearer how to add one.
|
||||
virtual ConstString &GetBroadcasterClass() const;
|
||||
|
||||
BroadcasterManager *GetManager();
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
void
|
||||
PrivateBroadcastEvent (lldb::EventSP &event_sp, bool unique);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// Classes that inherit from Broadcaster can see and modify these
|
||||
//------------------------------------------------------------------
|
||||
typedef std::vector< std::pair<Listener*,uint32_t> > collection;
|
||||
typedef std::map<uint32_t, std::string> event_names_map;
|
||||
// Prefix the name of our member variables with "m_broadcaster_"
|
||||
// since this is a class that gets subclassed.
|
||||
const ConstString m_broadcaster_name; ///< The name of this broadcaster object.
|
||||
event_names_map m_event_names; ///< Optionally define event names for readability and logging for each event bit
|
||||
collection m_listeners; ///< A list of Listener / event_mask pairs that are listening to this broadcaster.
|
||||
Mutex m_listeners_mutex; ///< A mutex that protects \a m_listeners.
|
||||
std::vector<Listener *> m_hijacking_listeners; // A simple mechanism to intercept events from a broadcaster
|
||||
std::vector<uint32_t> m_hijacking_masks; // At some point we may want to have a stack or Listener
|
||||
// collections, but for now this is just for private hijacking.
|
||||
BroadcasterManager *m_manager;
|
||||
|
||||
private:
|
||||
//------------------------------------------------------------------
|
||||
// For Broadcaster only
|
||||
//------------------------------------------------------------------
|
||||
DISALLOW_COPY_AND_ASSIGN (Broadcaster);
|
||||
};
|
||||
|
||||
} // namespace lldb_private
|
||||
|
||||
#endif // liblldb_Broadcaster_h_
|
136
include/lldb/Core/ClangForward.h
Normal file
136
include/lldb/Core/ClangForward.h
Normal file
@ -0,0 +1,136 @@
|
||||
//===-- ClangForward.h ------------------------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef liblldb_ClangForward_h_
|
||||
#define liblldb_ClangForward_h_
|
||||
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
|
||||
#if defined(__cplusplus)
|
||||
|
||||
namespace clang
|
||||
{
|
||||
namespace Builtin
|
||||
{
|
||||
class Context;
|
||||
}
|
||||
|
||||
class Action;
|
||||
class ASTConsumer;
|
||||
class ASTContext;
|
||||
class ASTRecordLayout;
|
||||
class AddrLabelExpr;
|
||||
class AnalyzerOptions;
|
||||
class BinaryOperator;
|
||||
class ClassTemplateDecl;
|
||||
class ClassTemplateSpecializationDecl;
|
||||
class CodeGenOptions;
|
||||
class CodeGenerator;
|
||||
class CompilerInstance;
|
||||
class CompoundStmt;
|
||||
class CXXBaseSpecifier;
|
||||
class CXXBoolLiteralExpr;
|
||||
class CXXFunctionalCastExpr;
|
||||
class CXXMethodDecl;
|
||||
class CXXNamedCastExpr;
|
||||
class CXXRecordDecl;
|
||||
class CXXThisExpr;
|
||||
class CharacterLiteral;
|
||||
class CompoundAssignOperator;
|
||||
class Decl;
|
||||
class DeclarationName;
|
||||
class DeclaratorDecl;
|
||||
class DeclContext;
|
||||
class DeclRefExpr;
|
||||
class DeclStmt;
|
||||
class DependencyOutputOptions;
|
||||
class Diagnostic;
|
||||
class DiagnosticConsumer;
|
||||
class DiagnosticsEngine;
|
||||
class DiagnosticOptions;
|
||||
class EnumDecl;
|
||||
class Expr;
|
||||
class ExternalASTSource;
|
||||
class ExtVectorElementExpr;
|
||||
class FieldDecl;
|
||||
class FileManager;
|
||||
class FileSystemOptions;
|
||||
class FloatingLiteral;
|
||||
class FrontendOptions;
|
||||
class FunctionDecl;
|
||||
class FunctionTemplateDecl;
|
||||
class FunctionTemplateSpecializationInfo;
|
||||
class GotoStmt;
|
||||
class HeaderSearchOptions;
|
||||
class IdentifierTable;
|
||||
class IntegerLiteral;
|
||||
class LabelStmt;
|
||||
class LangOptions;
|
||||
class MemberExpr;
|
||||
class NamedDecl;
|
||||
class NamespaceDecl;
|
||||
class NonTypeTemplateParmDecl;
|
||||
class ObjCEncodeExpr;
|
||||
class ObjCImplicitSetterGetterRefExpr;
|
||||
class ObjCInterfaceDecl;
|
||||
class ObjCIvarDecl;
|
||||
class ObjCIvarRefExpr;
|
||||
class ObjCMessageExpr;
|
||||
class ObjCMethodDecl;
|
||||
class ObjCPropertyRefExpr;
|
||||
class ObjCProtocolDecl;
|
||||
class ObjCProtocolExpr;
|
||||
class ObjCSelectorExpr;
|
||||
class ObjCSuperExpr;
|
||||
class ParenExpr;
|
||||
class ParmVarDecl;
|
||||
class PredefinedExpr;
|
||||
class PreprocessorOptions;
|
||||
class PreprocessorOutputOptions;
|
||||
class QualType;
|
||||
class QualifiedNameType;
|
||||
class RecordDecl;
|
||||
class SelectorTable;
|
||||
class SizeOfAlignOfExpr;
|
||||
class SourceLocation;
|
||||
class SourceManager;
|
||||
class Stmt;
|
||||
class StmtIteratorBase;
|
||||
class StringLiteral;
|
||||
class TagDecl;
|
||||
class TargetInfo;
|
||||
class TargetOptions;
|
||||
class TemplateArgument;
|
||||
class TemplateDecl;
|
||||
class TemplateParameterList;
|
||||
class TemplateTemplateParmDecl;
|
||||
class TemplateTypeParmDecl;
|
||||
class TextDiagnosticBuffer;
|
||||
class TranslationUnitDecl;
|
||||
class Type;
|
||||
class TypeDecl;
|
||||
class TypedefDecl;
|
||||
class TypesCompatibleExpr;
|
||||
class UnaryOperator;
|
||||
class ValueDecl;
|
||||
class VarDecl;
|
||||
struct PrintingPolicy;
|
||||
}
|
||||
|
||||
namespace llvm
|
||||
{
|
||||
class LLVMContext;
|
||||
class ExecutionEngine;
|
||||
}
|
||||
|
||||
#endif // #if defined(__cplusplus)
|
||||
#endif // liblldb_ClangForward_h_
|
413
include/lldb/Core/Communication.h
Normal file
413
include/lldb/Core/Communication.h
Normal file
@ -0,0 +1,413 @@
|
||||
//===-- Communication.h -----------------------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef liblldb_Communication_h_
|
||||
#define liblldb_Communication_h_
|
||||
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
#include <string>
|
||||
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/lldb-private.h"
|
||||
#include "lldb/Core/Broadcaster.h"
|
||||
#include "lldb/Core/Error.h"
|
||||
#include "lldb/Host/Mutex.h"
|
||||
#include "lldb/lldb-private.h"
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
/// @class Communication Communication.h "lldb/Core/Communication.h"
|
||||
/// @brief An abstract communications class.
|
||||
///
|
||||
/// Communication is an class that handles data communication
|
||||
/// between two data sources. It uses a Connection class to do the
|
||||
/// real communication. This approach has a couple of advantages: it
|
||||
/// allows a single instance of this class to be used even though its
|
||||
/// connection can change. Connections could negotiate for different
|
||||
/// connections based on abilities like starting with Bluetooth and
|
||||
/// negotiating up to WiFi if available. It also allows this class to be
|
||||
/// subclassed by any interfaces that don't want to give bytes but want
|
||||
/// to validate and give out packets. This can be done by overriding:
|
||||
///
|
||||
/// AppendBytesToCache (const uint8_t *src, size_t src_len, bool broadcast);
|
||||
///
|
||||
/// Communication inherits from Broadcaster which means it can be
|
||||
/// used in conjunction with Listener to wait for multiple broadcaster
|
||||
/// objects and multiple events from each of those objects.
|
||||
/// Communication defines a set of pre-defined event bits (see
|
||||
/// enumerations definitions that start with "eBroadcastBit" below).
|
||||
///
|
||||
/// There are two modes in which communications can occur:
|
||||
/// @li single-threaded
|
||||
/// @li multi-threaded
|
||||
///
|
||||
/// In single-threaded mode, all reads and writes happen synchronously
|
||||
/// on the calling thread.
|
||||
///
|
||||
/// In multi-threaded mode, a read thread is spawned that continually
|
||||
/// reads data and caches any received bytes. To start the read thread
|
||||
/// clients call:
|
||||
///
|
||||
/// bool Communication::StartReadThread (Error *);
|
||||
///
|
||||
/// If true is returned a read thead has been spawned that will
|
||||
/// continually execute a call to the pure virtual DoRead function:
|
||||
///
|
||||
/// size_t Communication::ReadFromConnection (void *, size_t, uint32_t);
|
||||
///
|
||||
/// When bytes are received the data gets cached in \a m_bytes and this
|
||||
/// class will broadcast a \b eBroadcastBitReadThreadGotBytes event.
|
||||
/// Clients that want packet based communication should override
|
||||
/// AppendBytesToCache. The subclasses can choose to call the
|
||||
/// built in AppendBytesToCache with the \a broadcast parameter set to
|
||||
/// false. This will cause the \b eBroadcastBitReadThreadGotBytes event
|
||||
/// not get broadcast, and then the subclass can post a \b
|
||||
/// eBroadcastBitPacketAvailable event when a full packet of data has
|
||||
/// been received.
|
||||
///
|
||||
/// If the connection is disconnected a \b eBroadcastBitDisconnected
|
||||
/// event gets broadcast. If the read thread exits a \b
|
||||
/// eBroadcastBitReadThreadDidExit event will be broadcast. Clients
|
||||
/// can also post a \b eBroadcastBitReadThreadShouldExit event to this
|
||||
/// object which will cause the read thread to exit.
|
||||
//----------------------------------------------------------------------
|
||||
class Communication : public Broadcaster
|
||||
{
|
||||
public:
|
||||
enum {
|
||||
eBroadcastBitDisconnected = (1 << 0), ///< Sent when the communications connection is lost.
|
||||
eBroadcastBitReadThreadGotBytes = (1 << 1), ///< Sent by the read thread when bytes become available.
|
||||
eBroadcastBitReadThreadDidExit = (1 << 2), ///< Sent by the read thread when it exits to inform clients.
|
||||
eBroadcastBitReadThreadShouldExit = (1 << 3), ///< Sent by clients that need to cancel the read thread.
|
||||
eBroadcastBitPacketAvailable = (1 << 4), ///< Sent when data received makes a complete packet.
|
||||
kLoUserBroadcastBit = (1 << 16),///< Subclasses can used bits 31:16 for any needed events.
|
||||
kHiUserBroadcastBit = (1 << 31),
|
||||
eAllEventBits = 0xffffffff
|
||||
};
|
||||
|
||||
typedef void (*ReadThreadBytesReceived) (void *baton, const void *src, size_t src_len);
|
||||
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Construct the Communication object with the specified name for
|
||||
/// the Broadcaster that this object inherits from.
|
||||
///
|
||||
/// @param[in] broadcaster_name
|
||||
/// The name of the broadcaster object. This name should be as
|
||||
/// complete as possible to uniquely identify this object. The
|
||||
/// broadcaster name can be updated after the connect function
|
||||
/// is called.
|
||||
//------------------------------------------------------------------
|
||||
Communication(const char * broadcaster_name);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Destructor.
|
||||
///
|
||||
/// The destructor is virtual since this class gets subclassed.
|
||||
//------------------------------------------------------------------
|
||||
virtual
|
||||
~Communication();
|
||||
|
||||
void
|
||||
Clear ();
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Connect using the current connection by passing \a url to its
|
||||
/// connect function.
|
||||
/// string.
|
||||
///
|
||||
/// @param[in] url
|
||||
/// A string that contains all information needed by the
|
||||
/// subclass to connect to another client.
|
||||
///
|
||||
/// @return
|
||||
/// \b True if the connect succeeded, \b false otherwise. The
|
||||
/// internal error object should be filled in with an
|
||||
/// appropriate value based on the result of this function.
|
||||
///
|
||||
/// @see Error& Communication::GetError ();
|
||||
/// @see bool Connection::Connect (const char *url);
|
||||
//------------------------------------------------------------------
|
||||
lldb::ConnectionStatus
|
||||
Connect (const char *url, Error *error_ptr);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Disconnect the communications connection if one is currently
|
||||
/// connected.
|
||||
///
|
||||
/// @return
|
||||
/// \b True if the disconnect succeeded, \b false otherwise. The
|
||||
/// internal error object should be filled in with an
|
||||
/// appropriate value based on the result of this function.
|
||||
///
|
||||
/// @see Error& Communication::GetError ();
|
||||
/// @see bool Connection::Disconnect ();
|
||||
//------------------------------------------------------------------
|
||||
lldb::ConnectionStatus
|
||||
Disconnect (Error *error_ptr = NULL);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Check if the connection is valid.
|
||||
///
|
||||
/// @return
|
||||
/// \b True if this object is currently connected, \b false
|
||||
/// otherwise.
|
||||
//------------------------------------------------------------------
|
||||
bool
|
||||
IsConnected () const;
|
||||
|
||||
bool
|
||||
HasConnection () const;
|
||||
|
||||
lldb_private::Connection *
|
||||
GetConnection ()
|
||||
{
|
||||
return m_connection_sp.get();
|
||||
}
|
||||
//------------------------------------------------------------------
|
||||
/// Read bytes from the current connection.
|
||||
///
|
||||
/// If no read thread is running, this function call the
|
||||
/// connection's Connection::Read(...) function to get any available.
|
||||
///
|
||||
/// If a read thread has been started, this function will check for
|
||||
/// any cached bytes that have already been read and return any
|
||||
/// currently available bytes. If no bytes are cached, it will wait
|
||||
/// for the bytes to become available by listening for the \a
|
||||
/// eBroadcastBitReadThreadGotBytes event. If this function consumes
|
||||
/// all of the bytes in the cache, it will reset the
|
||||
/// \a eBroadcastBitReadThreadGotBytes event bit.
|
||||
///
|
||||
/// @param[in] dst
|
||||
/// A destination buffer that must be at least \a dst_len bytes
|
||||
/// long.
|
||||
///
|
||||
/// @param[in] dst_len
|
||||
/// The number of bytes to attempt to read, and also the max
|
||||
/// number of bytes that can be placed into \a dst.
|
||||
///
|
||||
/// @param[in] timeout_usec
|
||||
/// A timeout value in micro-seconds.
|
||||
///
|
||||
/// @return
|
||||
/// The number of bytes actually read.
|
||||
///
|
||||
/// @see size_t Connection::Read (void *, size_t);
|
||||
//------------------------------------------------------------------
|
||||
size_t
|
||||
Read (void *dst,
|
||||
size_t dst_len,
|
||||
uint32_t timeout_usec,
|
||||
lldb::ConnectionStatus &status,
|
||||
Error *error_ptr);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// The actual write function that attempts to write to the
|
||||
/// communications protocol.
|
||||
///
|
||||
/// Subclasses must override this function.
|
||||
///
|
||||
/// @param[in] src
|
||||
/// A source buffer that must be at least \a src_len bytes
|
||||
/// long.
|
||||
///
|
||||
/// @param[in] src_len
|
||||
/// The number of bytes to attempt to write, and also the
|
||||
/// number of bytes are currently available in \a src.
|
||||
///
|
||||
/// @return
|
||||
/// The number of bytes actually Written.
|
||||
//------------------------------------------------------------------
|
||||
size_t
|
||||
Write (const void *src,
|
||||
size_t src_len,
|
||||
lldb::ConnectionStatus &status,
|
||||
Error *error_ptr);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Sets the connection that it to be used by this class.
|
||||
///
|
||||
/// By making a communication class that uses different connections
|
||||
/// it allows a single communication interface to negotiate and
|
||||
/// change its connection without any interruption to the client.
|
||||
/// It also allows the Communication class to be subclassed for
|
||||
/// packet based communication.
|
||||
///
|
||||
/// @param[in] connection
|
||||
/// A connection that this class will own and destroy.
|
||||
///
|
||||
/// @see
|
||||
/// class Connection
|
||||
//------------------------------------------------------------------
|
||||
void
|
||||
SetConnection (Connection *connection);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Starts a read thread whose sole purpose it to read bytes from
|
||||
/// the current connection. This function will call connection's
|
||||
/// read function:
|
||||
///
|
||||
/// size_t Connection::Read (void *, size_t);
|
||||
///
|
||||
/// When bytes are read and cached, this function will call:
|
||||
///
|
||||
/// Communication::AppendBytesToCache (const uint8_t * bytes, size_t len, bool broadcast);
|
||||
///
|
||||
/// Subclasses should override this function if they wish to override
|
||||
/// the default action of caching the bytes and broadcasting a \b
|
||||
/// eBroadcastBitReadThreadGotBytes event.
|
||||
///
|
||||
/// @return
|
||||
/// \b True if the read thread was successfully started, \b
|
||||
/// false otherwise.
|
||||
///
|
||||
/// @see size_t Connection::Read (void *, size_t);
|
||||
/// @see void Communication::AppendBytesToCache (const uint8_t * bytes, size_t len, bool broadcast);
|
||||
//------------------------------------------------------------------
|
||||
virtual bool
|
||||
StartReadThread (Error *error_ptr = NULL);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Stops the read thread by cancelling it.
|
||||
///
|
||||
/// @return
|
||||
/// \b True if the read thread was successfully canceled, \b
|
||||
/// false otherwise.
|
||||
//------------------------------------------------------------------
|
||||
virtual bool
|
||||
StopReadThread (Error *error_ptr = NULL);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Checks if there is a currently running read thread.
|
||||
///
|
||||
/// @return
|
||||
/// \b True if the read thread is running, \b false otherwise.
|
||||
//------------------------------------------------------------------
|
||||
bool
|
||||
ReadThreadIsRunning ();
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// The static read thread function. This function will call
|
||||
/// the "DoRead" function continuously and wait for data to become
|
||||
/// avaialble. When data is received it will append the available
|
||||
/// data to the internal cache and broadcast a
|
||||
/// \b eBroadcastBitReadThreadGotBytes event.
|
||||
///
|
||||
/// @param[in] comm_ptr
|
||||
/// A pointer to an instance of this class.
|
||||
///
|
||||
/// @return
|
||||
/// \b NULL.
|
||||
///
|
||||
/// @see void Communication::ReadThreadGotBytes (const uint8_t *, size_t);
|
||||
//------------------------------------------------------------------
|
||||
static lldb::thread_result_t
|
||||
ReadThread (lldb::thread_arg_t comm_ptr);
|
||||
|
||||
void
|
||||
SetReadThreadBytesReceivedCallback (ReadThreadBytesReceived callback,
|
||||
void *callback_baton);
|
||||
|
||||
static const char *
|
||||
ConnectionStatusAsCString (lldb::ConnectionStatus status);
|
||||
|
||||
bool
|
||||
GetCloseOnEOF () const
|
||||
{
|
||||
return m_close_on_eof;
|
||||
}
|
||||
|
||||
void
|
||||
SetCloseOnEOF (bool b)
|
||||
{
|
||||
m_close_on_eof = b;
|
||||
}
|
||||
|
||||
static ConstString &GetStaticBroadcasterClass ();
|
||||
|
||||
virtual ConstString &GetBroadcasterClass() const
|
||||
{
|
||||
return GetStaticBroadcasterClass();
|
||||
}
|
||||
|
||||
private:
|
||||
//------------------------------------------------------------------
|
||||
// For Communication only
|
||||
//------------------------------------------------------------------
|
||||
DISALLOW_COPY_AND_ASSIGN (Communication);
|
||||
|
||||
|
||||
protected:
|
||||
lldb::ConnectionSP m_connection_sp; ///< The connection that is current in use by this communications class.
|
||||
lldb::thread_t m_read_thread; ///< The read thread handle in case we need to cancel the thread.
|
||||
bool m_read_thread_enabled;
|
||||
std::string m_bytes; ///< A buffer to cache bytes read in the ReadThread function.
|
||||
Mutex m_bytes_mutex; ///< A mutex to protect multi-threaded access to the cached bytes.
|
||||
Mutex m_write_mutex; ///< Don't let multiple threads write at the same time...
|
||||
ReadThreadBytesReceived m_callback;
|
||||
void *m_callback_baton;
|
||||
bool m_close_on_eof;
|
||||
|
||||
size_t
|
||||
ReadFromConnection (void *dst,
|
||||
size_t dst_len,
|
||||
uint32_t timeout_usec,
|
||||
lldb::ConnectionStatus &status,
|
||||
Error *error_ptr);
|
||||
//------------------------------------------------------------------
|
||||
/// Append new bytes that get read from the read thread into the
|
||||
/// internal object byte cache. This will cause a \b
|
||||
/// eBroadcastBitReadThreadGotBytes event to be broadcast if \a
|
||||
/// broadcast is true.
|
||||
///
|
||||
/// Subclasses can override this function in order to inspect the
|
||||
/// received data and check if a packet is available.
|
||||
///
|
||||
/// Subclasses can also still call this function from the
|
||||
/// overridden method to allow the caching to correctly happen and
|
||||
/// suppress the broadcasting of the \a eBroadcastBitReadThreadGotBytes
|
||||
/// event by setting \a broadcast to false.
|
||||
///
|
||||
/// @param[in] src
|
||||
/// A source buffer that must be at least \a src_len bytes
|
||||
/// long.
|
||||
///
|
||||
/// @param[in] src_len
|
||||
/// The number of bytes to append to the cache.
|
||||
//------------------------------------------------------------------
|
||||
virtual void
|
||||
AppendBytesToCache (const uint8_t *src, size_t src_len, bool broadcast, lldb::ConnectionStatus status);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Get any available bytes from our data cache. If this call
|
||||
/// empties the data cache, the \b eBroadcastBitReadThreadGotBytes event
|
||||
/// will be reset to signify no more bytes are available.
|
||||
///
|
||||
/// @param[in] dst
|
||||
/// A destination buffer that must be at least \a dst_len bytes
|
||||
/// long.
|
||||
///
|
||||
/// @param[in] dst_len
|
||||
/// The number of bytes to attempt to read from the cache,
|
||||
/// and also the max number of bytes that can be placed into
|
||||
/// \a dst.
|
||||
///
|
||||
/// @return
|
||||
/// The number of bytes extracted from the data cache.
|
||||
//------------------------------------------------------------------
|
||||
size_t
|
||||
GetCachedBytes (void *dst, size_t dst_len);
|
||||
};
|
||||
|
||||
} // namespace lldb_private
|
||||
|
||||
#endif // liblldb_Communication_h_
|
162
include/lldb/Core/Connection.h
Normal file
162
include/lldb/Core/Connection.h
Normal file
@ -0,0 +1,162 @@
|
||||
//===-- Connection.h --------------------------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef liblldb_Connection_h_
|
||||
#define liblldb_Connection_h_
|
||||
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/lldb-private.h"
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
/// @class Connection Connection.h "lldb/Core/Connection.h"
|
||||
/// @brief A communication connection class.
|
||||
///
|
||||
/// A class that implements that actual communication functions for
|
||||
/// connecting/disconnecting, reading/writing, and waiting for bytes
|
||||
/// to become available from a two way communication connection.
|
||||
///
|
||||
/// This class is designed to only do very simple communication
|
||||
/// functions. Instances can be instantiated and given to a
|
||||
/// Communication class to perform communications where clients can
|
||||
/// listen for broadcasts, and perform other higher level communications.
|
||||
//----------------------------------------------------------------------
|
||||
class Connection
|
||||
{
|
||||
public:
|
||||
//------------------------------------------------------------------
|
||||
/// Default constructor
|
||||
//------------------------------------------------------------------
|
||||
Connection ();
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Virtual destructor since this class gets subclassed and handed
|
||||
/// to a Communication object.
|
||||
//------------------------------------------------------------------
|
||||
virtual
|
||||
~Connection ();
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Connect using the connect string \a url.
|
||||
///
|
||||
/// @param[in] url
|
||||
/// A string that contains all information needed by the
|
||||
/// subclass to connect to another client.
|
||||
///
|
||||
/// @param[out] error_ptr
|
||||
/// A pointer to an error object that should be given an
|
||||
/// approriate error value if this method returns false. This
|
||||
/// value can be NULL if the error value should be ignored.
|
||||
///
|
||||
/// @return
|
||||
/// \b True if the connect succeeded, \b false otherwise. The
|
||||
/// internal error object should be filled in with an
|
||||
/// appropriate value based on the result of this function.
|
||||
///
|
||||
/// @see Error& Communication::GetError ();
|
||||
//------------------------------------------------------------------
|
||||
virtual lldb::ConnectionStatus
|
||||
Connect (const char *url, Error *error_ptr) = 0;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Disconnect the communications connection if one is currently
|
||||
/// connected.
|
||||
///
|
||||
/// @param[out] error_ptr
|
||||
/// A pointer to an error object that should be given an
|
||||
/// approriate error value if this method returns false. This
|
||||
/// value can be NULL if the error value should be ignored.
|
||||
///
|
||||
/// @return
|
||||
/// \b True if the disconnect succeeded, \b false otherwise. The
|
||||
/// internal error object should be filled in with an
|
||||
/// appropriate value based on the result of this function.
|
||||
///
|
||||
/// @see Error& Communication::GetError ();
|
||||
//------------------------------------------------------------------
|
||||
virtual lldb::ConnectionStatus
|
||||
Disconnect (Error *error_ptr) = 0;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Check if the connection is valid.
|
||||
///
|
||||
/// @return
|
||||
/// \b True if this object is currently connected, \b false
|
||||
/// otherwise.
|
||||
//------------------------------------------------------------------
|
||||
virtual bool
|
||||
IsConnected () const = 0;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// The read function that attempts to read from the connection.
|
||||
///
|
||||
/// @param[in] dst
|
||||
/// A destination buffer that must be at least \a dst_len bytes
|
||||
/// long.
|
||||
///
|
||||
/// @param[in] dst_len
|
||||
/// The number of bytes to attempt to read, and also the max
|
||||
/// number of bytes that can be placed into \a dst.
|
||||
///
|
||||
/// @param[out] error_ptr
|
||||
/// A pointer to an error object that should be given an
|
||||
/// approriate error value if this method returns zero. This
|
||||
/// value can be NULL if the error value should be ignored.
|
||||
///
|
||||
/// @return
|
||||
/// The number of bytes actually read.
|
||||
///
|
||||
/// @see size_t Communication::Read (void *, size_t, uint32_t);
|
||||
//------------------------------------------------------------------
|
||||
virtual size_t
|
||||
Read (void *dst,
|
||||
size_t dst_len,
|
||||
uint32_t timeout_usec,
|
||||
lldb::ConnectionStatus &status,
|
||||
Error *error_ptr) = 0;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// The actual write function that attempts to write to the
|
||||
/// communications protocol.
|
||||
///
|
||||
/// Subclasses must override this function.
|
||||
///
|
||||
/// @param[in] src
|
||||
/// A source buffer that must be at least \a src_len bytes
|
||||
/// long.
|
||||
///
|
||||
/// @param[in] src_len
|
||||
/// The number of bytes to attempt to write, and also the
|
||||
/// number of bytes are currently available in \a src.
|
||||
///
|
||||
/// @param[out] error_ptr
|
||||
/// A pointer to an error object that should be given an
|
||||
/// approriate error value if this method returns zero. This
|
||||
/// value can be NULL if the error value should be ignored.
|
||||
///
|
||||
/// @return
|
||||
/// The number of bytes actually Written.
|
||||
//------------------------------------------------------------------
|
||||
virtual size_t
|
||||
Write (const void *buffer, size_t length, lldb::ConnectionStatus &status, Error *error_ptr) = 0;
|
||||
|
||||
private:
|
||||
//------------------------------------------------------------------
|
||||
// For Connection only
|
||||
//------------------------------------------------------------------
|
||||
DISALLOW_COPY_AND_ASSIGN (Connection);
|
||||
};
|
||||
|
||||
} // namespace lldb_private
|
||||
|
||||
#endif // liblldb_Connection_h_
|
139
include/lldb/Core/ConnectionFileDescriptor.h
Normal file
139
include/lldb/Core/ConnectionFileDescriptor.h
Normal file
@ -0,0 +1,139 @@
|
||||
//===-- ConnectionFileDescriptor.h ------------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef liblldb_ConnectionFileDescriptor_h_
|
||||
#define liblldb_ConnectionFileDescriptor_h_
|
||||
|
||||
// C Includes
|
||||
#include <sys/socket.h>
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
|
||||
// C++ Includes
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/Core/Connection.h"
|
||||
#include "lldb/Host/Mutex.h"
|
||||
#include "lldb/Host/Predicate.h"
|
||||
#include "lldb/Host/SocketAddress.h"
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
class ConnectionFileDescriptor :
|
||||
public Connection
|
||||
{
|
||||
public:
|
||||
|
||||
ConnectionFileDescriptor ();
|
||||
|
||||
ConnectionFileDescriptor (int fd, bool owns_fd);
|
||||
|
||||
virtual
|
||||
~ConnectionFileDescriptor ();
|
||||
|
||||
virtual bool
|
||||
IsConnected () const;
|
||||
|
||||
virtual lldb::ConnectionStatus
|
||||
Connect (const char *s, Error *error_ptr);
|
||||
|
||||
virtual lldb::ConnectionStatus
|
||||
Disconnect (Error *error_ptr);
|
||||
|
||||
virtual size_t
|
||||
Read (void *dst,
|
||||
size_t dst_len,
|
||||
uint32_t timeout_usec,
|
||||
lldb::ConnectionStatus &status,
|
||||
Error *error_ptr);
|
||||
|
||||
virtual size_t
|
||||
Write (const void *src,
|
||||
size_t src_len,
|
||||
lldb::ConnectionStatus &status,
|
||||
Error *error_ptr);
|
||||
|
||||
// If the read file descriptor is a socket, then return
|
||||
// the port number that is being used by the socket.
|
||||
in_port_t
|
||||
GetReadPort () const;
|
||||
|
||||
// If the write file descriptor is a socket, then return
|
||||
// the port number that is being used by the socket.
|
||||
in_port_t
|
||||
GetWritePort () const;
|
||||
|
||||
protected:
|
||||
|
||||
void
|
||||
OpenCommandPipe ();
|
||||
|
||||
void
|
||||
CloseCommandPipe ();
|
||||
|
||||
lldb::ConnectionStatus
|
||||
BytesAvailable (uint32_t timeout_usec, Error *error_ptr);
|
||||
|
||||
lldb::ConnectionStatus
|
||||
SocketListen (uint16_t listen_port_num, Error *error_ptr);
|
||||
|
||||
lldb::ConnectionStatus
|
||||
ConnectTCP (const char *host_and_port, Error *error_ptr);
|
||||
|
||||
lldb::ConnectionStatus
|
||||
ConnectUDP (const char *args, Error *error_ptr);
|
||||
|
||||
lldb::ConnectionStatus
|
||||
NamedSocketAccept (const char *socket_name, Error *error_ptr);
|
||||
|
||||
lldb::ConnectionStatus
|
||||
NamedSocketConnect (const char *socket_name, Error *error_ptr);
|
||||
|
||||
lldb::ConnectionStatus
|
||||
Close (int& fd, Error *error);
|
||||
|
||||
typedef enum
|
||||
{
|
||||
eFDTypeFile, // Other FD requireing read/write
|
||||
eFDTypeSocket, // Socket requiring send/recv
|
||||
eFDTypeSocketUDP // Unconnected UDP socket requiring sendto/recvfrom
|
||||
} FDType;
|
||||
|
||||
int m_fd_send;
|
||||
int m_fd_recv;
|
||||
FDType m_fd_send_type;
|
||||
FDType m_fd_recv_type;
|
||||
SocketAddress m_udp_send_sockaddr;
|
||||
bool m_should_close_fd; // True if this class should close the file descriptor when it goes away.
|
||||
uint32_t m_socket_timeout_usec;
|
||||
int m_pipe_read; // A pipe that we select on the reading end of along with
|
||||
int m_pipe_write; // m_fd_recv so we can force ourselves out of the select.
|
||||
Mutex m_mutex;
|
||||
bool m_shutting_down; // This marks that we are shutting down so if we get woken up from BytesAvailable
|
||||
// to disconnect, we won't try to read again.
|
||||
|
||||
static in_port_t
|
||||
GetSocketPort (int fd);
|
||||
|
||||
static int
|
||||
GetSocketOption(int fd, int level, int option_name, int &option_value);
|
||||
|
||||
static int
|
||||
SetSocketOption(int fd, int level, int option_name, int option_value);
|
||||
|
||||
bool
|
||||
SetSocketReceiveTimeout (uint32_t timeout_usec);
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN (ConnectionFileDescriptor);
|
||||
};
|
||||
|
||||
} // namespace lldb_private
|
||||
|
||||
#endif // liblldb_ConnectionFileDescriptor_h_
|
92
include/lldb/Core/ConnectionMachPort.h
Normal file
92
include/lldb/Core/ConnectionMachPort.h
Normal file
@ -0,0 +1,92 @@
|
||||
//===-- ConnectionMachPort.h --------------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
#if defined(__APPLE__)
|
||||
|
||||
#ifndef liblldb_ConnectionMachPort_h_
|
||||
#define liblldb_ConnectionMachPort_h_
|
||||
|
||||
// C Includes
|
||||
#include <mach/mach.h>
|
||||
|
||||
// C++ Includes
|
||||
#include <string>
|
||||
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/Core/Connection.h"
|
||||
|
||||
class ConnectionMachPort :
|
||||
public lldb_private::Connection
|
||||
{
|
||||
public:
|
||||
ConnectionMachPort ();
|
||||
|
||||
virtual
|
||||
~ConnectionMachPort ();
|
||||
|
||||
virtual bool
|
||||
IsConnected () const;
|
||||
|
||||
virtual lldb::ConnectionStatus
|
||||
BytesAvailable (uint32_t timeout_usec, lldb_private::Error *error_ptr);
|
||||
|
||||
virtual lldb::ConnectionStatus
|
||||
Connect (const char *s, lldb_private::Error *error_ptr);
|
||||
|
||||
virtual lldb::ConnectionStatus
|
||||
Disconnect (lldb_private::Error *error_ptr);
|
||||
|
||||
virtual size_t
|
||||
Read (void *dst,
|
||||
size_t dst_len,
|
||||
uint32_t timeout_usec,
|
||||
lldb::ConnectionStatus &status,
|
||||
lldb_private::Error *error_ptr);
|
||||
|
||||
virtual size_t
|
||||
Write (const void *src,
|
||||
size_t src_len,
|
||||
lldb::ConnectionStatus &status,
|
||||
lldb_private::Error *error_ptr);
|
||||
|
||||
lldb::ConnectionStatus
|
||||
BootstrapCheckIn (const char *port_name,
|
||||
lldb_private::Error *error_ptr);
|
||||
|
||||
lldb::ConnectionStatus
|
||||
BootstrapLookup (const char *port_name,
|
||||
lldb_private::Error *error_ptr);
|
||||
|
||||
struct PayloadType
|
||||
{
|
||||
uint32_t command;
|
||||
uint32_t data_length;
|
||||
uint8_t data[32];
|
||||
};
|
||||
|
||||
kern_return_t
|
||||
Send (const PayloadType &payload);
|
||||
|
||||
kern_return_t
|
||||
Receive (PayloadType &payload);
|
||||
|
||||
|
||||
protected:
|
||||
mach_port_t m_task;
|
||||
mach_port_t m_port;
|
||||
|
||||
private:
|
||||
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN (ConnectionMachPort);
|
||||
};
|
||||
|
||||
#endif // liblldb_ConnectionMachPort_h_
|
||||
|
||||
#endif // #if defined(__APPLE__)
|
70
include/lldb/Core/ConnectionSharedMemory.h
Normal file
70
include/lldb/Core/ConnectionSharedMemory.h
Normal file
@ -0,0 +1,70 @@
|
||||
//===-- ConnectionSharedMemory.h --------------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef liblldb_ConnectionSharedMemory_h_
|
||||
#define liblldb_ConnectionSharedMemory_h_
|
||||
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
#include <string>
|
||||
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/Core/Connection.h"
|
||||
#include "lldb/Core/DataBufferMemoryMap.h"
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
class ConnectionSharedMemory :
|
||||
public Connection
|
||||
{
|
||||
public:
|
||||
|
||||
ConnectionSharedMemory ();
|
||||
|
||||
virtual
|
||||
~ConnectionSharedMemory ();
|
||||
|
||||
virtual bool
|
||||
IsConnected () const;
|
||||
|
||||
virtual lldb::ConnectionStatus
|
||||
BytesAvailable (uint32_t timeout_usec, Error *error_ptr);
|
||||
|
||||
virtual lldb::ConnectionStatus
|
||||
Connect (const char *s, Error *error_ptr);
|
||||
|
||||
virtual lldb::ConnectionStatus
|
||||
Disconnect (Error *error_ptr);
|
||||
|
||||
virtual size_t
|
||||
Read (void *dst,
|
||||
size_t dst_len,
|
||||
uint32_t timeout_usec,
|
||||
lldb::ConnectionStatus &status,
|
||||
Error *error_ptr);
|
||||
|
||||
virtual size_t
|
||||
Write (const void *src, size_t src_len, lldb::ConnectionStatus &status, Error *error_ptr);
|
||||
|
||||
lldb::ConnectionStatus
|
||||
Open (bool create, const char *name, size_t size, Error *error_ptr);
|
||||
|
||||
protected:
|
||||
|
||||
std::string m_name;
|
||||
int m_fd; // One buffer that contains all we need
|
||||
DataBufferMemoryMap m_mmap;
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN (ConnectionSharedMemory);
|
||||
};
|
||||
|
||||
} // namespace lldb_private
|
||||
|
||||
#endif // liblldb_ConnectionSharedMemory_h_
|
507
include/lldb/Core/ConstString.h
Normal file
507
include/lldb/Core/ConstString.h
Normal file
@ -0,0 +1,507 @@
|
||||
//===-- ConstString.h -------------------------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef liblldb_ConstString_h_
|
||||
#define liblldb_ConstString_h_
|
||||
#if defined(__cplusplus)
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "lldb/lldb-private.h"
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
/// @class ConstString ConstString.h "lldb/Core/ConstString.h"
|
||||
/// @brief A uniqued constant string class.
|
||||
///
|
||||
/// Provides an efficient way to store strings as uniqued strings. After
|
||||
/// the strings are uniqued, finding strings that are equal to one
|
||||
/// another is very fast as just the pointers need to be compared. It
|
||||
/// also allows for many common strings from many different sources to
|
||||
/// be shared to keep the memory footprint low.
|
||||
///
|
||||
/// No reference counting is done on strings that are added to the
|
||||
/// string pool, once strings are added they are in the string pool for
|
||||
/// the life of the program.
|
||||
//----------------------------------------------------------------------
|
||||
class ConstString
|
||||
{
|
||||
public:
|
||||
//------------------------------------------------------------------
|
||||
/// Default constructor
|
||||
///
|
||||
/// Initializes the string to an empty string.
|
||||
//------------------------------------------------------------------
|
||||
ConstString ():
|
||||
m_string (NULL)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Copy constructor
|
||||
///
|
||||
/// Copies the string value in \a rhs into this object.
|
||||
///
|
||||
/// @param[in] rhs
|
||||
/// Another string object to copy.
|
||||
//------------------------------------------------------------------
|
||||
ConstString (const ConstString& rhs) :
|
||||
m_string (rhs.m_string)
|
||||
{
|
||||
}
|
||||
|
||||
explicit ConstString (const llvm::StringRef &s);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Construct with C String value
|
||||
///
|
||||
/// Constructs this object with a C string by looking to see if the
|
||||
/// C string already exists in the global string pool. If it doesn't
|
||||
/// exist, it is added to the string pool.
|
||||
///
|
||||
/// @param[in] cstr
|
||||
/// A NULL terminated C string to add to the string pool.
|
||||
//------------------------------------------------------------------
|
||||
explicit ConstString (const char *cstr);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Construct with C String value with max length
|
||||
///
|
||||
/// Constructs this object with a C string with a length. If
|
||||
/// \a max_cstr_len is greater than the actual length of the string,
|
||||
/// the string length will be truncated. This allows substrings to
|
||||
/// be created without the need to NULL terminate the string as it
|
||||
/// is passed into this function.
|
||||
///
|
||||
/// @param[in] cstr
|
||||
/// A pointer to the first character in the C string. The C
|
||||
/// string can be NULL terminated in a buffer that contains
|
||||
/// more characters than the length of the stirng, or the
|
||||
/// string can be part of another string and a new substring
|
||||
/// can be created.
|
||||
///
|
||||
/// @param[in] max_cstr_len
|
||||
/// The max length of \a cstr. If the string length of \a cstr
|
||||
/// is less than \a max_cstr_len, then the string will be
|
||||
/// truncated. If the string length of \a cstr is greater than
|
||||
/// \a max_cstr_len, then only max_cstr_len bytes will be used
|
||||
/// from \a cstr.
|
||||
//------------------------------------------------------------------
|
||||
explicit ConstString (const char *cstr, size_t max_cstr_len);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Destructor
|
||||
///
|
||||
/// Since constant string values are currently not reference counted,
|
||||
/// there isn't much to do here.
|
||||
//------------------------------------------------------------------
|
||||
~ConstString ()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
/// C string equality binary predicate function object for ConstString
|
||||
/// objects.
|
||||
//----------------------------------------------------------------------
|
||||
struct StringIsEqual
|
||||
{
|
||||
//--------------------------------------------------------------
|
||||
/// C equality test.
|
||||
///
|
||||
/// Two C strings are equal when they are contained in ConstString
|
||||
/// objects when their pointer values are equal to each other.
|
||||
///
|
||||
/// @return
|
||||
/// Returns \b true if the C string in \a lhs is equal to
|
||||
/// the C string value in \a rhs, \b false otherwise.
|
||||
//--------------------------------------------------------------
|
||||
bool operator()(const char* lhs, const char* rhs) const
|
||||
{
|
||||
return lhs == rhs;
|
||||
}
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Convert to bool operator.
|
||||
///
|
||||
/// This allows code to check a ConstString object to see if it
|
||||
/// contains a valid string using code such as:
|
||||
///
|
||||
/// @code
|
||||
/// ConstString str(...);
|
||||
/// if (str)
|
||||
/// { ...
|
||||
/// @endcode
|
||||
///
|
||||
/// @return
|
||||
/// /b True this object contains a valid non-empty C string, \b
|
||||
/// false otherwise.
|
||||
//------------------------------------------------------------------
|
||||
operator bool() const
|
||||
{
|
||||
return m_string && m_string[0];
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Assignment operator
|
||||
///
|
||||
/// Assigns the string in this object with the value from \a rhs.
|
||||
///
|
||||
/// @param[in] rhs
|
||||
/// Another string object to copy into this object.
|
||||
///
|
||||
/// @return
|
||||
/// A const reference to this object.
|
||||
//------------------------------------------------------------------
|
||||
const ConstString&
|
||||
operator = (const ConstString& rhs)
|
||||
{
|
||||
m_string = rhs.m_string;
|
||||
return *this;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Equal to operator
|
||||
///
|
||||
/// Returns true if this string is equal to the string in \a rhs.
|
||||
/// This operation is very fast as it results in a pointer
|
||||
/// comparison since all strings are in a uniqued in a global string
|
||||
/// pool.
|
||||
///
|
||||
/// @param[in] rhs
|
||||
/// Another string object to compare this object to.
|
||||
///
|
||||
/// @return
|
||||
/// @li \b true if this object is equal to \a rhs.
|
||||
/// @li \b false if this object is not equal to \a rhs.
|
||||
//------------------------------------------------------------------
|
||||
bool
|
||||
operator == (const ConstString& rhs) const
|
||||
{
|
||||
// We can do a pointer compare to compare these strings since they
|
||||
// must come from the same pool in order to be equal.
|
||||
return m_string == rhs.m_string;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Not equal to operator
|
||||
///
|
||||
/// Returns true if this string is not equal to the string in \a rhs.
|
||||
/// This operation is very fast as it results in a pointer
|
||||
/// comparison since all strings are in a uniqued in a global string
|
||||
/// pool.
|
||||
///
|
||||
/// @param[in] rhs
|
||||
/// Another string object to compare this object to.
|
||||
///
|
||||
/// @return
|
||||
/// @li \b true if this object is not equal to \a rhs.
|
||||
/// @li \b false if this object is equal to \a rhs.
|
||||
//------------------------------------------------------------------
|
||||
bool
|
||||
operator != (const ConstString& rhs) const
|
||||
{
|
||||
return m_string != rhs.m_string;
|
||||
}
|
||||
|
||||
bool
|
||||
operator < (const ConstString& rhs) const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Get the string value as a C string.
|
||||
///
|
||||
/// Get the value of the contained string as a NULL terminated C
|
||||
/// string value.
|
||||
///
|
||||
/// If \a value_if_empty is NULL, then NULL will be returned.
|
||||
///
|
||||
/// @return
|
||||
/// Returns \a value_if_empty if the string is empty, otherwise
|
||||
/// the C string value contained in this object.
|
||||
//------------------------------------------------------------------
|
||||
const char *
|
||||
AsCString(const char *value_if_empty = NULL) const
|
||||
{
|
||||
if (m_string == NULL)
|
||||
return value_if_empty;
|
||||
return m_string;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Get the string value as a llvm::StringRef
|
||||
///
|
||||
/// @return
|
||||
/// Returns a new llvm::StringRef object filled in with the
|
||||
/// needed data.
|
||||
//------------------------------------------------------------------
|
||||
llvm::StringRef
|
||||
GetStringRef () const
|
||||
{
|
||||
return llvm::StringRef (m_string, GetLength());
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Get the string value as a C string.
|
||||
///
|
||||
/// Get the value of the contained string as a NULL terminated C
|
||||
/// string value. Similar to the ConstString::AsCString() function,
|
||||
/// yet this function will always return NULL if the string is not
|
||||
/// valid. So this function is a direct accessor to the string
|
||||
/// pointer value.
|
||||
///
|
||||
/// @return
|
||||
/// Returns NULL the string is invalid, otherwise the C string
|
||||
/// value contained in this object.
|
||||
//------------------------------------------------------------------
|
||||
const char *
|
||||
GetCString () const
|
||||
{
|
||||
return m_string;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Get the length in bytes of string value.
|
||||
///
|
||||
/// The string pool stores the length of the string, so we can avoid
|
||||
/// calling strlen() on the pointer value with this function.
|
||||
///
|
||||
/// @return
|
||||
/// Returns the number of bytes that this string occupies in
|
||||
/// memory, not including the NULL termination byte.
|
||||
//------------------------------------------------------------------
|
||||
size_t
|
||||
GetLength () const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Clear this object's state.
|
||||
///
|
||||
/// Clear any contained string and reset the value to the an empty
|
||||
/// string value.
|
||||
//------------------------------------------------------------------
|
||||
void
|
||||
Clear ()
|
||||
{
|
||||
m_string = NULL;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Compare two string objects.
|
||||
///
|
||||
/// Compares the C string values contained in \a lhs and \a rhs and
|
||||
/// returns an integer result.
|
||||
///
|
||||
/// NOTE: only call this function when you want a true string
|
||||
/// comparision. If you want string equality use the, use the ==
|
||||
/// operator as it is much more efficient. Also if you want string
|
||||
/// inequality, use the != operator for the same reasons.
|
||||
///
|
||||
/// @param[in] lhs
|
||||
/// The Left Hand Side const ConstString object reference.
|
||||
///
|
||||
/// @param[in] rhs
|
||||
/// The Right Hand Side const ConstString object reference.
|
||||
///
|
||||
/// @return
|
||||
/// @li -1 if lhs < rhs
|
||||
/// @li 0 if lhs == rhs
|
||||
/// @li 1 if lhs > rhs
|
||||
//------------------------------------------------------------------
|
||||
static int
|
||||
Compare (const ConstString& lhs, const ConstString& rhs);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Dump the object description to a stream.
|
||||
///
|
||||
/// Dump the string value to the stream \a s. If the contained string
|
||||
/// is empty, print \a value_if_empty to the stream instead. If
|
||||
/// \a value_if_empty is NULL, then nothing will be dumped to the
|
||||
/// stream.
|
||||
///
|
||||
/// @param[in] s
|
||||
/// The stream that will be used to dump the object description.
|
||||
///
|
||||
/// @param[in] value_if_empty
|
||||
/// The value to dump if the string is empty. If NULL, nothing
|
||||
/// will be output to the stream.
|
||||
//------------------------------------------------------------------
|
||||
void
|
||||
Dump (Stream *s, const char *value_if_empty = NULL) const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Dump the object debug description to a stream.
|
||||
///
|
||||
/// @param[in] s
|
||||
/// The stream that will be used to dump the object description.
|
||||
//------------------------------------------------------------------
|
||||
void
|
||||
DumpDebug (Stream *s) const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Test for empty string.
|
||||
///
|
||||
/// @return
|
||||
/// @li \b true if the contained string is empty.
|
||||
/// @li \b false if the contained string is not empty.
|
||||
//------------------------------------------------------------------
|
||||
bool
|
||||
IsEmpty () const
|
||||
{
|
||||
return m_string == NULL || m_string[0] == '\0';
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Set the C string value.
|
||||
///
|
||||
/// Set the string value in the object by uniquing the \a cstr
|
||||
/// string value in our global string pool.
|
||||
///
|
||||
/// If the C string already exists in the global string pool, it
|
||||
/// finds the current entry and returns the existing value. If it
|
||||
/// doesn't exist, it is added to the string pool.
|
||||
///
|
||||
/// @param[in] cstr
|
||||
/// A NULL terminated C string to add to the string pool.
|
||||
//------------------------------------------------------------------
|
||||
void
|
||||
SetCString (const char *cstr);
|
||||
|
||||
void
|
||||
SetString (const llvm::StringRef &s);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Set the C string value and its mangled counterpart.
|
||||
///
|
||||
/// Object files and debug sybmols often use mangled string to
|
||||
/// represent the linkage name for a symbol, function or global.
|
||||
/// The string pool can efficiently store these values and their
|
||||
/// counterparts so when we run into another instance of a mangled
|
||||
/// name, we can avoid calling the name demangler over and over on
|
||||
/// the same strings and then trying to unique them.
|
||||
///
|
||||
/// @param[in] demangled
|
||||
/// The demangled C string to correlate with the \a mangled
|
||||
/// name.
|
||||
///
|
||||
/// @param[in] mangled
|
||||
/// The already uniqued mangled ConstString to correlate the
|
||||
/// soon to be uniqued version of \a demangled.
|
||||
//------------------------------------------------------------------
|
||||
void
|
||||
SetCStringWithMangledCounterpart (const char *demangled,
|
||||
const ConstString &mangled);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Retrieve the mangled or demangled counterpart for a mangled
|
||||
/// or demangled ConstString.
|
||||
///
|
||||
/// Object files and debug sybmols often use mangled string to
|
||||
/// represent the linkage name for a symbol, function or global.
|
||||
/// The string pool can efficiently store these values and their
|
||||
/// counterparts so when we run into another instance of a mangled
|
||||
/// name, we can avoid calling the name demangler over and over on
|
||||
/// the same strings and then trying to unique them.
|
||||
///
|
||||
/// @param[in] counterpart
|
||||
/// A reference to a ConstString object that might get filled in
|
||||
/// with the demangled/mangled counterpart.
|
||||
///
|
||||
/// @return
|
||||
/// /b True if \a counterpart was filled in with the counterpart
|
||||
/// /b false otherwise.
|
||||
//------------------------------------------------------------------
|
||||
bool
|
||||
GetMangledCounterpart (ConstString &counterpart) const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Set the C string value with length.
|
||||
///
|
||||
/// Set the string value in the object by uniquing \a cstr_len bytes
|
||||
/// starting at the \a cstr string value in our global string pool.
|
||||
/// If trim is true, then \a cstr_len indicates a maximum length of
|
||||
/// the CString and if the actual length of the string is less, then
|
||||
/// it will be trimmed.
|
||||
///
|
||||
/// If the C string already exists in the global string pool, it
|
||||
/// finds the current entry and returns the existing value. If it
|
||||
/// doesn't exist, it is added to the string pool.
|
||||
///
|
||||
/// @param[in] cstr
|
||||
/// A NULL terminated C string to add to the string pool.
|
||||
///
|
||||
/// @param[in] cstr_len
|
||||
/// The maximum length of the C string.
|
||||
//------------------------------------------------------------------
|
||||
void
|
||||
SetCStringWithLength (const char *cstr, size_t cstr_len);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Set the C string value with the minimum length between
|
||||
/// \a fixed_cstr_len and the actual length of the C string. This
|
||||
/// can be used for data structures that have a fixed length to
|
||||
/// store a C string where the string might not be NULL terminated
|
||||
/// if the string takes the entire buffer.
|
||||
//------------------------------------------------------------------
|
||||
void
|
||||
SetTrimmedCStringWithLength (const char *cstr, size_t fixed_cstr_len);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Get the memory cost of this object.
|
||||
///
|
||||
/// Return the size in bytes that this object takes in memory. This
|
||||
/// returns the size in bytes of this object, which does not include
|
||||
/// any the shared string values it may refer to.
|
||||
///
|
||||
/// @return
|
||||
/// The number of bytes that this object occupies in memory.
|
||||
///
|
||||
/// @see ConstString::StaticMemorySize ()
|
||||
//------------------------------------------------------------------
|
||||
size_t
|
||||
MemorySize () const
|
||||
{
|
||||
return sizeof(ConstString);
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Get the size in bytes of the current global string pool.
|
||||
///
|
||||
/// Reports the the size in bytes of all shared C string values,
|
||||
/// containers and any other values as a byte size for the
|
||||
/// entire string pool.
|
||||
///
|
||||
/// @return
|
||||
/// The number of bytes that the global string pool occupies
|
||||
/// in memory.
|
||||
//------------------------------------------------------------------
|
||||
static size_t
|
||||
StaticMemorySize ();
|
||||
|
||||
protected:
|
||||
//------------------------------------------------------------------
|
||||
// Member variables
|
||||
//------------------------------------------------------------------
|
||||
const char *m_string;
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Stream the string value \a str to the stream \a s
|
||||
//------------------------------------------------------------------
|
||||
Stream& operator << (Stream& s, const ConstString& str);
|
||||
|
||||
} // namespace lldb_private
|
||||
|
||||
#endif // #if defined(__cplusplus)
|
||||
#endif // liblldb_ConstString_h_
|
94
include/lldb/Core/DataBuffer.h
Normal file
94
include/lldb/Core/DataBuffer.h
Normal file
@ -0,0 +1,94 @@
|
||||
//===-- DataBuffer.h --------------------------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef liblldb_DataBuffer_h_
|
||||
#define liblldb_DataBuffer_h_
|
||||
#if defined(__cplusplus)
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
/// @class DataBuffer DataBuffer.h "lldb/Core/DataBuffer.h"
|
||||
/// @brief A pure virtual protocol class for abstracted data buffers.
|
||||
///
|
||||
/// DataBuffer is an abtract class that gets packaged into a shared pointer
|
||||
/// that can use to implement various ways to store data (on the heap,
|
||||
/// memory mapped, cached inferior memory). It gets used by DataExtractor
|
||||
/// so many DataExtractor objects can share the same data and sub-ranges
|
||||
/// of that shared data, and the last object that contains a reference
|
||||
/// to the shared data will free it.
|
||||
///
|
||||
/// Subclasses can implement as many different constructors or member
|
||||
/// functions that allow data to be stored in the object's buffer prior
|
||||
/// to handing the shared data to clients that use these buffers.
|
||||
///
|
||||
/// All subclasses must override all of the pure virtual functions as
|
||||
/// they are used by clients to access the data. Having a common
|
||||
/// interface allows different ways of storing data, yet using it in
|
||||
/// one common way.
|
||||
///
|
||||
/// This class currently expects all data to be available without any
|
||||
/// extra calls being made, but we can modify it to optionally get
|
||||
/// data on demand with some extra function calls to load the data
|
||||
/// before it gets accessed.
|
||||
//----------------------------------------------------------------------
|
||||
class DataBuffer
|
||||
{
|
||||
public:
|
||||
//------------------------------------------------------------------
|
||||
/// Destructor
|
||||
///
|
||||
/// The destructor is virtual as other classes will inherit from
|
||||
/// this class and be downcast to the DataBuffer pure virtual
|
||||
/// interface. The virtual destructor ensures that destructing the
|
||||
/// base class will destruct the class that inherited from it
|
||||
/// correctly.
|
||||
//------------------------------------------------------------------
|
||||
virtual
|
||||
~DataBuffer()
|
||||
{
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Get a pointer to the data.
|
||||
///
|
||||
/// @return
|
||||
/// A pointer to the bytes owned by this object, or NULL if the
|
||||
/// object contains no bytes.
|
||||
//------------------------------------------------------------------
|
||||
virtual uint8_t *
|
||||
GetBytes () = 0;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Get a const pointer to the data.
|
||||
///
|
||||
/// @return
|
||||
/// A const pointer to the bytes owned by this object, or NULL
|
||||
/// if the object contains no bytes.
|
||||
//------------------------------------------------------------------
|
||||
virtual const uint8_t *
|
||||
GetBytes () const = 0;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Get the number of bytes in the data buffer.
|
||||
///
|
||||
/// @return
|
||||
/// The number of bytes this object currently contains.
|
||||
//------------------------------------------------------------------
|
||||
virtual lldb::offset_t
|
||||
GetByteSize() const = 0;
|
||||
};
|
||||
|
||||
} // namespace lldb_private
|
||||
|
||||
#endif /// #if defined(__cplusplus)
|
||||
#endif /// lldb_DataBuffer_h_
|
139
include/lldb/Core/DataBufferHeap.h
Normal file
139
include/lldb/Core/DataBufferHeap.h
Normal file
@ -0,0 +1,139 @@
|
||||
//===-- DataBufferHeap.h ----------------------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef liblldb_DataBufferHeap_h_
|
||||
#define liblldb_DataBufferHeap_h_
|
||||
#if defined(__cplusplus)
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "lldb/lldb-private.h"
|
||||
#include "lldb/Core/DataBuffer.h"
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
/// @class DataBufferHeap DataBufferHeap.h "lldb/Core/DataBufferHeap.h"
|
||||
/// @brief A subclass of DataBuffer that stores a data buffer on the heap.
|
||||
///
|
||||
/// This class keeps its data in a heap based buffer that is owned by
|
||||
/// the object. This class is best used to store chunks of data that
|
||||
/// are created or read from sources that can't intelligently and lazily
|
||||
/// fault new data pages in. Large amounts of data that comes from files
|
||||
/// should probably use the DataBufferMemoryMap class.
|
||||
//----------------------------------------------------------------------
|
||||
class DataBufferHeap : public DataBuffer
|
||||
{
|
||||
public:
|
||||
//------------------------------------------------------------------
|
||||
/// Default constructor
|
||||
///
|
||||
/// Initializes the heap based buffer with no bytes.
|
||||
//------------------------------------------------------------------
|
||||
DataBufferHeap ();
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Construct with size \a n and fill with \a ch.
|
||||
///
|
||||
/// Initialize this class with \a n bytes and fills the buffer with
|
||||
/// \a ch.
|
||||
///
|
||||
/// @param[in] n
|
||||
/// The number of bytes that heap based buffer should contain.
|
||||
///
|
||||
/// @param[in] ch
|
||||
/// The character to use when filling the buffer initially.
|
||||
//------------------------------------------------------------------
|
||||
DataBufferHeap (lldb::offset_t n, uint8_t ch);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Construct by making a copy of \a src_len bytes from \a src.
|
||||
///
|
||||
/// @param[in] src
|
||||
/// A pointer to the data to copy.
|
||||
///
|
||||
/// @param[in] src_len
|
||||
/// The number of bytes in \a src to copy.
|
||||
//------------------------------------------------------------------
|
||||
DataBufferHeap (const void *src, lldb::offset_t src_len);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Destructor.
|
||||
///
|
||||
/// Virtual destructor since this class inherits from a pure virtual
|
||||
/// base class #DataBuffer.
|
||||
//------------------------------------------------------------------
|
||||
virtual
|
||||
~DataBufferHeap();
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// @copydoc DataBuffer::GetBytes()
|
||||
//------------------------------------------------------------------
|
||||
virtual uint8_t *
|
||||
GetBytes ();
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// @copydoc DataBuffer::GetBytes() const
|
||||
//------------------------------------------------------------------
|
||||
virtual const uint8_t *
|
||||
GetBytes () const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// @copydoc DataBuffer::GetByteSize() const
|
||||
//------------------------------------------------------------------
|
||||
virtual lldb::offset_t
|
||||
GetByteSize () const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Set the number of bytes in the data buffer.
|
||||
///
|
||||
/// Sets the number of bytes that this object should be able to
|
||||
/// contain. This can be used prior to copying data into the buffer.
|
||||
///
|
||||
/// @param[in] byte_size
|
||||
/// The new size in bytes that this data buffer should attempt
|
||||
/// to resize itself to.
|
||||
///
|
||||
/// @return
|
||||
/// The size in bytes after that this heap buffer was
|
||||
/// successfully resized to.
|
||||
//------------------------------------------------------------------
|
||||
lldb::offset_t
|
||||
SetByteSize (lldb::offset_t byte_size);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Makes a copy of the \a src_len bytes in \a src.
|
||||
///
|
||||
/// Copies the data in \a src into an internal buffer.
|
||||
///
|
||||
/// @param[in] src
|
||||
/// A pointer to the data to copy.
|
||||
///
|
||||
/// @param[in] src_len
|
||||
/// The number of bytes in \a src to copy.
|
||||
//------------------------------------------------------------------
|
||||
void
|
||||
CopyData (const void *src, lldb::offset_t src_len);
|
||||
|
||||
void
|
||||
Clear();
|
||||
|
||||
private:
|
||||
//------------------------------------------------------------------
|
||||
// This object uses a std::vector<uint8_t> to store its data. This
|
||||
// takes care of free the data when the object is deleted.
|
||||
//------------------------------------------------------------------
|
||||
typedef std::vector<uint8_t> buffer_t; ///< Buffer type
|
||||
buffer_t m_data; ///< The heap based buffer where data is stored
|
||||
};
|
||||
|
||||
} // namespace lldb_private
|
||||
|
||||
#endif // #if defined(__cplusplus)
|
||||
#endif // liblldb_DataBufferHeap_h_
|
160
include/lldb/Core/DataBufferMemoryMap.h
Normal file
160
include/lldb/Core/DataBufferMemoryMap.h
Normal file
@ -0,0 +1,160 @@
|
||||
//===-- DataBufferMemoryMap.h -----------------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef liblldb_DataBufferMemoryMap_h_
|
||||
#define liblldb_DataBufferMemoryMap_h_
|
||||
#if defined(__cplusplus)
|
||||
|
||||
|
||||
#include "lldb/lldb-private.h"
|
||||
#include "lldb/Core/DataBuffer.h"
|
||||
#include "lldb/Core/Error.h"
|
||||
#include <string>
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
/// @class DataBufferMemoryMap DataBufferMemoryMap.h "lldb/Core/DataBufferMemoryMap.h"
|
||||
/// @brief A subclass of DataBuffer that memory maps data.
|
||||
///
|
||||
/// This class memory maps data and stores any needed data for the
|
||||
/// memory mapping in its internal state. Memory map requests are not
|
||||
/// required to have any alignment or size constraints, this class will
|
||||
/// work around any host OS issues regarding such things.
|
||||
///
|
||||
/// This class is designed to allow pages to be faulted in as needed and
|
||||
/// works well data from large files that won't be accessed all at once.
|
||||
//----------------------------------------------------------------------
|
||||
class DataBufferMemoryMap : public DataBuffer
|
||||
{
|
||||
public:
|
||||
//------------------------------------------------------------------
|
||||
/// Default Constructor
|
||||
//------------------------------------------------------------------
|
||||
DataBufferMemoryMap ();
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Destructor.
|
||||
///
|
||||
/// Virtual destructor since this class inherits from a pure virtual
|
||||
/// base class #DataBuffer.
|
||||
//------------------------------------------------------------------
|
||||
virtual
|
||||
~DataBufferMemoryMap ();
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Reverts this object to an empty state by unmapping any memory
|
||||
/// that is currently owned.
|
||||
//------------------------------------------------------------------
|
||||
void
|
||||
Clear ();
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// @copydoc DataBuffer::GetBytes()
|
||||
//------------------------------------------------------------------
|
||||
virtual uint8_t *
|
||||
GetBytes ();
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// @copydoc DataBuffer::GetBytes() const
|
||||
//------------------------------------------------------------------
|
||||
virtual const uint8_t *
|
||||
GetBytes () const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// @copydoc DataBuffer::GetByteSize() const
|
||||
//------------------------------------------------------------------
|
||||
virtual lldb::offset_t
|
||||
GetByteSize () const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Error get accessor.
|
||||
///
|
||||
/// @return
|
||||
/// A const reference to Error object in case memory mapping
|
||||
/// fails.
|
||||
//------------------------------------------------------------------
|
||||
const Error &
|
||||
GetError() const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Memory map all or part of a file.
|
||||
///
|
||||
/// Memory map \a length bytes from \a file starting \a offset
|
||||
/// bytes into the file. If \a length is set to \c SIZE_MAX,
|
||||
/// then map as many bytes as possible.
|
||||
///
|
||||
/// @param[in] file
|
||||
/// The file specification from which to map data.
|
||||
///
|
||||
/// @param[in] offset
|
||||
/// The offset in bytes from the beginning of the file where
|
||||
/// memory mapping should begin.
|
||||
///
|
||||
/// @param[in] length
|
||||
/// The size in bytes that should be mapped starting \a offset
|
||||
/// bytes into the file. If \a length is \c SIZE_MAX, map
|
||||
/// as many bytes as possible.
|
||||
///
|
||||
/// @return
|
||||
/// The number of bytes mapped starting from the \a offset.
|
||||
//------------------------------------------------------------------
|
||||
size_t
|
||||
MemoryMapFromFileSpec (const FileSpec* file,
|
||||
lldb::offset_t offset = 0,
|
||||
lldb::offset_t length = SIZE_MAX,
|
||||
bool writeable = false);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Memory map all or part of a file.
|
||||
///
|
||||
/// Memory map \a length bytes from an opened file descriptor \a fd
|
||||
/// starting \a offset bytes into the file. If \a length is set to
|
||||
/// \c SIZE_MAX, then map as many bytes as possible.
|
||||
///
|
||||
/// @param[in] fd
|
||||
/// The posix file descriptor for an already opened file
|
||||
/// from which to map data.
|
||||
///
|
||||
/// @param[in] offset
|
||||
/// The offset in bytes from the beginning of the file where
|
||||
/// memory mapping should begin.
|
||||
///
|
||||
/// @param[in] length
|
||||
/// The size in bytes that should be mapped starting \a offset
|
||||
/// bytes into the file. If \a length is \c SIZE_MAX, map
|
||||
/// as many bytes as possible.
|
||||
///
|
||||
/// @return
|
||||
/// The number of bytes mapped starting from the \a offset.
|
||||
//------------------------------------------------------------------
|
||||
size_t
|
||||
MemoryMapFromFileDescriptor (int fd,
|
||||
lldb::offset_t offset,
|
||||
lldb::offset_t length,
|
||||
bool write,
|
||||
bool fd_is_file);
|
||||
|
||||
protected:
|
||||
//------------------------------------------------------------------
|
||||
// Classes that inherit from DataBufferMemoryMap can see and modify these
|
||||
//------------------------------------------------------------------
|
||||
uint8_t * m_mmap_addr; ///< The actual pointer that was returned from \c mmap()
|
||||
size_t m_mmap_size; ///< The actual number of bytes that were mapped when \c mmap() was called
|
||||
uint8_t *m_data; ///< The data the user requested somewhere within the memory mapped data.
|
||||
lldb::offset_t m_size; ///< The size of the data the user got when data was requested
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN (DataBufferMemoryMap);
|
||||
};
|
||||
|
||||
} // namespace lldb_private
|
||||
|
||||
#endif // #if defined(__cplusplus)
|
||||
#endif // liblldb_DataBufferMemoryMap_h_
|
459
include/lldb/Core/DataEncoder.h
Normal file
459
include/lldb/Core/DataEncoder.h
Normal file
@ -0,0 +1,459 @@
|
||||
//===-- DataEncoder.h -------------------------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef liblldb_DataEncoder_h_
|
||||
#define liblldb_DataEncoder_h_
|
||||
|
||||
#if defined (__cplusplus)
|
||||
|
||||
#include "lldb/lldb-private.h"
|
||||
#include <limits.h>
|
||||
#include <stdint.h>
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
/// @class DataEncoder DataEncoder.h "lldb/Core/DataEncoder.h"
|
||||
/// @brief An binary data encoding class.
|
||||
///
|
||||
/// DataEncoder is a class that can encode binary data (swapping if needed)
|
||||
/// to a data buffer. The data buffer can be caller owned, or can be
|
||||
/// shared data that can be shared between multiple DataEncoder or
|
||||
/// DataEncoder instances.
|
||||
///
|
||||
/// @see DataBuffer
|
||||
//----------------------------------------------------------------------
|
||||
class DataEncoder
|
||||
{
|
||||
public:
|
||||
//------------------------------------------------------------------
|
||||
/// Default constructor.
|
||||
///
|
||||
/// Initialize all members to a default empty state.
|
||||
//------------------------------------------------------------------
|
||||
DataEncoder ();
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Construct with a buffer that is owned by the caller.
|
||||
///
|
||||
/// This constructor allows us to use data that is owned by the
|
||||
/// caller. The data must stay around as long as this object is
|
||||
/// valid.
|
||||
///
|
||||
/// @param[in] data
|
||||
/// A pointer to caller owned data.
|
||||
///
|
||||
/// @param[in] data_length
|
||||
/// The length in bytes of \a data.
|
||||
///
|
||||
/// @param[in] byte_order
|
||||
/// A byte order of the data that we are extracting from.
|
||||
///
|
||||
/// @param[in] addr_size
|
||||
/// A new address byte size value.
|
||||
//------------------------------------------------------------------
|
||||
DataEncoder (void* data, uint32_t data_length, lldb::ByteOrder byte_order, uint8_t addr_size);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Construct with shared data.
|
||||
///
|
||||
/// Copies the data shared pointer which adds a reference to the
|
||||
/// contained in \a data_sp. The shared data reference is reference
|
||||
/// counted to ensure the data lives as long as anyone still has a
|
||||
/// valid shared pointer to the data in \a data_sp.
|
||||
///
|
||||
/// @param[in] data_sp
|
||||
/// A shared pointer to data.
|
||||
///
|
||||
/// @param[in] byte_order
|
||||
/// A byte order of the data that we are extracting from.
|
||||
///
|
||||
/// @param[in] addr_size
|
||||
/// A new address byte size value.
|
||||
//------------------------------------------------------------------
|
||||
DataEncoder (const lldb::DataBufferSP& data_sp, lldb::ByteOrder byte_order, uint8_t addr_size);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Destructor
|
||||
///
|
||||
/// If this object contains a valid shared data reference, the
|
||||
/// reference count on the data will be decremented, and if zero,
|
||||
/// the data will be freed.
|
||||
//------------------------------------------------------------------
|
||||
~DataEncoder ();
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Clears the object state.
|
||||
///
|
||||
/// Clears the object contents back to a default invalid state, and
|
||||
/// release any references to shared data that this object may
|
||||
/// contain.
|
||||
//------------------------------------------------------------------
|
||||
void
|
||||
Clear ();
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Get the current address size.
|
||||
///
|
||||
/// Return the size in bytes of any address values this object will
|
||||
/// extract.
|
||||
///
|
||||
/// @return
|
||||
/// The size in bytes of address values that will be extracted.
|
||||
//------------------------------------------------------------------
|
||||
uint8_t
|
||||
GetAddressByteSize () const
|
||||
{
|
||||
return m_addr_size;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Get the number of bytes contained in this object.
|
||||
///
|
||||
/// @return
|
||||
/// The total number of bytes of data this object refers to.
|
||||
//------------------------------------------------------------------
|
||||
size_t
|
||||
GetByteSize () const
|
||||
{
|
||||
return m_end - m_start;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Get the data end pointer.
|
||||
///
|
||||
/// @return
|
||||
/// Returns a pointer to the next byte contained in this
|
||||
/// object's data, or NULL of there is no data in this object.
|
||||
//------------------------------------------------------------------
|
||||
uint8_t *
|
||||
GetDataEnd ()
|
||||
{
|
||||
return m_end;
|
||||
}
|
||||
|
||||
const uint8_t *
|
||||
GetDataEnd () const
|
||||
{
|
||||
return m_end;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Get the shared data offset.
|
||||
///
|
||||
/// Get the offset of the first byte of data in the shared data (if
|
||||
/// any).
|
||||
///
|
||||
/// @return
|
||||
/// If this object contains shared data, this function returns
|
||||
/// the offset in bytes into that shared data, zero otherwise.
|
||||
//------------------------------------------------------------------
|
||||
size_t
|
||||
GetSharedDataOffset () const;
|
||||
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Get the current byte order value.
|
||||
///
|
||||
/// @return
|
||||
/// The current byte order value from this object's internal
|
||||
/// state.
|
||||
//------------------------------------------------------------------
|
||||
lldb::ByteOrder
|
||||
GetByteOrder() const
|
||||
{
|
||||
return m_byte_order;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Get a the data start pointer.
|
||||
///
|
||||
/// @return
|
||||
/// Returns a pointer to the first byte contained in this
|
||||
/// object's data, or NULL of there is no data in this object.
|
||||
//------------------------------------------------------------------
|
||||
uint8_t *
|
||||
GetDataStart ()
|
||||
{
|
||||
return m_start;
|
||||
}
|
||||
|
||||
const uint8_t *
|
||||
GetDataStart () const
|
||||
{
|
||||
return m_start;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Encode unsigned integer values into the data at \a offset.
|
||||
///
|
||||
/// @param[in] offset
|
||||
/// The offset within the contained data at which to put the
|
||||
/// data.
|
||||
///
|
||||
/// @param[in] value
|
||||
/// The value to encode into the data.
|
||||
///
|
||||
/// @return
|
||||
/// The next offset in the bytes of this data if the data
|
||||
/// was successfully encoded, UINT32_MAX if the encoding failed.
|
||||
//------------------------------------------------------------------
|
||||
uint32_t
|
||||
PutU8 (uint32_t offset, uint8_t value);
|
||||
|
||||
uint32_t
|
||||
PutU16 (uint32_t offset, uint16_t value);
|
||||
|
||||
uint32_t
|
||||
PutU32 (uint32_t offset, uint32_t value);
|
||||
|
||||
uint32_t
|
||||
PutU64 (uint32_t offset, uint64_t value);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Encode an unsigned integer of size \a byte_size to \a offset.
|
||||
///
|
||||
/// Encode a single integer value at \a offset and return the offset
|
||||
/// that follows the newly encoded integer when the data is successfully
|
||||
/// encoded into the existing data. There must be enough room in the
|
||||
/// data, else UINT32_MAX will be returned to indicate that encoding
|
||||
/// failed.
|
||||
///
|
||||
/// @param[in] offset
|
||||
/// The offset within the contained data at which to put the
|
||||
/// encoded integer.
|
||||
///
|
||||
/// @param[in] byte_size
|
||||
/// The size in byte of the integer to encode.
|
||||
///
|
||||
/// @param[in] value
|
||||
/// The integer value to write. The least significate bytes of
|
||||
/// the integer value will be written if the size is less than
|
||||
/// 8 bytes.
|
||||
///
|
||||
/// @return
|
||||
/// The next offset in the bytes of this data if the integer
|
||||
/// was successfully encoded, UINT32_MAX if the encoding failed.
|
||||
//------------------------------------------------------------------
|
||||
uint32_t
|
||||
PutMaxU64 (uint32_t offset, uint32_t byte_size, uint64_t value);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Encode an arbitrary number of bytes.
|
||||
///
|
||||
/// @param[in] offset
|
||||
/// The offset in bytes into the contained data at which to
|
||||
/// start encoding.
|
||||
///
|
||||
/// @param[int] src
|
||||
/// The buffer that contains the the bytes to encode.
|
||||
///
|
||||
/// @param[in] src_len
|
||||
/// The number of bytes to encode.
|
||||
///
|
||||
/// @return
|
||||
/// The next valid offset within data if the put operation
|
||||
/// was successful, else UINT32_MAX to indicate the put failed.
|
||||
//------------------------------------------------------------------
|
||||
uint32_t
|
||||
PutData (uint32_t offset,
|
||||
const void *src,
|
||||
uint32_t src_len);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Encode an address in the existing buffer at \a offset bytes into
|
||||
/// the buffer.
|
||||
///
|
||||
/// Encode a single address (honoring the m_addr_size member) to
|
||||
/// the data and return the next offset where subsequent data would
|
||||
/// go.
|
||||
/// pointed to by \a offset_ptr. The size of the extracted address
|
||||
/// comes from the \a m_addr_size member variable and should be
|
||||
/// set correctly prior to extracting any address values.
|
||||
///
|
||||
/// @param[in,out] offset_ptr
|
||||
/// A pointer to an offset within the data that will be advanced
|
||||
/// by the appropriate number of bytes if the value is extracted
|
||||
/// correctly. If the offset is out of bounds or there are not
|
||||
/// enough bytes to extract this value, the offset will be left
|
||||
/// unmodified.
|
||||
///
|
||||
/// @return
|
||||
/// The next valid offset within data if the put operation
|
||||
/// was successful, else UINT32_MAX to indicate the put failed.
|
||||
//------------------------------------------------------------------
|
||||
uint32_t
|
||||
PutAddress (uint32_t offset, lldb::addr_t addr);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Put a C string to \a offset.
|
||||
///
|
||||
/// Encodes a C string into the existing data including the
|
||||
/// terminating
|
||||
///
|
||||
/// @param[in,out] offset_ptr
|
||||
/// A pointer to an offset within the data that will be advanced
|
||||
/// by the appropriate number of bytes if the value is extracted
|
||||
/// correctly. If the offset is out of bounds or there are not
|
||||
/// enough bytes to extract this value, the offset will be left
|
||||
/// unmodified.
|
||||
///
|
||||
/// @return
|
||||
/// A pointer to the C string value in the data. If the offset
|
||||
/// pointed to by \a offset_ptr is out of bounds, or if the
|
||||
/// offset plus the length of the C string is out of bounds,
|
||||
/// NULL will be returned.
|
||||
//------------------------------------------------------------------
|
||||
uint32_t
|
||||
PutCString (uint32_t offset_ptr, const char *cstr);
|
||||
|
||||
lldb::DataBufferSP &
|
||||
GetSharedDataBuffer ()
|
||||
{
|
||||
return m_data_sp;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Set the address byte size.
|
||||
///
|
||||
/// Set the size in bytes that will be used when extracting any
|
||||
/// address and pointer values from data contained in this object.
|
||||
///
|
||||
/// @param[in] addr_size
|
||||
/// The size in bytes to use when extracting addresses.
|
||||
//------------------------------------------------------------------
|
||||
void
|
||||
SetAddressByteSize (uint8_t addr_size)
|
||||
{
|
||||
m_addr_size = addr_size;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Set data with a buffer that is caller owned.
|
||||
///
|
||||
/// Use data that is owned by the caller when extracting values.
|
||||
/// The data must stay around as long as this object, or any object
|
||||
/// that copies a subset of this object's data, is valid. If \a
|
||||
/// bytes is NULL, or \a length is zero, this object will contain
|
||||
/// no data.
|
||||
///
|
||||
/// @param[in] bytes
|
||||
/// A pointer to caller owned data.
|
||||
///
|
||||
/// @param[in] length
|
||||
/// The length in bytes of \a bytes.
|
||||
///
|
||||
/// @param[in] byte_order
|
||||
/// A byte order of the data that we are extracting from.
|
||||
///
|
||||
/// @return
|
||||
/// The number of bytes that this object now contains.
|
||||
//------------------------------------------------------------------
|
||||
uint32_t
|
||||
SetData (const void *bytes, uint32_t length, lldb::ByteOrder byte_order);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Adopt a subset of shared data in \a data_sp.
|
||||
///
|
||||
/// Copies the data shared pointer which adds a reference to the
|
||||
/// contained in \a data_sp. The shared data reference is reference
|
||||
/// counted to ensure the data lives as long as anyone still has a
|
||||
/// valid shared pointer to the data in \a data_sp. The byte order
|
||||
/// and address byte size settings remain the same. If
|
||||
/// \a offset is not a valid offset in \a data_sp, then no reference
|
||||
/// to the shared data will be added. If there are not \a length
|
||||
/// bytes available in \a data starting at \a offset, the length
|
||||
/// will be truncated to contains as many bytes as possible.
|
||||
///
|
||||
/// @param[in] data_sp
|
||||
/// A shared pointer to data.
|
||||
///
|
||||
/// @param[in] offset
|
||||
/// The offset into \a data_sp at which the subset starts.
|
||||
///
|
||||
/// @param[in] length
|
||||
/// The length in bytes of the subset of \a data_sp.
|
||||
///
|
||||
/// @return
|
||||
/// The number of bytes that this object now contains.
|
||||
//------------------------------------------------------------------
|
||||
uint32_t
|
||||
SetData (const lldb::DataBufferSP& data_sp, uint32_t offset = 0, uint32_t length = UINT32_MAX);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Set the byte_order value.
|
||||
///
|
||||
/// Sets the byte order of the data to extract. Extracted values
|
||||
/// will be swapped if necessary when decoding.
|
||||
///
|
||||
/// @param[in] byte_order
|
||||
/// The byte order value to use when extracting data.
|
||||
//------------------------------------------------------------------
|
||||
void
|
||||
SetByteOrder (lldb::ByteOrder byte_order)
|
||||
{
|
||||
m_byte_order = byte_order;
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Test the validity of \a offset.
|
||||
///
|
||||
/// @return
|
||||
/// \b true if \a offset is a valid offset into the data in this
|
||||
/// object, \b false otherwise.
|
||||
//------------------------------------------------------------------
|
||||
bool
|
||||
ValidOffset (uint32_t offset) const
|
||||
{
|
||||
return offset < GetByteSize();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Test the availability of \a length bytes of data from \a offset.
|
||||
///
|
||||
/// @return
|
||||
/// \b true if \a offset is a valid offset and there are \a
|
||||
/// length bytes available at that offset, \b false otherwise.
|
||||
//------------------------------------------------------------------
|
||||
bool
|
||||
ValidOffsetForDataOfSize (uint32_t offset, uint32_t length) const
|
||||
{
|
||||
return length <= BytesLeft (offset);
|
||||
}
|
||||
|
||||
uint32_t
|
||||
BytesLeft (uint32_t offset) const
|
||||
{
|
||||
const uint32_t size = GetByteSize();
|
||||
if (size > offset)
|
||||
return size - offset;
|
||||
return 0;
|
||||
}
|
||||
|
||||
protected:
|
||||
//------------------------------------------------------------------
|
||||
// Member variables
|
||||
//------------------------------------------------------------------
|
||||
uint8_t *m_start; ///< A pointer to the first byte of data.
|
||||
uint8_t *m_end; ///< A pointer to the byte that is past the end of the data.
|
||||
lldb::ByteOrder m_byte_order; ///< The byte order of the data we are extracting from.
|
||||
uint8_t m_addr_size; ///< The address size to use when extracting pointers or addresses
|
||||
mutable lldb::DataBufferSP m_data_sp; ///< The shared pointer to data that can be shared among multilple instances
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN (DataEncoder);
|
||||
|
||||
};
|
||||
|
||||
} // namespace lldb_private
|
||||
|
||||
#endif // #if defined (__cplusplus)
|
||||
#endif // #ifndef liblldb_DataEncoder_h_
|
1298
include/lldb/Core/DataExtractor.h
Normal file
1298
include/lldb/Core/DataExtractor.h
Normal file
File diff suppressed because it is too large
Load Diff
397
include/lldb/Core/Debugger.h
Normal file
397
include/lldb/Core/Debugger.h
Normal file
@ -0,0 +1,397 @@
|
||||
//===-- Debugger.h ----------------------------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef liblldb_Debugger_h_
|
||||
#define liblldb_Debugger_h_
|
||||
#if defined(__cplusplus)
|
||||
|
||||
|
||||
#include <stdint.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <stack>
|
||||
|
||||
#include "lldb/lldb-public.h"
|
||||
|
||||
#include "lldb/API/SBDefines.h"
|
||||
|
||||
#include "lldb/Core/Broadcaster.h"
|
||||
#include "lldb/Core/Communication.h"
|
||||
#include "lldb/Core/InputReaderStack.h"
|
||||
#include "lldb/Core/Listener.h"
|
||||
#include "lldb/Core/StreamFile.h"
|
||||
#include "lldb/Core/SourceManager.h"
|
||||
#include "lldb/Core/UserID.h"
|
||||
#include "lldb/Core/UserSettingsController.h"
|
||||
#include "lldb/DataFormatters/FormatManager.h"
|
||||
#include "lldb/Host/Terminal.h"
|
||||
#include "lldb/Interpreter/OptionValueProperties.h"
|
||||
#include "lldb/Target/ExecutionContext.h"
|
||||
#include "lldb/Target/Platform.h"
|
||||
#include "lldb/Target/TargetList.h"
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
/// @class Debugger Debugger.h "lldb/Core/Debugger.h"
|
||||
/// @brief A class to manage flag bits.
|
||||
///
|
||||
/// Provides a global root objects for the debugger core.
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
|
||||
class Debugger :
|
||||
public std::enable_shared_from_this<Debugger>,
|
||||
public UserID,
|
||||
public Properties,
|
||||
public BroadcasterManager
|
||||
{
|
||||
friend class SourceManager; // For GetSourceFileCache.
|
||||
|
||||
public:
|
||||
|
||||
static lldb::DebuggerSP
|
||||
CreateInstance (lldb::LogOutputCallback log_callback = NULL, void *baton = NULL);
|
||||
|
||||
static lldb::TargetSP
|
||||
FindTargetWithProcessID (lldb::pid_t pid);
|
||||
|
||||
static lldb::TargetSP
|
||||
FindTargetWithProcess (Process *process);
|
||||
|
||||
static void
|
||||
Initialize ();
|
||||
|
||||
static void
|
||||
Terminate ();
|
||||
|
||||
static void
|
||||
SettingsInitialize ();
|
||||
|
||||
static void
|
||||
SettingsTerminate ();
|
||||
|
||||
static void
|
||||
Destroy (lldb::DebuggerSP &debugger_sp);
|
||||
|
||||
virtual
|
||||
~Debugger ();
|
||||
|
||||
void Clear();
|
||||
|
||||
bool
|
||||
GetAsyncExecution ();
|
||||
|
||||
void
|
||||
SetAsyncExecution (bool async);
|
||||
|
||||
File &
|
||||
GetInputFile ()
|
||||
{
|
||||
return m_input_file.GetFile();
|
||||
}
|
||||
|
||||
File &
|
||||
GetOutputFile ()
|
||||
{
|
||||
return m_output_file.GetFile();
|
||||
}
|
||||
|
||||
File &
|
||||
GetErrorFile ()
|
||||
{
|
||||
return m_error_file.GetFile();
|
||||
}
|
||||
|
||||
void
|
||||
SetInputFileHandle (FILE *fh, bool tranfer_ownership);
|
||||
|
||||
void
|
||||
SetOutputFileHandle (FILE *fh, bool tranfer_ownership);
|
||||
|
||||
void
|
||||
SetErrorFileHandle (FILE *fh, bool tranfer_ownership);
|
||||
|
||||
void
|
||||
SaveInputTerminalState();
|
||||
|
||||
void
|
||||
RestoreInputTerminalState();
|
||||
|
||||
Stream&
|
||||
GetOutputStream ()
|
||||
{
|
||||
return m_output_file;
|
||||
}
|
||||
|
||||
Stream&
|
||||
GetErrorStream ()
|
||||
{
|
||||
return m_error_file;
|
||||
}
|
||||
|
||||
lldb::StreamSP
|
||||
GetAsyncOutputStream ();
|
||||
|
||||
lldb::StreamSP
|
||||
GetAsyncErrorStream ();
|
||||
|
||||
CommandInterpreter &
|
||||
GetCommandInterpreter ()
|
||||
{
|
||||
assert (m_command_interpreter_ap.get());
|
||||
return *m_command_interpreter_ap;
|
||||
}
|
||||
|
||||
Listener &
|
||||
GetListener ()
|
||||
{
|
||||
return m_listener;
|
||||
}
|
||||
|
||||
// This returns the Debugger's scratch source manager. It won't be able to look up files in debug
|
||||
// information, but it can look up files by absolute path and display them to you.
|
||||
// To get the target's source manager, call GetSourceManager on the target instead.
|
||||
SourceManager &
|
||||
GetSourceManager ();
|
||||
|
||||
public:
|
||||
|
||||
lldb::TargetSP
|
||||
GetSelectedTarget ()
|
||||
{
|
||||
return m_target_list.GetSelectedTarget ();
|
||||
}
|
||||
|
||||
ExecutionContext
|
||||
GetSelectedExecutionContext();
|
||||
//------------------------------------------------------------------
|
||||
/// Get accessor for the target list.
|
||||
///
|
||||
/// The target list is part of the global debugger object. This
|
||||
/// the single debugger shared instance to control where targets
|
||||
/// get created and to allow for tracking and searching for targets
|
||||
/// based on certain criteria.
|
||||
///
|
||||
/// @return
|
||||
/// A global shared target list.
|
||||
//------------------------------------------------------------------
|
||||
TargetList &
|
||||
GetTargetList ()
|
||||
{
|
||||
return m_target_list;
|
||||
}
|
||||
|
||||
PlatformList &
|
||||
GetPlatformList ()
|
||||
{
|
||||
return m_platform_list;
|
||||
}
|
||||
|
||||
void
|
||||
DispatchInputInterrupt ();
|
||||
|
||||
void
|
||||
DispatchInputEndOfFile ();
|
||||
|
||||
void
|
||||
DispatchInput (const char *bytes, size_t bytes_len);
|
||||
|
||||
void
|
||||
WriteToDefaultReader (const char *bytes, size_t bytes_len);
|
||||
|
||||
void
|
||||
PushInputReader (const lldb::InputReaderSP& reader_sp);
|
||||
|
||||
bool
|
||||
PopInputReader (const lldb::InputReaderSP& reader_sp);
|
||||
|
||||
void
|
||||
NotifyTopInputReader (lldb::InputReaderAction notification);
|
||||
|
||||
bool
|
||||
InputReaderIsTopReader (const lldb::InputReaderSP& reader_sp);
|
||||
|
||||
static lldb::DebuggerSP
|
||||
FindDebuggerWithID (lldb::user_id_t id);
|
||||
|
||||
static lldb::DebuggerSP
|
||||
FindDebuggerWithInstanceName (const ConstString &instance_name);
|
||||
|
||||
static size_t
|
||||
GetNumDebuggers();
|
||||
|
||||
static lldb::DebuggerSP
|
||||
GetDebuggerAtIndex (size_t index);
|
||||
|
||||
static bool
|
||||
FormatPrompt (const char *format,
|
||||
const SymbolContext *sc,
|
||||
const ExecutionContext *exe_ctx,
|
||||
const Address *addr,
|
||||
Stream &s,
|
||||
ValueObject* valobj = NULL);
|
||||
|
||||
|
||||
void
|
||||
CleanUpInputReaders ();
|
||||
|
||||
static int
|
||||
TestDebuggerRefCount ();
|
||||
|
||||
bool
|
||||
GetCloseInputOnEOF () const;
|
||||
|
||||
void
|
||||
SetCloseInputOnEOF (bool b);
|
||||
|
||||
bool
|
||||
EnableLog (const char *channel, const char **categories, const char *log_file, uint32_t log_options, Stream &error_stream);
|
||||
|
||||
void
|
||||
SetLoggingCallback (lldb::LogOutputCallback log_callback, void *baton);
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Properties Functions
|
||||
//----------------------------------------------------------------------
|
||||
enum StopDisassemblyType
|
||||
{
|
||||
eStopDisassemblyTypeNever = 0,
|
||||
eStopDisassemblyTypeNoSource,
|
||||
eStopDisassemblyTypeAlways
|
||||
};
|
||||
|
||||
virtual Error
|
||||
SetPropertyValue (const ExecutionContext *exe_ctx,
|
||||
VarSetOperationType op,
|
||||
const char *property_path,
|
||||
const char *value);
|
||||
|
||||
bool
|
||||
GetAutoConfirm () const;
|
||||
|
||||
const char *
|
||||
GetFrameFormat() const;
|
||||
|
||||
const char *
|
||||
GetThreadFormat() const;
|
||||
|
||||
lldb::ScriptLanguage
|
||||
GetScriptLanguage() const;
|
||||
|
||||
bool
|
||||
SetScriptLanguage (lldb::ScriptLanguage script_lang);
|
||||
|
||||
uint32_t
|
||||
GetTerminalWidth () const;
|
||||
|
||||
bool
|
||||
SetTerminalWidth (uint32_t term_width);
|
||||
|
||||
const char *
|
||||
GetPrompt() const;
|
||||
|
||||
void
|
||||
SetPrompt(const char *p);
|
||||
|
||||
bool
|
||||
GetUseExternalEditor () const;
|
||||
|
||||
bool
|
||||
SetUseExternalEditor (bool use_external_editor_p);
|
||||
|
||||
bool
|
||||
GetUseColor () const;
|
||||
|
||||
bool
|
||||
SetUseColor (bool use_color);
|
||||
|
||||
uint32_t
|
||||
GetStopSourceLineCount (bool before) const;
|
||||
|
||||
StopDisassemblyType
|
||||
GetStopDisassemblyDisplay () const;
|
||||
|
||||
uint32_t
|
||||
GetDisassemblyLineCount () const;
|
||||
|
||||
bool
|
||||
GetNotifyVoid () const;
|
||||
|
||||
|
||||
const ConstString &
|
||||
GetInstanceName()
|
||||
{
|
||||
return m_instance_name;
|
||||
}
|
||||
|
||||
typedef bool (*LLDBCommandPluginInit) (lldb::SBDebugger& debugger);
|
||||
|
||||
bool
|
||||
LoadPlugin (const FileSpec& spec, Error& error);
|
||||
|
||||
protected:
|
||||
|
||||
static void
|
||||
DispatchInputCallback (void *baton, const void *bytes, size_t bytes_len);
|
||||
|
||||
lldb::InputReaderSP
|
||||
GetCurrentInputReader ();
|
||||
|
||||
void
|
||||
ActivateInputReader (const lldb::InputReaderSP &reader_sp);
|
||||
|
||||
bool
|
||||
CheckIfTopInputReaderIsDone ();
|
||||
|
||||
SourceManager::SourceFileCache &
|
||||
GetSourceFileCache ()
|
||||
{
|
||||
return m_source_file_cache;
|
||||
}
|
||||
Communication m_input_comm;
|
||||
StreamFile m_input_file;
|
||||
StreamFile m_output_file;
|
||||
StreamFile m_error_file;
|
||||
TerminalState m_terminal_state;
|
||||
TargetList m_target_list;
|
||||
PlatformList m_platform_list;
|
||||
Listener m_listener;
|
||||
std::unique_ptr<SourceManager> m_source_manager_ap; // This is a scratch source manager that we return if we have no targets.
|
||||
SourceManager::SourceFileCache m_source_file_cache; // All the source managers for targets created in this debugger used this shared
|
||||
// source file cache.
|
||||
std::unique_ptr<CommandInterpreter> m_command_interpreter_ap;
|
||||
|
||||
InputReaderStack m_input_reader_stack;
|
||||
std::string m_input_reader_data;
|
||||
typedef std::map<std::string, lldb::StreamWP> LogStreamMap;
|
||||
LogStreamMap m_log_streams;
|
||||
lldb::StreamSP m_log_callback_stream_sp;
|
||||
ConstString m_instance_name;
|
||||
typedef std::vector<lldb::DynamicLibrarySP> LoadedPluginsList;
|
||||
LoadedPluginsList m_loaded_plugins;
|
||||
|
||||
void
|
||||
InstanceInitialize ();
|
||||
|
||||
private:
|
||||
|
||||
// Use Debugger::CreateInstance() to get a shared pointer to a new
|
||||
// debugger object
|
||||
Debugger (lldb::LogOutputCallback m_log_callback, void *baton);
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN (Debugger);
|
||||
|
||||
};
|
||||
|
||||
} // namespace lldb_private
|
||||
|
||||
#endif // #if defined(__cplusplus)
|
||||
#endif // liblldb_Debugger_h_
|
422
include/lldb/Core/Disassembler.h
Normal file
422
include/lldb/Core/Disassembler.h
Normal file
@ -0,0 +1,422 @@
|
||||
//===-- Disassembler.h ------------------------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef liblldb_Disassembler_h_
|
||||
#define liblldb_Disassembler_h_
|
||||
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/lldb-private.h"
|
||||
#include "lldb/Core/Address.h"
|
||||
#include "lldb/Core/ArchSpec.h"
|
||||
#include "lldb/Core/EmulateInstruction.h"
|
||||
#include "lldb/Core/Opcode.h"
|
||||
#include "lldb/Core/PluginInterface.h"
|
||||
#include "lldb/Interpreter/OptionValue.h"
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
class Instruction
|
||||
{
|
||||
public:
|
||||
Instruction (const Address &address,
|
||||
lldb::AddressClass addr_class = lldb::eAddressClassInvalid);
|
||||
|
||||
virtual
|
||||
~Instruction();
|
||||
|
||||
const Address &
|
||||
GetAddress () const
|
||||
{
|
||||
return m_address;
|
||||
}
|
||||
|
||||
const char *
|
||||
GetMnemonic (const ExecutionContext* exe_ctx)
|
||||
{
|
||||
CalculateMnemonicOperandsAndCommentIfNeeded (exe_ctx);
|
||||
return m_opcode_name.c_str();
|
||||
}
|
||||
const char *
|
||||
GetOperands (const ExecutionContext* exe_ctx)
|
||||
{
|
||||
CalculateMnemonicOperandsAndCommentIfNeeded (exe_ctx);
|
||||
return m_mnemonics.c_str();
|
||||
}
|
||||
|
||||
const char *
|
||||
GetComment (const ExecutionContext* exe_ctx)
|
||||
{
|
||||
CalculateMnemonicOperandsAndCommentIfNeeded (exe_ctx);
|
||||
return m_comment.c_str();
|
||||
}
|
||||
|
||||
virtual void
|
||||
CalculateMnemonicOperandsAndComment (const ExecutionContext* exe_ctx) = 0;
|
||||
|
||||
lldb::AddressClass
|
||||
GetAddressClass ();
|
||||
|
||||
void
|
||||
SetAddress (const Address &addr)
|
||||
{
|
||||
// Invalidate the address class to lazily discover
|
||||
// it if we need to.
|
||||
m_address_class = lldb::eAddressClassInvalid;
|
||||
m_address = addr;
|
||||
}
|
||||
|
||||
virtual void
|
||||
Dump (Stream *s,
|
||||
uint32_t max_opcode_byte_size,
|
||||
bool show_address,
|
||||
bool show_bytes,
|
||||
const ExecutionContext* exe_ctx);
|
||||
|
||||
virtual bool
|
||||
DoesBranch () = 0;
|
||||
|
||||
virtual size_t
|
||||
Decode (const Disassembler &disassembler,
|
||||
const DataExtractor& data,
|
||||
lldb::offset_t data_offset) = 0;
|
||||
|
||||
virtual void
|
||||
SetDescription (const char *) {} // May be overridden in sub-classes that have descriptions.
|
||||
|
||||
lldb::OptionValueSP
|
||||
ReadArray (FILE *in_file, Stream *out_stream, OptionValue::Type data_type);
|
||||
|
||||
lldb::OptionValueSP
|
||||
ReadDictionary (FILE *in_file, Stream *out_stream);
|
||||
|
||||
bool
|
||||
DumpEmulation (const ArchSpec &arch);
|
||||
|
||||
virtual bool
|
||||
TestEmulation (Stream *stream, const char *test_file_name);
|
||||
|
||||
bool
|
||||
Emulate (const ArchSpec &arch,
|
||||
uint32_t evaluate_options,
|
||||
void *baton,
|
||||
EmulateInstruction::ReadMemoryCallback read_mem_callback,
|
||||
EmulateInstruction::WriteMemoryCallback write_mem_calback,
|
||||
EmulateInstruction::ReadRegisterCallback read_reg_callback,
|
||||
EmulateInstruction::WriteRegisterCallback write_reg_callback);
|
||||
|
||||
const Opcode &
|
||||
GetOpcode () const
|
||||
{
|
||||
return m_opcode;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
GetData (DataExtractor &data);
|
||||
|
||||
protected:
|
||||
Address m_address; // The section offset address of this instruction
|
||||
// We include an address class in the Instruction class to
|
||||
// allow the instruction specify the eAddressClassCodeAlternateISA
|
||||
// (currently used for thumb), and also to specify data (eAddressClassData).
|
||||
// The usual value will be eAddressClassCode, but often when
|
||||
// disassembling memory, you might run into data. This can
|
||||
// help us to disassemble appropriately.
|
||||
private:
|
||||
lldb::AddressClass m_address_class; // Use GetAddressClass () accessor function!
|
||||
protected:
|
||||
Opcode m_opcode; // The opcode for this instruction
|
||||
std::string m_opcode_name;
|
||||
std::string m_mnemonics;
|
||||
std::string m_comment;
|
||||
bool m_calculated_strings;
|
||||
|
||||
void
|
||||
CalculateMnemonicOperandsAndCommentIfNeeded (const ExecutionContext* exe_ctx)
|
||||
{
|
||||
if (!m_calculated_strings)
|
||||
{
|
||||
m_calculated_strings = true;
|
||||
CalculateMnemonicOperandsAndComment(exe_ctx);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class InstructionList
|
||||
{
|
||||
public:
|
||||
InstructionList();
|
||||
~InstructionList();
|
||||
|
||||
size_t
|
||||
GetSize() const;
|
||||
|
||||
uint32_t
|
||||
GetMaxOpcocdeByteSize () const;
|
||||
|
||||
lldb::InstructionSP
|
||||
GetInstructionAtIndex (size_t idx) const;
|
||||
|
||||
uint32_t
|
||||
GetIndexOfNextBranchInstruction(uint32_t start) const;
|
||||
|
||||
uint32_t
|
||||
GetIndexOfInstructionAtLoadAddress (lldb::addr_t load_addr, Target &target);
|
||||
|
||||
void
|
||||
Clear();
|
||||
|
||||
void
|
||||
Append (lldb::InstructionSP &inst_sp);
|
||||
|
||||
void
|
||||
Dump (Stream *s,
|
||||
bool show_address,
|
||||
bool show_bytes,
|
||||
const ExecutionContext* exe_ctx);
|
||||
|
||||
private:
|
||||
typedef std::vector<lldb::InstructionSP> collection;
|
||||
typedef collection::iterator iterator;
|
||||
typedef collection::const_iterator const_iterator;
|
||||
|
||||
collection m_instructions;
|
||||
};
|
||||
|
||||
class PseudoInstruction :
|
||||
public Instruction
|
||||
{
|
||||
public:
|
||||
|
||||
PseudoInstruction ();
|
||||
|
||||
virtual
|
||||
~PseudoInstruction ();
|
||||
|
||||
virtual bool
|
||||
DoesBranch ();
|
||||
|
||||
virtual void
|
||||
CalculateMnemonicOperandsAndComment (const ExecutionContext* exe_ctx)
|
||||
{
|
||||
// TODO: fill this in and put opcode name into Instruction::m_opcode_name,
|
||||
// mnemonic into Instruction::m_mnemonics, and any comment into
|
||||
// Instruction::m_comment
|
||||
}
|
||||
|
||||
virtual size_t
|
||||
Decode (const Disassembler &disassembler,
|
||||
const DataExtractor &data,
|
||||
lldb::offset_t data_offset);
|
||||
|
||||
void
|
||||
SetOpcode (size_t opcode_size, void *opcode_data);
|
||||
|
||||
virtual void
|
||||
SetDescription (const char *description);
|
||||
|
||||
protected:
|
||||
std::string m_description;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN (PseudoInstruction);
|
||||
};
|
||||
|
||||
class Disassembler :
|
||||
public std::enable_shared_from_this<Disassembler>,
|
||||
public PluginInterface
|
||||
{
|
||||
public:
|
||||
|
||||
enum
|
||||
{
|
||||
eOptionNone = 0u,
|
||||
eOptionShowBytes = (1u << 0),
|
||||
eOptionRawOuput = (1u << 1),
|
||||
eOptionMarkPCSourceLine = (1u << 2), // Mark the source line that contains the current PC (mixed mode only)
|
||||
eOptionMarkPCAddress = (1u << 3) // Mark the disassembly line the contains the PC
|
||||
};
|
||||
|
||||
enum HexImmediateStyle
|
||||
{
|
||||
eHexStyleC,
|
||||
eHexStyleAsm,
|
||||
};
|
||||
|
||||
// FindPlugin should be lax about the flavor string (it is too annoying to have various internal uses of the
|
||||
// disassembler fail because the global flavor string gets set wrong. Instead, if you get a flavor string you
|
||||
// don't understand, use the default. Folks who care to check can use the FlavorValidForArchSpec method on the
|
||||
// disassembler they got back.
|
||||
static lldb::DisassemblerSP
|
||||
FindPlugin (const ArchSpec &arch, const char *flavor, const char *plugin_name);
|
||||
|
||||
// This version will use the value in the Target settings if flavor is NULL;
|
||||
static lldb::DisassemblerSP
|
||||
FindPluginForTarget(const lldb::TargetSP target_sp, const ArchSpec &arch, const char *flavor, const char *plugin_name);
|
||||
|
||||
static lldb::DisassemblerSP
|
||||
DisassembleRange (const ArchSpec &arch,
|
||||
const char *plugin_name,
|
||||
const char *flavor,
|
||||
const ExecutionContext &exe_ctx,
|
||||
const AddressRange &disasm_range);
|
||||
|
||||
static lldb::DisassemblerSP
|
||||
DisassembleBytes (const ArchSpec &arch,
|
||||
const char *plugin_name,
|
||||
const char *flavor,
|
||||
const Address &start,
|
||||
const void *bytes,
|
||||
size_t length,
|
||||
uint32_t max_num_instructions,
|
||||
bool data_from_file);
|
||||
|
||||
static bool
|
||||
Disassemble (Debugger &debugger,
|
||||
const ArchSpec &arch,
|
||||
const char *plugin_name,
|
||||
const char *flavor,
|
||||
const ExecutionContext &exe_ctx,
|
||||
const AddressRange &range,
|
||||
uint32_t num_instructions,
|
||||
uint32_t num_mixed_context_lines,
|
||||
uint32_t options,
|
||||
Stream &strm);
|
||||
|
||||
static bool
|
||||
Disassemble (Debugger &debugger,
|
||||
const ArchSpec &arch,
|
||||
const char *plugin_name,
|
||||
const char *flavor,
|
||||
const ExecutionContext &exe_ctx,
|
||||
const Address &start,
|
||||
uint32_t num_instructions,
|
||||
uint32_t num_mixed_context_lines,
|
||||
uint32_t options,
|
||||
Stream &strm);
|
||||
|
||||
static size_t
|
||||
Disassemble (Debugger &debugger,
|
||||
const ArchSpec &arch,
|
||||
const char *plugin_name,
|
||||
const char *flavor,
|
||||
const ExecutionContext &exe_ctx,
|
||||
SymbolContextList &sc_list,
|
||||
uint32_t num_instructions,
|
||||
uint32_t num_mixed_context_lines,
|
||||
uint32_t options,
|
||||
Stream &strm);
|
||||
|
||||
static bool
|
||||
Disassemble (Debugger &debugger,
|
||||
const ArchSpec &arch,
|
||||
const char *plugin_name,
|
||||
const char *flavor,
|
||||
const ExecutionContext &exe_ctx,
|
||||
const ConstString &name,
|
||||
Module *module,
|
||||
uint32_t num_instructions,
|
||||
uint32_t num_mixed_context_lines,
|
||||
uint32_t options,
|
||||
Stream &strm);
|
||||
|
||||
static bool
|
||||
Disassemble (Debugger &debugger,
|
||||
const ArchSpec &arch,
|
||||
const char *plugin_name,
|
||||
const char *flavor,
|
||||
const ExecutionContext &exe_ctx,
|
||||
uint32_t num_instructions,
|
||||
uint32_t num_mixed_context_lines,
|
||||
uint32_t options,
|
||||
Stream &strm);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// Constructors and Destructors
|
||||
//------------------------------------------------------------------
|
||||
Disassembler(const ArchSpec &arch, const char *flavor);
|
||||
virtual ~Disassembler();
|
||||
|
||||
typedef const char * (*SummaryCallback)(const Instruction& inst, ExecutionContext *exe_context, void *user_data);
|
||||
|
||||
static bool
|
||||
PrintInstructions (Disassembler *disasm_ptr,
|
||||
Debugger &debugger,
|
||||
const ArchSpec &arch,
|
||||
const ExecutionContext &exe_ctx,
|
||||
uint32_t num_instructions,
|
||||
uint32_t num_mixed_context_lines,
|
||||
uint32_t options,
|
||||
Stream &strm);
|
||||
|
||||
size_t
|
||||
ParseInstructions (const ExecutionContext *exe_ctx,
|
||||
const AddressRange &range,
|
||||
Stream *error_strm_ptr,
|
||||
bool prefer_file_cache);
|
||||
|
||||
size_t
|
||||
ParseInstructions (const ExecutionContext *exe_ctx,
|
||||
const Address &range,
|
||||
uint32_t num_instructions,
|
||||
bool prefer_file_cache);
|
||||
|
||||
virtual size_t
|
||||
DecodeInstructions (const Address &base_addr,
|
||||
const DataExtractor& data,
|
||||
lldb::offset_t data_offset,
|
||||
size_t num_instructions,
|
||||
bool append,
|
||||
bool data_from_file) = 0;
|
||||
|
||||
InstructionList &
|
||||
GetInstructionList ();
|
||||
|
||||
const InstructionList &
|
||||
GetInstructionList () const;
|
||||
|
||||
const ArchSpec &
|
||||
GetArchitecture () const
|
||||
{
|
||||
return m_arch;
|
||||
}
|
||||
|
||||
const char *
|
||||
GetFlavor () const
|
||||
{
|
||||
return m_flavor.c_str();
|
||||
}
|
||||
|
||||
virtual bool
|
||||
FlavorValidForArchSpec (const lldb_private::ArchSpec &arch, const char *flavor) = 0;
|
||||
|
||||
protected:
|
||||
//------------------------------------------------------------------
|
||||
// Classes that inherit from Disassembler can see and modify these
|
||||
//------------------------------------------------------------------
|
||||
const ArchSpec m_arch;
|
||||
InstructionList m_instruction_list;
|
||||
lldb::addr_t m_base_addr;
|
||||
std::string m_flavor;
|
||||
|
||||
private:
|
||||
//------------------------------------------------------------------
|
||||
// For Disassembler only
|
||||
//------------------------------------------------------------------
|
||||
DISALLOW_COPY_AND_ASSIGN (Disassembler);
|
||||
};
|
||||
|
||||
} // namespace lldb_private
|
||||
|
||||
#endif // liblldb_Disassembler_h_
|
641
include/lldb/Core/EmulateInstruction.h
Normal file
641
include/lldb/Core/EmulateInstruction.h
Normal file
@ -0,0 +1,641 @@
|
||||
//===-- EmulateInstruction.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_EmulateInstruction_h_
|
||||
#define lldb_EmulateInstruction_h_
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "lldb/lldb-private.h"
|
||||
#include "lldb/lldb-public.h"
|
||||
#include "lldb/Core/ArchSpec.h"
|
||||
#include "lldb/Core/PluginInterface.h"
|
||||
#include "lldb/Core/Opcode.h"
|
||||
#include "lldb/Core/RegisterValue.h"
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
/// @class EmulateInstruction EmulateInstruction.h "lldb/Core/EmulateInstruction.h"
|
||||
/// @brief A class that allows emulation of CPU opcodes.
|
||||
///
|
||||
/// This class is a plug-in interface that is accessed through the
|
||||
/// standard static FindPlugin function call in the EmulateInstruction
|
||||
/// class. The FindPlugin takes a target triple and returns a new object
|
||||
/// if there is a plug-in that supports the architecture and OS. Four
|
||||
/// callbacks and a baton are provided. The four callbacks are read
|
||||
/// register, write register, read memory and write memory.
|
||||
///
|
||||
/// This class is currently designed for these main use cases:
|
||||
/// - Auto generation of Call Frame Information (CFI) from assembly code
|
||||
/// - Predicting single step breakpoint locations
|
||||
/// - Emulating instructions for breakpoint traps
|
||||
///
|
||||
/// Objects can be asked to read an instruction which will cause a call
|
||||
/// to the read register callback to get the PC, followed by a read
|
||||
/// memory call to read the opcode. If ReadInstruction () returns true,
|
||||
/// then a call to EmulateInstruction::EvaluateInstruction () can be
|
||||
/// made. At this point the EmulateInstruction subclass will use all of
|
||||
/// the callbacks to emulate an instruction.
|
||||
///
|
||||
/// Clients that provide the callbacks can either do the read/write
|
||||
/// registers/memory to actually emulate the instruction on a real or
|
||||
/// virtual CPU, or watch for the EmulateInstruction::Context which
|
||||
/// is context for the read/write register/memory which explains why
|
||||
/// the callback is being called. Examples of a context are:
|
||||
/// "pushing register 3 onto the stack at offset -12", or "adjusting
|
||||
/// stack pointer by -16". This extra context allows the generation of
|
||||
/// CFI information from assembly code without having to actually do
|
||||
/// the read/write register/memory.
|
||||
///
|
||||
/// Clients must be prepared that not all instructions for an
|
||||
/// Instruction Set Architecture (ISA) will be emulated.
|
||||
///
|
||||
/// Subclasses at the very least should implement the instructions that
|
||||
/// save and restore registers onto the stack and adjustment to the stack
|
||||
/// pointer. By just implementing a few instructions for an ISA that are
|
||||
/// the typical prologue opcodes, you can then generate CFI using a
|
||||
/// class that will soon be available.
|
||||
///
|
||||
/// Implementing all of the instructions that affect the PC can then
|
||||
/// allow single step prediction support.
|
||||
///
|
||||
/// Implementing all of the instructions allows for emulation of opcodes
|
||||
/// for breakpoint traps and will pave the way for "thread centric"
|
||||
/// debugging. The current debugging model is "process centric" where
|
||||
/// all threads must be stopped when any thread is stopped; when
|
||||
/// hitting software breakpoints we must disable the breakpoint by
|
||||
/// restoring the original breakpoint opcde, single stepping and
|
||||
/// restoring the breakpoint trap. If all threads were allowed to run
|
||||
/// then other threads could miss the breakpoint.
|
||||
///
|
||||
/// This class centralizes the code that usually is done in separate
|
||||
/// code paths in a debugger (single step prediction, finding save
|
||||
/// restore locations of registers for unwinding stack frame variables)
|
||||
/// and emulating the intruction is just a bonus.
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
class EmulateInstruction :
|
||||
public PluginInterface
|
||||
{
|
||||
public:
|
||||
|
||||
static EmulateInstruction*
|
||||
FindPlugin (const ArchSpec &arch,
|
||||
InstructionType supported_inst_type,
|
||||
const char *plugin_name);
|
||||
|
||||
enum ContextType
|
||||
{
|
||||
eContextInvalid = 0,
|
||||
// Read an instruciton opcode from memory
|
||||
eContextReadOpcode,
|
||||
|
||||
// Usually used for writing a register value whose source value is an
|
||||
// immediate
|
||||
eContextImmediate,
|
||||
|
||||
// Exclusively used when saving a register to the stack as part of the
|
||||
// prologue
|
||||
eContextPushRegisterOnStack,
|
||||
|
||||
// Exclusively used when restoring a register off the stack as part of
|
||||
// the epilogue
|
||||
eContextPopRegisterOffStack,
|
||||
|
||||
// Add or subtract a value from the stack
|
||||
eContextAdjustStackPointer,
|
||||
|
||||
// Adjust the frame pointer for the current frame
|
||||
eContextSetFramePointer,
|
||||
|
||||
// Add or subtract a value from a base address register (other than SP)
|
||||
eContextAdjustBaseRegister,
|
||||
|
||||
// Add or subtract a value from the PC or store a value to the PC.
|
||||
eContextAdjustPC,
|
||||
|
||||
// Used in WriteRegister callbacks to indicate where the
|
||||
eContextRegisterPlusOffset,
|
||||
|
||||
// Used in WriteMemory callback to indicate where the data came from
|
||||
eContextRegisterStore,
|
||||
|
||||
eContextRegisterLoad,
|
||||
|
||||
// Used when performing a PC-relative branch where the
|
||||
eContextRelativeBranchImmediate,
|
||||
|
||||
// Used when performing an absolute branch where the
|
||||
eContextAbsoluteBranchRegister,
|
||||
|
||||
// Used when performing a supervisor call to an operating system to
|
||||
// provide a service:
|
||||
eContextSupervisorCall,
|
||||
|
||||
// Used when performing a MemU operation to read the PC-relative offset
|
||||
// from an address.
|
||||
eContextTableBranchReadMemory,
|
||||
|
||||
// Used when random bits are written into a register
|
||||
eContextWriteRegisterRandomBits,
|
||||
|
||||
// Used when random bits are written to memory
|
||||
eContextWriteMemoryRandomBits,
|
||||
|
||||
eContextArithmetic,
|
||||
|
||||
eContextAdvancePC,
|
||||
|
||||
eContextReturnFromException
|
||||
};
|
||||
|
||||
enum InfoType {
|
||||
eInfoTypeRegisterPlusOffset,
|
||||
eInfoTypeRegisterPlusIndirectOffset,
|
||||
eInfoTypeRegisterToRegisterPlusOffset,
|
||||
eInfoTypeRegisterToRegisterPlusIndirectOffset,
|
||||
eInfoTypeRegisterRegisterOperands,
|
||||
eInfoTypeOffset,
|
||||
eInfoTypeRegister,
|
||||
eInfoTypeImmediate,
|
||||
eInfoTypeImmediateSigned,
|
||||
eInfoTypeAddress,
|
||||
eInfoTypeISAAndImmediate,
|
||||
eInfoTypeISAAndImmediateSigned,
|
||||
eInfoTypeISA,
|
||||
eInfoTypeNoArgs
|
||||
} InfoType;
|
||||
|
||||
struct Context
|
||||
{
|
||||
ContextType type;
|
||||
enum InfoType info_type;
|
||||
union
|
||||
{
|
||||
struct RegisterPlusOffset
|
||||
{
|
||||
RegisterInfo reg; // base register
|
||||
int64_t signed_offset; // signed offset added to base register
|
||||
} RegisterPlusOffset;
|
||||
|
||||
struct RegisterPlusIndirectOffset
|
||||
{
|
||||
RegisterInfo base_reg; // base register number
|
||||
RegisterInfo offset_reg; // offset register kind
|
||||
} RegisterPlusIndirectOffset;
|
||||
|
||||
struct RegisterToRegisterPlusOffset
|
||||
{
|
||||
RegisterInfo data_reg; // source/target register for data
|
||||
RegisterInfo base_reg; // base register for address calculation
|
||||
int64_t offset; // offset for address calculation
|
||||
} RegisterToRegisterPlusOffset;
|
||||
|
||||
struct RegisterToRegisterPlusIndirectOffset
|
||||
{
|
||||
RegisterInfo base_reg; // base register for address calculation
|
||||
RegisterInfo offset_reg; // offset register for address calculation
|
||||
RegisterInfo data_reg; // source/target register for data
|
||||
} RegisterToRegisterPlusIndirectOffset;
|
||||
|
||||
struct RegisterRegisterOperands
|
||||
{
|
||||
RegisterInfo operand1; // register containing first operand for binary op
|
||||
RegisterInfo operand2; // register containing second operand for binary op
|
||||
} RegisterRegisterOperands;
|
||||
|
||||
int64_t signed_offset; // signed offset by which to adjust self (for registers only)
|
||||
|
||||
RegisterInfo reg; // plain register
|
||||
|
||||
uint64_t unsigned_immediate;// unsigned immediate value
|
||||
int64_t signed_immediate; // signed immediate value
|
||||
|
||||
lldb::addr_t address; // direct address
|
||||
|
||||
struct ISAAndImmediate
|
||||
{
|
||||
uint32_t isa;
|
||||
uint32_t unsigned_data32; // immdiate data
|
||||
} ISAAndImmediate;
|
||||
|
||||
struct ISAAndImmediateSigned
|
||||
{
|
||||
uint32_t isa;
|
||||
int32_t signed_data32; // signed immdiate data
|
||||
} ISAAndImmediateSigned;
|
||||
|
||||
uint32_t isa;
|
||||
|
||||
} info;
|
||||
|
||||
Context () :
|
||||
type (eContextInvalid),
|
||||
info_type (eInfoTypeNoArgs)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
SetRegisterPlusOffset (RegisterInfo base_reg,
|
||||
int64_t signed_offset)
|
||||
{
|
||||
info_type = eInfoTypeRegisterPlusOffset;
|
||||
info.RegisterPlusOffset.reg = base_reg;
|
||||
info.RegisterPlusOffset.signed_offset = signed_offset;
|
||||
}
|
||||
|
||||
void
|
||||
SetRegisterPlusIndirectOffset (RegisterInfo base_reg,
|
||||
RegisterInfo offset_reg)
|
||||
{
|
||||
info_type = eInfoTypeRegisterPlusIndirectOffset;
|
||||
info.RegisterPlusIndirectOffset.base_reg = base_reg;
|
||||
info.RegisterPlusIndirectOffset.offset_reg = offset_reg;
|
||||
}
|
||||
|
||||
void
|
||||
SetRegisterToRegisterPlusOffset (RegisterInfo data_reg,
|
||||
RegisterInfo base_reg,
|
||||
int64_t offset)
|
||||
{
|
||||
info_type = eInfoTypeRegisterToRegisterPlusOffset;
|
||||
info.RegisterToRegisterPlusOffset.data_reg = data_reg;
|
||||
info.RegisterToRegisterPlusOffset.base_reg = base_reg;
|
||||
info.RegisterToRegisterPlusOffset.offset = offset;
|
||||
}
|
||||
|
||||
void
|
||||
SetRegisterToRegisterPlusIndirectOffset (RegisterInfo base_reg,
|
||||
RegisterInfo offset_reg,
|
||||
RegisterInfo data_reg)
|
||||
{
|
||||
info_type = eInfoTypeRegisterToRegisterPlusIndirectOffset;
|
||||
info.RegisterToRegisterPlusIndirectOffset.base_reg = base_reg;
|
||||
info.RegisterToRegisterPlusIndirectOffset.offset_reg = offset_reg;
|
||||
info.RegisterToRegisterPlusIndirectOffset.data_reg = data_reg;
|
||||
}
|
||||
|
||||
void
|
||||
SetRegisterRegisterOperands (RegisterInfo op1_reg,
|
||||
RegisterInfo op2_reg)
|
||||
{
|
||||
info_type = eInfoTypeRegisterRegisterOperands;
|
||||
info.RegisterRegisterOperands.operand1 = op1_reg;
|
||||
info.RegisterRegisterOperands.operand2 = op2_reg;
|
||||
}
|
||||
|
||||
void
|
||||
SetOffset (int64_t signed_offset)
|
||||
{
|
||||
info_type = eInfoTypeOffset;
|
||||
info.signed_offset = signed_offset;
|
||||
}
|
||||
|
||||
void
|
||||
SetRegister (RegisterInfo reg)
|
||||
{
|
||||
info_type = eInfoTypeRegister;
|
||||
info.reg = reg;
|
||||
}
|
||||
|
||||
void
|
||||
SetImmediate (uint64_t immediate)
|
||||
{
|
||||
info_type = eInfoTypeImmediate;
|
||||
info.unsigned_immediate = immediate;
|
||||
}
|
||||
|
||||
void
|
||||
SetImmediateSigned (int64_t signed_immediate)
|
||||
{
|
||||
info_type = eInfoTypeImmediateSigned;
|
||||
info.signed_immediate = signed_immediate;
|
||||
}
|
||||
|
||||
void
|
||||
SetAddress (lldb::addr_t address)
|
||||
{
|
||||
info_type = eInfoTypeAddress;
|
||||
info.address = address;
|
||||
}
|
||||
void
|
||||
SetISAAndImmediate (uint32_t isa, uint32_t data)
|
||||
{
|
||||
info_type = eInfoTypeISAAndImmediate;
|
||||
info.ISAAndImmediate.isa = isa;
|
||||
info.ISAAndImmediate.unsigned_data32 = data;
|
||||
}
|
||||
|
||||
void
|
||||
SetISAAndImmediateSigned (uint32_t isa, int32_t data)
|
||||
{
|
||||
info_type = eInfoTypeISAAndImmediateSigned;
|
||||
info.ISAAndImmediateSigned.isa = isa;
|
||||
info.ISAAndImmediateSigned.signed_data32 = data;
|
||||
}
|
||||
|
||||
void
|
||||
SetISA (uint32_t isa)
|
||||
{
|
||||
info_type = eInfoTypeISA;
|
||||
info.isa = isa;
|
||||
}
|
||||
|
||||
void
|
||||
SetNoArgs ()
|
||||
{
|
||||
info_type = eInfoTypeNoArgs;
|
||||
}
|
||||
|
||||
void
|
||||
Dump (Stream &s,
|
||||
EmulateInstruction *instruction) const;
|
||||
|
||||
};
|
||||
|
||||
typedef size_t (*ReadMemoryCallback) (EmulateInstruction *instruction,
|
||||
void *baton,
|
||||
const Context &context,
|
||||
lldb::addr_t addr,
|
||||
void *dst,
|
||||
size_t length);
|
||||
|
||||
typedef size_t (*WriteMemoryCallback) (EmulateInstruction *instruction,
|
||||
void *baton,
|
||||
const Context &context,
|
||||
lldb::addr_t addr,
|
||||
const void *dst,
|
||||
size_t length);
|
||||
|
||||
typedef bool (*ReadRegisterCallback) (EmulateInstruction *instruction,
|
||||
void *baton,
|
||||
const RegisterInfo *reg_info,
|
||||
RegisterValue ®_value);
|
||||
|
||||
typedef bool (*WriteRegisterCallback) (EmulateInstruction *instruction,
|
||||
void *baton,
|
||||
const Context &context,
|
||||
const RegisterInfo *reg_info,
|
||||
const RegisterValue ®_value);
|
||||
|
||||
EmulateInstruction (const ArchSpec &arch);
|
||||
|
||||
virtual ~EmulateInstruction()
|
||||
{
|
||||
}
|
||||
//----------------------------------------------------------------------
|
||||
// Mandatory overrides
|
||||
//----------------------------------------------------------------------
|
||||
virtual bool
|
||||
SupportsEmulatingIntructionsOfType (InstructionType inst_type) = 0;
|
||||
|
||||
virtual bool
|
||||
SetTargetTriple (const ArchSpec &arch) = 0;
|
||||
|
||||
virtual bool
|
||||
ReadInstruction () = 0;
|
||||
|
||||
virtual bool
|
||||
EvaluateInstruction (uint32_t evaluate_options) = 0;
|
||||
|
||||
virtual bool
|
||||
TestEmulation (Stream *out_stream, ArchSpec &arch, OptionValueDictionary *test_data) = 0;
|
||||
|
||||
virtual bool
|
||||
GetRegisterInfo (uint32_t reg_kind, uint32_t reg_num, RegisterInfo ®_info) = 0;
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Optional overrides
|
||||
//----------------------------------------------------------------------
|
||||
virtual bool
|
||||
SetInstruction (const Opcode &insn_opcode, const Address &inst_addr, Target *target);
|
||||
|
||||
virtual bool
|
||||
CreateFunctionEntryUnwind (UnwindPlan &unwind_plan);
|
||||
|
||||
static const char *
|
||||
TranslateRegister (uint32_t reg_kind, uint32_t reg_num, std::string ®_name);
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// RegisterInfo variants
|
||||
//----------------------------------------------------------------------
|
||||
bool
|
||||
ReadRegister (const RegisterInfo *reg_info,
|
||||
RegisterValue& reg_value);
|
||||
|
||||
uint64_t
|
||||
ReadRegisterUnsigned (const RegisterInfo *reg_info,
|
||||
uint64_t fail_value,
|
||||
bool *success_ptr);
|
||||
|
||||
bool
|
||||
WriteRegister (const Context &context,
|
||||
const RegisterInfo *ref_info,
|
||||
const RegisterValue& reg_value);
|
||||
|
||||
bool
|
||||
WriteRegisterUnsigned (const Context &context,
|
||||
const RegisterInfo *reg_info,
|
||||
uint64_t reg_value);
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Register kind and number variants
|
||||
//----------------------------------------------------------------------
|
||||
bool
|
||||
ReadRegister (uint32_t reg_kind,
|
||||
uint32_t reg_num,
|
||||
RegisterValue& reg_value);
|
||||
|
||||
bool
|
||||
WriteRegister (const Context &context,
|
||||
uint32_t reg_kind,
|
||||
uint32_t reg_num,
|
||||
const RegisterValue& reg_value);
|
||||
|
||||
uint64_t
|
||||
ReadRegisterUnsigned (uint32_t reg_kind,
|
||||
uint32_t reg_num,
|
||||
uint64_t fail_value,
|
||||
bool *success_ptr);
|
||||
|
||||
bool
|
||||
WriteRegisterUnsigned (const Context &context,
|
||||
uint32_t reg_kind,
|
||||
uint32_t reg_num,
|
||||
uint64_t reg_value);
|
||||
|
||||
|
||||
size_t
|
||||
ReadMemory (const Context &context,
|
||||
lldb::addr_t addr,
|
||||
void *dst,
|
||||
size_t dst_len);
|
||||
|
||||
uint64_t
|
||||
ReadMemoryUnsigned (const Context &context,
|
||||
lldb::addr_t addr,
|
||||
size_t byte_size,
|
||||
uint64_t fail_value,
|
||||
bool *success_ptr);
|
||||
|
||||
bool
|
||||
WriteMemory (const Context &context,
|
||||
lldb::addr_t addr,
|
||||
const void *src,
|
||||
size_t src_len);
|
||||
|
||||
bool
|
||||
WriteMemoryUnsigned (const Context &context,
|
||||
lldb::addr_t addr,
|
||||
uint64_t uval,
|
||||
size_t uval_byte_size);
|
||||
|
||||
uint32_t
|
||||
GetAddressByteSize () const
|
||||
{
|
||||
return m_arch.GetAddressByteSize();
|
||||
}
|
||||
|
||||
lldb::ByteOrder
|
||||
GetByteOrder () const
|
||||
{
|
||||
return m_arch.GetByteOrder();
|
||||
}
|
||||
|
||||
const Opcode &
|
||||
GetOpcode () const
|
||||
{
|
||||
return m_opcode;
|
||||
}
|
||||
|
||||
lldb::addr_t
|
||||
GetAddress () const
|
||||
{
|
||||
return m_addr;
|
||||
}
|
||||
|
||||
const ArchSpec &
|
||||
GetArchitecture () const
|
||||
{
|
||||
return m_arch;
|
||||
}
|
||||
|
||||
|
||||
static size_t
|
||||
ReadMemoryFrame (EmulateInstruction *instruction,
|
||||
void *baton,
|
||||
const Context &context,
|
||||
lldb::addr_t addr,
|
||||
void *dst,
|
||||
size_t length);
|
||||
|
||||
static size_t
|
||||
WriteMemoryFrame (EmulateInstruction *instruction,
|
||||
void *baton,
|
||||
const Context &context,
|
||||
lldb::addr_t addr,
|
||||
const void *dst,
|
||||
size_t length);
|
||||
|
||||
static bool
|
||||
ReadRegisterFrame (EmulateInstruction *instruction,
|
||||
void *baton,
|
||||
const RegisterInfo *reg_info,
|
||||
RegisterValue ®_value);
|
||||
|
||||
|
||||
static bool
|
||||
WriteRegisterFrame (EmulateInstruction *instruction,
|
||||
void *baton,
|
||||
const Context &context,
|
||||
const RegisterInfo *reg_info,
|
||||
const RegisterValue ®_value);
|
||||
|
||||
static size_t
|
||||
ReadMemoryDefault (EmulateInstruction *instruction,
|
||||
void *baton,
|
||||
const Context &context,
|
||||
lldb::addr_t addr,
|
||||
void *dst,
|
||||
size_t length);
|
||||
|
||||
static size_t
|
||||
WriteMemoryDefault (EmulateInstruction *instruction,
|
||||
void *baton,
|
||||
const Context &context,
|
||||
lldb::addr_t addr,
|
||||
const void *dst,
|
||||
size_t length);
|
||||
|
||||
static bool
|
||||
ReadRegisterDefault (EmulateInstruction *instruction,
|
||||
void *baton,
|
||||
const RegisterInfo *reg_info,
|
||||
RegisterValue ®_value);
|
||||
|
||||
|
||||
static bool
|
||||
WriteRegisterDefault (EmulateInstruction *instruction,
|
||||
void *baton,
|
||||
const Context &context,
|
||||
const RegisterInfo *reg_info,
|
||||
const RegisterValue ®_value);
|
||||
|
||||
void
|
||||
SetBaton (void *baton);
|
||||
|
||||
void
|
||||
SetCallbacks (ReadMemoryCallback read_mem_callback,
|
||||
WriteMemoryCallback write_mem_callback,
|
||||
ReadRegisterCallback read_reg_callback,
|
||||
WriteRegisterCallback write_reg_callback);
|
||||
|
||||
void
|
||||
SetReadMemCallback (ReadMemoryCallback read_mem_callback);
|
||||
|
||||
void
|
||||
SetWriteMemCallback (WriteMemoryCallback write_mem_callback);
|
||||
|
||||
void
|
||||
SetReadRegCallback (ReadRegisterCallback read_reg_callback);
|
||||
|
||||
void
|
||||
SetWriteRegCallback (WriteRegisterCallback write_reg_callback);
|
||||
|
||||
static bool
|
||||
GetBestRegisterKindAndNumber (const RegisterInfo *reg_info,
|
||||
uint32_t ®_kind,
|
||||
uint32_t ®_num);
|
||||
|
||||
static uint32_t
|
||||
GetInternalRegisterNumber (RegisterContext *reg_ctx,
|
||||
const RegisterInfo ®_info);
|
||||
|
||||
protected:
|
||||
ArchSpec m_arch;
|
||||
void * m_baton;
|
||||
ReadMemoryCallback m_read_mem_callback;
|
||||
WriteMemoryCallback m_write_mem_callback;
|
||||
ReadRegisterCallback m_read_reg_callback;
|
||||
WriteRegisterCallback m_write_reg_callback;
|
||||
lldb::addr_t m_addr;
|
||||
Opcode m_opcode;
|
||||
|
||||
|
||||
private:
|
||||
//------------------------------------------------------------------
|
||||
// For EmulateInstruction only
|
||||
//------------------------------------------------------------------
|
||||
DISALLOW_COPY_AND_ASSIGN (EmulateInstruction);
|
||||
};
|
||||
|
||||
} // namespace lldb_private
|
||||
|
||||
#endif // lldb_EmulateInstruction_h_
|
312
include/lldb/Core/Error.h
Normal file
312
include/lldb/Core/Error.h
Normal file
@ -0,0 +1,312 @@
|
||||
//===-- Error.h -------------------------------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef __DCError_h__
|
||||
#define __DCError_h__
|
||||
#if defined(__cplusplus)
|
||||
|
||||
#if defined (__APPLE__)
|
||||
#include <mach/mach.h>
|
||||
#endif
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <string>
|
||||
|
||||
#include "lldb/lldb-private.h"
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
class Log;
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
/// @class Error Error.h "lldb/Core/Error.h"
|
||||
/// @brief An error handling class.
|
||||
///
|
||||
/// This class is designed to be able to hold any error code that can be
|
||||
/// encountered on a given platform. The errors are stored as a value
|
||||
/// of type Error::ValueType. This value should be large enough to hold
|
||||
/// any and all errors that the class supports. Each error has an
|
||||
/// associated type that is of type lldb::ErrorType. New types
|
||||
/// can be added to support new error types, and architecture specific
|
||||
/// types can be enabled. In the future we may wish to switch to a
|
||||
/// registration mechanism where new error types can be registered at
|
||||
/// runtime instead of a hard coded scheme.
|
||||
///
|
||||
/// All errors in this class also know how to generate a string
|
||||
/// representation of themselves for printing results and error codes.
|
||||
/// The string value will be fetched on demand and its string value will
|
||||
/// be cached until the error is cleared of the value of the error
|
||||
/// changes.
|
||||
//----------------------------------------------------------------------
|
||||
class Error
|
||||
{
|
||||
public:
|
||||
//------------------------------------------------------------------
|
||||
/// Every error value that this object can contain needs to be able
|
||||
/// to fit into ValueType.
|
||||
//------------------------------------------------------------------
|
||||
typedef uint32_t ValueType;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Default constructor.
|
||||
///
|
||||
/// Initialize the error object with a generic success value.
|
||||
///
|
||||
/// @param[in] err
|
||||
/// An error code.
|
||||
///
|
||||
/// @param[in] type
|
||||
/// The type for \a err.
|
||||
//------------------------------------------------------------------
|
||||
Error ();
|
||||
|
||||
explicit
|
||||
Error (ValueType err, lldb::ErrorType type = lldb::eErrorTypeGeneric);
|
||||
|
||||
explicit
|
||||
Error (const char* err_str);
|
||||
|
||||
Error (const Error &rhs);
|
||||
//------------------------------------------------------------------
|
||||
/// Assignment operator.
|
||||
///
|
||||
/// @param[in] err
|
||||
/// An error code.
|
||||
///
|
||||
/// @return
|
||||
/// A const reference to this object.
|
||||
//------------------------------------------------------------------
|
||||
const Error&
|
||||
operator = (const Error& rhs);
|
||||
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Assignment operator from a kern_return_t.
|
||||
///
|
||||
/// Sets the type to \c MachKernel and the error code to \a err.
|
||||
///
|
||||
/// @param[in] err
|
||||
/// A mach error code.
|
||||
///
|
||||
/// @return
|
||||
/// A const reference to this object.
|
||||
//------------------------------------------------------------------
|
||||
const Error&
|
||||
operator = (uint32_t err);
|
||||
|
||||
~Error();
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Get the error string associated with the current error.
|
||||
//
|
||||
/// Gets the error value as a NULL terminated C string. The error
|
||||
/// string will be fetched and cached on demand. The error string
|
||||
/// will be retrieved from a callback that is appropriate for the
|
||||
/// type of the error and will be cached until the error value is
|
||||
/// changed or cleared.
|
||||
///
|
||||
/// @return
|
||||
/// The error as a NULL terminated C string value if the error
|
||||
/// is valid and is able to be converted to a string value,
|
||||
/// NULL otherwise.
|
||||
//------------------------------------------------------------------
|
||||
const char *
|
||||
AsCString (const char *default_error_str = "unknown error") const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Clear the object state.
|
||||
///
|
||||
/// Reverts the state of this object to contain a generic success
|
||||
/// value and frees any cached error string value.
|
||||
//------------------------------------------------------------------
|
||||
void
|
||||
Clear ();
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Test for error condition.
|
||||
///
|
||||
/// @return
|
||||
/// \b true if this object contains an error, \b false
|
||||
/// otherwise.
|
||||
//------------------------------------------------------------------
|
||||
bool
|
||||
Fail () const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Access the error value.
|
||||
///
|
||||
/// @return
|
||||
/// The error value.
|
||||
//------------------------------------------------------------------
|
||||
ValueType
|
||||
GetError () const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Access the error type.
|
||||
///
|
||||
/// @return
|
||||
/// The error type enumeration value.
|
||||
//------------------------------------------------------------------
|
||||
lldb::ErrorType
|
||||
GetType () const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Log an error to Log().
|
||||
///
|
||||
/// Log the error given a formatted string \a format. If the this
|
||||
/// object contains an error code, update the error string to
|
||||
/// contain the prefix "error: ", followed by the formatted string,
|
||||
/// followed by the error value and any string that describes the
|
||||
/// error value. This allows more context to be given to an error
|
||||
/// string that remains cached in this object. Logging always occurs
|
||||
/// even when the error code contains a non-error value.
|
||||
///
|
||||
/// @param[in] format
|
||||
/// A printf style format string.
|
||||
///
|
||||
/// @param[in] ...
|
||||
/// Variable arguments that are needed for the printf style
|
||||
/// format string \a format.
|
||||
//------------------------------------------------------------------
|
||||
void
|
||||
PutToLog (Log *log, const char *format, ...) __attribute__ ((format (printf, 3, 4)));
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Log an error to Log() if the error value is an error.
|
||||
///
|
||||
/// Log the error given a formatted string \a format only if the
|
||||
/// error value in this object describes an error condition. If the
|
||||
/// this object contains an error, update the error string to
|
||||
/// contain the prefix "error: " followed by the formatted string,
|
||||
/// followed by the error value and any string that describes the
|
||||
/// error value. This allows more context to be given to an error
|
||||
/// string that remains cached in this object.
|
||||
///
|
||||
/// @param[in] format
|
||||
/// A printf style format string.
|
||||
///
|
||||
/// @param[in] ...
|
||||
/// Variable arguments that are needed for the printf style
|
||||
/// format string \a format.
|
||||
//------------------------------------------------------------------
|
||||
void
|
||||
LogIfError (Log *log, const char *format, ...) __attribute__ ((format (printf, 3, 4)));
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Set accessor from a kern_return_t.
|
||||
///
|
||||
/// Set accesssor for the error value to \a err and the error type
|
||||
/// to \c MachKernel.
|
||||
///
|
||||
/// @param[in] err
|
||||
/// A mach error code.
|
||||
//------------------------------------------------------------------
|
||||
void
|
||||
SetMachError (uint32_t err);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Set accesssor with an error value and type.
|
||||
///
|
||||
/// Set accesssor for the error value to \a err and the error type
|
||||
/// to \a type.
|
||||
///
|
||||
/// @param[in] err
|
||||
/// A mach error code.
|
||||
///
|
||||
/// @param[in] type
|
||||
/// The type for \a err.
|
||||
//------------------------------------------------------------------
|
||||
void
|
||||
SetError (ValueType err, lldb::ErrorType type);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Set the current error to errno.
|
||||
///
|
||||
/// Update the error value to be \c errno and update the type to
|
||||
/// be \c Error::POSIX.
|
||||
//------------------------------------------------------------------
|
||||
void
|
||||
SetErrorToErrno ();
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Set the current error to a generic error.
|
||||
///
|
||||
/// Update the error value to be \c LLDB_GENERIC_ERROR and update the
|
||||
/// type to be \c Error::Generic.
|
||||
//------------------------------------------------------------------
|
||||
void
|
||||
SetErrorToGenericError ();
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Set the current error string to \a err_str.
|
||||
///
|
||||
/// Set accessor for the error string value for a generic errors,
|
||||
/// or to supply additional details above and beyond the standard
|
||||
/// error strings that the standard type callbacks typically
|
||||
/// provide. This allows custom strings to be supplied as an
|
||||
/// error explanation. The error string value will remain until the
|
||||
/// error value is cleared or a new error value/type is assigned.
|
||||
///
|
||||
/// @param err_str
|
||||
/// The new custom error string to copy and cache.
|
||||
//------------------------------------------------------------------
|
||||
void
|
||||
SetErrorString (const char *err_str);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Set the current error string to a formatted error string.
|
||||
///
|
||||
/// @param format
|
||||
/// A printf style format string
|
||||
//------------------------------------------------------------------
|
||||
int
|
||||
SetErrorStringWithFormat (const char *format, ...) __attribute__ ((format (printf, 2, 3)));
|
||||
|
||||
int
|
||||
SetErrorStringWithVarArg (const char *format, va_list args);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Test for success condition.
|
||||
///
|
||||
/// Returns true if the error code in this object is considered a
|
||||
/// successful return value.
|
||||
///
|
||||
/// @return
|
||||
/// \b true if this object contains an value that describes
|
||||
/// success (non-erro), \b false otherwise.
|
||||
//------------------------------------------------------------------
|
||||
bool
|
||||
Success () const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Test for a failure due to a generic interrupt.
|
||||
///
|
||||
/// Returns true if the error code in this object was caused by an interrupt.
|
||||
/// At present only supports Posix EINTR.
|
||||
///
|
||||
/// @return
|
||||
/// \b true if this object contains an value that describes
|
||||
/// failure due to interrupt, \b false otherwise.
|
||||
//------------------------------------------------------------------
|
||||
bool
|
||||
WasInterrupted() const;
|
||||
|
||||
protected:
|
||||
//------------------------------------------------------------------
|
||||
/// Member variables
|
||||
//------------------------------------------------------------------
|
||||
ValueType m_code; ///< Error code as an integer value.
|
||||
lldb::ErrorType m_type; ///< The type of the above error code.
|
||||
mutable std::string m_string; ///< A string representation of the error code.
|
||||
};
|
||||
|
||||
} // namespace lldb_private
|
||||
|
||||
#endif // #if defined(__cplusplus)
|
||||
#endif // #ifndef __DCError_h__
|
217
include/lldb/Core/Event.h
Normal file
217
include/lldb/Core/Event.h
Normal file
@ -0,0 +1,217 @@
|
||||
//===-- Event.h -------------------------------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef liblldb_Event_h_
|
||||
#define liblldb_Event_h_
|
||||
|
||||
// C Includes
|
||||
// C++ Includes
|
||||
#include <list>
|
||||
#include <string>
|
||||
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/lldb-private.h"
|
||||
#include "lldb/Core/ConstString.h"
|
||||
#include "lldb/Host/Predicate.h"
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// lldb::EventData
|
||||
//----------------------------------------------------------------------
|
||||
class EventData
|
||||
{
|
||||
friend class Event;
|
||||
|
||||
public:
|
||||
EventData ();
|
||||
|
||||
virtual
|
||||
~EventData();
|
||||
|
||||
virtual const ConstString &
|
||||
GetFlavor () const = 0;
|
||||
|
||||
virtual void
|
||||
Dump (Stream *s) const;
|
||||
|
||||
private:
|
||||
virtual void
|
||||
DoOnRemoval (Event *event_ptr)
|
||||
{
|
||||
}
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN (EventData);
|
||||
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// lldb::EventDataBytes
|
||||
//----------------------------------------------------------------------
|
||||
class EventDataBytes : public EventData
|
||||
{
|
||||
public:
|
||||
//------------------------------------------------------------------
|
||||
// Constructors
|
||||
//------------------------------------------------------------------
|
||||
EventDataBytes ();
|
||||
|
||||
EventDataBytes (const char *cstr);
|
||||
|
||||
EventDataBytes (const void *src, size_t src_len);
|
||||
|
||||
virtual
|
||||
~EventDataBytes();
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// Member functions
|
||||
//------------------------------------------------------------------
|
||||
virtual const ConstString &
|
||||
GetFlavor () const;
|
||||
|
||||
virtual void
|
||||
Dump (Stream *s) const;
|
||||
|
||||
const void *
|
||||
GetBytes() const;
|
||||
|
||||
size_t
|
||||
GetByteSize() const;
|
||||
|
||||
void
|
||||
SetBytes (const void *src, size_t src_len);
|
||||
|
||||
void
|
||||
SwapBytes (std::string &new_bytes);
|
||||
|
||||
void
|
||||
SetBytesFromCString (const char *cstr);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// Static functions
|
||||
//------------------------------------------------------------------
|
||||
static const EventDataBytes *
|
||||
GetEventDataFromEvent (const Event *event_ptr);
|
||||
|
||||
static const void *
|
||||
GetBytesFromEvent (const Event *event_ptr);
|
||||
|
||||
static size_t
|
||||
GetByteSizeFromEvent (const Event *event_ptr);
|
||||
|
||||
static const ConstString &
|
||||
GetFlavorString ();
|
||||
|
||||
private:
|
||||
std::string m_bytes;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN (EventDataBytes);
|
||||
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// lldb::Event
|
||||
//----------------------------------------------------------------------
|
||||
class Event
|
||||
{
|
||||
friend class Broadcaster;
|
||||
friend class Listener;
|
||||
friend class EventData;
|
||||
|
||||
public:
|
||||
|
||||
Event (Broadcaster *broadcaster, uint32_t event_type, EventData *data = NULL);
|
||||
|
||||
Event (uint32_t event_type, EventData *data = NULL);
|
||||
|
||||
~Event ();
|
||||
|
||||
void
|
||||
Dump (Stream *s) const;
|
||||
|
||||
EventData *
|
||||
GetData ()
|
||||
{
|
||||
return m_data_ap.get();
|
||||
}
|
||||
|
||||
const EventData *
|
||||
GetData () const
|
||||
{
|
||||
return m_data_ap.get();
|
||||
}
|
||||
|
||||
void
|
||||
SetData (EventData *new_data)
|
||||
{
|
||||
m_data_ap.reset (new_data);
|
||||
}
|
||||
|
||||
uint32_t
|
||||
GetType () const
|
||||
{
|
||||
return m_type;
|
||||
}
|
||||
|
||||
void
|
||||
SetType (uint32_t new_type)
|
||||
{
|
||||
m_type = new_type;
|
||||
}
|
||||
|
||||
Broadcaster *
|
||||
GetBroadcaster () const
|
||||
{
|
||||
return m_broadcaster;
|
||||
}
|
||||
|
||||
bool
|
||||
BroadcasterIs (Broadcaster *broadcaster)
|
||||
{
|
||||
return broadcaster == m_broadcaster;
|
||||
}
|
||||
|
||||
void
|
||||
Clear()
|
||||
{
|
||||
m_data_ap.reset();
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
// This is only called by Listener when it pops an event off the queue for
|
||||
// the listener. It calls the Event Data's DoOnRemoval() method, which is
|
||||
// virtual and can be overridden by the specific data classes.
|
||||
|
||||
void
|
||||
DoOnRemoval ();
|
||||
|
||||
// Called by Broadcaster::BroadcastEvent prior to letting all the listeners
|
||||
// know about it update the contained broadcaster so that events can be
|
||||
// popped off one queue and re-broadcast to others.
|
||||
void
|
||||
SetBroadcaster (Broadcaster *broadcaster)
|
||||
{
|
||||
m_broadcaster = broadcaster;
|
||||
}
|
||||
|
||||
|
||||
Broadcaster * m_broadcaster; // The broadcaster that sent this event
|
||||
uint32_t m_type; // The bit describing this event
|
||||
std::unique_ptr<EventData> m_data_ap; // User specific data for this event
|
||||
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN (Event);
|
||||
Event(); // Disallow default constructor
|
||||
};
|
||||
|
||||
} // namespace lldb_private
|
||||
|
||||
#endif // liblldb_Event_h_
|
81
include/lldb/Core/FileLineResolver.h
Normal file
81
include/lldb/Core/FileLineResolver.h
Normal file
@ -0,0 +1,81 @@
|
||||
//===-- FileLineResolver.h --------------------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef liblldb_FileLineResolver_h_
|
||||
#define liblldb_FileLineResolver_h_
|
||||
|
||||
// Project includes
|
||||
#include "lldb/Core/AddressResolver.h"
|
||||
#include "lldb/Symbol/SymbolContext.h"
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
/// @class FileLineResolver FileLineResolver.h "lldb/Core/FileLineResolver.h"
|
||||
/// @brief This class finds address for source file and line. Optionally, it will look for inlined
|
||||
/// instances of the file and line specification.
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
class FileLineResolver :
|
||||
public Searcher
|
||||
{
|
||||
public:
|
||||
FileLineResolver () :
|
||||
m_file_spec(),
|
||||
m_line_number(UINT32_MAX), // Set this to zero for all lines in a file
|
||||
m_sc_list (),
|
||||
m_inlines (true)
|
||||
{
|
||||
}
|
||||
|
||||
FileLineResolver (const FileSpec &resolver,
|
||||
uint32_t line_no,
|
||||
bool check_inlines);
|
||||
|
||||
virtual
|
||||
~FileLineResolver ();
|
||||
|
||||
virtual Searcher::CallbackReturn
|
||||
SearchCallback (SearchFilter &filter,
|
||||
SymbolContext &context,
|
||||
Address *addr,
|
||||
bool containing);
|
||||
|
||||
virtual Searcher::Depth
|
||||
GetDepth ();
|
||||
|
||||
virtual void
|
||||
GetDescription (Stream *s);
|
||||
|
||||
const SymbolContextList &
|
||||
GetFileLineMatches()
|
||||
{
|
||||
return m_sc_list;
|
||||
}
|
||||
|
||||
void
|
||||
Clear();
|
||||
|
||||
void
|
||||
Reset (const FileSpec &file_spec,
|
||||
uint32_t line,
|
||||
bool check_inlines);
|
||||
protected:
|
||||
FileSpec m_file_spec; // This is the file spec we are looking for.
|
||||
uint32_t m_line_number; // This is the line number that we are looking for.
|
||||
SymbolContextList m_sc_list;
|
||||
bool m_inlines; // This determines whether the resolver looks for inlined functions or not.
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(FileLineResolver);
|
||||
};
|
||||
|
||||
} // namespace lldb_private
|
||||
|
||||
#endif // liblldb_FileLineResolver_h_
|
243
include/lldb/Core/FileSpecList.h
Normal file
243
include/lldb/Core/FileSpecList.h
Normal file
@ -0,0 +1,243 @@
|
||||
//===-- FileSpecList.h ------------------------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef liblldb_FileSpecList_h_
|
||||
#define liblldb_FileSpecList_h_
|
||||
#if defined(__cplusplus)
|
||||
|
||||
#include "lldb/lldb-private.h"
|
||||
#include "lldb/Host/FileSpec.h"
|
||||
#include <vector>
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
/// @class FileSpecList FileSpecList.h "lldb/Core/FileSpecList.h"
|
||||
/// @brief A file collection class.
|
||||
///
|
||||
/// A class that contains a mutable list of FileSpec objects.
|
||||
//----------------------------------------------------------------------
|
||||
class FileSpecList
|
||||
{
|
||||
public:
|
||||
//------------------------------------------------------------------
|
||||
/// Default constructor.
|
||||
///
|
||||
/// Initialize this object with an empty file list.
|
||||
//------------------------------------------------------------------
|
||||
FileSpecList ();
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Copy constructor.
|
||||
///
|
||||
/// Initialize this object with a copy of the file list from \a rhs.
|
||||
///
|
||||
/// @param[in] rhs
|
||||
/// A const reference to another file list object.
|
||||
//------------------------------------------------------------------
|
||||
FileSpecList (const FileSpecList &rhs);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Destructor.
|
||||
//------------------------------------------------------------------
|
||||
~FileSpecList ();
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Assignment operator.
|
||||
///
|
||||
/// Replace the file list in this object with the file list from
|
||||
/// \a rhs.
|
||||
///
|
||||
/// @param[in] rhs
|
||||
/// A file list object to copy.
|
||||
///
|
||||
/// @return
|
||||
/// A const reference to this object.
|
||||
//------------------------------------------------------------------
|
||||
const FileSpecList&
|
||||
operator= (const FileSpecList &rhs);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Append a FileSpec object to the list.
|
||||
///
|
||||
/// Appends \a file to the end of the file list.
|
||||
///
|
||||
/// @param[in] file
|
||||
/// A new file to append to this file list.
|
||||
//------------------------------------------------------------------
|
||||
void
|
||||
Append (const FileSpec &file);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Append a FileSpec object if unique.
|
||||
///
|
||||
/// Appends \a file to the end of the file list if it doesn't
|
||||
/// already exist in the file list.
|
||||
///
|
||||
/// @param[in] file
|
||||
/// A new file to append to this file list.
|
||||
///
|
||||
/// @return
|
||||
/// \b true if the file was appended, \b false otherwise.
|
||||
//------------------------------------------------------------------
|
||||
bool
|
||||
AppendIfUnique (const FileSpec &file);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Clears the file list.
|
||||
//------------------------------------------------------------------
|
||||
void
|
||||
Clear ();
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Dumps the file list to the supplied stream pointer "s".
|
||||
///
|
||||
/// @param[in] s
|
||||
/// The stream that will be used to dump the object description.
|
||||
//------------------------------------------------------------------
|
||||
void
|
||||
Dump (Stream *s, const char *separator_cstr = "\n") const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Find a file index.
|
||||
///
|
||||
/// Find the index of the file in the file spec list that matches
|
||||
/// \a file starting \a idx entries into the file spec list.
|
||||
///
|
||||
/// @param[in] idx
|
||||
/// An index into the file list.
|
||||
///
|
||||
/// @param[in] file
|
||||
/// The file specification to search for.
|
||||
///
|
||||
/// @param[in] full
|
||||
/// Should FileSpec::Equal be called with "full" true or false.
|
||||
///
|
||||
/// @return
|
||||
/// The index of the file that matches \a file if it is found,
|
||||
/// else UINT32_MAX is returned.
|
||||
//------------------------------------------------------------------
|
||||
size_t
|
||||
FindFileIndex (size_t idx, const FileSpec &file, bool full) const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Get file at index.
|
||||
///
|
||||
/// Gets a file from the file list. If \a idx is not a valid index,
|
||||
/// an empty FileSpec object will be returned. The file objects
|
||||
/// that are returned can be tested using
|
||||
/// FileSpec::operator void*().
|
||||
///
|
||||
/// @param[in] idx
|
||||
/// An index into the file list.
|
||||
///
|
||||
/// @return
|
||||
/// A copy of the FileSpec object at index \a idx. If \a idx
|
||||
/// is out of range, then an empty FileSpec object will be
|
||||
/// returned.
|
||||
//------------------------------------------------------------------
|
||||
const FileSpec &
|
||||
GetFileSpecAtIndex (size_t idx) const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Get file specification pointer at index.
|
||||
///
|
||||
/// Gets a file from the file list. The file objects that are
|
||||
/// returned can be tested using FileSpec::operator void*().
|
||||
///
|
||||
/// @param[in] idx
|
||||
/// An index into the file list.
|
||||
///
|
||||
/// @return
|
||||
/// A pointer to a contained FileSpec object at index \a idx.
|
||||
/// If \a idx is out of range, then an NULL is returned.
|
||||
//------------------------------------------------------------------
|
||||
const FileSpec *
|
||||
GetFileSpecPointerAtIndex (size_t idx) const;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Get the memory cost of this object.
|
||||
///
|
||||
/// Return the size in bytes that this object takes in memory. This
|
||||
/// returns the size in bytes of this object, not any shared string
|
||||
/// values it may refer to.
|
||||
///
|
||||
/// @return
|
||||
/// The number of bytes that this object occupies in memory.
|
||||
///
|
||||
/// @see ConstString::StaticMemorySize ()
|
||||
//------------------------------------------------------------------
|
||||
size_t
|
||||
MemorySize () const;
|
||||
|
||||
bool
|
||||
IsEmpty() const
|
||||
{
|
||||
return m_files.empty();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Get the number of files in the file list.
|
||||
///
|
||||
/// @return
|
||||
/// The number of files in the file spec list.
|
||||
//------------------------------------------------------------------
|
||||
size_t
|
||||
GetSize () const;
|
||||
|
||||
bool
|
||||
Insert (size_t idx, const FileSpec &file)
|
||||
{
|
||||
if (idx < m_files.size())
|
||||
{
|
||||
m_files.insert(m_files.begin() + idx, file);
|
||||
return true;
|
||||
}
|
||||
else if (idx == m_files.size())
|
||||
{
|
||||
m_files.push_back(file);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
Replace (size_t idx, const FileSpec &file)
|
||||
{
|
||||
if (idx < m_files.size())
|
||||
{
|
||||
m_files[idx] = file;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
Remove (size_t idx)
|
||||
{
|
||||
if (idx < m_files.size())
|
||||
{
|
||||
m_files.erase(m_files.begin() + idx);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static size_t GetFilesMatchingPartialPath (const char *path, bool dir_okay, FileSpecList &matches);
|
||||
|
||||
protected:
|
||||
typedef std::vector<FileSpec> collection; ///< The collection type for the file list.
|
||||
collection m_files; ///< A collection of FileSpec objects.
|
||||
};
|
||||
|
||||
} // namespace lldb_private
|
||||
|
||||
|
||||
#endif // #if defined(__cplusplus)
|
||||
#endif // liblldb_FileSpecList_h_
|
253
include/lldb/Core/Flags.h
Normal file
253
include/lldb/Core/Flags.h
Normal file
@ -0,0 +1,253 @@
|
||||
//===-- Flags.h -------------------------------------------------*- C++ -*-===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef liblldb_Flags_h_
|
||||
#define liblldb_Flags_h_
|
||||
#if defined(__cplusplus)
|
||||
|
||||
|
||||
#include <stdint.h>
|
||||
#include <unistd.h>
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
/// @class Flags Flags.h "lldb/Core/Flags.h"
|
||||
/// @brief A class to manage flags.
|
||||
///
|
||||
/// The Flags class managed flag bits and allows testing and
|
||||
/// modification of individual or multiple flag bits.
|
||||
//----------------------------------------------------------------------
|
||||
class Flags
|
||||
{
|
||||
public:
|
||||
//----------------------------------------------------------------------
|
||||
/// The value type for flags is a 32 bit unsigned integer type.
|
||||
//----------------------------------------------------------------------
|
||||
typedef uint32_t ValueType;
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
/// Construct with initial flag bit values.
|
||||
///
|
||||
/// Constructs this object with \a mask as the initial value for all
|
||||
/// of the flags.
|
||||
///
|
||||
/// @param[in] mask
|
||||
/// The initial value for all flags.
|
||||
//----------------------------------------------------------------------
|
||||
Flags (ValueType flags = 0) :
|
||||
m_flags (flags)
|
||||
{
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
/// Copy constructor.
|
||||
///
|
||||
/// Construct and copy the flags from \a rhs.
|
||||
///
|
||||
/// @param[in] rhs
|
||||
/// A const Flags object reference to copy.
|
||||
//----------------------------------------------------------------------
|
||||
Flags (const Flags& rhs) :
|
||||
m_flags(rhs.m_flags)
|
||||
{
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
/// Destructor.
|
||||
//----------------------------------------------------------------------
|
||||
~Flags ()
|
||||
{
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
/// Get accessor for all flags.
|
||||
///
|
||||
/// @return
|
||||
/// Returns all of the flags as a Flags::ValueType.
|
||||
//----------------------------------------------------------------------
|
||||
ValueType
|
||||
Get () const
|
||||
{
|
||||
return m_flags;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
/// Return the number of flags that can be represented in this
|
||||
/// object.
|
||||
///
|
||||
/// @return
|
||||
/// The maximum number bits in this flag object.
|
||||
//----------------------------------------------------------------------
|
||||
size_t
|
||||
GetBitSize() const
|
||||
{
|
||||
return sizeof (ValueType) * 8;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
/// Set accessor for all flags.
|
||||
///
|
||||
/// @param[in] flags
|
||||
/// The bits with which to replace all of the current flags.
|
||||
//----------------------------------------------------------------------
|
||||
void
|
||||
Reset (ValueType flags)
|
||||
{
|
||||
m_flags = flags;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
/// Clear one or more flags.
|
||||
///
|
||||
/// @param[in] mask
|
||||
/// A bitfield containing one or more flags.
|
||||
///
|
||||
/// @return
|
||||
/// The new flags after clearing all bits from \a mask.
|
||||
//----------------------------------------------------------------------
|
||||
ValueType
|
||||
Clear (ValueType mask = ~(ValueType)0)
|
||||
{
|
||||
m_flags &= ~mask;
|
||||
return m_flags;
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
/// Set one or more flags by logical OR'ing \a mask with the current
|
||||
/// flags.
|
||||
///
|
||||
/// @param[in] mask
|
||||
/// A bitfield containing one or more flags.
|
||||
///
|
||||
/// @return
|
||||
/// The new flags after setting all bits from \a mask.
|
||||
//----------------------------------------------------------------------
|
||||
ValueType
|
||||
Set (ValueType mask)
|
||||
{
|
||||
m_flags |= mask;
|
||||
return m_flags;
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
/// Test if all bits in \a mask are 1 in the current flags
|
||||
///
|
||||
/// @return
|
||||
/// \b true if all flags in \a mask are 1, \b false
|
||||
/// otherwise.
|
||||
//----------------------------------------------------------------------
|
||||
bool
|
||||
AllSet (ValueType mask) const
|
||||
{
|
||||
return (m_flags & mask) == mask;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
/// Test one or more flags.
|
||||
///
|
||||
/// @return
|
||||
/// \b true if any flags in \a mask are 1, \b false
|
||||
/// otherwise.
|
||||
//----------------------------------------------------------------------
|
||||
bool
|
||||
AnySet (ValueType mask) const
|
||||
{
|
||||
return (m_flags & mask) != 0;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
/// Test a single flag bit.
|
||||
///
|
||||
/// @return
|
||||
/// \b true if \a bit is set, \b false otherwise.
|
||||
//----------------------------------------------------------------------
|
||||
bool
|
||||
Test (ValueType bit) const
|
||||
{
|
||||
return (m_flags & bit) != 0;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
/// Test if all bits in \a mask are clear.
|
||||
///
|
||||
/// @return
|
||||
/// \b true if \b all flags in \a mask are clear, \b false
|
||||
/// otherwise.
|
||||
//----------------------------------------------------------------------
|
||||
bool
|
||||
AllClear (ValueType mask) const
|
||||
{
|
||||
return (m_flags & mask) == 0;
|
||||
}
|
||||
|
||||
bool
|
||||
AnyClear (ValueType mask) const
|
||||
{
|
||||
return (m_flags & mask) != mask;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
/// Test a single flag bit to see if it is clear (zero).
|
||||
///
|
||||
/// @return
|
||||
/// \b true if \a bit is 0, \b false otherwise.
|
||||
//----------------------------------------------------------------------
|
||||
bool
|
||||
IsClear (ValueType bit) const
|
||||
{
|
||||
return (m_flags & bit) == 0;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
/// Get the number of zero bits in \a m_flags.
|
||||
///
|
||||
/// @return
|
||||
/// The number of bits that are set to 0 in the current flags.
|
||||
//----------------------------------------------------------------------
|
||||
size_t
|
||||
ClearCount () const
|
||||
{
|
||||
size_t count = 0;
|
||||
for (ValueType shift = 0; shift < sizeof(ValueType)*8; ++shift)
|
||||
{
|
||||
if ((m_flags & (1u << shift)) == 0)
|
||||
++count;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
/// Get the number of one bits in \a m_flags.
|
||||
///
|
||||
/// @return
|
||||
/// The number of bits that are set to 1 in the current flags.
|
||||
//----------------------------------------------------------------------
|
||||
size_t
|
||||
SetCount () const
|
||||
{
|
||||
size_t count = 0;
|
||||
for (ValueType mask = m_flags; mask; mask >>= 1)
|
||||
{
|
||||
if (mask & 1u)
|
||||
++count;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
protected:
|
||||
ValueType m_flags; ///< The flags.
|
||||
};
|
||||
|
||||
} // namespace lldb_private
|
||||
|
||||
#endif // #if defined(__cplusplus)
|
||||
#endif // liblldb_Flags_h_
|
177
include/lldb/Core/History.h
Normal file
177
include/lldb/Core/History.h
Normal file
@ -0,0 +1,177 @@
|
||||
//===-- History.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_History_h_
|
||||
#define lldb_History_h_
|
||||
|
||||
// C Includes
|
||||
#include <stdint.h>
|
||||
|
||||
// C++ Includes
|
||||
#include <stack>
|
||||
#include <string>
|
||||
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/lldb-public.h"
|
||||
#include "lldb/Host/Mutex.h"
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
/// @class HistorySource History.h "lldb/Core/History.h"
|
||||
/// @brief A class that defines history events.
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
class HistorySource
|
||||
{
|
||||
public:
|
||||
typedef const void * HistoryEvent;
|
||||
|
||||
HistorySource () :
|
||||
m_mutex (Mutex::eMutexTypeRecursive),
|
||||
m_events ()
|
||||
{
|
||||
}
|
||||
|
||||
virtual
|
||||
~HistorySource()
|
||||
{
|
||||
}
|
||||
|
||||
// Create a new history event. Subclasses should use any data or members
|
||||
// in the subclass of this class to produce a history event and push it
|
||||
// onto the end of the history stack.
|
||||
|
||||
virtual HistoryEvent
|
||||
CreateHistoryEvent () = 0;
|
||||
|
||||
virtual void
|
||||
DeleteHistoryEvent (HistoryEvent event) = 0;
|
||||
|
||||
virtual void
|
||||
DumpHistoryEvent (Stream &strm, HistoryEvent event) = 0;
|
||||
|
||||
virtual size_t
|
||||
GetHistoryEventCount() = 0;
|
||||
|
||||
virtual HistoryEvent
|
||||
GetHistoryEventAtIndex (uint32_t idx) = 0;
|
||||
|
||||
virtual HistoryEvent
|
||||
GetCurrentHistoryEvent () = 0;
|
||||
|
||||
// Return 0 when lhs == rhs, 1 if lhs > rhs, or -1 if lhs < rhs.
|
||||
virtual int
|
||||
CompareHistoryEvents (const HistoryEvent lhs,
|
||||
const HistoryEvent rhs) = 0;
|
||||
|
||||
virtual bool
|
||||
IsCurrentHistoryEvent (const HistoryEvent event) = 0;
|
||||
|
||||
private:
|
||||
typedef std::stack<HistoryEvent> collection;
|
||||
|
||||
Mutex m_mutex;
|
||||
collection m_events;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN (HistorySource);
|
||||
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
/// @class HistorySourceUInt History.h "lldb/Core/History.h"
|
||||
/// @brief A class that defines history events that are represented by
|
||||
/// unsigned integers.
|
||||
///
|
||||
/// Any history event that is defined by a unique monotonically
|
||||
/// increasing unsigned integer
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
class HistorySourceUInt : public HistorySource
|
||||
{
|
||||
HistorySourceUInt (const char *id_name, uintptr_t start_value = 0u) :
|
||||
HistorySource(),
|
||||
m_name (id_name),
|
||||
m_curr_id (start_value)
|
||||
{
|
||||
}
|
||||
|
||||
virtual
|
||||
~HistorySourceUInt()
|
||||
{
|
||||
}
|
||||
|
||||
// Create a new history event. Subclasses should use any data or members
|
||||
// in the subclass of this class to produce a history event and push it
|
||||
// onto the end of the history stack.
|
||||
|
||||
virtual HistoryEvent
|
||||
CreateHistoryEvent ()
|
||||
{
|
||||
++m_curr_id;
|
||||
return (HistoryEvent)m_curr_id;
|
||||
}
|
||||
|
||||
virtual void
|
||||
DeleteHistoryEvent (HistoryEvent event)
|
||||
{
|
||||
// Nothing to delete, the event contains the integer
|
||||
}
|
||||
|
||||
virtual void
|
||||
DumpHistoryEvent (Stream &strm, HistoryEvent event);
|
||||
|
||||
virtual size_t
|
||||
GetHistoryEventCount()
|
||||
{
|
||||
return m_curr_id;
|
||||
}
|
||||
|
||||
virtual HistoryEvent
|
||||
GetHistoryEventAtIndex (uint32_t idx)
|
||||
{
|
||||
return (HistoryEvent)((uintptr_t)idx);
|
||||
}
|
||||
|
||||
virtual HistoryEvent
|
||||
GetCurrentHistoryEvent ()
|
||||
{
|
||||
return (HistoryEvent)m_curr_id;
|
||||
}
|
||||
|
||||
// Return 0 when lhs == rhs, 1 if lhs > rhs, or -1 if lhs < rhs.
|
||||
virtual int
|
||||
CompareHistoryEvents (const HistoryEvent lhs,
|
||||
const HistoryEvent rhs)
|
||||
{
|
||||
uintptr_t lhs_uint = (uintptr_t)lhs;
|
||||
uintptr_t rhs_uint = (uintptr_t)rhs;
|
||||
if (lhs_uint < rhs_uint)
|
||||
return -1;
|
||||
if (lhs_uint > rhs_uint)
|
||||
return +1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
virtual bool
|
||||
IsCurrentHistoryEvent (const HistoryEvent event)
|
||||
{
|
||||
return (uintptr_t)event == m_curr_id;
|
||||
}
|
||||
|
||||
protected:
|
||||
std::string m_name; // The name of the history unsigned integer
|
||||
uintptr_t m_curr_id; // The current value of the history unsigned unteger
|
||||
};
|
||||
|
||||
|
||||
} // namespace lldb_private
|
||||
|
||||
#endif // lldb_History_h_
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user