-
Notifications
You must be signed in to change notification settings - Fork 279
instrument: README: fix invocation #973
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
```sh | ||
cargo run -- analysis_metadata.bc ../analysis/tests/misc/src/main.rs -L ~/.rustup/toolchains/nightly-2022-02-14-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/ -L ../target/debug/deps/ --extern c2rust_analysis_rt=../target/debug/deps/libc2rust_analysis_rt-4c5a3dcb09c8161c.rlib | ||
INSTRUMENT_BACKEND=debug METADATA_FILE=analysis_metadata.bc ./main | ||
cargo build | ||
${CARGO_TARGET_DIR:-../target/debug/c2rust-instrument} --metadata instrument.target/debug/metadata.bc -- build --manifest-path analysis/tests/misc/Cargo.toml | ||
(cd analysis/tests/misc/instrument.target/debug; INSTRUMENT_BACKEND=debug INSTRUMENT_RUNTIME=bg METADATA_FILE=metadata.bc ./c2rust-analysis-tests-misc) | ||
``` | ||
|
||
This instruments the binary built from main.rs with dynamic memory tracing, and | ||
outputs the necessary metadata to match up instrumentation points to source code | ||
into `analysis_metadata.bc`. We then run the binary, printing output to the | ||
into `metadata.bc`. We then run the binary, printing output to the | ||
debug console and using the aformentioned metadata file. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this still might be broken, which is why I hadn't approved it earlier. The
${CARGO_TARGET_DIR:-../target/debug/c2rust-instrument}
assumes the cwd isdynamic_instrumentation/
(I think, or at least some other directory), butanalysis/tests/misc/Cargo.toml
is relative to the repo root. Also, I don't remember if--metadata
is supposed to be relative to the cwd or to the manifest dir.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I pushed a fix that works correctly with the repo root as cwd. Even when building the entire repo with
cargo build
in the repo root,c2rust-instrument
ends up in thedebug
subdir of the cargo target directory; the other commands already expected to be there.--metadata
is relative to the cwd, which does mean that we need it to include the base path of theCargo.toml
.