[all-commits] [llvm/llvm-project] 537cbd: Escape command line arguments in backtraces

ldrumm via All-commits all-commits at lists.llvm.org
Tue Nov 17 04:16:53 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 537cbd90c43dd9b166fa8f03347b1397505140e5
      https://github.com/llvm/llvm-project/commit/537cbd90c43dd9b166fa8f03347b1397505140e5
  Author: Luke Drummond <luke.drummond at codeplay.com>
  Date:   2020-11-17 (Tue, 17 Nov 2020)

  Changed paths:
    M llvm/lib/Support/PrettyStackTrace.cpp

  Log Message:
  -----------
  Escape command line arguments in backtraces

A common routine is to have the compiler crash, and attempt to rerun the
cc1 command-line by copying and pasting the arguments printed by
`llvm::Support::PrettyStackProgram::print`. However, these arguments are
not quoted or escaped which means they must be manually edited before
working correctly. This patch ensures that shell-unfriendly characters
are C-escaped, and arguments with spaces are double-quoted reducing the
frustration of running cc1 inside a debugger.

As the quoting is C, this is "best effort for most shells", but should
be fine for at least bash, zsh, csh, and cmd.exe.

Reviewed by: jhenderson

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




More information about the All-commits mailing list