When the user types that command 'thread trace dump info' and there's a running Trace session in LLDB, a raw trace in bytes should be printed; the command 'thread trace dump info all' should print the info for all the threads.
Details
Diff Detail
Event Timeline
lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.cpp | ||
---|---|---|
118 | 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 |
lldb/include/lldb/Target/Trace.h | ||
---|---|---|
155 | Are any statistics being dumped here? Maybe DumpTraceSummary(...) or DumpTraceInfo(...) would be better? | |
lldb/source/Commands/CommandObjectThread.cpp | ||
2206–2208 | Since we are iterating on this new command, I am wondering if we should have just a "thread trace dump" command with options? (lldb) thread trace dump --stats (lldb) thread trace dump --instructions This way the user could dump more than one thing at a time with a single command?: (lldb) thread trace dump --stats --instructions Just thinking out loud here, so no worries if you feel this is already correct and should stay this way | |
lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.cpp | ||
118 | 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 |
lldb/source/Commands/CommandObjectThread.cpp | ||
---|---|---|
2206–2208 | I think that's a bit too much for this patch, but I'll keep it in mind if we end up having more dumpers. | |
lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.cpp | ||
118 | That's a pretty good idea. @hanbingwang , you can invoke trace_sp->GetPluginName() for getting the name of the tracing technology being used |
- rename "thread trace dump stats" to "thread trace dump info"
- Additionally, print out the tracing plugin name.
lldb/include/lldb/Target/Trace.h | ||
---|---|---|
155 | @clayborg Sorry I didn't turn on the notification! Just saw your comments yesterday. | |
lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.cpp | ||
118 | 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? |
lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.cpp | ||
---|---|---|
118 | 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 |
print out the tracing plugin name exactly once when there are one or more than one threads.
add two spaces before the string "Raw trace size : xxx"; add new line between each thread.
- create a "thread trace dump info" command.
- the string "Trace technology: xxx" should be only printed out once when there are more than one thread.
- add two spaces before the string "Raw trace size : xxx"; add new line between each thread.
lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.cpp | ||
---|---|---|
125–126 | No else after return. Seems like a good candidate for a ternary operator. |
Committed on behalf of @hanbingwang. Commit hash 345ace026b6e5cdbc38d207291e4b399d72e62ee
Are any statistics being dumped here? Maybe DumpTraceSummary(...) or DumpTraceInfo(...) would be better?