/* Target-dependent code for OpenBSD/amd64.
- Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
This file is part of GDB.
cache = trad_frame_cache_zalloc (next_frame);
*this_cache = cache;
- func = frame_func_unwind (next_frame);
+ /* NORMAL_FRAME matches the type in amd64obsd_trapframe_unwind, but
+ SIGTRAMP_FRAME might be more appropriate. */
+ func = frame_func_unwind (next_frame, NORMAL_FRAME);
sp = frame_unwind_register_unsigned (next_frame, AMD64_RSP_REGNUM);
find_pc_partial_function (func, &name, NULL, NULL);
- if (name && strncmp(name, "Xintr", 5) == 0)
+ if (name && strncmp (name, "Xintr", 5) == 0)
addr = sp + 8; /* It's an interrupt frame. */
else
addr = sp;
trad_frame_set_reg_addr (cache, i, addr + amd64obsd_tf_reg_offset[i]);
/* Read %cs from trap frame. */
- addr = sp + amd64obsd_tf_reg_offset[AMD64_CS_REGNUM];
+ addr += amd64obsd_tf_reg_offset[AMD64_CS_REGNUM];
cs = read_memory_unsigned_integer (addr, 8);
if ((cs & I386_SEL_RPL) == I386_SEL_UPL)
{
- /* Trap from use space; terminate backtrace. */
+ /* Trap from user space; terminate backtrace. */
trad_frame_set_id (cache, null_frame_id);
}
else
ULONGEST cs;
char *name;
+ /* Check Current Privilege Level and bail out if we're not executing
+ in kernel space. */
cs = frame_unwind_register_unsigned (next_frame, AMD64_CS_REGNUM);
if ((cs & I386_SEL_RPL) == I386_SEL_UPL)
return 0;