Skip to content
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

Print more information on non fatal warnings #1578

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

antonblanchard
Copy link
Contributor

Make non fatal warnings print the same one line of context
that fatal ones do, eg:

../../src/ieee2008/numeric_std-body.vhdl:3036:7:@1102465ns:(assertion warning): NUMERIC_STD.TO_INTEGER: metavalue detected, returning 0
in process .core_tb(behave).soc0@soc(behaviour).processor@core(behave).icache_0@icache(rtl).itlb_update

Make non fatal warnings print the same one line of context
that fatal ones do, eg:

../../src/ieee2008/numeric_std-body.vhdl:3036:7:@1102465ns:(assertion warning): NUMERIC_STD.TO_INTEGER: metavalue detected, returning 0
in process .core_tb(behave).soc0@soc(behaviour).processor@core(behave).icache_0@icache(rtl).itlb_update
@antonblanchard
Copy link
Contributor Author

I basically copied what the fatal error path does, I guess it should go into a common function.

@tgingold
Copy link
Member

tgingold commented Jan 3, 2021 via email

@antonblanchard
Copy link
Contributor Author

I did stumble over that option, but it gives me no output. I wonder if the backtracing isn't working:

# ./core_tb --backtrace-severity=warning | head -30
...
../../src/ieee2008/numeric_std-body.vhdl:3036:7:@0ms:(assertion warning): NUMERIC_STD.TO_INTEGER: metavalue detected, returning 0
../../src/ieee2008/numeric_std-body.vhdl:3036:7:@0ms:(assertion warning): NUMERIC_STD.TO_INTEGER: metavalue detected, returning 0
../../src/ieee2008/numeric_std-body.vhdl:3036:7:@0ms:(assertion warning): NUMERIC_STD.TO_INTEGER: metavalue detected, returning 0

but the assert path gives me a line of useful info:

./core_tb --assert-level=warning |head -20
...
../../src/ieee2008/numeric_std-body.vhdl:3036:7:@0ms:(assertion warning): NUMERIC_STD.TO_INTEGER: metavalue detected, returning 0
./core_tb:error: assertion failed
in process .core_tb(behave).soc0@soc(behaviour).processor@core(behave).icache_0@icache(rtl).itlb_lookup

I've tried the Fedora 33 version of ghdl as well as the ghdl/ghdl:buster-llvm-7 ghdl image. I also tried building my own with libbacktrace.a.

@eine
Copy link
Collaborator

eine commented Jan 6, 2021

@antonblanchard would you mind providing a minimal reproducer that illustrates the feature? Then, I'll test it on multiple distros (Debian, Ubuntu and Fedora).

@antonblanchard
Copy link
Contributor Author

@eine this shows the issue I'm hitting: backtrace-test.tar.gz

I try to use backtrace-severity=warning, but get no backtrace (I presume it's meant to):

ghdl -c --std=08 test_tb.vhdl test.vhdl -e test_tb
./test_tb --backtrace-severity=warning
../../src/ieee2008/numeric_std-body.vhdl:2025:7:@109345ns:(assertion warning): NUMERIC_STD."/=": metavalue detected, returning TRUE
../../src/ieee2008/numeric_std-body.vhdl:2025:7:@109355ns:(assertion warning): NUMERIC_STD."/=": metavalue detected, returning TRUE
...

My patch in this bug gives us one line of context, enough in this case to sort out what is going on:

../../src/ieee2008/numeric_std-body.vhdl:2025:7:@106715ns:(assertion warning): NUMERIC_STD."/=": metavalue detected, returning TRUE
in process .test_tb(behave).check_process

@eine
Copy link
Collaborator

eine commented Jan 11, 2021

@antonblanchard, I bet you did all your tests with LLVM backend. Running the tests with the three backends (Debian and Fedora) shows that --backtrace-severity=warning produces a different output for mcode, or for LLVM/GCC. See: https://github.com/eine/ghdl/runs/1678810852?check_suite_focus=true.

According to configure, --with-backtrace-lib needs to be used for LLVM, which we don't do when building the containers, and I don't think it's done in Fedora packages (/cc @sharkcz). However, for GCC it should be used automatically. Furthermore, if you built it explicitly...

@tmeissner
Copy link
Contributor

tmeissner commented Jan 11, 2021

According to configure, --with-backtrace-lib needs to be used for LLVM, which we don't do when building the containers, and I don't think it's done in Fedora packages (/cc @sharkcz). However, for GCC it should be used automatically. Furthermore, if you built it explicitly...

Are there any comprehensible reasons to not use ˋ--with-backtraceˋ in container builds? Would be useful also ther, I think.

@eine
Copy link
Collaborator

eine commented Jan 11, 2021

Are there any comprehensible reasons to not use ˋ--with-backtraceˋ in container builds? Would be useful also ther, I think.

Honestly, until today I was not aware that we were missing that feature. I knew libbacktrace was not used, but I thought it was only useful for debugging crashes. So, I agree, it'd be nice to add it. We need to find the package name and the location in each container, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants