clang confuses kgdb on static symbols

John Baldwin jhb at freebsd.org
Tue Oct 20 18:32:39 UTC 2015


On Tuesday, October 20, 2015 02:38:48 PM Andriy Gapon 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.

What if you disable the hack in sys/conf/kern.mk to use dwarf-2?

If '-gdwarf-4' works then you can just set that in the DEBUG makeoptions as a
test, otherwise try hacking kern.mk to disable this bit:

#
# Add -gdwarf-2 when compiling -g. The default starting in clang v3.4
# and gcc 4.8 is to generate DWARF version 4. However, our tools don't
# cope well with DWARF 4, so force it to genereate DWARF2, which they
# understand. Do this unconditionally as it is harmless when not needed,
# but critical for these newer versions.
#
.if ${CFLAGS:M-g} != "" && ${CFLAGS:M-gdwarf*} == ""
CFLAGS+=        -gdwarf-2
.endif


-- 
John Baldwin


More information about the freebsd-toolchain mailing list