Don't override FRAME_CHAIN(). If the current frame is valid, then

the previous frame is in the usual place even for traps, interrupts
and syscalls in the kernel, because the assembly language stubs
don't change the frame pointer.  The previous frame is just not for
the calling function.  We may as well depend on this as on magic to
determine the trap frame address.  The magic is in FRAME_SAVED_PC()
which elides the correct number of stubs (1) to go back to a pc that
matches the previous frame.

Removing fbsd_kern_frame_chain() fixes bugs in it.  Xsyscall was
misspelled as _Xsyscall (gdb removes one leading underscore), so
the tf_syscall frame type was never found.  This was harmless
because tf_normal works in all cases in fbsd_kern_frame_chain()
and Xsyscall is spelled correctly in fbsd_kern_frame_saved_pc()
where it matters.  There were style bugs on almost every line,
starting with a primary indent of 7.
This commit is contained in:
Bruce Evans 1998-01-18 12:35:48 +00:00
parent 41051eb9e7
commit 941b2747b6
5 changed files with 0 additions and 144 deletions

View file

@ -162,44 +162,6 @@ struct frame_info *fr;
}
}
CORE_ADDR
fbsd_kern_frame_chain (fr)
struct frame_info *fr;
{
struct minimal_symbol *sym;
CORE_ADDR this_saved_pc;
enum frametype frametype;
this_saved_pc = read_memory_integer (fr->frame + 4, 4);
sym = lookup_minimal_symbol_by_pc (this_saved_pc);
frametype = tf_normal;
if (sym != NULL) {
if (strcmp (SYMBOL_NAME(sym), "calltrap") == 0)
frametype = tf_trap;
else if (strncmp (SYMBOL_NAME(sym), "Xresume", 7) == 0)
frametype = tf_interrupt;
else if (strcmp (SYMBOL_NAME(sym), "_Xsyscall") == 0)
frametype = tf_syscall;
}
switch (frametype) {
case tf_normal:
return (read_memory_integer (fr->frame, 4));
#define oEBP offsetof(struct trapframe, tf_ebp)
case tf_trap:
return (read_memory_integer (fr->frame + 8 + oEBP, 4));
case tf_interrupt:
return (read_memory_integer (fr->frame + 16 + oEBP, 4));
case tf_syscall:
return (read_memory_integer (fr->frame + 8 + oEBP, 4));
#undef oEBP
}
}
static CORE_ADDR
ksym_lookup (name)
const char *name;

View file

@ -35,21 +35,6 @@ extern void i386_float_info PARAMS ((void));
#define IN_SOLIB_CALL_TRAMPOLINE(pc, name) STREQ (name, "_DYNAMIC")
/* FRAME_CHAIN takes a frame's nominal address and produces the frame's
chain-pointer.
In the case of the i386, the frame's nominal address
is the address of a 4-byte word containing the calling frame's address. */
extern CORE_ADDR fbsd_kern_frame_chain (struct frame_info *);
#undef FRAME_CHAIN
#define FRAME_CHAIN(thisframe) \
(kernel_debugging ? fbsd_kern_frame_chain(thisframe) : \
((thisframe)->signal_handler_caller \
? (thisframe)->frame \
: (!inside_entry_file ((thisframe)->pc) \
? read_memory_integer ((thisframe)->frame, 4) \
: 0)))
/* Saved Pc. Get it from sigcontext if within sigtramp. */
extern CORE_ADDR fbsd_kern_frame_saved_pc (struct frame_info *);

View file

@ -162,44 +162,6 @@ struct frame_info *fr;
}
}
CORE_ADDR
fbsd_kern_frame_chain (fr)
struct frame_info *fr;
{
struct minimal_symbol *sym;
CORE_ADDR this_saved_pc;
enum frametype frametype;
this_saved_pc = read_memory_integer (fr->frame + 4, 4);
sym = lookup_minimal_symbol_by_pc (this_saved_pc);
frametype = tf_normal;
if (sym != NULL) {
if (strcmp (SYMBOL_NAME(sym), "calltrap") == 0)
frametype = tf_trap;
else if (strncmp (SYMBOL_NAME(sym), "Xresume", 7) == 0)
frametype = tf_interrupt;
else if (strcmp (SYMBOL_NAME(sym), "_Xsyscall") == 0)
frametype = tf_syscall;
}
switch (frametype) {
case tf_normal:
return (read_memory_integer (fr->frame, 4));
#define oEBP offsetof(struct trapframe, tf_ebp)
case tf_trap:
return (read_memory_integer (fr->frame + 8 + oEBP, 4));
case tf_interrupt:
return (read_memory_integer (fr->frame + 16 + oEBP, 4));
case tf_syscall:
return (read_memory_integer (fr->frame + 8 + oEBP, 4));
#undef oEBP
}
}
static CORE_ADDR
ksym_lookup (name)
const char *name;

View file

@ -162,44 +162,6 @@ struct frame_info *fr;
}
}
CORE_ADDR
fbsd_kern_frame_chain (fr)
struct frame_info *fr;
{
struct minimal_symbol *sym;
CORE_ADDR this_saved_pc;
enum frametype frametype;
this_saved_pc = read_memory_integer (fr->frame + 4, 4);
sym = lookup_minimal_symbol_by_pc (this_saved_pc);
frametype = tf_normal;
if (sym != NULL) {
if (strcmp (SYMBOL_NAME(sym), "calltrap") == 0)
frametype = tf_trap;
else if (strncmp (SYMBOL_NAME(sym), "Xresume", 7) == 0)
frametype = tf_interrupt;
else if (strcmp (SYMBOL_NAME(sym), "_Xsyscall") == 0)
frametype = tf_syscall;
}
switch (frametype) {
case tf_normal:
return (read_memory_integer (fr->frame, 4));
#define oEBP offsetof(struct trapframe, tf_ebp)
case tf_trap:
return (read_memory_integer (fr->frame + 8 + oEBP, 4));
case tf_interrupt:
return (read_memory_integer (fr->frame + 16 + oEBP, 4));
case tf_syscall:
return (read_memory_integer (fr->frame + 8 + oEBP, 4));
#undef oEBP
}
}
static CORE_ADDR
ksym_lookup (name)
const char *name;

View file

@ -35,21 +35,6 @@ extern void i386_float_info PARAMS ((void));
#define IN_SOLIB_CALL_TRAMPOLINE(pc, name) STREQ (name, "_DYNAMIC")
/* FRAME_CHAIN takes a frame's nominal address and produces the frame's
chain-pointer.
In the case of the i386, the frame's nominal address
is the address of a 4-byte word containing the calling frame's address. */
extern CORE_ADDR fbsd_kern_frame_chain (struct frame_info *);
#undef FRAME_CHAIN
#define FRAME_CHAIN(thisframe) \
(kernel_debugging ? fbsd_kern_frame_chain(thisframe) : \
((thisframe)->signal_handler_caller \
? (thisframe)->frame \
: (!inside_entry_file ((thisframe)->pc) \
? read_memory_integer ((thisframe)->frame, 4) \
: 0)))
/* Saved Pc. Get it from sigcontext if within sigtramp. */
extern CORE_ADDR fbsd_kern_frame_saved_pc (struct frame_info *);