Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/usermode/usermode Cleanup the exec debugging printf...



details:   https://anonhg.NetBSD.org/src/rev/e2b8df43350f
branches:  trunk
changeset: 769287:e2b8df43350f
user:      reinoud <reinoud%NetBSD.org@localhost>
date:      Mon Sep 05 18:31:04 2011 +0000

description:
Cleanup the exec debugging printf mess in usermode's machdep.c and make them
depend on DEBUG_EXEC

diffstat:

 sys/arch/usermode/usermode/machdep.c |  52 +++++++++++++++++++++++------------
 1 files changed, 34 insertions(+), 18 deletions(-)

diffs (86 lines):

diff -r 3798e2614727 -r e2b8df43350f sys/arch/usermode/usermode/machdep.c
--- a/sys/arch/usermode/usermode/machdep.c      Mon Sep 05 18:29:36 2011 +0000
+++ b/sys/arch/usermode/usermode/machdep.c      Mon Sep 05 18:31:04 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.23 2011/09/04 21:08:18 jmcneill Exp $ */
+/* $NetBSD: machdep.c,v 1.24 2011/09/05 18:31:04 reinoud Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -31,7 +31,7 @@
 #include "opt_urkelvisor.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.23 2011/09/04 21:08:18 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.24 2011/09/05 18:31:04 reinoud Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -147,12 +147,19 @@
        struct pcb *pcb = lwp_getpcb(l);
        ucontext_t *ucp = &pcb->pcb_userland_ucp;
 
-printf("setregs called: lwp %p, exec package %p, stack %p\n", l, pack, (void *) stack);
-printf("current stat of pcb %p\n", pcb);
-printf("\tpcb->pcb_ucp.uc_stack.ss_sp   = %p\n", pcb->pcb_ucp.uc_stack.ss_sp);
-printf("\tpcb->pcb_ucp.uc_stack.ss_size = %d\n", (int) pcb->pcb_ucp.uc_stack.ss_size);
-printf("\tpcb->pcb_userland_ucp.uc_stack.ss_sp   = %p\n", pcb->pcb_userland_ucp.uc_stack.ss_sp);
-printf("\tpcb->pcb_userland_ucp.uc_stack.ss_size = %d\n", (int) pcb->pcb_userland_ucp.uc_stack.ss_size);
+#ifdef DEBUG_EXEC
+       printf("setregs called: lwp %p, exec package %p, stack %p\n",
+               l, pack, (void *) stack);
+       printf("current stat of pcb %p\n", pcb);
+       printf("\tpcb->pcb_ucp.uc_stack.ss_sp   = %p\n",
+               pcb->pcb_ucp.uc_stack.ss_sp);
+       printf("\tpcb->pcb_ucp.uc_stack.ss_size = %d\n",
+               (int) pcb->pcb_ucp.uc_stack.ss_size);
+       printf("\tpcb->pcb_userland_ucp.uc_stack.ss_sp   = %p\n",
+               pcb->pcb_userland_ucp.uc_stack.ss_sp);
+       printf("\tpcb->pcb_userland_ucp.uc_stack.ss_size = %d\n",
+               (int) pcb->pcb_userland_ucp.uc_stack.ss_size);
+#endif
 
 #ifdef __i386__
        uint *reg, i;
@@ -170,22 +177,31 @@
        reg[17] = (stack);              /* _REG_UESP */
 
 #if 0
-const char *name[] = {"GS", "FS", "ES", "DS", "EDI", "ESI", "EBP", "ESP", "EBX", "EDX", "ECX", "EAX", "TRAPNO", "ERR", "EIP", "CS", "EFL", "UESP", "SS"};
+       /* register dump before call */
+       const char *name[] = {"GS", "FS", "ES", "DS", "EDI", "ESI", "EBP", "ESP",
+               "EBX", "EDX", "ECX", "EAX", "TRAPNO", "ERR", "EIP", "CS", "EFL",
+               "UESP", "SS"};
 
-for (i =0; i < 19; i++)
-       printf("reg[%02d] (%6s) = %"PRIx32"\n", i, name[i], reg[i]);
+       for (i =0; i < 19; i++)
+               printf("reg[%02d] (%6s) = %"PRIx32"\n", i, name[i], reg[i]);
 #endif
 #else
 #      error setregs() not yet ported to this architecture
 #endif
 
-printf("updated pcb %p\n", pcb);
-printf("\tpcb->pcb_ucp.uc_stack.ss_sp   = %p\n", pcb->pcb_ucp.uc_stack.ss_sp);
-printf("\tpcb->pcb_ucp.uc_stack.ss_size = %d\n", (int) pcb->pcb_ucp.uc_stack.ss_size);
-printf("\tpcb->pcb_userland_ucp.uc_stack.ss_sp   = %p\n", pcb->pcb_userland_ucp.uc_stack.ss_sp);
-printf("\tpcb->pcb_userland_ucp.uc_stack.ss_size = %d\n", (int) pcb->pcb_userland_ucp.uc_stack.ss_size);
-printf("\tpack->ep_entry                = %p\n", (void *) pack->ep_entry);
-printf("\t    argument                  = %p\n", &pcb->pcb_tf);
+#ifdef DEBUG_EXEC
+       printf("updated pcb %p\n", pcb);
+       printf("\tpcb->pcb_ucp.uc_stack.ss_sp   = %p\n",
+               pcb->pcb_ucp.uc_stack.ss_sp);
+       printf("\tpcb->pcb_ucp.uc_stack.ss_size = %d\n",
+               (int) pcb->pcb_ucp.uc_stack.ss_size);
+       printf("\tpcb->pcb_userland_ucp.uc_stack.ss_sp   = %p\n",
+               pcb->pcb_userland_ucp.uc_stack.ss_sp);
+       printf("\tpcb->pcb_userland_ucp.uc_stack.ss_size = %d\n",
+               (int) pcb->pcb_userland_ucp.uc_stack.ss_size);
+       printf("\tpack->ep_entry                = %p\n",
+               (void *) pack->ep_entry);
+#endif
 }
 
 void



Home | Main Index | Thread Index | Old Index