Note: This is based on top of D99651 which addds the DexDeclareFile command. DexDeclareFile(path) sets subsequent commands' path attributes to path.
We want to use DexDeclareFile to specify paths relative to a project root directory. The option --source-root-dir, prior to this patch, causes dexter to strip the path prefix from commands before passing them to a debugger, and appends the prefix to file paths returned from a debugger. This patch changes the behviour of --source-root-dir. Relative paths in commands, made possible with DexDeclareFile(relative/path), are appended to the --source-root-dir directory.
A new option, --debugger-use-relative-paths, can be used alongside --source-root-dir to reproduce the old behaviour: all paths passed to the debugger will be made relative to --source-root-dir.
I've added a regression test debuginfo-tests/dexter/feature_tests/commands/perfect/dex_declare_file/precompiled_binary_different_dir/dex_commands/source_root_dir.dex for this new behaviour, and modified the existing --source-root-dir regression and unit tests to use --debugger-use-relative-paths.
I was going to say 'if the option has a value' is unclear, but the code is sufficiently clear that I think this comment can be removed.