Add a kluge to allow kgdb(1) to inject its own frame sniffer in the
list of frame sniffers so that trapframes can be detected. The kluge is needed because this version of gdb only supports appending a sniffer to the list of sniffers and the moment kgdb gets a chance to add its own frame sniffer, the target's default frame sniffer is already in the list. Since the default frame sniffer claims any frame thrown at it, kgdb's frame sniffer never gets to smell (a process much akin to tasting, but with lesser chance of hurling :-) This commit adds dummy frame sniffers that never claim a frame and as such don't fix anything yet. However, we now have frame sniffers and they are being called, so it's just a matter of adding meat to the bones and we'll be able to properly unwind across trapframes. MFC after: 1 week
This commit is contained in:
parent
756320bcbb
commit
d05b9c6e82
@ -29,7 +29,7 @@
|
||||
#ifndef _KGDB_H_
|
||||
#define _KGDB_H_
|
||||
|
||||
struct thread_info;
|
||||
struct thread_info;
|
||||
|
||||
extern kvm_t *kvm;
|
||||
extern int verbose;
|
||||
@ -50,6 +50,8 @@ void kgdb_target(void);
|
||||
void kgdb_trgt_fetch_registers(int);
|
||||
void kgdb_trgt_store_registers(int);
|
||||
|
||||
frame_unwind_sniffer_ftype kgdb_trgt_trapframe_sniffer;
|
||||
|
||||
struct kthr *kgdb_thr_first(void);
|
||||
struct kthr *kgdb_thr_init(void);
|
||||
struct kthr *kgdb_thr_lookup_tid(int);
|
||||
|
@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <defs.h>
|
||||
#include <frame-unwind.h>
|
||||
|
||||
#include "kgdb.h"
|
||||
|
||||
|
@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$");
|
||||
/* libgdb stuff. */
|
||||
#include <defs.h>
|
||||
#include <frame.h>
|
||||
#include <frame-unwind.h>
|
||||
#include <inferior.h>
|
||||
#include <interps.h>
|
||||
#include <cli-out.h>
|
||||
@ -61,6 +62,8 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
extern void (*init_ui_hook)(char *);
|
||||
|
||||
extern frame_unwind_sniffer_ftype *kgdb_sniffer_kluge;
|
||||
|
||||
extern void symbol_file_add_main (char *args, int from_tty);
|
||||
|
||||
#include "kgdb.h"
|
||||
@ -478,5 +481,7 @@ main(int argc, char *argv[])
|
||||
|
||||
init_ui_hook = kgdb_init;
|
||||
|
||||
kgdb_sniffer_kluge = kgdb_trgt_trapframe_sniffer;
|
||||
|
||||
return (gdb_main(&args));
|
||||
}
|
||||
|
@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
#include <defs.h>
|
||||
#include <command.h>
|
||||
#include <frame-unwind.h>
|
||||
#include <gdbthread.h>
|
||||
#include <inferior.h>
|
||||
#include <regcache.h>
|
||||
|
@ -33,13 +33,14 @@ __FBSDID("$FreeBSD$");
|
||||
#include <kvm.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "kgdb.h"
|
||||
|
||||
#include <defs.h>
|
||||
#include <target.h>
|
||||
#include <gdbthread.h>
|
||||
#include <inferior.h>
|
||||
#include <regcache.h>
|
||||
#include <frame-unwind.h>
|
||||
|
||||
#include "kgdb.h"
|
||||
|
||||
void
|
||||
kgdb_trgt_fetch_registers(int regno __unused)
|
||||
@ -71,3 +72,29 @@ kgdb_trgt_store_registers(int regno __unused)
|
||||
{
|
||||
fprintf_unfiltered(gdb_stderr, "XXX: %s\n", __func__);
|
||||
}
|
||||
|
||||
static void
|
||||
kgdb_trgt_trapframe_this_id(struct frame_info *next_frame, void **this_cache,
|
||||
struct frame_id *this_id)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
kgdb_trgt_trapframe_prev_register(struct frame_info *next_frame,
|
||||
void **this_cache, int regnum, int *optimizedp, enum lval_type *lvalp,
|
||||
CORE_ADDR *addrp, int *realnump, void *valuep)
|
||||
{
|
||||
}
|
||||
|
||||
static const struct frame_unwind kgdb_trgt_trapframe_unwind = {
|
||||
UNKNOWN_FRAME,
|
||||
&kgdb_trgt_trapframe_this_id,
|
||||
&kgdb_trgt_trapframe_prev_register
|
||||
};
|
||||
|
||||
const struct frame_unwind *
|
||||
kgdb_trgt_trapframe_sniffer(struct frame_info *next_frame)
|
||||
{
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
|
@ -33,13 +33,14 @@ __FBSDID("$FreeBSD$");
|
||||
#include <kvm.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "kgdb.h"
|
||||
|
||||
#include <defs.h>
|
||||
#include <target.h>
|
||||
#include <gdbthread.h>
|
||||
#include <inferior.h>
|
||||
#include <regcache.h>
|
||||
#include <frame-unwind.h>
|
||||
|
||||
#include "kgdb.h"
|
||||
|
||||
void
|
||||
kgdb_trgt_fetch_registers(int regno __unused)
|
||||
@ -71,3 +72,29 @@ kgdb_trgt_store_registers(int regno __unused)
|
||||
{
|
||||
fprintf_unfiltered(gdb_stderr, "XXX: %s\n", __func__);
|
||||
}
|
||||
|
||||
static void
|
||||
kgdb_trgt_trapframe_this_id(struct frame_info *next_frame, void **this_cache,
|
||||
struct frame_id *this_id)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
kgdb_trgt_trapframe_prev_register(struct frame_info *next_frame,
|
||||
void **this_cache, int regnum, int *optimizedp, enum lval_type *lvalp,
|
||||
CORE_ADDR *addrp, int *realnump, void *valuep)
|
||||
{
|
||||
}
|
||||
|
||||
static const struct frame_unwind kgdb_trgt_trapframe_unwind = {
|
||||
UNKNOWN_FRAME,
|
||||
&kgdb_trgt_trapframe_this_id,
|
||||
&kgdb_trgt_trapframe_prev_register
|
||||
};
|
||||
|
||||
const struct frame_unwind *
|
||||
kgdb_trgt_trapframe_sniffer(struct frame_info *next_frame)
|
||||
{
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
|
@ -33,13 +33,14 @@ __FBSDID("$FreeBSD$");
|
||||
#include <kvm.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "kgdb.h"
|
||||
|
||||
#include <defs.h>
|
||||
#include <target.h>
|
||||
#include <gdbthread.h>
|
||||
#include <inferior.h>
|
||||
#include <regcache.h>
|
||||
#include <frame-unwind.h>
|
||||
|
||||
#include "kgdb.h"
|
||||
|
||||
void
|
||||
kgdb_trgt_fetch_registers(int regno __unused)
|
||||
@ -67,3 +68,29 @@ kgdb_trgt_store_registers(int regno __unused)
|
||||
{
|
||||
fprintf_unfiltered(gdb_stderr, "XXX: %s\n", __func__);
|
||||
}
|
||||
|
||||
static void
|
||||
kgdb_trgt_trapframe_this_id(struct frame_info *next_frame, void **this_cache,
|
||||
struct frame_id *this_id)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
kgdb_trgt_trapframe_prev_register(struct frame_info *next_frame,
|
||||
void **this_cache, int regnum, int *optimizedp, enum lval_type *lvalp,
|
||||
CORE_ADDR *addrp, int *realnump, void *valuep)
|
||||
{
|
||||
}
|
||||
|
||||
static const struct frame_unwind kgdb_trgt_trapframe_unwind = {
|
||||
UNKNOWN_FRAME,
|
||||
&kgdb_trgt_trapframe_this_id,
|
||||
&kgdb_trgt_trapframe_prev_register
|
||||
};
|
||||
|
||||
const struct frame_unwind *
|
||||
kgdb_trgt_trapframe_sniffer(struct frame_info *next_frame)
|
||||
{
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
|
@ -34,13 +34,14 @@ __FBSDID("$FreeBSD$");
|
||||
#include <kvm.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "kgdb.h"
|
||||
|
||||
#include <defs.h>
|
||||
#include <target.h>
|
||||
#include <gdbthread.h>
|
||||
#include <inferior.h>
|
||||
#include <regcache.h>
|
||||
#include <frame-unwind.h>
|
||||
|
||||
#include "kgdb.h"
|
||||
|
||||
void
|
||||
kgdb_trgt_fetch_registers(int regno __unused)
|
||||
@ -131,3 +132,29 @@ kgdb_trgt_store_registers(int regno __unused)
|
||||
{
|
||||
fprintf_unfiltered(gdb_stderr, "XXX: %s\n", __func__);
|
||||
}
|
||||
|
||||
static void
|
||||
kgdb_trgt_trapframe_this_id(struct frame_info *next_frame, void **this_cache,
|
||||
struct frame_id *this_id)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
kgdb_trgt_trapframe_prev_register(struct frame_info *next_frame,
|
||||
void **this_cache, int regnum, int *optimizedp, enum lval_type *lvalp,
|
||||
CORE_ADDR *addrp, int *realnump, void *valuep)
|
||||
{
|
||||
}
|
||||
|
||||
static const struct frame_unwind kgdb_trgt_trapframe_unwind = {
|
||||
UNKNOWN_FRAME,
|
||||
&kgdb_trgt_trapframe_this_id,
|
||||
&kgdb_trgt_trapframe_prev_register
|
||||
};
|
||||
|
||||
const struct frame_unwind *
|
||||
kgdb_trgt_trapframe_sniffer(struct frame_info *next_frame)
|
||||
{
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
|
@ -34,16 +34,17 @@ __FBSDID("$FreeBSD$");
|
||||
#include <kvm.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "kgdb.h"
|
||||
|
||||
#include <defs.h>
|
||||
#include <target.h>
|
||||
#include <gdbthread.h>
|
||||
#include <inferior.h>
|
||||
#include <regcache.h>
|
||||
#include <frame-unwind.h>
|
||||
#include <sparc-tdep.h>
|
||||
#include <sparc64-tdep.h>
|
||||
|
||||
#include "kgdb.h"
|
||||
|
||||
void
|
||||
kgdb_trgt_fetch_registers(int regno __unused)
|
||||
{
|
||||
@ -70,3 +71,29 @@ kgdb_trgt_store_registers(int regno __unused)
|
||||
{
|
||||
fprintf_unfiltered(gdb_stderr, "XXX: %s\n", __func__);
|
||||
}
|
||||
|
||||
static void
|
||||
kgdb_trgt_trapframe_this_id(struct frame_info *next_frame, void **this_cache,
|
||||
struct frame_id *this_id)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
kgdb_trgt_trapframe_prev_register(struct frame_info *next_frame,
|
||||
void **this_cache, int regnum, int *optimizedp, enum lval_type *lvalp,
|
||||
CORE_ADDR *addrp, int *realnump, void *valuep)
|
||||
{
|
||||
}
|
||||
|
||||
static const struct frame_unwind kgdb_trgt_trapframe_unwind = {
|
||||
UNKNOWN_FRAME,
|
||||
&kgdb_trgt_trapframe_this_id,
|
||||
&kgdb_trgt_trapframe_prev_register
|
||||
};
|
||||
|
||||
const struct frame_unwind *
|
||||
kgdb_trgt_trapframe_sniffer(struct frame_info *next_frame)
|
||||
{
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ SRCS= annotate.c arch-utils.c auxv.c ax-gdb.c ax-general.c \
|
||||
elfread.c environ.c eval.c event-loop.c event-top.c exec.c \
|
||||
expprint.c \
|
||||
f-exp.y f-lang.c f-typeprint.c f-valprint.c findvar.c \
|
||||
${_fork_child} frame-base.c frame-unwind.c frame.c \
|
||||
${_fork_child} frame-base.c frame-unwind-kluge.c frame.c \
|
||||
gdb-events.c gdbarch.c gdbtypes.c gnu-v2-abi.c gnu-v3-abi.c \
|
||||
hpacc-abi.c \
|
||||
inf-loop.c infcall.c infcmd.c inflow.c ${_infptrace} infrun.c \
|
||||
@ -59,7 +59,11 @@ _infptrace= infptrace.c
|
||||
_inftarg= inftarg.c
|
||||
.endif
|
||||
|
||||
GENSRCS= version.c
|
||||
GENSRCS= frame-unwind-kluge.c version.c
|
||||
|
||||
frame-unwind-kluge.c: frame-unwind.diff
|
||||
cat ${CNTRB_GDB}/gdb/frame-unwind.c > ${.TARGET}
|
||||
patch ${.TARGET} ${.ALLSRC}
|
||||
|
||||
version.c:
|
||||
echo '#include "version.h"' > ${.TARGET}
|
||||
|
27
gnu/usr.bin/gdb/libgdb/frame-unwind.diff
Normal file
27
gnu/usr.bin/gdb/libgdb/frame-unwind.diff
Normal file
@ -0,0 +1,27 @@
|
||||
$FreeBSD$
|
||||
|
||||
Index: frame-unwind.c
|
||||
===================================================================
|
||||
RCS file: /home/ncvs/src/contrib/gdb/gdb/frame-unwind.c,v
|
||||
retrieving revision 1.1.1.1
|
||||
diff -u -r1.1.1.1 frame-unwind.c
|
||||
--- frame-unwind.c 20 Jun 2004 18:16:58 -0000 1.1.1.1
|
||||
+++ frame-unwind.c 10 Sep 2005 06:36:55 -0000
|
||||
@@ -27,6 +27,8 @@
|
||||
|
||||
static struct gdbarch_data *frame_unwind_data;
|
||||
|
||||
+frame_unwind_sniffer_ftype *kgdb_sniffer_kluge;
|
||||
+
|
||||
struct frame_unwind_table
|
||||
{
|
||||
frame_unwind_sniffer_ftype **sniffer;
|
||||
@@ -49,6 +51,8 @@
|
||||
{
|
||||
struct frame_unwind_table *table = XCALLOC (1, struct frame_unwind_table);
|
||||
append_predicate (table, dummy_frame_sniffer);
|
||||
+ if (kgdb_sniffer_kluge != NULL)
|
||||
+ append_predicate (table, kgdb_sniffer_kluge);
|
||||
return table;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user