[lldb-dev] Bug in StackFrame::UpdateCurrentFrameFromPreviousFrame

Zachary Turner via lldb-dev lldb-dev at lists.llvm.org
Sun Nov 13 16:48:09 PST 2016


I was going through doing some routine StringRef changes and I ran across
this function:

  std::lock_guard<std::recursive_mutex> guard(m_mutex);
  assert(GetStackID() ==
         prev_frame.GetStackID()); // TODO: remove this after some testing
  m_variable_list_sp = prev_frame.m_variable_list_sp;

m_variable_list_value_objects.Swap(prev_frame.m_variable_list_value_objects);
  if (!m_disassembly.GetString().empty()) {
    m_disassembly.Clear();
*    m_disassembly.GetString().swap(m_disassembly.GetString());*
  }

Either I'm crazy or that bolded line is a bug.  Is it supposed to be
prev_frame.m_disassembly.GetString()?

What would the implications of this bug be?  i.e. how can we write a test
for this?

Also, as a matter of curiosity, why is it swapping?  That means it's
modifying the input frame, when it seems like it really should just be
modifying the current frame.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20161114/7c3bc095/attachment.html>


More information about the lldb-dev mailing list