2007-07-02 Markus Deuling <deuling@de.ibm.com>
[deliverable/binutils-gdb.git] / gdb / amd64obsd-tdep.c
index 30e8fc12476946d5571b4fa478b0b216c99d9b85..4e412e9ea1de95a5229d7f3b61f9ee75130519bb 100644 (file)
@@ -1,6 +1,6 @@
 /* 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.
 
@@ -356,11 +356,13 @@ amd64obsd_trapframe_cache(struct frame_info *next_frame, void **this_cache)
   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;
@@ -370,11 +372,11 @@ amd64obsd_trapframe_cache(struct frame_info *next_frame, void **this_cache)
       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
@@ -418,6 +420,8 @@ amd64obsd_trapframe_sniffer (const struct frame_unwind *self,
   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;
This page took 0.024013 seconds and 4 git commands to generate.