[Lldb-commits] [lldb] r242380 - Only include the stack memory for the caller stack

Jason Molenda jmolenda at apple.com
Wed Jul 15 20:42:40 PDT 2015


Author: jmolenda
Date: Wed Jul 15 22:42:40 2015
New Revision: 242380

URL: http://llvm.org/viewvc/llvm-project?rev=242380&view=rev
Log:
Only include the stack memory for the caller stack
frame, don't go any further, in RNBRemote::SendStopReplyPacketForThread.

These are the memory pre-fetches in the T05 packet and are
included in every private stop that lldb does.  lldb needs, at most,
the caller stack frame so we're sending more data than needed by
including additional stack memory prefetches in this reply packet.

Once we've stopped for a public stop, we're going to do a jThreadsInfo
which will include the stack memory prefetches for all threads, 
including the one which had the stop reason.

Modified:
    lldb/trunk/tools/debugserver/source/RNBRemote.cpp

Modified: lldb/trunk/tools/debugserver/source/RNBRemote.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/RNBRemote.cpp?rev=242380&r1=242379&r2=242380&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/RNBRemote.cpp (original)
+++ lldb/trunk/tools/debugserver/source/RNBRemote.cpp Wed Jul 15 22:42:40 2015
@@ -2573,7 +2573,7 @@ typedef std::map<nub_addr_t, StackMemory
 
 
 static void
-ReadStackMemory (nub_process_t pid, nub_thread_t tid, StackMemoryMap &stack_mmap)
+ReadStackMemory (nub_process_t pid, nub_thread_t tid, StackMemoryMap &stack_mmap, uint32_t backtrace_limit = 256)
 {
     DNBRegisterValue reg_value;
     if (DNBThreadGetRegisterValueByID(pid, tid, REGISTER_SET_GENERIC, GENERIC_REGNUM_FP, &reg_value))
@@ -2588,7 +2588,7 @@ ReadStackMemory (nub_process_t pid, nub_
         {
             // Make sure we never recurse more than 256 times so we don't recurse too far or
             // store up too much memory in the expedited cache
-            if (++frame_count > 256)
+            if (++frame_count > backtrace_limit)
                 break;
 
             const nub_size_t read_size = reg_value.info.size*2;
@@ -2791,7 +2791,7 @@ RNBRemote::SendStopReplyPacketForThread
         // Add expedited stack memory so stack backtracing doesn't need to read anything from the
         // frame pointer chain.
         StackMemoryMap stack_mmap;
-        ReadStackMemory (pid, tid, stack_mmap);
+        ReadStackMemory (pid, tid, stack_mmap, 1);
         if (!stack_mmap.empty())
         {
             for (const auto &stack_memory : stack_mmap)





More information about the lldb-commits mailing list