VirtualBox

Changeset 74344 in vbox


Ignore:
Timestamp:
Sep 18, 2018 2:24:24 PM (6 years ago)
Author:
vboxsync
Message:

IPRT/assert: Added check for env var IPRT_ASSERT_NO_STACK and IsDebuggerPresent() before dumping the stack.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/misc/assert.cpp

    r73762 r74344  
    4444#include <iprt/stdarg.h>
    4545#ifdef IN_RING3
     46# include <iprt/env.h>
    4647# include <stdio.h>
     48# ifdef RT_OS_WINDOWS
     49#  include <iprt/win/windows.h>
     50# endif
    4751#endif
    4852#include "internal/assert.h"
     
    139143#ifdef IPRT_WITH_ASSERT_STACK
    140144        /* The stack dump. */
    141         char szStack[sizeof(g_szRTAssertStack)];
    142         size_t cchStack = RTDbgStackDumpSelf(szStack, sizeof(szStack), 0);
     145        char   szStack[sizeof(g_szRTAssertStack)];
     146        size_t cchStack = 0;
     147# if defined(IN_RING3) && defined(RT_OS_WINDOWS) /** @todo make this stack on/off thing more modular. */
     148        bool   fStack = !IsDebuggerPresent() && !RTEnvExist("IPRT_ASSERT_NO_STACK");
     149# elif defined(IN_RING3)
     150        bool   fStack = !RTEnvExist("IPRT_ASSERT_NO_STACK");
     151# else
     152        bool   fStack = true;
     153# endif
     154        if (fStack)
     155            cchStack = RTDbgStackDumpSelf(szStack, sizeof(szStack), 0);
     156        else
     157            szStack[0] = '\0';
    143158        memcpy(g_szRTAssertStack, szStack, cchStack + 1);
    144159#endif
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette