When building a cross kgdb, link against the appropriate cross libkvm.

Provide an implementation of ps_pglobal_lookup() for use by the cross
libkvm.
This commit is contained in:
Marcel Moolenaar 2013-12-28 23:31:22 +00:00
parent 29c425acae
commit 03197d0ab0
2 changed files with 29 additions and 2 deletions

View File

@ -8,7 +8,13 @@ BULIBS= ${OBJ_BU}/libbfd/libbfd.a ${OBJ_BU}/libopcodes/libopcodes.a \
${OBJ_BU}/libiberty/libiberty.a
GDBLIBS= ${OBJ_GDB}/libgdb/libgdb.a
DPADD= ${GDBLIBS} ${BULIBS} ${LIBKVM} ${LIBM} ${LIBREADLINE} ${LIBTERMCAP} ${LIBGNUREGEX}
LDADD= ${GDBLIBS} ${BULIBS} -lkvm -lm -lreadline -ltermcap -lgnuregex
DPADD= ${GDBLIBS} ${BULIBS} ${LIBKVM} ${LIBM} ${LIBREADLINE} ${LIBTERMCAP} \
${LIBGNUREGEX}
LDADD= ${GDBLIBS} ${BULIBS} -lkvm${GDB_SUFFIX} -lm -lreadline -ltermcap \
-lgnuregex
.if defined(GDB_CROSS_DEBUGGER)
CFLAGS+= -Wl,-export-dynamic
.endif
.include <bsd.prog.mk>

View File

@ -41,6 +41,9 @@ __FBSDID("$FreeBSD$");
#include <kvm.h>
#include <limits.h>
#include <paths.h>
#ifdef CROSS_DEBUGGER
#include <proc_service.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -78,6 +81,24 @@ static struct ui_file *parse_gdberr;
static void (*kgdb_new_objfile_chain)(struct objfile * objfile);
#ifdef CROSS_DEBUGGER
ps_err_e
ps_pglobal_lookup(struct ps_prochandle *ph, const char *obj, const char *name,
psaddr_t *sym_addr)
{
struct minimal_symbol *ms;
CORE_ADDR addr;
ms = lookup_minimal_symbol (name, NULL, NULL);
if (ms == NULL)
return PS_NOSYM;
addr = SYMBOL_VALUE_ADDRESS (ms);
store_typed_address(sym_addr, builtin_type_void_data_ptr, addr);
return PS_OK;
}
#endif
static void
usage(void)
{