Changes to lldb and debugserver to reduce extraneous memory reads

at each public stop to improve performance a bit.  Most of the 
information lldb needed was already in the jThreadsInfo response;
complete that information and catch a few cases where we could still
fall back to getting the information via discrete memory reads.


debugserver adds 'associated_with_dispatch_queue' and 'dispatch_queue_t
keys to the jThreadsInfo response for all the threads.  lldb needs the
dispatch_queue_t value.  And associated_with_dispatch_queue helps to
identify which threads definitively don't have any queue information so
lldb doesn't try to do memory reads to get that information just because
it was absent in the jThreadsInfo response.

Remove the queue information from the questionmark (T) packet.  We'll
get the information for all threads via the jThreadsInfo response -
sending the information for the stopping thread (on all the private
stops, plus the less frequent public stop) was unnecessary information
being sent over the wire.

SystemRuntimeMacOSX will try to get information about queues by asking
the Threads for them, instead of reading memory.  

ProcessGDBRemote changes to recognize the new keys being sent in the
jThreadsInfo response.  Changes to ThreadGDBRemote to track the new
information.  Also, when a thread is marked as definitively not 
associated with a libdispatch queue, don't fall back to the system
runtime to try memory reads to find the queue name / kind / ID etc.


<rdar://problem/23309359> 

llvm-svn: 257453
This commit is contained in:
Jason Molenda 2016-01-12 07:09:16 +00:00
parent 85215942ef
commit 77f8935218
10 changed files with 285 additions and 65 deletions

View File

@ -275,6 +275,23 @@ public:
return LLDB_INVALID_ADDRESS;
}
//------------------------------------------------------------------
/// Retrieve the Queue kind for the queue at a thread's dispatch_qaddr.
///
/// Retrieve the Queue kind - either eQueueKindSerial or
/// eQueueKindConcurrent, indicating that this queue processes work
/// items serially or concurrently.
///
/// @return
/// The Queue kind, if it could be read, else eQueueKindUnknown.
//------------------------------------------------------------------
virtual lldb::QueueKind
GetQueueKind (lldb::addr_t dispatch_qaddr)
{
return lldb::eQueueKindUnknown;
}
//------------------------------------------------------------------
/// Get the pending work items for a libdispatch Queue
///

View File

@ -366,6 +366,35 @@ public:
{
}
//------------------------------------------------------------------
/// Whether this thread can be associated with a libdispatch queue
///
/// The Thread may know if it is associated with a libdispatch queue,
/// it may know definitively that it is NOT associated with a libdispatch
/// queue, or it may be unknown whether it is associated with a libdispatch
/// queue.
///
/// @return
/// eLazyBoolNo if this thread is definitely not associated with a
/// libdispatch queue (e.g. on a non-Darwin system where GCD aka
/// libdispatch is not available).
///
/// eLazyBoolYes this thread is associated with a libdispatch queue.
///
/// eLazyBoolCalculate this thread may be associated with a libdispatch
/// queue but the thread doesn't know one way or the other.
//------------------------------------------------------------------
virtual lldb_private::LazyBool
GetAssociatedWithLibdispatchQueue ()
{
return eLazyBoolNo;
}
virtual void
SetAssociatedWithLibdispatchQueue (lldb_private::LazyBool associated_with_libdispatch_queue)
{
}
//------------------------------------------------------------------
/// Retrieve the Queue ID for the queue currently using this Thread
///
@ -413,6 +442,29 @@ public:
{
}
//------------------------------------------------------------------
/// Retrieve the Queue kind for the queue currently using this Thread
///
/// If this Thread is doing work on behalf of a libdispatch/GCD queue,
/// retrieve the Queue kind - either eQueueKindSerial or
/// eQueueKindConcurrent, indicating that this queue processes work
/// items serially or concurrently.
///
/// @return
/// The Queue kind, if the Thread subclass implements this, else
/// eQueueKindUnknown.
//------------------------------------------------------------------
virtual lldb::QueueKind
GetQueueKind ()
{
return lldb::eQueueKindUnknown;
}
virtual void
SetQueueKind (lldb::QueueKind kind)
{
}
//------------------------------------------------------------------
/// Retrieve the Queue for this thread, if any.
///
@ -451,6 +503,30 @@ public:
return LLDB_INVALID_ADDRESS;
}
virtual void
SetQueueLibdispatchQueueAddress (lldb::addr_t dispatch_queue_t)
{
}
//------------------------------------------------------------------
/// Whether this Thread already has all the Queue information cached or not
///
/// A Thread may be associated with a libdispatch work Queue at a given
/// public stop event. If so, the thread can satisify requests like
/// GetQueueLibdispatchQueueAddress, GetQueueKind, GetQueueName, and GetQueueID
/// either from information from the remote debug stub when it is initially
/// created, or it can query the SystemRuntime for that information.
///
/// This method allows the SystemRuntime to discover if a thread has this
/// information already, instead of calling the thread to get the information
/// and having the thread call the SystemRuntime again.
//------------------------------------------------------------------
virtual bool
ThreadHasQueueInformation () const
{
return false;
}
virtual uint32_t
GetStackFrameCount()
{

View File

@ -2034,6 +2034,8 @@ ProcessGDBRemote::SetThreadStopInfo (lldb::tid_t tid,
const std::vector<addr_t> &exc_data,
addr_t thread_dispatch_qaddr,
bool queue_vars_valid, // Set to true if queue_name, queue_kind and queue_serial are valid
LazyBool associated_with_dispatch_queue,
addr_t dispatch_queue_t,
std::string &queue_name,
QueueKind queue_kind,
uint64_t queue_serial)
@ -2074,10 +2076,15 @@ ProcessGDBRemote::SetThreadStopInfo (lldb::tid_t tid,
gdb_thread->SetThreadDispatchQAddr (thread_dispatch_qaddr);
// Check if the GDB server was able to provide the queue name, kind and serial number
if (queue_vars_valid)
gdb_thread->SetQueueInfo(std::move(queue_name), queue_kind, queue_serial);
gdb_thread->SetQueueInfo(std::move(queue_name), queue_kind, queue_serial, dispatch_queue_t, associated_with_dispatch_queue);
else
gdb_thread->ClearQueueInfo();
gdb_thread->SetAssociatedWithLibdispatchQueue (associated_with_dispatch_queue);
if (dispatch_queue_t != LLDB_INVALID_ADDRESS)
gdb_thread->SetQueueLibdispatchQueueAddress (dispatch_queue_t);
// Make sure we update our thread stop reason just once
if (!thread_sp->StopInfoIsUpToDate())
{
@ -2248,6 +2255,8 @@ ProcessGDBRemote::SetThreadStopInfo (StructuredData::Dictionary *thread_dict)
static ConstString g_key_metype("metype");
static ConstString g_key_medata("medata");
static ConstString g_key_qaddr("qaddr");
static ConstString g_key_dispatch_queue_t("dispatch_queue_t");
static ConstString g_key_associated_with_dispatch_queue("associated_with_dispatch_queue");
static ConstString g_key_queue_name("qname");
static ConstString g_key_queue_kind("qkind");
static ConstString g_key_queue_serial_number("qserialnum");
@ -2270,6 +2279,8 @@ ProcessGDBRemote::SetThreadStopInfo (StructuredData::Dictionary *thread_dict)
addr_t thread_dispatch_qaddr = LLDB_INVALID_ADDRESS;
ExpeditedRegisterMap expedited_register_map;
bool queue_vars_valid = false;
addr_t dispatch_queue_t = LLDB_INVALID_ADDRESS;
LazyBool associated_with_dispatch_queue = eLazyBoolCalculate;
std::string queue_name;
QueueKind queue_kind = eQueueKindUnknown;
uint64_t queue_serial_number = 0;
@ -2286,6 +2297,8 @@ ProcessGDBRemote::SetThreadStopInfo (StructuredData::Dictionary *thread_dict)
&exc_data,
&thread_dispatch_qaddr,
&queue_vars_valid,
&associated_with_dispatch_queue,
&dispatch_queue_t,
&queue_name,
&queue_kind,
&queue_serial_number]
@ -2346,6 +2359,21 @@ ProcessGDBRemote::SetThreadStopInfo (StructuredData::Dictionary *thread_dict)
if (queue_serial_number != 0)
queue_vars_valid = true;
}
else if (key == g_key_dispatch_queue_t)
{
dispatch_queue_t = object->GetIntegerValue(0);
if (dispatch_queue_t != 0 && dispatch_queue_t != LLDB_INVALID_ADDRESS)
queue_vars_valid = true;
}
else if (key == g_key_associated_with_dispatch_queue)
{
queue_vars_valid = true;
bool associated = object->GetBooleanValue ();
if (associated)
associated_with_dispatch_queue = eLazyBoolYes;
else
associated_with_dispatch_queue = eLazyBoolNo;
}
else if (key == g_key_reason)
{
reason = object->GetStringValue();
@ -2416,6 +2444,8 @@ ProcessGDBRemote::SetThreadStopInfo (StructuredData::Dictionary *thread_dict)
exc_data,
thread_dispatch_qaddr,
queue_vars_valid,
associated_with_dispatch_queue,
dispatch_queue_t,
queue_name,
queue_kind,
queue_serial_number);
@ -2461,6 +2491,8 @@ ProcessGDBRemote::SetThreadStopInfo (StringExtractor& stop_packet)
std::vector<addr_t> exc_data;
addr_t thread_dispatch_qaddr = LLDB_INVALID_ADDRESS;
bool queue_vars_valid = false; // says if locals below that start with "queue_" are valid
addr_t dispatch_queue_t = LLDB_INVALID_ADDRESS;
LazyBool associated_with_dispatch_queue = eLazyBoolCalculate;
std::string queue_name;
QueueKind queue_kind = eQueueKindUnknown;
uint64_t queue_serial_number = 0;
@ -2554,6 +2586,11 @@ ProcessGDBRemote::SetThreadStopInfo (StringExtractor& stop_packet)
{
thread_dispatch_qaddr = StringConvert::ToUInt64 (value.c_str(), 0, 16);
}
else if (key.compare("dispatch_queue_t") == 0)
{
queue_vars_valid = true;
dispatch_queue_t = StringConvert::ToUInt64 (value.c_str(), 0, 16);
}
else if (key.compare("qname") == 0)
{
queue_vars_valid = true;
@ -2678,6 +2715,8 @@ ProcessGDBRemote::SetThreadStopInfo (StringExtractor& stop_packet)
exc_data,
thread_dispatch_qaddr,
queue_vars_valid,
associated_with_dispatch_queue,
dispatch_queue_t,
queue_name,
queue_kind,
queue_serial_number);

View File

@ -429,6 +429,8 @@ protected:
const std::vector<lldb::addr_t> &exc_data,
lldb::addr_t thread_dispatch_qaddr,
bool queue_vars_valid,
lldb_private::LazyBool associated_with_libdispatch_queue,
lldb::addr_t dispatch_queue_t,
std::string &queue_name,
lldb::QueueKind queue_kind,
uint64_t queue_serial);

View File

@ -41,8 +41,10 @@ ThreadGDBRemote::ThreadGDBRemote (Process &process, lldb::tid_t tid) :
m_thread_name (),
m_dispatch_queue_name (),
m_thread_dispatch_qaddr (LLDB_INVALID_ADDRESS),
m_queue_kind(eQueueKindUnknown),
m_queue_serial(0)
m_dispatch_queue_t (LLDB_INVALID_ADDRESS),
m_queue_kind (eQueueKindUnknown),
m_queue_serial_number (LLDB_INVALID_QUEUE_ID),
m_associated_with_libdispatch_queue (eLazyBoolCalculate)
{
ProcessGDBRemoteLog::LogIf(GDBR_LOG_THREAD, "%p: ThreadGDBRemote::ThreadGDBRemote (pid = %i, tid = 0x%4.4x)",
this,
@ -73,15 +75,19 @@ ThreadGDBRemote::ClearQueueInfo ()
{
m_dispatch_queue_name.clear();
m_queue_kind = eQueueKindUnknown;
m_queue_serial = 0;
m_queue_serial_number = 0;
m_dispatch_queue_t = LLDB_INVALID_ADDRESS;
m_associated_with_libdispatch_queue = eLazyBoolCalculate;
}
void
ThreadGDBRemote::SetQueueInfo (std::string &&queue_name, QueueKind queue_kind, uint64_t queue_serial)
ThreadGDBRemote::SetQueueInfo (std::string &&queue_name, QueueKind queue_kind, uint64_t queue_serial, addr_t dispatch_queue_t, LazyBool associated_with_libdispatch_queue)
{
m_dispatch_queue_name = queue_name;
m_queue_kind = queue_kind;
m_queue_serial = queue_serial;
m_queue_serial_number = queue_serial;
m_dispatch_queue_t = dispatch_queue_t;
m_associated_with_libdispatch_queue = associated_with_libdispatch_queue;
}
@ -100,7 +106,10 @@ ThreadGDBRemote::GetQueueName ()
}
// Always re-fetch the dispatch queue name since it can change
if (m_thread_dispatch_qaddr != 0 || m_thread_dispatch_qaddr != LLDB_INVALID_ADDRESS)
if (m_associated_with_libdispatch_queue == eLazyBoolNo)
return nullptr;
if (m_thread_dispatch_qaddr != 0 && m_thread_dispatch_qaddr != LLDB_INVALID_ADDRESS)
{
ProcessSP process_sp (GetProcess());
if (process_sp)
@ -118,6 +127,35 @@ ThreadGDBRemote::GetQueueName ()
return NULL;
}
QueueKind
ThreadGDBRemote::GetQueueKind ()
{
// If our cached queue info is valid, then someone called ThreadGDBRemote::SetQueueInfo(...)
// with valid information that was gleaned from the stop reply packet. In this case we trust
// that the info is valid in m_dispatch_queue_name without refetching it
if (CachedQueueInfoIsValid())
{
return m_queue_kind;
}
if (m_associated_with_libdispatch_queue == eLazyBoolNo)
return eQueueKindUnknown;
if (m_thread_dispatch_qaddr != 0 && m_thread_dispatch_qaddr != LLDB_INVALID_ADDRESS)
{
ProcessSP process_sp (GetProcess());
if (process_sp)
{
SystemRuntime *runtime = process_sp->GetSystemRuntime ();
if (runtime)
m_queue_kind = runtime->GetQueueKind (m_thread_dispatch_qaddr);
return m_queue_kind;
}
}
return eQueueKindUnknown;
}
queue_id_t
ThreadGDBRemote::GetQueueID ()
{
@ -125,9 +163,12 @@ ThreadGDBRemote::GetQueueID ()
// with valid information that was gleaned from the stop reply packet. In this case we trust
// that the info is valid in m_dispatch_queue_name without refetching it
if (CachedQueueInfoIsValid())
return m_queue_serial;
return m_queue_serial_number;
if (m_thread_dispatch_qaddr != 0 || m_thread_dispatch_qaddr != LLDB_INVALID_ADDRESS)
if (m_associated_with_libdispatch_queue == eLazyBoolNo)
return LLDB_INVALID_QUEUE_ID;
if (m_thread_dispatch_qaddr != 0 && m_thread_dispatch_qaddr != LLDB_INVALID_ADDRESS)
{
ProcessSP process_sp (GetProcess());
if (process_sp)
@ -161,20 +202,54 @@ ThreadGDBRemote::GetQueue ()
addr_t
ThreadGDBRemote::GetQueueLibdispatchQueueAddress ()
{
addr_t dispatch_queue_t_addr = LLDB_INVALID_ADDRESS;
if (m_thread_dispatch_qaddr != 0 || m_thread_dispatch_qaddr != LLDB_INVALID_ADDRESS)
if (m_dispatch_queue_t == LLDB_INVALID_ADDRESS)
{
ProcessSP process_sp (GetProcess());
if (process_sp)
if (m_thread_dispatch_qaddr != 0 && m_thread_dispatch_qaddr != LLDB_INVALID_ADDRESS)
{
SystemRuntime *runtime = process_sp->GetSystemRuntime ();
if (runtime)
ProcessSP process_sp (GetProcess());
if (process_sp)
{
dispatch_queue_t_addr = runtime->GetLibdispatchQueueAddressFromThreadQAddress (m_thread_dispatch_qaddr);
SystemRuntime *runtime = process_sp->GetSystemRuntime ();
if (runtime)
{
m_dispatch_queue_t = runtime->GetLibdispatchQueueAddressFromThreadQAddress (m_thread_dispatch_qaddr);
}
}
}
}
return dispatch_queue_t_addr;
return m_dispatch_queue_t;
}
void
ThreadGDBRemote::SetQueueLibdispatchQueueAddress (lldb::addr_t dispatch_queue_t)
{
m_dispatch_queue_t = dispatch_queue_t;
}
bool
ThreadGDBRemote::ThreadHasQueueInformation () const
{
if (m_thread_dispatch_qaddr != 0
&& m_thread_dispatch_qaddr != LLDB_INVALID_ADDRESS
&& m_dispatch_queue_t != LLDB_INVALID_ADDRESS
&& m_queue_kind != eQueueKindUnknown
&& m_queue_serial_number != 0)
{
return true;
}
return false;
}
LazyBool
ThreadGDBRemote::GetAssociatedWithLibdispatchQueue ()
{
return m_associated_with_libdispatch_queue;
}
void
ThreadGDBRemote::SetAssociatedWithLibdispatchQueue (LazyBool associated_with_libdispatch_queue)
{
m_associated_with_libdispatch_queue = associated_with_libdispatch_queue;
}
StructuredData::ObjectSP

View File

@ -46,6 +46,9 @@ public:
const char *
GetQueueName () override;
lldb::QueueKind
GetQueueKind () override;
lldb::queue_id_t
GetQueueID () override;
@ -55,6 +58,12 @@ public:
lldb::addr_t
GetQueueLibdispatchQueueAddress () override;
void
SetQueueLibdispatchQueueAddress (lldb::addr_t dispatch_queue_t) override;
bool
ThreadHasQueueInformation () const override;
lldb::RegisterContextSP
GetRegisterContext () override;
@ -98,7 +107,13 @@ public:
ClearQueueInfo ();
void
SetQueueInfo (std::string &&queue_name, lldb::QueueKind queue_kind, uint64_t queue_serial);
SetQueueInfo (std::string &&queue_name, lldb::QueueKind queue_kind, uint64_t queue_serial, lldb::addr_t dispatch_queue_t, lldb_private::LazyBool associated_with_libdispatch_queue);
lldb_private::LazyBool
GetAssociatedWithLibdispatchQueue () override;
void
SetAssociatedWithLibdispatchQueue (lldb_private::LazyBool associated_with_libdispatch_queue) override;
StructuredData::ObjectSP
FetchThreadExtendedInfo () override;
@ -109,8 +124,10 @@ protected:
std::string m_thread_name;
std::string m_dispatch_queue_name;
lldb::addr_t m_thread_dispatch_qaddr;
lldb::addr_t m_dispatch_queue_t;
lldb::QueueKind m_queue_kind; // Queue info from stop reply/stop info for thread
uint64_t m_queue_serial; // Queue info from stop reply/stop info for thread
uint64_t m_queue_serial_number; // Queue info from stop reply/stop info for thread
lldb_private::LazyBool m_associated_with_libdispatch_queue;
bool
PrivateSetRegisterValue (uint32_t reg,

View File

@ -725,14 +725,26 @@ SystemRuntimeMacOSX::PopulateQueueList (lldb_private::QueueList &queue_list)
for (ThreadSP thread_sp : m_process->Threads())
{
if (thread_sp->GetQueueID() != LLDB_INVALID_QUEUE_ID)
if (thread_sp->GetAssociatedWithLibdispatchQueue () != eLazyBoolNo)
{
if (queue_list.FindQueueByID (thread_sp->GetQueueID()).get() == NULL)
if (thread_sp->GetQueueID() != LLDB_INVALID_QUEUE_ID)
{
QueueSP queue_sp (new Queue(m_process->shared_from_this(), thread_sp->GetQueueID(), thread_sp->GetQueueName()));
queue_sp->SetKind (GetQueueKind (thread_sp->GetQueueLibdispatchQueueAddress()));
queue_sp->SetLibdispatchQueueAddress (thread_sp->GetQueueLibdispatchQueueAddress());
queue_list.AddQueue (queue_sp);
if (queue_list.FindQueueByID (thread_sp->GetQueueID()).get() == NULL)
{
QueueSP queue_sp (new Queue(m_process->shared_from_this(), thread_sp->GetQueueID(), thread_sp->GetQueueName()));
if (thread_sp->ThreadHasQueueInformation ())
{
queue_sp->SetKind (thread_sp->GetQueueKind ());
queue_sp->SetLibdispatchQueueAddress (thread_sp->GetQueueLibdispatchQueueAddress());
queue_list.AddQueue (queue_sp);
}
else
{
queue_sp->SetKind (GetQueueKind (thread_sp->GetQueueLibdispatchQueueAddress()));
queue_sp->SetLibdispatchQueueAddress (thread_sp->GetQueueLibdispatchQueueAddress());
queue_list.AddQueue (queue_sp);
}
}
}
}
}

View File

@ -104,8 +104,8 @@ public:
void
CompleteQueueItem(lldb_private::QueueItem *queue_item, lldb::addr_t item_ref) override;
virtual lldb::QueueKind
GetQueueKind (lldb::addr_t dispatch_queue_addr);
lldb::QueueKind
GetQueueKind (lldb::addr_t dispatch_queue_addr) override;
void
AddThreadExtendedInfoPacketHints(lldb_private::StructuredData::ObjectSP dict) override;

View File

@ -2547,6 +2547,7 @@ debugserver_regnum_with_fixed_width_hex_register_value (std::ostream& ostrm,
void
RNBRemote::DispatchQueueOffsets::GetThreadQueueInfo (nub_process_t pid,
nub_addr_t dispatch_qaddr,
nub_addr_t &dispatch_queue_t,
std::string &queue_name,
uint64_t &queue_width,
uint64_t &queue_serialnum) const
@ -2557,17 +2558,17 @@ RNBRemote::DispatchQueueOffsets::GetThreadQueueInfo (nub_process_t pid,
if (IsValid() && dispatch_qaddr != INVALID_NUB_ADDRESS && dispatch_qaddr != 0)
{
nub_addr_t dispatch_queue_addr = DNBProcessMemoryReadPointer (pid, dispatch_qaddr);
if (dispatch_queue_addr)
dispatch_queue_t = DNBProcessMemoryReadPointer (pid, dispatch_qaddr);
if (dispatch_queue_t)
{
queue_width = DNBProcessMemoryReadInteger (pid, dispatch_queue_addr + dqo_width, dqo_width_size, 0);
queue_serialnum = DNBProcessMemoryReadInteger (pid, dispatch_queue_addr + dqo_serialnum, dqo_serialnum_size, 0);
queue_width = DNBProcessMemoryReadInteger (pid, dispatch_queue_t + dqo_width, dqo_width_size, 0);
queue_serialnum = DNBProcessMemoryReadInteger (pid, dispatch_queue_t + dqo_serialnum, dqo_serialnum_size, 0);
if (dqo_version >= 4)
{
// libdispatch versions 4+, pointer to dispatch name is in the
// queue structure.
nub_addr_t pointer_to_label_address = dispatch_queue_addr + dqo_label;
nub_addr_t pointer_to_label_address = dispatch_queue_t + dqo_label;
nub_addr_t label_addr = DNBProcessMemoryReadPointer (pid, pointer_to_label_address);
if (label_addr)
queue_name = std::move(DNBProcessMemoryReadCString (pid, label_addr));
@ -2576,7 +2577,7 @@ RNBRemote::DispatchQueueOffsets::GetThreadQueueInfo (nub_process_t pid,
{
// libdispatch versions 1-3, dispatch name is a fixed width char array
// in the queue structure.
queue_name = std::move(DNBProcessMemoryReadCStringFixed(pid, dispatch_queue_addr + dqo_label, dqo_label_size));
queue_name = std::move(DNBProcessMemoryReadCStringFixed(pid, dispatch_queue_t + dqo_label, dqo_label_size));
}
}
}
@ -2781,37 +2782,6 @@ RNBRemote::SendStopReplyPacketForThread (nub_thread_t tid)
}
}
thread_identifier_info_data_t thread_ident_info;
if (DNBThreadGetIdentifierInfo (pid, tid, &thread_ident_info))
{
if (thread_ident_info.dispatch_qaddr != 0)
{
ostrm << "qaddr:" << std::hex << thread_ident_info.dispatch_qaddr << ';';
const DispatchQueueOffsets *dispatch_queue_offsets = GetDispatchQueueOffsets();
if (dispatch_queue_offsets)
{
std::string queue_name;
uint64_t queue_width = 0;
uint64_t queue_serialnum = 0;
dispatch_queue_offsets->GetThreadQueueInfo(pid, thread_ident_info.dispatch_qaddr, queue_name, queue_width, queue_serialnum);
if (!queue_name.empty())
{
ostrm << "qname:";
append_hex_value(ostrm, queue_name.data(), queue_name.size(), false);
ostrm << ';';
}
if (queue_width == 1)
ostrm << "qkind:serial;";
else if (queue_width > 1)
ostrm << "qkind:concurrent;";
if (queue_serialnum > 0)
ostrm << "qserialnum:" << DECIMAL << queue_serialnum << ';';
}
}
}
if (g_num_reg_entries == 0)
InitializeRegisters ();
@ -5190,7 +5160,18 @@ RNBRemote::GetJSONThreadsInfo(bool threads_with_valid_stop_info_only)
std::string queue_name;
uint64_t queue_width = 0;
uint64_t queue_serialnum = 0;
dispatch_queue_offsets->GetThreadQueueInfo(pid, thread_ident_info.dispatch_qaddr, queue_name, queue_width, queue_serialnum);
nub_addr_t dispatch_queue_t = INVALID_NUB_ADDRESS;
dispatch_queue_offsets->GetThreadQueueInfo(pid, thread_ident_info.dispatch_qaddr, dispatch_queue_t, queue_name, queue_width, queue_serialnum);
if (dispatch_queue_t == 0 && queue_name.empty() && queue_serialnum == 0)
{
thread_dict_sp->AddBooleanItem ("associated_with_dispatch_queue", false);
}
else
{
thread_dict_sp->AddBooleanItem ("associated_with_dispatch_queue", true);
}
if (dispatch_queue_t != INVALID_NUB_ADDRESS && dispatch_queue_t != 0)
thread_dict_sp->AddIntegerItem("dispatch_queue_t", dispatch_queue_t);
if (!queue_name.empty())
thread_dict_sp->AddStringItem("qname", queue_name);
if (queue_width == 1)

View File

@ -373,6 +373,7 @@ protected:
void
GetThreadQueueInfo (nub_process_t pid,
nub_addr_t dispatch_qaddr,
nub_addr_t &dispatch_queue_t,
std::string &queue_name,
uint64_t &queue_width,
uint64_t &queue_serialnum) const;