[Lldb-commits] [PATCH] D130607: [trace] Add instruction control flow kind to JSON trace dumper's output

Jakob Johnson via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Jul 27 05:24:49 PDT 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rGdde3cf2e83d2: [trace] Add instruction control flow kind to JSON trace dumper's output (authored by jj10306).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D130607/new/

https://reviews.llvm.org/D130607

Files:
  lldb/source/Target/TraceDumper.cpp


Index: lldb/source/Target/TraceDumper.cpp
===================================================================
--- lldb/source/Target/TraceDumper.cpp
+++ lldb/source/Target/TraceDumper.cpp
@@ -199,6 +199,7 @@
       "column"?: decimal,
       "source"?: string,
       "mnemonic"?: string,
+      "controlFlowKind"?: string,
     }
   */
 public:
@@ -234,10 +235,18 @@
           "symbol",
           ToOptionalString(item.symbol_info->sc.GetFunctionName().AsCString()));
 
-      if (item.symbol_info->instruction) {
+      if (lldb::InstructionSP instruction = item.symbol_info->instruction) {
+        ExecutionContext exe_ctx = item.symbol_info->exe_ctx;
         m_j.attribute("mnemonic",
-                      ToOptionalString(item.symbol_info->instruction->GetMnemonic(
-                          &item.symbol_info->exe_ctx)));
+                      ToOptionalString(instruction->GetMnemonic(&exe_ctx)));
+        if (m_options.show_control_flow_kind) {
+          lldb::InstructionControlFlowKind instruction_control_flow_kind =
+              instruction->GetControlFlowKind(&exe_ctx);
+          m_j.attribute("controlFlowKind",
+                        ToOptionalString(
+                            Instruction::GetNameForInstructionControlFlowKind(
+                                instruction_control_flow_kind)));
+        }
       }
 
       if (IsLineEntryValid(item.symbol_info->sc.line_entry)) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D130607.448008.patch
Type: text/x-patch
Size: 1416 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220727/f113e3df/attachment.bin>


More information about the lldb-commits mailing list