summaryrefslogtreecommitdiffstats
path: root/lldb/tools/debugserver/source/RNBRemote.cpp
diff options
context:
space:
mode:
authorJason Molenda <jmolenda@apple.com>2016-01-12 07:09:16 +0000
committerJason Molenda <jmolenda@apple.com>2016-01-12 07:09:16 +0000
commit77f8935218a48b7b223a4e304785e31a69b1c3f3 (patch)
tree8a44bb9251bca072dc94400817ff53fbb2cfad2b /lldb/tools/debugserver/source/RNBRemote.cpp
parent85215942efed6e99e4d79a5d44d2fcb83171efbc (diff)
downloadbcm5719-llvm-77f8935218a48b7b223a4e304785e31a69b1c3f3.tar.gz
bcm5719-llvm-77f8935218a48b7b223a4e304785e31a69b1c3f3.zip
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
Diffstat (limited to 'lldb/tools/debugserver/source/RNBRemote.cpp')
-rw-r--r--lldb/tools/debugserver/source/RNBRemote.cpp57
1 files changed, 19 insertions, 38 deletions
diff --git a/lldb/tools/debugserver/source/RNBRemote.cpp b/lldb/tools/debugserver/source/RNBRemote.cpp
index 0036e89bfc4..6dddb046acc 100644
--- a/lldb/tools/debugserver/source/RNBRemote.cpp
+++ b/lldb/tools/debugserver/source/RNBRemote.cpp
@@ -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)
OpenPOWER on IntegriCloud