[Lldb-commits] [lldb] r194063 - Add the GetNumThreadOriginExtendedBacktraceTypes and
Jason Molenda
jmolenda at apple.com
Tue Nov 5 03:00:36 PST 2013
Author: jmolenda
Date: Tue Nov 5 05:00:35 2013
New Revision: 194063
URL: http://llvm.org/viewvc/llvm-project?rev=194063&view=rev
Log:
Add the GetNumThreadOriginExtendedBacktraceTypes and
GetThreadOriginExtendedBacktraceTypeAtIndex methods to
SBProcess.
Add documentation for the GetQueueName and GetQueueID methods
to SBThread.
<rdar://problem/15314369>
Modified:
lldb/trunk/include/lldb/API/SBProcess.h
lldb/trunk/scripts/Python/interface/SBProcess.i
lldb/trunk/scripts/Python/interface/SBThread.i
lldb/trunk/scripts/lldb.swig
lldb/trunk/source/API/SBProcess.cpp
Modified: lldb/trunk/include/lldb/API/SBProcess.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBProcess.h?rev=194063&r1=194062&r2=194063&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBProcess.h (original)
+++ lldb/trunk/include/lldb/API/SBProcess.h Tue Nov 5 05:00:35 2013
@@ -269,6 +269,38 @@ public:
lldb::SBError
UnloadImage (uint32_t image_token);
+ //------------------------------------------------------------------
+ /// Return the number of different thread-origin extended backtraces
+ /// this process can support.
+ ///
+ /// When the process is stopped and you have an SBThread, lldb may be
+ /// able to show a backtrace of when that thread was originally created,
+ /// or the work item was enqueued to it (in the case of a libdispatch
+ /// queue).
+ ///
+ /// @return
+ /// The number of thread-origin extended backtrace types that may be
+ /// available.
+ //------------------------------------------------------------------
+ uint32_t
+ GetNumThreadOriginExtendedBacktraceTypes ();
+
+ //------------------------------------------------------------------
+ /// Return the name of one of the thread-origin extended backtrace
+ /// methods.
+ ///
+ /// @param [in] idx
+ /// The index of the name to return. They will be returned in
+ /// the order that the user will most likely want to see them.
+ /// e.g. if the type at index 0 is not available for a thread,
+ /// see if the type at index 1 provides an extended backtrace.
+ ///
+ /// @return
+ /// The name at that index.
+ //------------------------------------------------------------------
+ const char *
+ GetThreadOriginExtendedBacktraceTypeAtIndex (uint32_t idx);
+
protected:
friend class SBAddress;
friend class SBBreakpoint;
Modified: lldb/trunk/scripts/Python/interface/SBProcess.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBProcess.i?rev=194063&r1=194062&r2=194063&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBProcess.i (original)
+++ lldb/trunk/scripts/Python/interface/SBProcess.i Tue Nov 5 05:00:35 2013
@@ -354,6 +354,26 @@ public:
lldb::SBError
UnloadImage (uint32_t image_token);
+ %feature("autodoc", "
+ Return the number of different thread-origin extended backtraces
+ this process can support as a uint32_t.
+ When the process is stopped and you have an SBThread, lldb may be
+ able to show a backtrace of when that thread was originally created,
+ or the work item was enqueued to it (in the case of a libdispatch
+ queue).
+ ") GetNumThreadOriginExtendedBacktraceTypes;
+
+ uint32_t
+ GetNumThreadOriginExtendedBacktraceTypes ();
+
+ %feature("autodoc", "
+ Takes an index argument, returns the name of one of the thread-origin
+ extended backtrace methods as a str.
+ ") GetThreadOriginExtendedBacktraceTypeAtIndex;
+
+ const char *
+ GetThreadOriginExtendedBacktraceTypeAtIndex (uint32_t idx);
+
%pythoncode %{
def __get_is_alive__(self):
'''Returns "True" if the process is currently alive, "False" otherwise'''
Modified: lldb/trunk/scripts/Python/interface/SBThread.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBThread.i?rev=194063&r1=194062&r2=194063&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBThread.i (original)
+++ lldb/trunk/scripts/Python/interface/SBThread.i Tue Nov 5 05:00:35 2013
@@ -130,9 +130,19 @@ public:
const char *
GetName () const;
+ %feature("autodoc", "
+ Return the queue name associated with this thread, if any, as a str.
+ For example, with a libdispatch (aka Grand Central Dispatch) queue.
+ ") GetQueueName;
+
const char *
GetQueueName() const;
+ %feature("autodoc", "
+ Return the dispatch_queue_id for this thread, if any, as a lldb::queue_id_t.
+ For example, with a libdispatch (aka Grand Central Dispatch) queue.
+ ") GetQueueID;
+
lldb::queue_id_t
GetQueueID() const;
Modified: lldb/trunk/scripts/lldb.swig
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/lldb.swig?rev=194063&r1=194062&r2=194063&view=diff
==============================================================================
--- lldb/trunk/scripts/lldb.swig (original)
+++ lldb/trunk/scripts/lldb.swig Tue Nov 5 05:00:35 2013
@@ -10,7 +10,7 @@
%define DOCSTRING
"The lldb module contains the public APIs for Python binding.
-Some of the important classes are describe here:
+Some of the important classes are described here:
o SBTarget: Represents the target program running under the debugger.
o SBProcess: Represents the process associated with the target program.
Modified: lldb/trunk/source/API/SBProcess.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBProcess.cpp?rev=194063&r1=194062&r2=194063&view=diff
==============================================================================
--- lldb/trunk/source/API/SBProcess.cpp (original)
+++ lldb/trunk/source/API/SBProcess.cpp Tue Nov 5 05:00:35 2013
@@ -26,6 +26,7 @@
#include "lldb/Core/StreamFile.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/RegisterContext.h"
+#include "lldb/Target/SystemRuntime.h"
#include "lldb/Target/Target.h"
#include "lldb/Target/Thread.h"
@@ -1257,3 +1258,37 @@ SBProcess::UnloadImage (uint32_t image_t
sb_error.SetErrorString("invalid process");
return sb_error;
}
+
+uint32_t
+SBProcess::GetNumThreadOriginExtendedBacktraceTypes ()
+{
+ ProcessSP process_sp(GetSP());
+ if (process_sp && process_sp->GetSystemRuntime())
+ {
+ SystemRuntime *runtime = process_sp->GetSystemRuntime();
+ return runtime->GetThreadOriginExtendedBacktraceTypes().size();
+ }
+ return 0;
+}
+
+const char *
+SBProcess::GetThreadOriginExtendedBacktraceTypeAtIndex (uint32_t idx)
+{
+ ProcessSP process_sp(GetSP());
+ if (process_sp && process_sp->GetSystemRuntime())
+ {
+ SystemRuntime *runtime = process_sp->GetSystemRuntime();
+ std::vector<ConstString> names = runtime->GetThreadOriginExtendedBacktraceTypes();
+ if (idx < names.size())
+ {
+ return names[idx].AsCString();
+ }
+ else
+ {
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+ if (log)
+ log->Printf("SBProcess(%p)::GetThreadOriginExtendedBacktraceTypeAtIndex() => error: requested extended backtrace name out of bounds", process_sp.get());
+ }
+ }
+ return NULL;
+}
More information about the lldb-commits
mailing list