Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/i386/include prevent coredumps by skipping everythi...



details:   https://anonhg.NetBSD.org/src/rev/167d0cc1cee6
branches:  trunk
changeset: 824289:167d0cc1cee6
user:      christos <christos%NetBSD.org@localhost>
date:      Wed May 31 01:50:19 2017 +0000

description:
prevent coredumps by skipping everything early if we are not counting.

diffstat:

 sys/arch/i386/include/profile.h |  9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diffs (30 lines):

diff -r f6c39cc6d9bf -r 167d0cc1cee6 sys/arch/i386/include/profile.h
--- a/sys/arch/i386/include/profile.h   Wed May 31 01:31:07 2017 +0000
+++ b/sys/arch/i386/include/profile.h   Wed May 31 01:50:19 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: profile.h,v 1.34 2016/01/10 09:04:32 ryo Exp $ */
+/*     $NetBSD: profile.h,v 1.35 2017/05/31 01:50:19 christos Exp $    */
 
 /*
  * Copyright (c) 1992, 1993
@@ -45,6 +45,12 @@
 #define MCOUNT_COMPAT  /* nothing */
 #endif
 
+#if defined(_REENTRANT) && !defined(_KERNEL) 
+#define MCOUNT_ACTIVE  if (_gmonparam.state != GMON_PROF_ON) return
+#else
+#define MCOUNT_ACTIVE  
+#endif
+
 #define        MCOUNT \
 MCOUNT_COMPAT                                                          \
 extern void mcount(void) __asm(MCOUNT_ENTRY)                           \
@@ -55,6 +61,7 @@
        int selfpc, frompcindex;                                        \
        int eax, ecx, edx;                                              \
                                                                        \
+       MCOUNT_ACTIVE;                                                  \
        __asm volatile("movl %%eax,%0" : "=g" (eax));                   \
        __asm volatile("movl %%ecx,%0" : "=g" (ecx));                   \
        __asm volatile("movl %%edx,%0" : "=g" (edx));                   \



Home | Main Index | Thread Index | Old Index