[all-commits] [llvm/llvm-project] f665e8: [lldb] Don't dissasemble large functions by default

Pavel Labath via All-commits all-commits at lists.llvm.org
Thu May 14 02:56:43 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: f665e80c023ec52557f55d7eeaf34471e4c6fa0d
      https://github.com/llvm/llvm-project/commit/f665e80c023ec52557f55d7eeaf34471e4c6fa0d
  Author: Pavel Labath <pavel at labath.sk>
  Date:   2020-05-14 (Thu, 14 May 2020)

  Changed paths:
    M lldb/source/Commands/CommandObjectDisassemble.cpp
    M lldb/source/Commands/CommandObjectDisassemble.h
    M lldb/source/Commands/Options.td
    M lldb/test/Shell/Commands/Inputs/command-disassemble.lldbinit
    M lldb/test/Shell/Commands/command-disassemble-process.yaml
    M lldb/test/Shell/Commands/command-disassemble.s

  Log Message:
  -----------
  [lldb] Don't dissasemble large functions by default

Summary:
If we have a binary without symbol information (and without
LC_FUNCTION_STARTS, if on a mac), then we have to resort to using
heuristics to determine the function boundaries. However, these don't
always work, and so we can easily end up thinking we have functions
which are several megabytes in size. Attempting to (accidentally)
disassemble these can take a very long time spam the terminal with
thousands of lines of disassembly.

This patch works around that problem by adding a sanity check to the
disassemble command. If we are about to disassemble a function which is
larger than a certain threshold, we will refuse to disassemble such a
function unless the user explicitly specifies the number of instructions
to disassemble, uses start/stop addresses for disassembly, or passes the
(new) --force argument.

The threshold is currently fairly aggressive (4000 bytes ~~ 1000
instructions). If needed, we can increase it, or even make it
configurable.

Differential Revision: https://reviews.llvm.org/D79789




More information about the All-commits mailing list