<div dir="ltr">After a chat with Greg, we agreed on this set of commands<div><br></div><div><br><span style="color:rgb(35,34,34);font-family:Menlo,Consolas,Monaco,monospace;font-size:15px;white-space:pre-wrap;background-color:rgba(255,255,255,0.5)">trace load /path/to/json
process trace start/stop
process trace save /path/to/json
thread trace start/stop
thread trace dump [instructions | functions]
</span><br class="gmail-Apple-interchange-newline"></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Il giorno gio 1 ott 2020 alle ore 13:21 Greg Clayton <<a href="mailto:clayborg@gmail.com">clayborg@gmail.com</a>> ha scritto:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
<br>
> On Oct 1, 2020, at 7:08 AM, Pavel Labath via lldb-dev <<a href="mailto:lldb-dev@lists.llvm.org" target="_blank">lldb-dev@lists.llvm.org</a>> wrote:<br>
> <br>
> Thank you for writing this Walter. I think this document will be a<br>
> useful reference both now and in the future.<br>
> <br>
> The part that's not clear to me is what is the story with multi-process<br>
> traces. The file format enables those, but it's not clear how are they<br>
> going be created or used. Can you elaborate more on what you intend to<br>
> use those for?<br>
<br>
Mainly for system trace kinds of things where an entire system gets traced.<br>
<br>
> <br>
> The main reason I am asking that is because I am thinking about the<br>
> proposed command structure. I'm wondering if it would not be better to<br>
> fit this into the existing target/process/thread commands instead of<br>
> adding a new top-level command. For example, one could imagine the<br>
> following set of commands:<br>
> <br>
> - "process trace start" + "thread trace start" instead of "thread trace<br>
> [tid]". That would be similar to "process continue" + "thread continue".<br>
> - "thread trace dump [tid]" instead of "trace dump [-t tid]". That would<br>
> be similar to "thread continue" and other thread control commands.<br>
> - "target create --trace" instead of "trace load". (analogous to target<br>
> create --core).<br>
> - "process trace save" instead of "trace save" -- (mostly) analogous to<br>
> "process save-core"<br>
<br>
> I am thinking this composition may fit in better into the existing lldb<br>
> command landscape, though I also see the appeal in grouping everything<br>
> trace-related under a single top-level command. What do you think?<br>
> <br>
> The main place where this idea breaks down is the multi-process traces.<br>
> While we could certainly make "target create --trace" create multiple<br>
> targets, that would be fairly unusual. OTOH, the whole concept of having<br>
> multiple targets share something is a pretty unusual thing for lldb.<br>
> That's why I'd like to hear more about where you want to go with this idea.<br>
<br>
I kind of see tracing has having two sides:<br>
1 - post mortem tracing for individual or multiple processes<br>
2 - live debug session tracing for being able to see how you crashed where trace data is for current process only<br>
<br>
For post mortem tracing, the trace top level command seemed to make sense here because there are no other target commands that act on more than one target. So "trace load" makes sense to me here for loading one or more traces. The idea is the trace JSON file has enough info to completely load up the state of the trace so we can symbolicate, dump and step around in history. So I would vote to keep "trace load" at the very least because it can create one or more targets. Options can be added to display the processes if needed:<br>
<br>
(lldb) trace list <trace-json-file><br>
<br>
But we could move "trace dump" over into "target trace dump" or "process trace dump" since that is effectively how we are coding these patches.<br>
<br>
For live debugging where we gather trace data through the process plug-in, we will have a live process that may or may not have trace data. If tracing isn't available we will not be able to dump anything. But I would like to see process/thread commands for this scenario:<br>
<br>
- process trace start/stop (only succeeds if we can gather trace data through the process plug-in)<br>
- thread trace start/stop (which can succeed only if current tracing can enable tracing for only one thread)<br>
<br>
Not sure if we need "process trace save" or "thread trace save" as the saving can be done as an option to "process trace stop --save /path/to/save"<br>
<br>
So I am all for fitting these commands in where they need to go.<br>
<br>
> <br>
> On 21/09/2020 22:17, Walter via lldb-dev wrote:<br>
>> Thanks for your feedback Fangrui, I've just been checking Capn' Proto<br>
>> and it looks really good. I'll keep it in mind in the design and see how<br>
>> it can optimize the overall data transfer.<br>
> <br>
> I'm not sure how Cap'n Proto comes into play here. The way I understand<br>
> it, the real data is contained in a separate file in the specialized<br>
> intel format and the json is just for the metadata. I'd expect the<br>
> metadata file to be small even for enormous traces, so I'm not sure<br>
> what's to be gained by optimizing it.<br>
> <br>
> pl<br>
> <br>
> _______________________________________________<br>
> lldb-dev mailing list<br>
> <a href="mailto:lldb-dev@lists.llvm.org" target="_blank">lldb-dev@lists.llvm.org</a><br>
> <a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev</a><br>
<br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>- Walter ErquÃnigo Pezo<br><br></div></div></div>