<div dir="ltr">Couple of things:<div><br></div><div>1) Unless you really really want iteration over this map to be in some deterministic order, better to use unordered_map.  And if you do want it to be in some deterministic order, you should provde a comparison function, as the default one is probably not what you want.</div><div>2) <span style="color:rgb(33,33,33)">std::map<std::vector<lldb::add</span><span style="color:rgb(33,33,33)">r_t>, std::vector<uint32_t>> is pretty horrible to read, and offers no insight into what the keys and values are.  At the very least, add some typedefs like:</span></div><div><span style="color:rgb(33,33,33)">typedef std::vector<lldb::addr_t> StackID;</span></div><div><span style="color:rgb(33,33,33)">typedef std::vector<tid_t> ThreadIDList;</span></div><div><span style="color:rgb(33,33,33)">std::unordered_map<StackID, ThreadIDList> TheMap;</span></div><div><span style="color:rgb(33,33,33)">3) If performance is a concern here (700+ threads seems like it could exhibit slowdown when uniquing stacks), the best performance would be to use DenseSet<std::unique_ptr<StackInfo>>, where StackInfo contains both the address list and the thread is list as well as a pre-computed hash value, and then use a custom implementation of DenseMapInfo that just returns the hash value directly.  See llvm/lib/DebugInfo/CodeView/TypeSerializer.cpp for an example.</span></div></div><br><div class="gmail_quote"><div dir="ltr">On Tue, May 30, 2017 at 8:40 AM Greg Clayton via Phabricator via lldb-commits <<a href="mailto:lldb-commits@lists.llvm.org">lldb-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">clayborg added a comment.<br>
<br>
The other option for fixing the problem with showing the wrong variables in the backtraces would be to make up a new frame-format string that is used for uniqued stack frames and use that format when showing uniqued stack frames:<br>
<br>
  (lldb) settings show frame-format-unique<br>
  frame-format (format-string) = "frame #${frame.index}: ${frame.pc}{ ${module.file.basename}{`${<a href="http://function.name" rel="noreferrer" target="_blank">function.name</a>}{${frame.no-debug}${function.pc-offset}}}}{ at ${line.file.basename}:${line.number}}{${function.is-optimized} [opt]}\n"<br>
<br>
The only difference in the format string is we use ${<a href="http://function.name" rel="noreferrer" target="_blank">function.name</a>} instead of ${function.name-with-args}.<br>
<br>
<br>
<a href="https://reviews.llvm.org/D33426" rel="noreferrer" target="_blank">https://reviews.llvm.org/D33426</a><br>
<br>
<br>
<br>
_______________________________________________<br>
lldb-commits mailing list<br>
<a href="mailto:lldb-commits@lists.llvm.org" target="_blank">lldb-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits</a><br>
</blockquote></div>