-
-
Notifications
You must be signed in to change notification settings - Fork 159
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
dwarf::format_error #107
Comments
@ccurtsinger will chime in, but in the meanwhile, can you attach the input files (or at least one input file that reproduces the issue)? Thanks! |
Ah, thanks for the reply! Below is a cleaner, reproducible setup with binaries attached. I build cryptominisat as such:
This builds with no dependencies, effectively. Example build line:
Note the Now I have a binary (attached), along with a library (attached):
Seems pretty clean to me. Then:
In case the issue is that coz.h was not added along with the macro, that's actually not the issue. Here is a diff that adds them (I compiled the binaries attached with this):
|
The exception is coming from libelfin as it tries to figure out what type the attribute tagged as DW_AT_sec_offset is. I think the attribute type is in the user-defined range, which is a bit odd, so libelfin doesn't know what type it should be. This is probably something we can skip over instead of failing, either by catching the exception or some other change. I'll try to reproduce locally and see what I can do about it. |
|
Crap, it has nothing to do with it :S It's section offset: http://wiki.dwarfstd.org/index.php?title=DW_FORM_sec_offset Seems to be a new thing? I am admittedly using Arch Linux which tends to be pretty fresh :S |
I have the same issue, also running in Arch It does not seems to be referenced in https://github.com/aclements/libelfin/blob/master/dwarf/data.hh also |
I'd like to chime in with the error i'm seeing; in my case, the error is |
i have had success with setting edit: FWIW, running my program with |
Yeah I also tried coz with one of my program and it generated and empty I used gcc 8.3.0 to compile everything.
|
Did you use progress points? |
Yes, I did. I actually changed the compiler to clang-9 for my program and the profile.coz was populated. So it hints towards an issue linked to gcc 8.3.0. I also tried to compile provided the examples with clang-9 to see if it would solve the problem as well, but I had a linking error. $ CC=clang-9 CCX=clang++-9 make bench
make[1]: Entering directory '/home/setepenre/work/coz/benchmarks'
[benchmarks/histogram] Compiling histogram-pthread.c
[benchmarks/histogram] Downloading histogram inputs
--2019-09-16 15:41:14-- http://csl.stanford.edu/~christos/data/histogram.tar.gz
Resolving csl.stanford.edu (csl.stanford.edu)... 171.64.73.4
Connecting to csl.stanford.edu (csl.stanford.edu)|171.64.73.4|:80... connected.
HTTP request sent, awaiting response... [benchmarks/histogram] Linking histogram
/usr/bin/ld: obj/histogram-pthread.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: final link failed: nonrepresentable section on output
collect2: error: ld returned 1 exit status
make[2]: *** [../../common.mk:91: histogram] Error 1
make[2]: *** Waiting for unfinished jobs....
|
I can reproduce this problem ( diff --git a/Cargo.lock b/Cargo.lock
index d4d5759..425ebc1 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -71,6 +71,15 @@ dependencies = [
"unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
+[[package]]
+name = "coz"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
+ "once_cell 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
[[package]]
name = "crossbeam-channel"
version = "0.3.9"
@@ -299,6 +308,11 @@ dependencies = [
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
]
+[[package]]
+name = "once_cell"
+version = "1.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+
[[package]]
name = "packed_simd"
version = "0.3.3"
@@ -379,6 +393,7 @@ version = "11.0.2"
dependencies = [
"bstr 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)",
"clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "coz 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"grep 0.2.4",
"ignore 0.4.10",
"jemallocator 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -536,6 +551,7 @@ dependencies = [
"checksum cc 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)" = "8dae9c4b8fedcae85592ba623c4fd08cfdab3e3b72d6df780c6ead964a69bfff"
"checksum cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "b486ce3ccf7ffd79fdeb678eac06a9e6c09fc88d33836340becb8fffe87c5e33"
"checksum clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9"
+"checksum coz 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f8526901d1bef683a5c0edddd892f0e5f80bc52d9c4653da9cc2440a60a2e777"
"checksum crossbeam-channel 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "c8ec7fcd21571dc78f96cc96243cab8d8f035247c3efd16c687be154c3fa9efa"
"checksum crossbeam-utils 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)" = "04973fa96e96579258a5091af6003abde64af786b860f18622b82e026cca60e6"
"checksum encoding_rs 0.8.17 (registry+https://github.com/rust-lang/crates.io-index)" = "4155785c79f2f6701f185eb2e6b4caf0555ec03477cb4c70db67b465311620ed"
@@ -552,6 +568,7 @@ dependencies = [
"checksum memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88579771288728879b57485cc7d6b07d648c9f0141eb955f8ab7f9d45394468e"
"checksum memmap 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6585fd95e7bb50d6cc31e20d4cf9afb4e2ba16c5846fc76793f11218da9c475b"
"checksum num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bcef43580c035376c0705c42792c294b66974abbfd2789b511784023f71f3273"
+"checksum once_cell 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "891f486f630e5c5a4916c7e16c4b24a53e78c860b646e9f8e005e4f16847bfed"
"checksum packed_simd 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a85ea9fc0d4ac0deb6fe7911d38786b32fc11119afd9e9d38b84ff691ce64220"
"checksum pcre2 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "603da5e101220b9b306bf28e4f1f8703458ce2f64d2787b374e1a19494317180"
"checksum pcre2-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "876c72d05059d23a84bd9fcdc3b1d31c50ea7fe00fe1522b4e68cd3608db8d5b"
diff --git a/Cargo.toml b/Cargo.toml
index d44c484..245a842 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -55,6 +55,7 @@ num_cpus = "1.8.0"
regex = "1.0.5"
serde_json = "1.0.23"
termcolor = "1.0.3"
+coz = "0.1"
[dependencies.clap]
version = "2.32.0"
diff --git a/src/main.rs b/src/main.rs
index 6c8826b..4948055 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,3 +1,5 @@
+extern crate coz;
+
use std::error;
use std::io::{self, Write};
use std::process;
@@ -55,6 +57,7 @@ fn main() {
fn try_main(args: Args) -> Result<()> {
use args::Command::*;
+ coz::begin!("main");
let matched =
match args.command()? {
Search => search(&args),
@@ -65,6 +68,7 @@ fn try_main(args: Args) -> Result<()> {
Types => types(&args),
PCRE2Version => pcre2_version(&args),
}?;
+ coz::end!("main");
if matched && (args.quiet() || !messages::errored()) {
process::exit(0)
} else if messages::errored() { |
0x2119 and 0x2137 are GNU extensions to the DWARF format https://github.com/gcc-mirror/gcc/blob/master/include/dwarf2.def#L441 |
Compiling with
Also a libelfin issue |
Backing out a previous change (#96, removed by #128) appears to fix this issue. The code relied on exceptions while walking through compilation units in an effort to improve performance. Unfortunately, the change didn't actually save any work (libelfin was still walking through all line tables), but that prevented existing error handling from working. |
Unfortunately, it doesn't seem to work, at least for me. Arch Linux here again. I only tried the included benchmark examples, e.g., word_count. When I compile with gcc 9.2, profile.coz is empty, except for startup time and runtime. I get a dwarf format error:
When I compile the example with clang 9.0, everything seems to be fine. |
Which version of libelfin are you running? If coz did not crash and you just get an empty profile then this could be a different issue (maybe #109). |
I use git master of libelfin. Comparing the outputs of word_count compiled with gcc and clang, I guess, gcc's version does not work as it cannot walk the compilation units. Two exceptions get thrown. How can I attach a debugger to coz to set a catchpoint? gcc 9.2
clang 9.0
|
For gcc try But coz should skip unknown symbols. |
DWARF 4 is the default in gcc 9.2, but |
I created a tiny patch for libelfin which solves the issue for me. gcc 9 works now with the default |
@tetzank great, I hope your patch gets accepted upstream. Fixes the problem for me. For whatever reason, putting |
This should have been at least partially addressed in libelfin with this commit: aclements/libelfin@74f1116 |
I'm currently on ubuntu 20.04 with GCC 10.2 and was running into this issue. I went into the libcoz directory and added in the -gdwarf-3 to the Makefile for libcoz.so, and this fixed my issue and generated a profile. I also added it to the histogram benchmark, which i was testing with. At least one of those changes allowed coz to run correctly. |
@ManuelMeraz Thanks Manuel, I applied the same changes as you said, the problem resolved! |
Hi @ManuelMeraz - would you mind submitting a PR to fix this? |
Yeah sure. |
I'm still getting this, except this time with Since that compilation unit is used to implement |
I'm getting this as well with [profile.release]
debug = 1 Commenting this block out and building in release mode causes the app to work again. However, I'm still getting empty |
It seems that compiling with gcc 11 will bring in glibc code blocks using DWARFv5 debug info. This will trip coz up even when the codebase was compiled with -gdwarf-3. This mismatch of DWARF versions can be seen by checking executables with Is there a way for coz to ignore the DWARFv5 sections and only profile the code that uses v3? |
I have the same problem 😔 |
@ebkalderon I was able to fix the bug by removing gcc-11 and passing |
Hi all - thanks for all this - we would welcome PRs to the documentation and any relevant code - thanks! |
Is there any workaround or fix that can be used? I can't really remove |
The best I could do was downgrade to GCC 10. Then everything worked perfectly. |
I added partial support for Dwarfv5 in my libelfin fork and that seems to fix this issue. |
As a first time user, I also encountered
Using @antoyo fork of libelfin, I managed to get it working. Here is my steps:
Then, make sure that LD_LIBRARY_PATH includes what ever make installed the libs:
In
Configure and build:
Verify correct lib was used:
Run coz:
|
I've also run into issue except my entire project uses -ffast-math. Disabling this fixes the Platform: Windows 10 WSL Ubuntu-22.04 V2 EDIT: |
I had a similar issue but I needed to apply both @antoyo's fix and aclements/libelfin#63 to make coz run without crashing. |
Hi,
Something is off, I am trying to run coz with CryptoMiniSat with ApproxMC but I am getting:
I am using latest
coz
and latestlibelfin
-- both compiled from git. Do you know what could be the issue? Both ApproxMC and CryptoMiniSat are open-source, see https://github.com/msoos/cryptominisat and https://github.com/meelgroup/approxmcBut I am getting the error with plain CryptoMiniSat too, so it's probably in CryptoMiniSat. I am compiling with
-g
andmtune=auto
, and I am linking in boost, zlib and m4ri. All are dynamically linked. Should I try without linking all these? I am using Arch Linux, so I think the debug symbols should be available for all libraries.Do you know what that issue above could mean?
The text was updated successfully, but these errors were encountered: