[Lldb-commits] [lldb] r286288 - Clean up the stop printing header lines.

Jim Ingham via lldb-commits lldb-commits at lists.llvm.org
Tue Nov 8 12:36:41 PST 2016


Author: jingham
Date: Tue Nov  8 14:36:40 2016
New Revision: 286288

URL: http://llvm.org/viewvc/llvm-project?rev=286288&view=rev
Log:
Clean up the stop printing header lines.

I added a "thread-stop-format" to distinguish between the form
that is just the thread info (since the stop printing immediately prints
the frame info) and one with more frame 0 info - which is useful for
"thread list" and the like.

I also added a frame.no-debug boolean to the format entities so you can
print frame information differently between frames with source info and those
without.

This closes https://reviews.llvm.org/D26383.
<rdar://problem/28273697>

Modified:
    lldb/trunk/include/lldb/API/SBThread.h
    lldb/trunk/include/lldb/Core/Debugger.h
    lldb/trunk/include/lldb/Core/FormatEntity.h
    lldb/trunk/include/lldb/Target/Process.h
    lldb/trunk/include/lldb/Target/Thread.h
    lldb/trunk/packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py
    lldb/trunk/packages/Python/lldbsuite/test/functionalities/embedded_interpreter/TestConvenienceVariables.py
    lldb/trunk/scripts/interface/SBThread.i
    lldb/trunk/source/API/SBThread.cpp
    lldb/trunk/source/Commands/CommandObjectMemory.cpp
    lldb/trunk/source/Commands/CommandObjectProcess.cpp
    lldb/trunk/source/Commands/CommandObjectTarget.cpp
    lldb/trunk/source/Commands/CommandObjectThread.cpp
    lldb/trunk/source/Core/Debugger.cpp
    lldb/trunk/source/Core/FormatEntity.cpp
    lldb/trunk/source/Target/Process.cpp
    lldb/trunk/source/Target/Thread.cpp
    lldb/trunk/www/formats.html

Modified: lldb/trunk/include/lldb/API/SBThread.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBThread.h?rev=286288&r1=286287&r2=286288&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBThread.h (original)
+++ lldb/trunk/include/lldb/API/SBThread.h Tue Nov  8 14:36:40 2016
@@ -176,6 +176,8 @@ public:
 
   bool GetDescription(lldb::SBStream &description) const;
 
+  bool GetDescription(lldb::SBStream &description, bool stop_format) const;
+
   bool GetStatus(lldb::SBStream &status) const;
 
   SBThread GetExtendedBacktraceThread(const char *type);

Modified: lldb/trunk/include/lldb/Core/Debugger.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Debugger.h?rev=286288&r1=286287&r2=286288&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/Debugger.h (original)
+++ lldb/trunk/include/lldb/Core/Debugger.h Tue Nov  8 14:36:40 2016
@@ -218,6 +218,8 @@ public:
 
   const FormatEntity::Entry *GetThreadFormat() const;
 
+  const FormatEntity::Entry *GetThreadStopFormat() const;
+
   lldb::ScriptLanguage GetScriptLanguage() const;
 
   bool SetScriptLanguage(lldb::ScriptLanguage script_lang);

Modified: lldb/trunk/include/lldb/Core/FormatEntity.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/FormatEntity.h?rev=286288&r1=286287&r2=286288&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/FormatEntity.h (original)
+++ lldb/trunk/include/lldb/Core/FormatEntity.h Tue Nov  8 14:36:40 2016
@@ -62,6 +62,7 @@ public:
       File,
       Lang,
       FrameIndex,
+      FrameNoDebug,
       FrameRegisterPC,
       FrameRegisterSP,
       FrameRegisterFP,

Modified: lldb/trunk/include/lldb/Target/Process.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Process.h?rev=286288&r1=286287&r2=286288&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Process.h (original)
+++ lldb/trunk/include/lldb/Target/Process.h Tue Nov  8 14:36:40 2016
@@ -1508,7 +1508,8 @@ public:
 
   size_t GetThreadStatus(Stream &ostrm, bool only_threads_with_stop_reason,
                          uint32_t start_frame, uint32_t num_frames,
-                         uint32_t num_frames_with_source);
+                         uint32_t num_frames_with_source,
+                         bool stop_format);
 
   void SendAsyncInterrupt();
 

Modified: lldb/trunk/include/lldb/Target/Thread.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Thread.h?rev=286288&r1=286287&r2=286288&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Thread.h (original)
+++ lldb/trunk/include/lldb/Target/Thread.h Tue Nov  8 14:36:40 2016
@@ -499,8 +499,11 @@ public:
     // thread for all memory threads each time we stop.
   }
 
-  void DumpUsingSettingsFormat(Stream &strm, uint32_t frame_idx);
-
+  // If stop_format is true, this will be the form used when we print stop info.
+  // If false, it will be the form we use for thread list and co.
+  void DumpUsingSettingsFormat(Stream &strm, uint32_t frame_idx, 
+                               bool stop_format);
+ 
   bool GetDescription(Stream &s, lldb::DescriptionLevel level,
                       bool print_json_thread, bool print_json_stopinfo);
 
@@ -1150,7 +1153,8 @@ public:
   GetStackFrameSPForStackFramePtr(StackFrame *stack_frame_ptr);
 
   size_t GetStatus(Stream &strm, uint32_t start_frame, uint32_t num_frames,
-                   uint32_t num_frames_with_source);
+                   uint32_t num_frames_with_source,
+                   bool stop_format);
 
   size_t GetStackFrameStatus(Stream &strm, uint32_t first_frame,
                              uint32_t num_frames, bool show_frame_info,

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py?rev=286288&r1=286287&r2=286288&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/completion/TestCompletion.py Tue Nov  8 14:36:40 2016
@@ -190,8 +190,8 @@ class CommandLineCompletionTestCase(Test
     @skipIfFreeBSD  # timing out on the FreeBSD buildbot
     @no_debug_info_test
     def test_settings_set_th(self):
-        """Test that 'settings set th' completes to 'settings set thread-format'."""
-        self.complete_from_to('settings set th', 'settings set thread-format')
+        """Test that 'settings set thread-f' completes to 'settings set thread-format'."""
+        self.complete_from_to('settings set thread-f', 'settings set thread-format')
 
     @expectedFailureAll(hostoslist=["windows"], bugnumber="llvm.org/pr24679")
     @skipIfFreeBSD  # timing out on the FreeBSD buildbot
@@ -204,9 +204,9 @@ class CommandLineCompletionTestCase(Test
     @skipIfFreeBSD  # timing out on the FreeBSD buildbot
     @no_debug_info_test
     def test_settings_clear_th(self):
-        """Test that 'settings clear th' completes to 'settings clear thread-format'."""
+        """Test that 'settings clear thread-f' completes to 'settings clear thread-format'."""
         self.complete_from_to(
-            'settings clear th',
+            'settings clear thread-f',
             'settings clear thread-format')
 
     @expectedFailureAll(hostoslist=["windows"], bugnumber="llvm.org/pr24679")

Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/embedded_interpreter/TestConvenienceVariables.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/embedded_interpreter/TestConvenienceVariables.py?rev=286288&r1=286287&r2=286288&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/embedded_interpreter/TestConvenienceVariables.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/embedded_interpreter/TestConvenienceVariables.py Tue Nov  8 14:36:40 2016
@@ -72,21 +72,37 @@ class ConvenienceVariablesCase(TestBase)
         self.expect(child.before, exe=False, patterns=[
                     'SBProcess: pid = \d+, state = stopped, threads = \d, executable = a.out'])
 
-        child.sendline('print(lldb.thread)')
+        child.sendline('print(lldb.thread.GetStopDescription(100))')
         child.expect_exact(python_prompt)
-        # Linux outputs decimal tid and 'name' instead of 'queue'
         self.expect(
             child.before,
             exe=False,
             patterns=[
-                'thread #1: tid = (0x[0-9a-f]+|[0-9]+), 0x[0-9a-f]+ a\.out`main\(argc=1, argv=0x[0-9a-f]+\) \+ \d+ at main\.c:%d, (name|queue) = \'.+\', stop reason = breakpoint 1\.1' %
-                self.line])
+                'breakpoint 1\.1'])
 
-        child.sendline('print(lldb.frame)')
+        child.sendline('lldb.frame.GetLineEntry().GetLine()')
         child.expect_exact(python_prompt)
+        line_number = "%d"%(self.line)
         self.expect(
             child.before,
             exe=False,
-            patterns=[
-                'frame #0: 0x[0-9a-f]+ a\.out`main\(argc=1, argv=0x[0-9a-f]+\) \+ \d+ at main\.c:%d' %
-                self.line])
+            substrs=[
+                line_number])
+
+        child.sendline('lldb.frame.GetLineEntry().GetFileSpec().GetFilename()')
+        child.expect_exact(python_prompt)
+        line_number = "%d"%(self.line)
+        self.expect(
+            child.before,
+            exe=False,
+            substrs=[
+                "main.c"])
+
+        child.sendline('lldb.frame.GetFunctionName()')
+        child.expect_exact(python_prompt)
+        line_number = "%d"%(self.line)
+        self.expect(
+            child.before,
+            exe=False,
+            substrs=[
+                "main"])

Modified: lldb/trunk/scripts/interface/SBThread.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/interface/SBThread.i?rev=286288&r1=286287&r2=286288&view=diff
==============================================================================
--- lldb/trunk/scripts/interface/SBThread.i (original)
+++ lldb/trunk/scripts/interface/SBThread.i Tue Nov  8 14:36:40 2016
@@ -323,6 +323,15 @@ public:
     bool
     GetDescription (lldb::SBStream &description) const;
     
+    %feature("docstring", "
+    //--------------------------------------------------------------------------
+    /// Get the description strings for this thread that match what the 
+    /// lldb driver will present, using the thread-format (stop_format==false)
+    /// or thread-stop-format (stop_format = true). 
+    //--------------------------------------------------------------------------
+    ") GetDescription;
+    bool GetDescription(lldb::SBStream &description, bool stop_format) const;
+
     bool
     GetStatus (lldb::SBStream &status) const;
     

Modified: lldb/trunk/source/API/SBThread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBThread.cpp?rev=286288&r1=286287&r2=286288&view=diff
==============================================================================
--- lldb/trunk/source/API/SBThread.cpp (original)
+++ lldb/trunk/source/API/SBThread.cpp Tue Nov  8 14:36:40 2016
@@ -1328,7 +1328,7 @@ bool SBThread::GetStatus(SBStream &statu
   ExecutionContext exe_ctx(m_opaque_sp.get(), lock);
 
   if (exe_ctx.HasThreadScope()) {
-    exe_ctx.GetThreadPtr()->GetStatus(strm, 0, 1, 1);
+    exe_ctx.GetThreadPtr()->GetStatus(strm, 0, 1, 1, true);
   } else
     strm.PutCString("No status");
 
@@ -1336,6 +1336,10 @@ bool SBThread::GetStatus(SBStream &statu
 }
 
 bool SBThread::GetDescription(SBStream &description) const {
+    return GetDescription(description, false);
+}
+
+bool SBThread::GetDescription(SBStream &description, bool stop_format) const {
   Stream &strm = description.ref();
 
   std::unique_lock<std::recursive_mutex> lock;
@@ -1343,7 +1347,8 @@ bool SBThread::GetDescription(SBStream &
 
   if (exe_ctx.HasThreadScope()) {
     exe_ctx.GetThreadPtr()->DumpUsingSettingsFormat(strm,
-                                                    LLDB_INVALID_THREAD_ID);
+                                                    LLDB_INVALID_THREAD_ID,
+                                                    stop_format);
     // strm.Printf("SBThread: tid = 0x%4.4" PRIx64,
     // exe_ctx.GetThreadPtr()->GetID());
   } else

Modified: lldb/trunk/source/Commands/CommandObjectMemory.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectMemory.cpp?rev=286288&r1=286287&r2=286288&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectMemory.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectMemory.cpp Tue Nov  8 14:36:40 2016
@@ -1672,8 +1672,9 @@ protected:
 
     HistoryThreads thread_list = memory_history->GetHistoryThreads(addr);
 
+    const bool stop_format = false;
     for (auto thread : thread_list) {
-      thread->GetStatus(*output_stream, 0, UINT32_MAX, 0);
+      thread->GetStatus(*output_stream, 0, UINT32_MAX, 0, stop_format);
     }
 
     result.SetStatus(eReturnStatusSuccessFinishResult);

Modified: lldb/trunk/source/Commands/CommandObjectProcess.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectProcess.cpp?rev=286288&r1=286287&r2=286288&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectProcess.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectProcess.cpp Tue Nov  8 14:36:40 2016
@@ -1352,9 +1352,10 @@ public:
     const uint32_t start_frame = 0;
     const uint32_t num_frames = 1;
     const uint32_t num_frames_with_source = 1;
+    const bool     stop_format = true;
     process->GetStatus(strm);
     process->GetThreadStatus(strm, only_threads_with_stop_reason, start_frame,
-                             num_frames, num_frames_with_source);
+                             num_frames, num_frames_with_source, stop_format);
     return result.Succeeded();
   }
 };

Modified: lldb/trunk/source/Commands/CommandObjectTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectTarget.cpp?rev=286288&r1=286287&r2=286288&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectTarget.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectTarget.cpp Tue Nov  8 14:36:40 2016
@@ -107,10 +107,11 @@ static void DumpTargetInfo(uint32_t targ
     const uint32_t start_frame = 0;
     const uint32_t num_frames = 1;
     const uint32_t num_frames_with_source = 1;
+    const bool     stop_format = false;
     process_sp->GetStatus(strm);
     process_sp->GetThreadStatus(strm, only_threads_with_stop_reason,
                                 start_frame, num_frames,
-                                num_frames_with_source);
+                                num_frames_with_source, stop_format);
   }
 }
 

Modified: lldb/trunk/source/Commands/CommandObjectThread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectThread.cpp?rev=286288&r1=286287&r2=286288&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectThread.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectThread.cpp Tue Nov  8 14:36:40 2016
@@ -248,9 +248,11 @@ protected:
             thread->shared_from_this(), type);
         if (ext_thread_sp && ext_thread_sp->IsValid()) {
           const uint32_t num_frames_with_source = 0;
+          const bool stop_format = false;
           if (ext_thread_sp->GetStatus(strm, m_options.m_start,
                                        m_options.m_count,
-                                       num_frames_with_source)) {
+                                       num_frames_with_source,
+                                       stop_format)) {
             DoExtendedBacktrace(ext_thread_sp.get(), result);
           }
         }
@@ -277,7 +279,7 @@ protected:
     const uint32_t num_frames_with_source = 0;
 
     if (!thread->GetStatus(strm, m_options.m_start, m_options.m_count,
-                           num_frames_with_source)) {
+                           num_frames_with_source, false)) {
       result.AppendErrorWithFormat(
           "error displaying backtrace for thread: \"0x%4.4x\"\n",
           thread->GetIndexID());
@@ -1308,7 +1310,7 @@ protected:
     const uint32_t num_frames_with_source = 0;
     process->GetStatus(strm);
     process->GetThreadStatus(strm, only_threads_with_stop_reason, start_frame,
-                             num_frames, num_frames_with_source);
+                             num_frames, num_frames_with_source, false);
     return result.Succeeded();
   }
 };

Modified: lldb/trunk/source/Core/Debugger.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Debugger.cpp?rev=286288&r1=286287&r2=286288&view=diff
==============================================================================
--- lldb/trunk/source/Core/Debugger.cpp (original)
+++ lldb/trunk/source/Core/Debugger.cpp Tue Nov  8 14:36:40 2016
@@ -97,7 +97,8 @@ OptionEnumValueElement g_language_enumer
 
 #define MODULE_WITH_FUNC                                                       \
   "{ "                                                                         \
-  "${module.file.basename}{`${function.name-with-args}${function.pc-offset}}}"
+  "${module.file.basename}{`${function.name-with-args}"                        \
+  "{${frame.no-debug}${function.pc-offset}}}}"
 #define FILE_AND_LINE "{ at ${line.file.basename}:${line.number}}"
 #define IS_OPTIMIZED "{${function.is-optimized} [opt]}"
 
@@ -113,8 +114,18 @@ OptionEnumValueElement g_language_enumer
   "{\\nCompleted expression: ${thread.completed-expression}}"                  \
   "\\n"
 
+#define DEFAULT_THREAD_STOP_FORMAT                                             \
+  "thread #${thread.index}{, name = '${thread.name}'}"                         \
+  "{, queue = '${thread.queue}'}"                                              \
+  "{, activity = '${thread.info.activity.name}'}"                              \
+  "{, ${thread.info.trace_messages} messages}"                                 \
+  "{, stop reason = ${thread.stop-reason}}"                                    \
+  "{\\nReturn value: ${thread.return-value}}"                                  \
+  "{\\nCompleted expression: ${thread.completed-expression}}"                  \
+  "\\n"
+
 #define DEFAULT_FRAME_FORMAT                                                   \
-  "frame #${frame.index}: ${frame.pc}" MODULE_WITH_FUNC FILE_AND_LINE          \
+  "frame #${frame.index}:{ ${frame.no-debug}${frame.pc}}" MODULE_WITH_FUNC FILE_AND_LINE          \
       IS_OPTIMIZED "\\n"
 
 // Three parts to this disassembly format specification:
@@ -210,6 +221,10 @@ static PropertyDefinition g_properties[]
     {"thread-format", OptionValue::eTypeFormatEntity, true, 0,
      DEFAULT_THREAD_FORMAT, nullptr, "The default thread format string to use "
                                      "when displaying thread information."},
+    {"thread-stop-format", OptionValue::eTypeFormatEntity, true, 0,
+     DEFAULT_THREAD_STOP_FORMAT, nullptr, "The default thread format  "
+                                     "string to usewhen displaying thread "
+                                     "information as part of the stop display."},
     {"use-external-editor", OptionValue::eTypeBoolean, true, false, nullptr,
      nullptr, "Whether to use an external editor or not."},
     {"use-color", OptionValue::eTypeBoolean, true, true, nullptr, nullptr,
@@ -247,6 +262,7 @@ enum {
   ePropertyStopShowColumnAnsiSuffix,
   ePropertyTerminalWidth,
   ePropertyThreadFormat,
+  ePropertyThreadStopFormat,
   ePropertyUseExternalEditor,
   ePropertyUseColor,
   ePropertyAutoOneLineSummaries,
@@ -359,6 +375,11 @@ const FormatEntity::Entry *Debugger::Get
   return m_collection_sp->GetPropertyAtIndexAsFormatEntity(nullptr, idx);
 }
 
+const FormatEntity::Entry *Debugger::GetThreadStopFormat() const {
+  const uint32_t idx = ePropertyThreadStopFormat;
+  return m_collection_sp->GetPropertyAtIndexAsFormatEntity(nullptr, idx);
+}
+
 lldb::ScriptLanguage Debugger::GetScriptLanguage() const {
   const uint32_t idx = ePropertyScriptLanguage;
   return (lldb::ScriptLanguage)m_collection_sp->GetPropertyAtIndexAsEnumeration(
@@ -1460,12 +1481,13 @@ void Debugger::HandleThreadEvent(const E
   // and all we do for that is just reprint the thread status for that thread.
   using namespace lldb;
   const uint32_t event_type = event_sp->GetType();
+  const bool stop_format = true;
   if (event_type == Thread::eBroadcastBitStackChanged ||
       event_type == Thread::eBroadcastBitThreadSelected) {
     ThreadSP thread_sp(
         Thread::ThreadEventData::GetThreadFromEvent(event_sp.get()));
     if (thread_sp) {
-      thread_sp->GetStatus(*GetAsyncOutputStream(), 0, 1, 1);
+      thread_sp->GetStatus(*GetAsyncOutputStream(), 0, 1, 1, stop_format);
     }
   }
 }

Modified: lldb/trunk/source/Core/FormatEntity.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/FormatEntity.cpp?rev=286288&r1=286287&r2=286288&view=diff
==============================================================================
--- lldb/trunk/source/Core/FormatEntity.cpp (original)
+++ lldb/trunk/source/Core/FormatEntity.cpp Tue Nov  8 14:36:40 2016
@@ -97,6 +97,7 @@ static FormatEntity::Entry::Definition g
     ENTRY("fp", FrameRegisterFP, UInt64),
     ENTRY("sp", FrameRegisterSP, UInt64),
     ENTRY("flags", FrameRegisterFlags, UInt64),
+    ENTRY("no-debug", FrameNoDebug, None),
     ENTRY_CHILDREN("reg", FrameRegisterByName, UInt64, g_string_entry),
 };
 
@@ -320,6 +321,7 @@ const char *FormatEntity::Entry::TypeToC
     ENUM_TO_CSTR(File);
     ENUM_TO_CSTR(Lang);
     ENUM_TO_CSTR(FrameIndex);
+    ENUM_TO_CSTR(FrameNoDebug);
     ENUM_TO_CSTR(FrameRegisterPC);
     ENUM_TO_CSTR(FrameRegisterSP);
     ENUM_TO_CSTR(FrameRegisterFP);
@@ -1445,6 +1447,15 @@ bool FormatEntity::Format(const Entry &e
     }
     return false;
 
+  case Entry::Type::FrameNoDebug:
+    if (exe_ctx) {
+      StackFrame *frame = exe_ctx->GetFramePtr();
+      if (frame) {
+        return !frame->HasDebugInformation();
+      }
+    }
+    return true;
+
   case Entry::Type::FrameRegisterByName:
     if (exe_ctx) {
       StackFrame *frame = exe_ctx->GetFramePtr();

Modified: lldb/trunk/source/Target/Process.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=286288&r1=286287&r2=286288&view=diff
==============================================================================
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Tue Nov  8 14:36:40 2016
@@ -1199,10 +1199,12 @@ bool Process::HandleProcessStateChangedE
           const uint32_t start_frame = 0;
           const uint32_t num_frames = 1;
           const uint32_t num_frames_with_source = 1;
+          const bool stop_format = true;
           process_sp->GetStatus(*stream);
           process_sp->GetThreadStatus(*stream, only_threads_with_stop_reason,
                                       start_frame, num_frames,
-                                      num_frames_with_source);
+                                      num_frames_with_source,
+                                      stop_format);
           if (curr_thread_stop_info_sp) {
             lldb::addr_t crashing_address;
             ValueObjectSP valobj_sp = StopInfo::GetCrashingDereference(
@@ -5789,7 +5791,8 @@ void Process::GetStatus(Stream &strm) {
 size_t Process::GetThreadStatus(Stream &strm,
                                 bool only_threads_with_stop_reason,
                                 uint32_t start_frame, uint32_t num_frames,
-                                uint32_t num_frames_with_source) {
+                                uint32_t num_frames_with_source,
+                                bool stop_format) {
   size_t num_thread_infos_dumped = 0;
 
   // You can't hold the thread list lock while calling Thread::GetStatus.  That
@@ -5820,7 +5823,8 @@ size_t Process::GetThreadStatus(Stream &
           continue;
       }
       thread_sp->GetStatus(strm, start_frame, num_frames,
-                           num_frames_with_source);
+                           num_frames_with_source,
+                           stop_format);
       ++num_thread_infos_dumped;
     } else {
       Log *log(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS));

Modified: lldb/trunk/source/Target/Thread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Thread.cpp?rev=286288&r1=286287&r2=286288&view=diff
==============================================================================
--- lldb/trunk/source/Target/Thread.cpp (original)
+++ lldb/trunk/source/Target/Thread.cpp Tue Nov  8 14:36:40 2016
@@ -1769,7 +1769,8 @@ Error Thread::JumpToLine(const FileSpec
   return Error();
 }
 
-void Thread::DumpUsingSettingsFormat(Stream &strm, uint32_t frame_idx) {
+void Thread::DumpUsingSettingsFormat(Stream &strm, uint32_t frame_idx,
+                                     bool stop_format) {
   ExecutionContext exe_ctx(shared_from_this());
   Process *process = exe_ctx.GetProcessPtr();
   if (process == nullptr)
@@ -1785,8 +1786,12 @@ void Thread::DumpUsingSettingsFormat(Str
     }
   }
 
-  const FormatEntity::Entry *thread_format =
-      exe_ctx.GetTargetRef().GetDebugger().GetThreadFormat();
+  const FormatEntity::Entry *thread_format;
+  if (stop_format)
+    thread_format = exe_ctx.GetTargetRef().GetDebugger().GetThreadStopFormat();
+  else
+    thread_format = exe_ctx.GetTargetRef().GetDebugger().GetThreadFormat();
+
   assert(thread_format);
 
   FormatEntity::Format(*thread_format, strm, frame_sp ? &frame_sc : nullptr,
@@ -1876,7 +1881,8 @@ const char *Thread::RunModeAsCString(lld
 }
 
 size_t Thread::GetStatus(Stream &strm, uint32_t start_frame,
-                         uint32_t num_frames, uint32_t num_frames_with_source) {
+                         uint32_t num_frames, uint32_t num_frames_with_source,
+                         bool stop_format) {
   ExecutionContext exe_ctx(shared_from_this());
   Target *target = exe_ctx.GetTargetPtr();
   Process *process = exe_ctx.GetProcessPtr();
@@ -1900,7 +1906,7 @@ size_t Thread::GetStatus(Stream &strm, u
     }
   }
 
-  DumpUsingSettingsFormat(strm, start_frame);
+  DumpUsingSettingsFormat(strm, start_frame, stop_format);
 
   if (num_frames > 0) {
     strm.IndentMore();
@@ -1926,7 +1932,8 @@ size_t Thread::GetStatus(Stream &strm, u
 
 bool Thread::GetDescription(Stream &strm, lldb::DescriptionLevel level,
                             bool print_json_thread, bool print_json_stopinfo) {
-  DumpUsingSettingsFormat(strm, 0);
+  const bool stop_format = false;
+  DumpUsingSettingsFormat(strm, 0, stop_format);
   strm.Printf("\n");
 
   StructuredData::ObjectSP thread_info = GetExtendedInfo();

Modified: lldb/trunk/www/formats.html
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/www/formats.html?rev=286288&r1=286287&r2=286288&view=diff
==============================================================================
--- lldb/trunk/www/formats.html (original)
+++ lldb/trunk/www/formats.html Tue Nov  8 14:36:40 2016
@@ -75,6 +75,7 @@
                     <tr valign=top><td><b>file.fullpath</b></td><td>The current compile unit file fullpath for the current frame.</td></tr>
                     <tr valign=top><td><b>language</b></td><td>The current compile unit language for the current frame.</td></tr>
                     <tr valign=top><td><b>frame.index</b></td><td>The frame index (0, 1, 2, 3...)</td></tr>
+                    <tr valign=top><td><b>frame.no-debug</b></td><td>Evaluates to true if the frame has no debug info.</td></tr>
                     <tr valign=top><td><b>frame.pc</b></td><td>The generic frame register for the program counter.</td></tr>
                     <tr valign=top><td><b>frame.sp</b></td><td>The generic frame register for the stack pointer.</td></tr>
                     <tr valign=top><td><b>frame.fp</b></td><td>The generic frame register for the frame pointer.</td></tr>




More information about the lldb-commits mailing list