[Lldb-commits] [PATCH] D105717: [trace] [intel pt] Create a "thread trace dump stats" command

walter erquinigo via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Jul 16 19:21:51 PDT 2021


wallace added inline comments.


================
Comment at: lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.cpp:118
+  }
+  s.Printf("\nraw trace size %zu\n", *raw_size);
+  return;
----------------
hanbingwang wrote:
> wallace wrote:
> > clayborg wrote:
> > > wallace wrote:
> > > > the presentation of this line could be better. Something like this would look nicer
> > > > 
> > > >   thread 1: tid = 123123
> > > >     
> > > >     - Tracing technology: Intel PT
> > > >     - Raw trace size: 1231232 bytes 
> > > The "Tracing technology: Intel PT" should probably come before any of the thread infos if it is added:
> > > ```
> > > Tracing technology: Intel PT
> > > thread 1: tid = 111, size = 0x1000
> > > thread 2: tid = 222, size = 0x1000
> > > ```
> > That's a pretty good idea.
> > 
> > @hanbingwang , you can invoke trace_sp->GetPluginName() for getting the name of the tracing technology being used
> Hi @wallace @clayborg,
> 
> I'm wondering how to let the string "Tracing technology: Intel PT" printed out exactly once, when there are more than one threads?  It looks like that HandleOneThread() will be called multiple times, which will then call DumpTraceInfo() which does the printout.
> 
> It seems that it'll be easy to print the string if we know if a thread is the *first* to be handled. However the threads are not indexed though?
You need to override CommandObjectIterateOverThreads::DoExecute in your command object. Something like this (figure out the correct function names)

  bool CommandObjectTraceDumpInfo::DoExecute(Args &command,
                                                CommandReturnObject &result) {
     Target &target = m_exe_ctx.GetTargetRef();
     result.GetOutput().Printf("trace technology: %s", target.GetTrace().GetPluginName().Data());
    
     return CommandObjectIterateOverThreads::DoExecute(command, result);
  }

that way that piece of code is executed before iterating over the threads


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

https://reviews.llvm.org/D105717



More information about the lldb-commits mailing list