[Lldb-commits] [lldb] r217296 - Expose ThreadCollection in SB API
Kuba Brecka
kuba.brecka at gmail.com
Fri Sep 5 18:21:19 PDT 2014
Author: kuba.brecka
Date: Fri Sep 5 20:21:19 2014
New Revision: 217296
URL: http://llvm.org/viewvc/llvm-project?rev=217296&view=rev
Log:
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
Added:
lldb/trunk/include/lldb/API/SBThreadCollection.h
lldb/trunk/scripts/Python/interface/SBThreadCollection.i
lldb/trunk/source/API/SBThreadCollection.cpp
Modified:
lldb/trunk/include/lldb/API/SBDefines.h
lldb/trunk/lldb.xcodeproj/project.pbxproj
lldb/trunk/scripts/Python/build-swig-Python.sh
lldb/trunk/scripts/Python/buildSwigPython.py
lldb/trunk/scripts/lldb.swig
Modified: lldb/trunk/include/lldb/API/SBDefines.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBDefines.h?rev=217296&r1=217295&r2=217296&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBDefines.h (original)
+++ lldb/trunk/include/lldb/API/SBDefines.h Fri Sep 5 20:21:19 2014
@@ -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;
Added: lldb/trunk/include/lldb/API/SBThreadCollection.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBThreadCollection.h?rev=217296&view=auto
==============================================================================
--- lldb/trunk/include/lldb/API/SBThreadCollection.h (added)
+++ lldb/trunk/include/lldb/API/SBThreadCollection.h Fri Sep 5 20:21:19 2014
@@ -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_
Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=217296&r1=217295&r2=217296&view=diff
==============================================================================
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Fri Sep 5 20:21:19 2014
@@ -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 */,
Modified: lldb/trunk/scripts/Python/build-swig-Python.sh
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/build-swig-Python.sh?rev=217296&r1=217295&r2=217296&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/build-swig-Python.sh (original)
+++ lldb/trunk/scripts/Python/build-swig-Python.sh Fri Sep 5 20:21:19 2014
@@ -113,6 +113,7 @@ HEADER_FILES="${SRC_ROOT}/include/lldb/l
" ${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/Pyt
" ${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"\
Modified: lldb/trunk/scripts/Python/buildSwigPython.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/buildSwigPython.py?rev=217296&r1=217295&r2=217296&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/buildSwigPython.py (original)
+++ lldb/trunk/scripts/Python/buildSwigPython.py Fri Sep 5 20:21:19 2014
@@ -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",
Added: lldb/trunk/scripts/Python/interface/SBThreadCollection.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBThreadCollection.i?rev=217296&view=auto
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBThreadCollection.i (added)
+++ lldb/trunk/scripts/Python/interface/SBThreadCollection.i Fri Sep 5 20:21:19 2014
@@ -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
Modified: lldb/trunk/scripts/lldb.swig
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/lldb.swig?rev=217296&r1=217295&r2=217296&view=diff
==============================================================================
--- lldb/trunk/scripts/lldb.swig (original)
+++ lldb/trunk/scripts/lldb.swig Fri Sep 5 20:21:19 2014
@@ -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"
Added: lldb/trunk/source/API/SBThreadCollection.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBThreadCollection.cpp?rev=217296&view=auto
==============================================================================
--- lldb/trunk/source/API/SBThreadCollection.cpp (added)
+++ lldb/trunk/source/API/SBThreadCollection.cpp Fri Sep 5 20:21:19 2014
@@ -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;
+}
More information about the lldb-commits
mailing list