[llvm-bugs] [Bug 46514] New: clang does not emit debug info for declaration

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jun 30 01:12:03 PDT 2020


https://bugs.llvm.org/show_bug.cgi?id=46514

            Bug ID: 46514
           Summary: clang does not emit debug info for declaration
           Product: new-bugs
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: vries at gcc.gnu.org
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org

Consider the following test-case from the gdb testsuite:
...
$ cat psym-external-decl.c
extern int aaa;
int
main (void)
{
  return aaa;
}
$ cat psym-external-decl-2.c
int aaa = 33;
...

Run with script compile.sh:
...
$ cat compile.sh
#!/bin/sh

$cc -c -g psym-external-decl.c 
$cc -c psym-external-decl-2.c
$cc -g psym-external-decl.o psym-external-decl-2.o

gdb -batch a.out -ex "ptype aaa" -ex "p aaa"
...

With gcc, we have:
...
$ cc=gcc ./compile.sh
type = int
$1 = 33
...

And with clang-10:
...
$ cc=clang-10 ./compile.sh
type = <data variable, no debug info>
'aaa' has unknown type; cast it to its declared type
...

The difference is caused by missing debug info for the declaration of aaa in
psym-external-decl.c.

That is, with gcc, we have:
...
$ readelf -wi psym-external-decl.o  | grep aaa
    <2e>   DW_AT_name        : aaa
$
...
and with clang:
...
$ readelf -wi psym-external-decl.o  | grep aaa
$
...

Is this a missing feature in clang, or is this explicitly unsupported?

-- 
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/20200630/e3b1dfb8/attachment.html>


More information about the llvm-bugs mailing list