[llvm-objdump] Add --substitute-path and --source-dir for --source (#201096)
When the code object was compiled on a different machine that does not
have the same directory structure, or the source code has been moved, we
are seeing a warning with the disassembler, stating that the files
embedded in the code object were not found on disk.
This patch introduces a command line options for llvm-objdump, which
provide alternate directory locations to locate the source files on
disk. These options are inspired by GDB commands _set directory_ and
_set substitute-path_.
--substitute-path — Takes two strings, _from_ and _to_, and do a simple
string replacement of from with to at the start of the directory part of
the source file name, then use that result instead of the original file
name to look up the sources. A rule applies only if _from_ ends at a
directory separator.
--source-dir — Add directories to the source search path. Directories
are searched in following order: original recorded path, source-dir +
relative recorded path or absolute path without root, source-dir +
basename.