[PATCH] D86406: Speedup llvm-dwarfdump 3.9x

Jan Kratochvil via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 22 13:17:50 PDT 2020


jankratochvil created this revision.
jankratochvil added reviewers: JDevlieghere, avl, labath.
jankratochvil added a project: LLVM.
Herald added subscribers: llvm-commits, cmtice, hiraditya, aprantl.
Herald added a reviewer: jhenderson.
jankratochvil requested review of this revision.
Herald added a subscriber: MaskRay.

Currently `strace llvm-dwarfdump x.debug >/tmp/file`:

  ioctl(1, TCGETS, 0x7ffd64d7f340)        = -1 ENOTTY (Inappropriate ioctl for device)
  write(1, "           DW_AT_decl_line\t(89)\n"..., 4096) = 4096
  ioctl(1, TCGETS, 0x7ffd64d7f400)        = -1 ENOTTY (Inappropriate ioctl for device)
  ioctl(1, TCGETS, 0x7ffd64d7f410)        = -1 ENOTTY (Inappropriate ioctl for device)
  ioctl(1, TCGETS, 0x7ffd64d7f400)        = -1 ENOTTY (Inappropriate ioctl for device)

After this patch:

  write(1, "0000000000001102 \"strlen\")\n     "..., 4096) = 4096
  write(1, "site\n                  DW_AT_low"..., 4096) = 4096
  write(1, "d53)\n\n0x000e4d4d:       DW_TAG_G"..., 4096) = 4096

The same speedup can be achieved by `--color=0` but that is not much convenient.
After this patch it still uses `ioctl` for printing DWARF parsing errors.
Maybe `raw_ostream &OS` could be moved into `DIDumpOptions DumpOpts` which would somehow make this patch more simple, I can investigate it more and change it upon request.
I can also drop this patch if it looks too hacky.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D86406

Files:
  llvm/include/llvm/DebugInfo/DIContext.h
  llvm/include/llvm/DebugInfo/DWARF/DWARFFormValue.h
  llvm/include/llvm/Support/WithColor.h
  llvm/lib/DebugInfo/DWARF/DWARFDie.cpp
  llvm/lib/DebugInfo/DWARF/DWARFFormValue.cpp
  llvm/lib/Support/WithColor.cpp
  llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86406.287217.patch
Type: text/x-patch
Size: 9124 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200822/155ceddf/attachment.bin>


More information about the llvm-commits mailing list