Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 30 May 2004 20:37:29 -0700 (PDT)
From:      Marcel Moolenaar <marcel@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 53842 for review
Message-ID:  <200405310337.i4V3bStZ073044@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=53842

Change 53842 by marcel@marcel_nfs on 2004/05/30 20:36:38

	Have get_esp() take a pointer to a trapframe so that it
	works with any thread, not just the one that entered the
	debugger.

Affected files ...

.. //depot/projects/gdb/sys/i386/i386/db_trace.c#5 edit

Differences ...

==== //depot/projects/gdb/sys/i386/i386/db_trace.c#5 (text+ko) ====

@@ -59,10 +59,10 @@
 static db_varfcn_t db_esp;
 
 static __inline int
-get_esp(void)
+get_esp(struct trapframe *tf)
 {
-	return ((ISPL(ddb_regs.tf_cs)) ? ddb_regs.tf_esp :
-	    (db_expr_t)kdb_frame + offsetof(struct trapframe, tf_esp));
+	return ((ISPL(tf->tf_cs)) ? tf->tf_esp :
+	    (db_expr_t)tf + offsetof(struct trapframe, tf_esp));
 }
 
 /*
@@ -125,7 +125,7 @@
 db_esp (struct db_variable *vp, db_expr_t *valuep, int op)
 {
 	if (op == DB_VAR_GET)
-		*valuep = get_esp();
+		*valuep = get_esp(kdb_frame);
 	else if (ISPL(ddb_regs.tf_cs))
 		ddb_regs.tf_esp = *valuep;
 	return (0);
@@ -300,7 +300,7 @@
 		tf = (struct trapframe *)((int)*fp + 8);
 
 	if (INKERNEL((int) tf)) {
-		esp = get_esp();
+		esp = get_esp(tf);
 		eip = tf->tf_eip;
 		ebp = tf->tf_ebp;
 		switch (frame_type) {
@@ -366,20 +366,20 @@
 				instr = db_get_value(pc, 4, FALSE);
 				if ((instr & 0xffffff) == 0x00e58955) {
 					/* pushl %ebp; movl %esp, %ebp */
-					actframe = (void *)(get_esp() - 4);
+					actframe = (void *)(get_esp(tf) - 4);
 				} else if ((instr & 0xffff) == 0x0000e589) {
 					/* movl %esp, %ebp */
-					actframe = (void *)get_esp();
+					actframe = (void *)get_esp(tf);
 					if (ddb_regs.tf_ebp == 0) {
 						/* Fake frame better. */
 						frame = actframe;
 					}
 				} else if ((instr & 0xff) == 0x000000c3) {
 					/* ret */
-					actframe = (void *)(get_esp() - 4);
+					actframe = (void *)(get_esp(tf) - 4);
 				} else if (offset == 0) {
 					/* Probably an assembler symbol. */
-					actframe = (void *)(get_esp() - 4);
+					actframe = (void *)(get_esp(tf) - 4);
 				}
 			} else if (strcmp(name, "fork_trampoline") == 0) {
 				/*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200405310337.i4V3bStZ073044>