`hermit-sys`, with features: `instrument` but `hermit-sys` does not have these features
Closed this issue · 7 comments
I wanted to try your traces with the demo application of the rusty-hermit repo, however I get the error messaged name in title. Here is what I did:
git clone --recursive https://github.com/hermitcore/rusty-hermit.git
- created
rust-toolchain
file and set it to nightly cargo build -Z build-std=std,core,alloc,panic_abort --target x86_64-unknown-hermit
worked fine and I could run the demo with uhyve- made the following changes to
demo/Cargo.toml
:
index 4cd2726..683ed2b 100644
--- a/demo/Cargo.toml
+++ b/demo/Cargo.toml
@@ -9,7 +9,8 @@ publish = false
rayon = "1.3.0"
[target.'cfg(all(any(target_arch = "x86_64", target_arch = "aarch64"), target_os = "hermit"))'.dependencies]
-hermit-sys = { path = "../hermit-sys", default-features = false, features = ["with_submodule"] }
+hermit-sys = { path = "../hermit-sys", default-features = false, features = ["with_submodule", "instrument"] }
+rftrace = { git = "https://github.com/tlambertz/rftrace" }
[target.'cfg(target_os = "linux")'.dependencies]
syscalls = { version = "0.2", default-features = false }
If I call cargo build -Z build-std=std,core,alloc,panic_abort,instrument-mcount --target x86_64-unknown-hermit --release
I get the following output:
$ cargo build -Z build-std=std,core,alloc,panic_abort,instrument-mcount --target x86_64-unknown-hermit --release
warning: profiles for the non root package will be ignored, specify profiles at the workspace root:
package: /home/jbreitbart/temp/h/rusty-hermit/demo/Cargo.toml
workspace: /home/jbreitbart/temp/h/rusty-hermit/Cargo.toml
warning: profiles for the non root package will be ignored, specify profiles at the workspace root:
package: /home/jbreitbart/temp/h/rusty-hermit/netbench/Cargo.toml
workspace: /home/jbreitbart/temp/h/rusty-hermit/Cargo.toml
warning: profiles for the non root package will be ignored, specify profiles at the workspace root:
package: /home/jbreitbart/temp/h/rusty-hermit/httpd/Cargo.toml
workspace: /home/jbreitbart/temp/h/rusty-hermit/Cargo.toml
Updating git repository `https://github.com/tlambertz/rftrace`
error: failed to select a version for `hermit-sys`.
... required by package `rusty_demo v0.1.0 (/home/jbreitbart/temp/h/rusty-hermit/demo)`
versions that meet the requirements `=0.1.14` are: 0.1.14
the package `rusty_demo` depends on `hermit-sys`, with features: `instrument` but `hermit-sys` does not have these features.
failed to select a version for `hermit-sys` which could resolve this conflict
Do you have an idea why it is not working for me?
I have not published the crate to crates.io yet, so it had to be commented out from hermit-sys cargo file.
The Readme is slightly out of date, the last commits changed some things. Have to revise it and publish it.
Take a look at the basic example to see the current "userland" interface.
In hermit-sys you have to use the backend with autokernel and interruptsafe features afaik
hermit-os/hermit-rs#55 should resolve the issue
Thanks 😄 I'll give it a try after it was merged.
It took me a while to get back to this, but I finally found some time. Trace generation seems to be working, but the symbol table generated by nm is missing the offset that is used by hermitcore. I had to run something like awk '{$0="0x"$0; printf "%x", $x+4194304; print substr($0, index($0, " "))}' trace/binaryname-nm.sym >trace/binaryname.sym
to fix it. Is it possible to directly fix this when writing the results to file?
I've not been following hermit's development lately, but I guess this is related to the changes to kernel relocation (hermit-os/loader#8).
For the purposes of mapping addresses to functions, uftrace treats all in-memory binaries as relocatable, and uses the sid-00.map
file for resolving offsets. Thus you can avoid the complicated awk command by just replacing the offset in the map file:
000000400000-ffffffffffff r-xp 00000000 00:00 0 test
ffffffffffff-ffffffffffff rw-p 00000000 00:00 0 [stack]
I am not sure if there is a nice, general fix for this issue. The file is generated by the rftrace-frontend. When using linux
mode, the map is directly copied from /proc/self/maps
, but hermit does not expose something similar afaik.
I suppose I could just change the offset in rftrace (as rustyhermit is the only usecase for non-linux mode right now), though that seems a bit dirty.
Related: hermit-os/hermit-rs#147