wallace created this revision.
wallace added a reviewer: clayborg.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.
wallace requested review of this revision.
Herald added a subscriber: JDevlieghere.

Depends on D84810 <https://reviews.llvm.org/D84810>.
The existing namespace name ptdecoder is really not good, as this extension 
does more things beyond decoding, and will have even more features soon.
So I'm renaming the namespace to intelpt, which is clearer.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D85068

Files:
  lldb/tools/intel-features/intel-pt/Decoder.cpp
  lldb/tools/intel-features/intel-pt/Decoder.h
  lldb/tools/intel-features/intel-pt/PTDecoder.cpp
  lldb/tools/intel-features/intel-pt/PTDecoder.h
  lldb/tools/intel-features/intel-pt/cli-wrapper-pt.cpp
  lldb/tools/intel-features/scripts/lldb-intel-features.swig

Index: lldb/tools/intel-features/scripts/lldb-intel-features.swig
===================================================================
--- lldb/tools/intel-features/scripts/lldb-intel-features.swig
+++ lldb/tools/intel-features/scripts/lldb-intel-features.swig
@@ -21,7 +21,7 @@
 %{
 #include "lldb/lldb-public.h"
 #include "intel-pt/PTDecoder.h"
-using namespace ptdecoder;
+using namespace intelpt;
 %}
 
 /* Undefine GCC keyword to make Swig happy when processing glibc's stdint.h */
Index: lldb/tools/intel-features/intel-pt/cli-wrapper-pt.cpp
===================================================================
--- lldb/tools/intel-features/intel-pt/cli-wrapper-pt.cpp
+++ lldb/tools/intel-features/intel-pt/cli-wrapper-pt.cpp
@@ -123,7 +123,7 @@
 
 class ProcessorTraceStart : public lldb::SBCommandPluginInterface {
 public:
-  ProcessorTraceStart(std::shared_ptr<ptdecoder::PTDecoder> &pt_decoder)
+  ProcessorTraceStart(std::shared_ptr<intelpt::PTDecoder> &pt_decoder)
       : SBCommandPluginInterface(), pt_decoder_sp(pt_decoder) {}
 
   ~ProcessorTraceStart() {}
@@ -137,7 +137,7 @@
 
     // Default initialize API's arguments
     lldb::SBTraceOptions lldb_SBTraceOptions =
-        ptdecoder::PTDecoder::GetDefaultTraceOptions();
+        intelpt::PTDecoder::GetDefaultTraceOptions();
     uint32_t trace_buffer_size = lldb_SBTraceOptions.getTraceBufferSize();
     lldb::tid_t thread_id;
 
@@ -186,13 +186,13 @@
   }
 
 private:
-  std::shared_ptr<ptdecoder::PTDecoder> pt_decoder_sp;
+  std::shared_ptr<intelpt::PTDecoder> pt_decoder_sp;
   const uint32_t m_max_trace_buff_size = 0x3fff;
 };
 
 class ProcessorTraceInfo : public lldb::SBCommandPluginInterface {
 public:
-  ProcessorTraceInfo(std::shared_ptr<ptdecoder::PTDecoder> &pt_decoder)
+  ProcessorTraceInfo(std::shared_ptr<intelpt::PTDecoder> &pt_decoder)
       : SBCommandPluginInterface(), pt_decoder_sp(pt_decoder) {}
 
   ~ProcessorTraceInfo() {}
@@ -246,7 +246,7 @@
         thread = process.GetThreadByID(thread_id);
       thread_id = thread.GetThreadID();
 
-      ptdecoder::PTTraceOptions options;
+      intelpt::PTTraceOptions options;
       pt_decoder_sp->GetProcessorTraceInfo(process, thread_id, options, error);
       if (!error.Success()) {
         res.Printf("thread #%" PRIu32 ": tid=%" PRIu64 ", error: %s",
@@ -285,12 +285,12 @@
   }
 
 private:
-  std::shared_ptr<ptdecoder::PTDecoder> pt_decoder_sp;
+  std::shared_ptr<intelpt::PTDecoder> pt_decoder_sp;
 };
 
 class ProcessorTraceShowInstrLog : public lldb::SBCommandPluginInterface {
 public:
-  ProcessorTraceShowInstrLog(std::shared_ptr<ptdecoder::PTDecoder> &pt_decoder)
+  ProcessorTraceShowInstrLog(std::shared_ptr<intelpt::PTDecoder> &pt_decoder)
       : SBCommandPluginInterface(), pt_decoder_sp(pt_decoder) {}
 
   ~ProcessorTraceShowInstrLog() {}
@@ -363,7 +363,7 @@
         offset = count - 1;
 
       // Get the instruction log
-      ptdecoder::PTInstructionList insn_list;
+      intelpt::PTInstructionList insn_list;
       pt_decoder_sp->GetInstructionLogAtOffset(process, thread_id, offset,
                                                count, insn_list, error);
       if (!error.Success()) {
@@ -381,7 +381,7 @@
           debugger.GetCommandInterpreter());
       lldb::SBCommandReturnObject result_obj;
       for (size_t i = 0; i < insn_list.GetSize(); i++) {
-        ptdecoder::PTInstruction insn = insn_list.GetInstructionAtIndex(i);
+        intelpt::PTInstruction insn = insn_list.GetInstructionAtIndex(i);
         uint64_t addr = insn.GetInsnAddress();
         std::string error = insn.GetError();
         if (!error.empty()) {
@@ -424,13 +424,13 @@
   }
 
 private:
-  std::shared_ptr<ptdecoder::PTDecoder> pt_decoder_sp;
+  std::shared_ptr<intelpt::PTDecoder> pt_decoder_sp;
   const uint32_t m_default_count = 10;
 };
 
 class ProcessorTraceStop : public lldb::SBCommandPluginInterface {
 public:
-  ProcessorTraceStop(std::shared_ptr<ptdecoder::PTDecoder> &pt_decoder)
+  ProcessorTraceStop(std::shared_ptr<intelpt::PTDecoder> &pt_decoder)
       : SBCommandPluginInterface(), pt_decoder_sp(pt_decoder) {}
 
   ~ProcessorTraceStop() {}
@@ -477,7 +477,7 @@
   }
 
 private:
-  std::shared_ptr<ptdecoder::PTDecoder> pt_decoder_sp;
+  std::shared_ptr<intelpt::PTDecoder> pt_decoder_sp;
 };
 
 bool PTPluginInitialize(lldb::SBDebugger &debugger) {
@@ -485,8 +485,8 @@
   lldb::SBCommand proc_trace = interpreter.AddMultiwordCommand(
       "processor-trace", "Intel(R) Processor Trace for thread/process");
 
-  std::shared_ptr<ptdecoder::PTDecoder> PTDecoderSP(
-      new ptdecoder::PTDecoder(debugger));
+  std::shared_ptr<intelpt::PTDecoder> PTDecoderSP(
+      new intelpt::PTDecoder(debugger));
 
   lldb::SBCommandPluginInterface *proc_trace_start =
       new ProcessorTraceStart(PTDecoderSP);
Index: lldb/tools/intel-features/intel-pt/PTDecoder.h
===================================================================
--- lldb/tools/intel-features/intel-pt/PTDecoder.h
+++ lldb/tools/intel-features/intel-pt/PTDecoder.h
@@ -20,14 +20,14 @@
 #include "lldb/lldb-enumerations.h"
 #include "lldb/lldb-types.h"
 
-namespace ptdecoder_private {
+namespace intelpt_private {
 class Instruction;
 class InstructionList;
 class TraceOptions;
 class Decoder;
-} // namespace ptdecoder_private
+} // namespace intelpt_private
 
-namespace ptdecoder {
+namespace intelpt {
 
 /// \class PTInstruction
 /// Represents an assembly instruction containing raw
@@ -38,7 +38,7 @@
 public:
   PTInstruction() = default;
 
-  PTInstruction(const std::shared_ptr<ptdecoder_private::Instruction> &ptr);
+  PTInstruction(const std::shared_ptr<intelpt_private::Instruction> &ptr);
 
   ~PTInstruction();
 
@@ -72,7 +72,7 @@
   bool GetSpeculative() const;
 
 private:
-  std::shared_ptr<ptdecoder_private::Instruction> m_opaque_sp;
+  std::shared_ptr<intelpt_private::Instruction> m_opaque_sp;
 };
 
 /// \class PTInstructionList
@@ -91,9 +91,9 @@
 private:
   friend class PTDecoder;
 
-  void SetSP(const std::shared_ptr<ptdecoder_private::InstructionList> &ptr);
+  void SetSP(const std::shared_ptr<intelpt_private::InstructionList> &ptr);
 
-  std::shared_ptr<ptdecoder_private::InstructionList> m_opaque_sp;
+  std::shared_ptr<intelpt_private::InstructionList> m_opaque_sp;
 };
 
 /// \class PTTraceOptions
@@ -121,9 +121,9 @@
 private:
   friend class PTDecoder;
 
-  void SetSP(const std::shared_ptr<ptdecoder_private::TraceOptions> &ptr);
+  void SetSP(const std::shared_ptr<intelpt_private::TraceOptions> &ptr);
 
-  std::shared_ptr<ptdecoder_private::TraceOptions> m_opaque_sp;
+  std::shared_ptr<intelpt_private::TraceOptions> m_opaque_sp;
 };
 
 /// \class PTDecoder
@@ -276,8 +276,8 @@
   static lldb::SBTraceOptions GetDefaultTraceOptions();
 
 private:
-  std::shared_ptr<ptdecoder_private::Decoder> m_opaque_sp;
+  std::shared_ptr<intelpt_private::Decoder> m_opaque_sp;
 };
 
-} // namespace ptdecoder
+} // namespace intelpt
 #endif // PTDecoder_h_
Index: lldb/tools/intel-features/intel-pt/PTDecoder.cpp
===================================================================
--- lldb/tools/intel-features/intel-pt/PTDecoder.cpp
+++ lldb/tools/intel-features/intel-pt/PTDecoder.cpp
@@ -9,12 +9,12 @@
 #include "PTDecoder.h"
 #include "Decoder.h"
 
-using namespace ptdecoder;
-using namespace ptdecoder_private;
+using namespace intelpt;
+using namespace intelpt_private;
 
 // PTInstruction class member functions definitions
 PTInstruction::PTInstruction(
-    const std::shared_ptr<ptdecoder_private::Instruction> &ptr)
+    const std::shared_ptr<intelpt_private::Instruction> &ptr)
     : m_opaque_sp(ptr) {}
 
 PTInstruction::~PTInstruction() {}
@@ -42,15 +42,15 @@
 
 PTInstruction PTInstructionList::GetInstructionAtIndex(uint32_t idx) {
   if (m_opaque_sp)
-    return PTInstruction(std::shared_ptr<ptdecoder_private::Instruction>(
+    return PTInstruction(std::shared_ptr<intelpt_private::Instruction>(
         new Instruction(m_opaque_sp->GetInstructionAtIndex(idx))));
 
-  return PTInstruction(std::shared_ptr<ptdecoder_private::Instruction>(
+  return PTInstruction(std::shared_ptr<intelpt_private::Instruction>(
       new Instruction("invalid instruction")));
 }
 
 void PTInstructionList::SetSP(
-    const std::shared_ptr<ptdecoder_private::InstructionList> &ptr) {
+    const std::shared_ptr<intelpt_private::InstructionList> &ptr) {
   m_opaque_sp = ptr;
 }
 void PTInstructionList::Clear() {
@@ -81,13 +81,13 @@
 }
 
 void PTTraceOptions::SetSP(
-    const std::shared_ptr<ptdecoder_private::TraceOptions> &ptr) {
+    const std::shared_ptr<intelpt_private::TraceOptions> &ptr) {
   m_opaque_sp = ptr;
 }
 
 // PTDecoder class member functions definitions
 PTDecoder::PTDecoder(lldb::SBDebugger &sbdebugger)
-    : m_opaque_sp(new ptdecoder_private::Decoder(sbdebugger)) {}
+    : m_opaque_sp(new intelpt_private::Decoder(sbdebugger)) {}
 
 void PTDecoder::StartProcessorTrace(lldb::SBProcess &sbprocess,
                                     lldb::SBTraceOptions &sbtraceoptions,
@@ -120,7 +120,7 @@
     return;
   }
 
-  std::shared_ptr<ptdecoder_private::InstructionList> insn_list_ptr(
+  std::shared_ptr<intelpt_private::InstructionList> insn_list_ptr(
       new InstructionList());
   m_opaque_sp->GetInstructionLogAtOffset(sbprocess, tid, offset, count,
                                          *insn_list_ptr, sberror);
@@ -138,7 +138,7 @@
     return;
   }
 
-  std::shared_ptr<ptdecoder_private::TraceOptions> trace_options_ptr(
+  std::shared_ptr<intelpt_private::TraceOptions> trace_options_ptr(
       new TraceOptions());
   m_opaque_sp->GetProcessorTraceInfo(sbprocess, tid, *trace_options_ptr,
                                      sberror);
Index: lldb/tools/intel-features/intel-pt/Decoder.h
===================================================================
--- lldb/tools/intel-features/intel-pt/Decoder.h
+++ lldb/tools/intel-features/intel-pt/Decoder.h
@@ -28,7 +28,7 @@
 
 #include "intel-pt.h"
 
-namespace ptdecoder_private {
+namespace intelpt_private {
 /// \class Instruction
 /// Represents an assembly instruction containing raw
 ///     instruction bytes, instruction address along with information
@@ -323,5 +323,5 @@
                                       // to this Decoder instance
 };
 
-} // namespace ptdecoder_private
+} // namespace intelpt_private
 #endif // Decoder_h_
Index: lldb/tools/intel-features/intel-pt/Decoder.cpp
===================================================================
--- lldb/tools/intel-features/intel-pt/Decoder.cpp
+++ lldb/tools/intel-features/intel-pt/Decoder.cpp
@@ -16,7 +16,7 @@
 #include "lldb/API/SBProcess.h"
 #include "lldb/API/SBThread.h"
 
-using namespace ptdecoder_private;
+using namespace intelpt_private;
 
 // This function removes entries of all the processes/threads which were once
 // registered in the class but are not alive anymore because they died or
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
  • [Lldb-commits] [PATCH] D... walter erquinigo via Phabricator via lldb-commits

Reply via email to