clang confuses kgdb on static symbols

Dimitry Andric dim at FreeBSD.org
Tue Oct 20 21:45:40 UTC 2015


On 20 Oct 2015, at 13:38, Andriy Gapon <avg at FreeBSD.org> wrote:
> 
> I see exactly the same behavior both kgdb and kgdb710 (devel/gdb with KGDB option):
> (kgdb) p/x intr_cpus
> No symbol "intr_cpus" in current context.
> (kgdb) p/x 'intr_cpus.0'
> $1 = 0xf
> 
> Not sure if clang should try to not produce that '.0' suffix (especially given
> that there are no other intr_cpus symbols) or if kgdb should somehow figure out
> the suffix.

As far as I know, static symbols are candidates for shuffling around,
completely optimizing away, et cetera, as long as the program still
works according to the abstract model.  (This is of course without
taking e.g. __used attributes into account.)

It appears that intr_cpus is a struct, and I have seen before that
individual members of such static structs are sometimes assigned
individual symbols, suffixed with .0, .1 and so on.  This is likely what
is happening in this case.

-Dimitry

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 194 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.freebsd.org/pipermail/freebsd-toolchain/attachments/20151020/76c4e3d1/attachment.bin>


More information about the freebsd-toolchain mailing list