[llvm-bugs] [Bug 49153] New: [DebugInfo] Missing debug-info for `enums` declared inside a C function
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Feb 11 22:21:42 PST 2021
https://bugs.llvm.org/show_bug.cgi?id=49153
Bug ID: 49153
Summary: [DebugInfo] Missing debug-info for `enums` declared
inside a C function
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: DebugInfo
Assignee: unassignedbugs at nondot.org
Reporter: sourav0311 at gmail.com
CC: aloksharma.knit at gmail.com, aprantl at apple.com,
dblaikie at gmail.com, jdevlieghere at apple.com,
jini.susan.george at gmail.com, keith.walker at arm.com,
llvm-bugs at lists.llvm.org, paul.robinson at am.sony.com,
paul_robinson at playstation.sony.com
$cat enum.c
int main() {
enum {
Hello = 1,
};
printf("%d\n", Hello);
}
---------------------------------
DWARF generated by CLANG(trunk):
0x0000000b: DW_TAG_compile_unit
...
0x0000002a: DW_TAG_subprogram
DW_AT_name ("main")
...
0x00000043: DW_TAG_base_type
DW_AT_name ("int")
...
0x0000004a: NULL
--------------------------------------
DWARF generated by GCC(trunk):
x0000002e: DW_TAG_subprogram
DW_AT_name ("main")
...
0x00000050: DW_TAG_enumeration_type
DW_AT_encoding (DW_ATE_unsigned)
DW_AT_byte_size (0x04)
DW_AT_type (0x0000007f "unsigned int")
...
0x0000005e: DW_TAG_enumerator
DW_AT_name ("Hello")
DW_AT_const_value (0x01)
--------------------------------------------
I think this is mostly due to design of enums in debug-info. Enums are
represented as part of CompileUnit as:
!0 = distinct !DICompileUnit(..... enums: !2, ....)
While this works well for cases when enum is at Global/CU scope, but leaves no
room for addressing the case depicted here, i.e Enum declared inside a
function.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210212/d1410fca/attachment-0001.html>
More information about the llvm-bugs
mailing list