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: unassignedb...@nondot.org
          Reporter: vr...@gcc.gnu.org
                CC: htmldevelo...@gmail.com, llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to