Add the GetNumThreadOriginExtendedBacktraceTypes and

GetThreadOriginExtendedBacktraceTypeAtIndex methods to
SBProcess.

Add documentation for the GetQueueName and GetQueueID methods
to SBThread.
<rdar://problem/15314369> 

llvm-svn: 194063
This commit is contained in:
Jason Molenda 2013-11-05 11:00:35 +00:00
parent 64582671af
commit 8c71337abc
5 changed files with 98 additions and 1 deletions

View File

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

View File

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

View File

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

View File

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

View File

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