[all-commits] [llvm/llvm-project] 826997: [lldb] Fix a regression introduced by D75730

Jonas Devlieghere via All-commits all-commits at lists.llvm.org
Thu Oct 22 08:38:25 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 826997c46280351861be43522d4a022d8fdbc466
      https://github.com/llvm/llvm-project/commit/826997c46280351861be43522d4a022d8fdbc466
  Author: Jonas Devlieghere <jonas at devlieghere.com>
  Date:   2020-10-22 (Thu, 22 Oct 2020)

  Changed paths:
    M lldb/include/lldb/Core/Disassembler.h
    M lldb/source/Core/Disassembler.cpp
    M lldb/source/Target/StackFrame.cpp
    M lldb/test/API/commands/disassemble/basic/TestFrameDisassemble.py
    M lldb/test/API/commands/disassemble/basic/main.cpp

  Log Message:
  -----------
  [lldb] Fix a regression introduced by D75730

In a new Range class was introduced to simplify and the Disassembler API
and reduce duplication. It unintentionally broke the
SBFrame::Disassemble functionality because it unconditionally converts
the number of instructions to a Range{Limit::Instructions,
num_instructions}. This is subtly different from the previous behavior,
where now we're passing a Range and assume it's valid in the callee, the
original code would propagate num_instructions and the callee would
compare the value and decided between disassembling instructions or
bytes.

Unfortunately the existing tests was not particularly strict:

  disassembly = frame.Disassemble()
  self.assertNotEqual(len(disassembly), 0, "Disassembly was empty.")

This would pass because without this patch we'd disassemble zero
instructions, resulting in an error:

  (lldb) script print(lldb.frame.Disassemble())
  error: error reading data from section __text

Differential revision: https://reviews.llvm.org/D89925




More information about the All-commits mailing list