Bug 481675
Summary: | bad DWARF location expressions | ||||||
---|---|---|---|---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | Roland McGrath <roland> | ||||
Component: | gcc | Assignee: | Jakub Jelinek <jakub> | ||||
Status: | CLOSED RAWHIDE | QA Contact: | Fedora Extras Quality Assurance <extras-qa> | ||||
Severity: | medium | Docs Contact: | |||||
Priority: | low | ||||||
Version: | 10 | CC: | aoliva, jakub, mnowak | ||||
Target Milestone: | --- | ||||||
Target Release: | --- | ||||||
Hardware: | All | ||||||
OS: | Linux | ||||||
Whiteboard: | |||||||
Fixed In Version: | Doc Type: | Bug Fix | |||||
Doc Text: | Story Points: | --- | |||||
Clone Of: | Environment: | ||||||
Last Closed: | 2009-09-25 10:32:59 UTC | Type: | --- | ||||
Regression: | --- | Mount Type: | --- | ||||
Documentation: | --- | CRM: | |||||
Verified Versions: | Category: | --- | |||||
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||
Cloudforms Team: | --- | Target Upstream Version: | |||||
Embargoed: | |||||||
Bug Depends On: | |||||||
Bug Blocks: | 516995 | ||||||
Attachments: |
|
What is invalid on DW_OP_reg4 DW_OP_deref? I thought it is the same thing as DW_OP_breg4 0 DW_OP_deref... No, DW_OP_reg* means "location in the register". DWARF says it can only appear alone (which really means only alone before DW_OP_piece et al). DW_OP_breg* means "push the register value on the stack". e.g., DW_OP_breg4 0 computes a value of "register 4's value" but is not a location; "DW_OP_reg4" indicates the register is the location, and can be changed. I think it would make sense if DW_OP_reg* were allowed as other than the last op in an expression, but that is not what the spec says (2.6.1). How long has gcc produced expressions like this? I see no sign that gdb has ever accepted them. It has an error diagnostic specifically for this kind of malformed expression. Even if we chose to make it a GNU extension of DWARF to interpret DW_OP_reg* this way, or even if a future DWARF spec were amended to allow it, all extant gdb versions (AFAICT) would still not support it. It's surely easy enough to make gdb support it, but then this gcc version will require using the latest and greatest gdb that supports the extension. An extra byte in an expression seems like the right trade-off there. There are so many much larger wastes of space in the DWARF we emit to worry about first. In .dwarf_frame/.eh_frame? Like forever. At least gcc-3.2 did this already. In location expression, I also believe 3.2 was able to emit say DW_OP_reg4 DW_OP_deref. Haven't looked at older GCCs, but GCC 3.2 is 6.5 years ago. I see no sign that GDB ever grokked this use. Perhaps only the EH unwinder ever has? (It clearly does.) I believe this problem is fixed in current F12 gcc. Please reopen if it is not, with a testcase. |
Created attachment 330044 [details] preprocessed C++ source Description of problem: The compiler produced some exprs like "reg4 deref", which are invalid. They probably meant to be "breg4 deref" and the like. Version-Release number of selected component (if applicable): gcc-4.3.2-7.x86_64 /usr/libexec/gcc/x86_64-redhat-linux/4.3.2/cc1plus -fpreprocessed dwarfcmp.ii -quiet -dumpbase dwarfcmp.cc -mtune=generic -auxbase-strip dwarfcmp.o -g -O1 -Wall -Wshadow -Werror -Wunused -Wextra -Wno-format -Wno-unused-parameter -std=gnu++0x -version -o dwarfcmp.s as -V -Qy -o dwarfcmp.o dwarfcmp.s eu-readelf --debug-dump={info,loc} dwarfcmp.o > log Look for "deref" uses in loc exprs.