PERFORCE change 50302 for review

Marcel Moolenaar marcel at FreeBSD.org
Sat Apr 3 19:33:33 PST 2004


http://perforce.freebsd.org/chv.cgi?CH=50302

Change 50302 by marcel at marcel_nfs on 2004/04/03 19:33:17

	We don't set tf_esp and tf_ss when we were already in
	kernel mode. We don't fixup the trapframe. We deal with
	it when we return the register values in gdb_cpu_getreg().
	It's easier because it it works when we switch threads.

Affected files ...

.. //depot/projects/gdb/sys/i386/i386/gdb_machdep.c#6 edit

Differences ...

==== //depot/projects/gdb/sys/i386/i386/gdb_machdep.c#6 (text+ko) ====

@@ -45,6 +45,7 @@
 void *
 gdb_cpu_getreg(int regnum, size_t *regsz)
 {
+	static register_t synth;
 	struct trapframe *tf = kdb_frame;
 
 	*regsz = gdb_cpu_regsz(regnum);
@@ -53,16 +54,21 @@
 	case 1:  return (&tf->tf_ecx);
 	case 2:  return (&tf->tf_edx);
 	case 3:  return (&tf->tf_ebx);
-	case 4:  return (&tf->tf_esp);
 	case 5:  return (&tf->tf_ebp);
 	case 6:  return (&tf->tf_esi);
 	case 7:  return (&tf->tf_edi);
 	case 8:  return (&tf->tf_eip);
 	case 9:  return (&tf->tf_eflags);
 	case 10: return (&tf->tf_cs);
-	case 11: return (&tf->tf_ss);
 	case 12: return (&tf->tf_ds);
 	case 13: return (&tf->tf_es);
+	case 4:
+		synth = (!ISPL(tf->tf_cs)) ?
+		    (int)&(kdb_thread->td_frame->tf_esp) : tf->tf_esp;
+		return (&synth);
+	case 11:
+		synth = (!ISPL(tf->tf_cs)) ? rss() : tf->tf_ss;
+		return (&synth);
 	}
 	return (NULL);
 }


More information about the p4-projects mailing list