Expose ThreadCollection in SB API

Reviewed at
http://reviews.llvm.org/D5218
and
http://lists.cs.uiuc.edu/pipermail/lldb-commits/Week-of-Mon-20140901/012828.html

llvm-svn: 217296
This commit is contained in:
Kuba Brecka 2014-09-06 01:21:19 +00:00
parent 095b92e51b
commit a5ea1e2b6c
8 changed files with 220 additions and 0 deletions

View File

@ -70,6 +70,7 @@ class LLDB_API SBSymbolContext;
class LLDB_API SBSymbolContextList;
class LLDB_API SBTarget;
class LLDB_API SBThread;
class LLDB_API SBThreadCollection;
class LLDB_API SBType;
class LLDB_API SBTypeCategory;
class LLDB_API SBTypeEnumMember;

View File

@ -0,0 +1,68 @@
//===-- SBThreadCollection.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_SBThreadCollection_h_
#define LLDB_SBThreadCollection_h_
#include "lldb/API/SBDefines.h"
namespace lldb {
class SBThreadCollection
{
public:
SBThreadCollection ();
SBThreadCollection (const SBThreadCollection &rhs);
const SBThreadCollection &
operator = (const SBThreadCollection &rhs);
~SBThreadCollection ();
bool
IsValid () const;
size_t
GetSize ();
lldb::SBThread
GetThreadAtIndex (size_t idx);
protected:
// Mimic shared pointer...
lldb_private::ThreadCollection *
get() const;
lldb_private::ThreadCollection *
operator->() const;
lldb::ThreadCollectionSP &
operator*();
const lldb::ThreadCollectionSP &
operator*() const;
SBThreadCollection (const lldb::ThreadCollectionSP &threads);
void
SetOpaque (const lldb::ThreadCollectionSP &threads);
private:
friend class SBProcess;
lldb::ThreadCollectionSP m_opaque_sp;
};
} // namespace lldb
#endif // LLDB_SBThreadCollection_h_

View File

@ -621,6 +621,8 @@
8C2D6A53197A1EAF006989C9 /* MemoryHistory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8C2D6A52197A1EAF006989C9 /* MemoryHistory.cpp */; };
8C2D6A5E197A250F006989C9 /* MemoryHistoryASan.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8C2D6A5A197A1FDC006989C9 /* MemoryHistoryASan.cpp */; };
8CCB017E19BA28A80009FD44 /* ThreadCollection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8CCB017A19BA283D0009FD44 /* ThreadCollection.cpp */; };
8CCB018219BA4E270009FD44 /* SBThreadCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 8CCB018119BA4E210009FD44 /* SBThreadCollection.h */; settings = {ATTRIBUTES = (Public, ); }; };
8CCB018319BA51BF0009FD44 /* SBThreadCollection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8CCB017F19BA4DD00009FD44 /* SBThreadCollection.cpp */; };
94094C6B163B6F840083A547 /* ValueObjectCast.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 94094C69163B6CD90083A547 /* ValueObjectCast.cpp */; };
94145431175E63B500284436 /* lldb-versioning.h in Headers */ = {isa = PBXBuildFile; fileRef = 94145430175D7FDE00284436 /* lldb-versioning.h */; settings = {ATTRIBUTES = (Public, ); }; };
941BCC7F14E48C4000BB969C /* SBTypeFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = 9461568614E355F2003A195C /* SBTypeFilter.h */; settings = {ATTRIBUTES = (Public, ); }; };
@ -1904,6 +1906,9 @@
8C2D6A5B197A1FDC006989C9 /* MemoryHistoryASan.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MemoryHistoryASan.h; sourceTree = "<group>"; };
8CCB017A19BA283D0009FD44 /* ThreadCollection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ThreadCollection.cpp; path = source/Target/ThreadCollection.cpp; sourceTree = "<group>"; };
8CCB017C19BA289B0009FD44 /* ThreadCollection.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = ThreadCollection.h; path = include/lldb/Target/ThreadCollection.h; sourceTree = "<group>"; };
8CCB017F19BA4DD00009FD44 /* SBThreadCollection.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = SBThreadCollection.cpp; path = source/API/SBThreadCollection.cpp; sourceTree = "<group>"; };
8CCB018119BA4E210009FD44 /* SBThreadCollection.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SBThreadCollection.h; path = include/lldb/API/SBThreadCollection.h; sourceTree = "<group>"; };
8CCB018419BA54930009FD44 /* SBThreadCollection.i */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c.preprocessed; path = SBThreadCollection.i; sourceTree = "<group>"; };
94005E0313F438DF001EF42D /* python-wrapper.swig */ = {isa = PBXFileReference; lastKnownFileType = text; path = "python-wrapper.swig"; sourceTree = "<group>"; };
94005E0513F45A1B001EF42D /* embedded_interpreter.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; name = embedded_interpreter.py; path = source/Interpreter/embedded_interpreter.py; sourceTree = "<group>"; };
94031A9F13CF5B3D00DCFF3C /* PriorityPointerPair.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = PriorityPointerPair.h; path = include/lldb/Utility/PriorityPointerPair.h; sourceTree = "<group>"; };
@ -2609,6 +2614,7 @@
2611FF0E142D83060017FEA3 /* SBSymbolContextList.i */,
2611FF0F142D83060017FEA3 /* SBTarget.i */,
2611FF10142D83060017FEA3 /* SBThread.i */,
8CCB018419BA54930009FD44 /* SBThreadCollection.i */,
2611FF11142D83060017FEA3 /* SBType.i */,
9475C18A14E5EA1C001BFC6D /* SBTypeCategory.i */,
9461569214E3567F003A195C /* SBTypeFilter.i */,
@ -2723,6 +2729,8 @@
9A9831071125FC5800A56CB0 /* SBTarget.cpp */,
9A98310A1125FC5800A56CB0 /* SBThread.h */,
9A9831091125FC5800A56CB0 /* SBThread.cpp */,
8CCB018119BA4E210009FD44 /* SBThreadCollection.h */,
8CCB017F19BA4DD00009FD44 /* SBThreadCollection.cpp */,
2617447911685869005ADD65 /* SBType.h */,
261744771168585B005ADD65 /* SBType.cpp */,
9475C18514E5E9C5001BFC6D /* SBTypeCategory.h */,
@ -4282,6 +4290,7 @@
26680220115FD13D008E1FE4 /* SBDebugger.h in Headers */,
490A966B1628C3BF00F0002E /* SBDeclaration.h in Headers */,
26680221115FD13D008E1FE4 /* SBDefines.h in Headers */,
8CCB018219BA4E270009FD44 /* SBThreadCollection.h in Headers */,
AF0EBBEC185941360059E52F /* SBQueue.h in Headers */,
26680222115FD13D008E1FE4 /* SBError.h in Headers */,
26680223115FD13D008E1FE4 /* SBEvent.h in Headers */,
@ -4802,6 +4811,7 @@
9443B122140C18C40013457C /* SBData.cpp in Sources */,
4CF52AF8142829390051E832 /* SBFileSpecList.cpp in Sources */,
23059A101958B319007B8189 /* SBUnixSignals.cpp in Sources */,
8CCB018319BA51BF0009FD44 /* SBThreadCollection.cpp in Sources */,
26B82840142D020F002DBC64 /* SBSection.cpp in Sources */,
B2A58724143119D50092BFBA /* SBWatchpoint.cpp in Sources */,
263C4938178B50C40070F12D /* SBModuleSpec.cpp in Sources */,

View File

@ -113,6 +113,7 @@ HEADER_FILES="${SRC_ROOT}/include/lldb/lldb.h"\
" ${SRC_ROOT}/include/lldb/API/SBSymbolContextList.h"\
" ${SRC_ROOT}/include/lldb/API/SBTarget.h"\
" ${SRC_ROOT}/include/lldb/API/SBThread.h"\
" ${SRC_ROOT}/include/lldb/API/SBThreadCollection.h"\
" ${SRC_ROOT}/include/lldb/API/SBType.h"\
" ${SRC_ROOT}/include/lldb/API/SBTypeCategory.h"\
" ${SRC_ROOT}/include/lldb/API/SBTypeFilter.h"\
@ -161,6 +162,7 @@ INTERFACE_FILES="${SRC_ROOT}/scripts/Python/interface/SBAddress.i"\
" ${SRC_ROOT}/scripts/Python/interface/SBSymbolContext.i"\
" ${SRC_ROOT}/scripts/Python/interface/SBTarget.i"\
" ${SRC_ROOT}/scripts/Python/interface/SBThread.i"\
" ${SRC_ROOT}/scripts/Python/interface/SBThreadCollection.i"\
" ${SRC_ROOT}/scripts/Python/interface/SBType.i"\
" ${SRC_ROOT}/scripts/Python/interface/SBTypeCategory.i"\
" ${SRC_ROOT}/scripts/Python/interface/SBTypeFilter.i"\

View File

@ -114,6 +114,7 @@ def get_header_files( vDictArgs ):
"/include/lldb/API/SBSymbolContextList.h",
"/include/lldb/API/SBTarget.h",
"/include/lldb/API/SBThread.h",
"/include/lldb/API/SBThreadCollection.h",
"/include/lldb/API/SBType.h",
"/include/lldb/API/SBTypeCategory.h",
"/include/lldb/API/SBTypeFilter.h",
@ -188,6 +189,7 @@ def get_interface_files( vDictArgs ):
"/scripts/Python/interface/SBSymbolContext.i",
"/scripts/Python/interface/SBTarget.i",
"/scripts/Python/interface/SBThread.i",
"/scripts/Python/interface/SBThreadCollection.i",
"/scripts/Python/interface/SBType.i",
"/scripts/Python/interface/SBTypeCategory.i",
"/scripts/Python/interface/SBTypeFilter.i",

View File

@ -0,0 +1,38 @@
//===-- SWIG Interface for SBThreadCollection -------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include <stdio.h>
namespace lldb {
%feature("docstring",
"Represents a collection of SBThread objects."
) SBThreadCollection;
class SBThreadCollection
{
public:
SBThreadCollection ();
SBThreadCollection (const SBThreadCollection &rhs);
~SBThreadCollection ();
bool
IsValid () const;
size_t
GetSize ();
lldb::SBThread
GetThreadAtIndex (size_t idx);
};
} // namespace lldb

View File

@ -91,6 +91,7 @@ import os
#include "lldb/API/SBSymbolContextList.h"
#include "lldb/API/SBTarget.h"
#include "lldb/API/SBThread.h"
#include "lldb/API/SBThreadCollection.h"
#include "lldb/API/SBType.h"
#include "lldb/API/SBTypeCategory.h"
#include "lldb/API/SBTypeEnumMember.h"
@ -162,6 +163,7 @@ import os
%include "./Python/interface/SBSymbolContextList.i"
%include "./Python/interface/SBTarget.i"
%include "./Python/interface/SBThread.i"
%include "./Python/interface/SBThreadCollection.i"
%include "./Python/interface/SBType.i"
%include "./Python/interface/SBTypeCategory.i"
%include "./Python/interface/SBTypeEnumMember.i"

View File

@ -0,0 +1,97 @@
//===-- SBThreadCollection.cpp ----------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include "lldb/API/SBThreadCollection.h"
#include "lldb/API/SBThread.h"
#include "lldb/Target/ThreadList.h"
using namespace lldb;
using namespace lldb_private;
SBThreadCollection::SBThreadCollection () :
m_opaque_sp()
{
}
SBThreadCollection::SBThreadCollection(const SBThreadCollection &rhs) :
m_opaque_sp (rhs.m_opaque_sp)
{
}
const SBThreadCollection &
SBThreadCollection::operator = (const SBThreadCollection &rhs)
{
if (this != &rhs)
m_opaque_sp = rhs.m_opaque_sp;
return *this;
}
SBThreadCollection::SBThreadCollection (const ThreadCollectionSP &threads) :
m_opaque_sp(threads)
{
}
SBThreadCollection::~SBThreadCollection ()
{
}
void
SBThreadCollection::SetOpaque (const lldb::ThreadCollectionSP &threads)
{
m_opaque_sp = threads;
}
lldb_private::ThreadCollection *
SBThreadCollection::get() const
{
return m_opaque_sp.get();
}
lldb_private::ThreadCollection *
SBThreadCollection::operator->() const
{
return m_opaque_sp.operator->();
}
lldb::ThreadCollectionSP &
SBThreadCollection::operator*()
{
return m_opaque_sp;
}
const lldb::ThreadCollectionSP &
SBThreadCollection::operator*() const
{
return m_opaque_sp;
}
bool
SBThreadCollection::IsValid () const
{
return m_opaque_sp.get() != NULL;
}
size_t
SBThreadCollection::GetSize ()
{
if (m_opaque_sp)
return m_opaque_sp->GetSize();
return 0;
}
SBThread
SBThreadCollection::GetThreadAtIndex(size_t idx)
{
SBThread thread;
if (m_opaque_sp && idx < m_opaque_sp->GetSize())
thread = m_opaque_sp->GetThreadAtIndex(idx);
return thread;
}