Module Name:    src
Committed By:   christos
Date:           Wed Apr 16 02:14:44 UTC 2014

Modified Files:
        src/external/gpl3/gdb/dist/gdb: amd64nbsd-nat.c amd64nbsd-tdep.c

Log Message:
It is not nice to fake things we don't have; instead check explicitly
that we can get CS.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/external/gpl3/gdb/dist/gdb/amd64nbsd-nat.c
cvs rdiff -u -r1.7 -r1.8 src/external/gpl3/gdb/dist/gdb/amd64nbsd-tdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/gpl3/gdb/dist/gdb/amd64nbsd-nat.c
diff -u src/external/gpl3/gdb/dist/gdb/amd64nbsd-nat.c:1.5 src/external/gpl3/gdb/dist/gdb/amd64nbsd-nat.c:1.6
--- src/external/gpl3/gdb/dist/gdb/amd64nbsd-nat.c:1.5	Tue Apr 15 20:32:33 2014
+++ src/external/gpl3/gdb/dist/gdb/amd64nbsd-nat.c	Tue Apr 15 22:14:44 2014
@@ -120,8 +120,6 @@ amd64nbsd_supply_pcb (struct regcache *r
   regcache_raw_supply (regcache, AMD64_RBP_REGNUM, &pcb->pcb_rbp);
   regcache_raw_supply (regcache, AMD64_FS_REGNUM, &pcb->pcb_fs);
   regcache_raw_supply (regcache, AMD64_GS_REGNUM, &pcb->pcb_gs);
-  /* fake it to 0 so SEL_UPL is not set (our sniffer looks at CS) */
-  regcache_raw_supply (regcache, AMD64_CS_REGNUM, &zero);
 
   return 1;
 }

Index: src/external/gpl3/gdb/dist/gdb/amd64nbsd-tdep.c
diff -u src/external/gpl3/gdb/dist/gdb/amd64nbsd-tdep.c:1.7 src/external/gpl3/gdb/dist/gdb/amd64nbsd-tdep.c:1.8
--- src/external/gpl3/gdb/dist/gdb/amd64nbsd-tdep.c:1.7	Tue Apr 15 20:34:10 2014
+++ src/external/gpl3/gdb/dist/gdb/amd64nbsd-tdep.c	Tue Apr 15 22:14:44 2014
@@ -230,12 +230,16 @@ amd64nbsd_trapframe_sniffer (const struc
 {
   ULONGEST cs;
   const char *name;
+  volatile struct gdb_exception ex;
 
-  /* Check Current Privilege Level and bail out if we're not executing
-     in kernel space.  */
-  cs = get_frame_register_unsigned (this_frame, AMD64_CS_REGNUM);
-  if ((cs & I386_SEL_RPL) == I386_SEL_UPL)
-    return 0;
+  TRY_CATCH (ex, RETURN_MASK_ERROR)
+    {
+      cs = get_frame_register_unsigned (this_frame, AMD64_CS_REGNUM);
+      if ((cs & I386_SEL_RPL) == I386_SEL_UPL)
+	return 0;
+    }
+  if (ex.reason < 0 && ex.error != NOT_AVAILABLE_ERROR)
+    throw_exception (ex);
 
   find_pc_partial_function (get_frame_pc (this_frame), &name, NULL, NULL);
   return (name && ((strcmp (name, "alltraps") == 0)

Reply via email to