HomePhabricator

Escape command line arguments in backtraces

Authored by ldrumm on Nov 4 2020, 4:10 AM.

Description

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

Details

Committed
ldrummNov 17 2020, 4:16 AM
Reviewer
jhenderson
Differential Revision
D90759: Escape command line arguments in backtraces
Parents
rGfcca6fe93f04: [LLDB] Update SVE Z reg info to remove invalidate regs
Branches
Unknown
Tags
Unknown