Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 06fa431

Browse files
marcelmarcel
authored andcommitted
When building a cross kgdb, link against the appropriate cross libkvm.
Provide an implementation of ps_pglobal_lookup() for use by the cross libkvm.
1 parent 7dde977 commit 06fa431

File tree

2 files changed

+29
-2
lines changed

2 files changed

+29
-2
lines changed

gnu/usr.bin/gdb/kgdb/Makefile

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,13 @@ BULIBS= ${OBJ_BU}/libbfd/libbfd.a ${OBJ_BU}/libopcodes/libopcodes.a \
88
${OBJ_BU}/libiberty/libiberty.a
99
GDBLIBS= ${OBJ_GDB}/libgdb/libgdb.a
1010

11-
DPADD= ${GDBLIBS} ${BULIBS} ${LIBKVM} ${LIBM} ${LIBREADLINE} ${LIBTERMCAP} ${LIBGNUREGEX}
12-
LDADD= ${GDBLIBS} ${BULIBS} -lkvm -lm -lreadline -ltermcap -lgnuregex
11+
DPADD= ${GDBLIBS} ${BULIBS} ${LIBKVM} ${LIBM} ${LIBREADLINE} ${LIBTERMCAP} \
12+
${LIBGNUREGEX}
13+
LDADD= ${GDBLIBS} ${BULIBS} -lkvm${GDB_SUFFIX} -lm -lreadline -ltermcap \
14+
-lgnuregex
15+
16+
.if defined(GDB_CROSS_DEBUGGER)
17+
CFLAGS+= -Wl,-export-dynamic
18+
.endif
1319

1420
.include <bsd.prog.mk>

gnu/usr.bin/gdb/kgdb/main.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ __FBSDID("$FreeBSD$");
4141
#include <kvm.h>
4242
#include <limits.h>
4343
#include <paths.h>
44+
#ifdef CROSS_DEBUGGER
45+
#include <proc_service.h>
46+
#endif
4447
#include <stdio.h>
4548
#include <stdlib.h>
4649
#include <string.h>
@@ -78,6 +81,24 @@ static struct ui_file *parse_gdberr;
7881

7982
static void (*kgdb_new_objfile_chain)(struct objfile * objfile);
8083

84+
#ifdef CROSS_DEBUGGER
85+
ps_err_e
86+
ps_pglobal_lookup(struct ps_prochandle *ph, const char *obj, const char *name,
87+
psaddr_t *sym_addr)
88+
{
89+
struct minimal_symbol *ms;
90+
CORE_ADDR addr;
91+
92+
ms = lookup_minimal_symbol (name, NULL, NULL);
93+
if (ms == NULL)
94+
return PS_NOSYM;
95+
96+
addr = SYMBOL_VALUE_ADDRESS (ms);
97+
store_typed_address(sym_addr, builtin_type_void_data_ptr, addr);
98+
return PS_OK;
99+
}
100+
#endif
101+
81102
static void
82103
usage(void)
83104
{

0 commit comments

Comments
 (0)