This is an archive of the discontinued LLVM Phabricator instance.

[dexter] Change --source-root-dir and add --debugger-use-relative-paths
ClosedPublic

Authored by Orlando on Apr 12 2021, 8:14 AM.

Details

Summary

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.

Diff Detail

Event Timeline

Orlando requested review of this revision.Apr 12 2021, 8:14 AM
Orlando created this revision.

One comment related nit, otherwise lgtm.

debuginfo-tests/dexter/dex/command/ParseCommand.py
282

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.

Orlando updated this revision to Diff 339148.Apr 21 2021, 2:27 AM

+Remove unnecessary comment.

Orlando marked an inline comment as done.Apr 21 2021, 2:27 AM
jmorse accepted this revision.Apr 21 2021, 6:53 AM

LGTM with a nit

debuginfo-tests/dexter/dex/command/ParseCommand.py
281–285

Doesn't need the parentheses around the tertiary expression, right?

284

Fee fi fo fum, I smell the need for PurePath, coming to a Dexter near you soon.

This revision is now accepted and ready to land.Apr 21 2021, 6:53 AM

Thanks both for the reviews.

debuginfo-tests/dexter/dex/command/ParseCommand.py
284

Agreed. That code is from D99651 so I'll wait for it to land and then see what can be done.

Orlando updated this revision to Diff 346999.May 21 2021, 5:57 AM
Orlando marked 2 inline comments as done.

+ Rebased on the latest version of D99651 (which has been approved now, so should be its final form)

debuginfo-tests/dexter/dex/command/ParseCommand.py
281–285

They are necessary because the expression is spread over multiple lines.

This revision was landed with ongoing or failed builds.May 25 2021, 5:28 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptMay 25 2021, 5:28 AM