Module Name:    src
Committed By:   christos
Date:           Mon Apr 23 14:53:07 UTC 2018

Modified Files:
        src/external/gpl3/gdb/dist/gdb: amd64-nbsd-tdep.c i386-nbsd-tdep.c

Log Message:
Add "Xhandle*" interrupt handling.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/gpl3/gdb/dist/gdb/amd64-nbsd-tdep.c \
    src/external/gpl3/gdb/dist/gdb/i386-nbsd-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/amd64-nbsd-tdep.c
diff -u src/external/gpl3/gdb/dist/gdb/amd64-nbsd-tdep.c:1.3 src/external/gpl3/gdb/dist/gdb/amd64-nbsd-tdep.c:1.4
--- src/external/gpl3/gdb/dist/gdb/amd64-nbsd-tdep.c:1.3	Wed Nov 29 13:15:29 2017
+++ src/external/gpl3/gdb/dist/gdb/amd64-nbsd-tdep.c	Mon Apr 23 10:53:07 2018
@@ -148,10 +148,21 @@ amd64nbsd_trapframe_cache(struct frame_i
 
   /* There is an extra 'call' in the interrupt sequence - ignore the extra
    * return address */
-  if (name && strncmp (name, "Xintr", 5) == 0)
-    addr = sp + 8;		/* It's an interrupt frame.  */
-  else
-    addr = sp;
+
+  addr = sp;
+  if (name) {
+	if (strncmp (name, "Xintr", 5) == 0
+	 || strncmp (name, "Xhandle", 7) == 0) {
+		addr += 8;		/* It's an interrupt frame.  */
+	}
+  }
+
+#ifdef DEBUG_TRAPFRAME
+  for (i = 0; i < 50; i++) {
+    cs = read_memory_unsigned_integer (addr + i * 8, 8, byte_order);
+    printf("%s i=%d r=%#jx\n", name, i, (intmax_t)cs);
+  }
+#endif
 
   for (i = 0; i < ARRAY_SIZE (amd64nbsd_tf_reg_offset); i++)
     if (amd64nbsd_tf_reg_offset[i] != -1)
@@ -163,6 +174,10 @@ amd64nbsd_trapframe_cache(struct frame_i
   rip = read_memory_unsigned_integer (addr
     + amd64nbsd_tf_reg_offset[AMD64_RIP_REGNUM], 8, byte_order);
 
+#ifdef DEBUG_TRAPFRAME
+  printf("%s cs=%#jx rip=%#jx\n", name, (intmax_t)cs, (intmax_t)rip);
+#endif
+
   /* The trap frame layout was changed lf the %rip value is less than 2^16 it
    * is almost certainly the %ss of the old format. */
   if (rip < (1 << 16))
@@ -243,16 +258,20 @@ amd64nbsd_trapframe_sniffer (const struc
 
   find_pc_partial_function (get_frame_pc (this_frame), &name, NULL, NULL);
   return (name && ((strcmp (name, "alltraps") == 0)
-		   || (strcmp (name, "calltrap") == 0)
-		   || (strncmp (name, "Xtrap", 5) == 0)
-		   || (strcmp (name, "osyscall1") == 0)
-		   || (strcmp (name, "Xsyscall") == 0)
-		   || (strncmp (name, "Xintr", 5) == 0)
-		   || (strncmp (name, "Xresume", 7) == 0)
-		   || (strncmp (name, "Xstray", 6) == 0)
-		   || (strncmp (name, "Xrecurse", 8) == 0)
-		   || (strncmp (name, "Xsoft", 5) == 0)
-		   || (strcmp (name, "Xdoreti") == 0)));
+	        || (strcmp (name, "calltrap") == 0)
+	        || (strcmp (name, "handle_syscall") == 0)
+		|| (strcmp (name, "Xdoreti") == 0)
+		|| (strcmp (name, "Xspllower") == 0)
+		|| (strncmp (name, "Xhandle", 7) == 0)
+		|| (strncmp (name, "Xintr", 5) == 0)
+		|| (strncmp (name, "Xpreempt", 8) == 0)
+		|| (strncmp (name, "Xrecurse", 8) == 0)
+		|| (strncmp (name, "Xresume", 7) == 0)
+		|| (strncmp (name, "Xsoft", 5) == 0)
+		|| (strncmp (name, "Xstray", 6) == 0)
+		|| (strncmp (name, "Xsyscall", 8) == 0)
+		|| (strncmp (name, "Xtrap", 5) == 0)
+	    ));
 }
 
 static const struct frame_unwind amd64nbsd_trapframe_unwind = {
Index: src/external/gpl3/gdb/dist/gdb/i386-nbsd-tdep.c
diff -u src/external/gpl3/gdb/dist/gdb/i386-nbsd-tdep.c:1.3 src/external/gpl3/gdb/dist/gdb/i386-nbsd-tdep.c:1.4
--- src/external/gpl3/gdb/dist/gdb/i386-nbsd-tdep.c:1.3	Wed Nov 29 13:15:29 2017
+++ src/external/gpl3/gdb/dist/gdb/i386-nbsd-tdep.c	Mon Apr 23 10:53:07 2018
@@ -312,7 +312,8 @@ i386nbsd_trapframe_cache(struct frame_in
   sp = get_frame_register_unsigned (this_frame, I386_ESP_REGNUM);
 
   find_pc_partial_function (func, &name, NULL, NULL);
-  if (name && strncmp (name, "Xintr", 5) == 0)
+  if (name && (strncmp (name, "Xintr", 5) == 0 ||
+               strncmp (name, "Xhandle", 7) == 0))
     {
       /* It's an interrupt frame. */
       tmp = read_memory_unsigned_integer (sp + 4, 4, byte_order);
@@ -391,16 +392,19 @@ i386nbsd_trapframe_sniffer (const struct
 
   find_pc_partial_function (get_frame_pc (this_frame), &name, NULL, NULL);
   return (name && ((strcmp (name, "alltraps") == 0)
-		   || (strcmp (name, "calltrap") == 0)
-		   || (strncmp (name, "Xtrap", 5) == 0)
-		   || (strcmp (name, "syscall1") == 0)
-		   || (strcmp (name, "Xsyscall") == 0)
-		   || (strncmp (name, "Xintr", 5) == 0)
-		   || (strncmp (name, "Xresume", 7) == 0)
-		   || (strncmp (name, "Xstray", 6) == 0)
-		   || (strncmp (name, "Xrecurse", 8) == 0)
-		   || (strncmp (name, "Xsoft", 5) == 0)
-		   || (strncmp (name, "Xdoreti", 5) == 0)));
+	        || (strcmp (name, "calltrap") == 0)
+		|| (strcmp (name, "syscall1") == 0)
+		|| (strcmp (name, "Xdoreti") == 0)
+		|| (strncmp (name, "Xintr", 5) == 0)
+		|| (strncmp (name, "Xhandle", 7) == 0)
+		|| (strncmp (name, "Xpreempt", 8) == 0)
+		|| (strncmp (name, "Xrecurse", 8) == 0)
+		|| (strncmp (name, "Xresume", 7) == 0)
+		|| (strncmp (name, "Xsoft", 5) == 0)
+		|| (strncmp (name, "Xstray", 6) == 0)
+		|| (strncmp (name, "Xsyscall", 8) == 0)
+		|| (strncmp (name, "Xtrap", 5) == 0)
+	    ));
 }
 
 const struct frame_unwind i386nbsd_trapframe_unwind = {

Reply via email to