-
Notifications
You must be signed in to change notification settings - Fork 15.3k
Description
| Bugzilla Link | 46514 |
| Version | trunk |
| OS | Linux |
| CC | @adrian-prantl,@dwblaikie,@JDevlieghere,@jmorse,@walkerkd,@pogo59,@pogo59,@vedantk |
Extended Description
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?