From 2d34114497ebf7f09b864b35b9c8c885d71637a2 Mon Sep 17 00:00:00 2001 From: Marcel Moolenaar Date: Mon, 13 Jan 2014 19:08:25 +0000 Subject: [PATCH] When building a cross-kgdb, suppress the registration of the standard core target by declaring coreops_suppress_target with initializer. This is also happening for non-cross kgdb, by virtue of having fbsd-threads.c in libgdb and having it do the exact same thing. Since fbsd-threads.c is not included in in libgdb when building a cross debugger, we ended up with more than 1 core file targets (the standard gdb core file target and kgdb's libkvm based core file target) and this behaves the same as not having a core target at all. --- gnu/usr.bin/gdb/kgdb/trgt.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/gnu/usr.bin/gdb/kgdb/trgt.c b/gnu/usr.bin/gdb/kgdb/trgt.c index 85065ccc383a..b2f61890b2a7 100644 --- a/gnu/usr.bin/gdb/kgdb/trgt.c +++ b/gnu/usr.bin/gdb/kgdb/trgt.c @@ -53,6 +53,18 @@ __FBSDID("$FreeBSD$"); #include "kgdb.h" +#ifdef CROSS_DEBUGGER +/* + * We suppress the call to add_target() of core_ops in corelow.c because if + * there are multiple core_stratum targets, the find_core_target() function + * won't know which one to return and returns none. We need it to return + * our target. We only have to do that when we're building a cross-debugger + * because fbsd-threads.c is part of a native debugger and it too defines + * coreops_suppress_target with 1 as the initializer. + */ +int coreops_suppress_target = 1; +#endif + static CORE_ADDR stoppcbs; static void kgdb_core_cleanup(void *);