[Lldb-commits] [PATCH] D79789: [lldb] Don't dissasemble large functions by default

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue May 12 08:34:55 PDT 2020


labath created this revision.
labath added reviewers: JDevlieghere, jasonmolenda.
Herald added a project: LLDB.

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, or start/stop addresses for disassembly.

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


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D79789

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79789.263445.patch
Type: text/x-patch
Size: 13235 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200512/a69c105e/attachment-0001.bin>


More information about the lldb-commits mailing list