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

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

Run with script
$ cat

$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 ./
type = int
$1 = 33

And with clang-10:
$ cc=clang-10 ./
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

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

Reply via email to