VirtualBox

Changeset 96448 in vbox


Ignore:
Timestamp:
Aug 23, 2022 10:35:23 PM (2 years ago)
Author:
vboxsync
Message:

IPRT/nocrt: A few tricks to avoid dragging in log.cpp into static binaries, unless there is an explicit log creation or debug logging in the app (or IPRT for the latter). bugref:10261

Location:
trunk
Files:
3 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/formats/pecoff.h

    r96407 r96448  
    741741 * @{  */
    742742/** No handler.
    743  * @note Aslo know as UNW_FLAG_NHANDLER. */
     743 * @note Also know as UNW_FLAG_NHANDLER. */
    744744#define IMAGE_UNW_FLAGS_NHANDLER        0
    745745/** Have exception handler (RVA after codes, dword aligned.)
    746  * @note Aslo know as UNW_FLAG_NHANDLER. */
     746 * @note Also know as UNW_FLAG_NHANDLER. */
    747747#define IMAGE_UNW_FLAGS_EHANDLER        1
    748748/** Have unwind handler (RVA after codes, dword aligned.)
    749  * @note Aslo know as UNW_FLAG_NHANDLER. */
     749 * @note Also know as UNW_FLAG_NHANDLER. */
    750750#define IMAGE_UNW_FLAGS_UHANDLER        2
    751751/** Set if not primary unwind info for a function.  An
  • trunk/include/iprt/log.h

    r96407 r96448  
    13521352 * Checks whether the specified release logging group is enabled or not.
    13531353 */
    1354 #define LogRelIsItEnabled(a_fFlags, a_iGroup) ( RTLogRelGetDefaultInstanceEx(RT_MAKE_U32(a_fFlags, a_iGroup)) != NULL )
     1354#define LogRelIsItEnabled(a_fFlags, a_iGroup) ( RTLogRelGetDefaultInstanceExWeak(RT_MAKE_U32(a_fFlags, a_iGroup)) != NULL )
    13551355
    13561356/** @def LogRelIsEnabled
     
    14421442    do \
    14431443    { \
    1444         PRTLOGGER LogRelIt_pLogger = RTLogRelGetDefaultInstanceEx(RT_MAKE_U32(a_fFlags, a_iGroup)); \
     1444        PRTLOGGER LogRelIt_pLogger = RTLogRelGetDefaultInstanceExWeak(RT_MAKE_U32(a_fFlags, a_iGroup)); \
    14451445        if (RT_LIKELY(!LogRelIt_pLogger)) \
    14461446        { /* likely */ } \
    14471447        else \
    1448             RTLogLoggerEx(LogRelIt_pLogger, a_fFlags, a_iGroup, __VA_ARGS__); \
     1448            RTLogLoggerExWeak(LogRelIt_pLogger, a_fFlags, a_iGroup, __VA_ARGS__); \
    14491449        _LogIt(a_fFlags, a_iGroup, __VA_ARGS__); \
    14501450    } while (0)
     
    14541454    do \
    14551455    { \
    1456         PRTLOGGER LogRelIt_pLogger = RTLogRelGetDefaultInstanceEx(RT_MAKE_U32(a_fFlags, a_iGroup)); \
     1456        PRTLOGGER LogRelIt_pLogger = RTLogRelGetDefaultInstanceExWeak(RT_MAKE_U32(a_fFlags, a_iGroup)); \
    14571457        if (LogRelIt_pLogger) \
    1458             RTLogLoggerEx(LogRelIt_pLogger, a_fFlags, a_iGroup, __VA_ARGS__); \
     1458            RTLogLoggerExWeak(LogRelIt_pLogger, a_fFlags, a_iGroup, __VA_ARGS__); \
    14591459        _LogIt(a_fFlags, a_iGroup, __VA_ARGS__); \
    14601460    } while (0)
     
    14641464    do \
    14651465    { \
    1466         PRTLOGGER LogRelIt_pLogger = RTLogRelGetDefaultInstanceEx(RT_MAKE_U32(a_fFlags, a_iGroup)); \
     1466        PRTLOGGER LogRelIt_pLogger = RTLogRelGetDefaultInstanceExWeak(RT_MAKE_U32(a_fFlags, a_iGroup)); \
    14671467        if (LogRelIt_pLogger) \
    14681468        { \
     
    14711471            { \
    14721472                s_LogRelMaxIt_cLogged++; \
    1473                 RTLogLoggerEx(LogRelIt_pLogger, a_fFlags, a_iGroup, __VA_ARGS__); \
     1473                RTLogLoggerExWeak(LogRelIt_pLogger, a_fFlags, a_iGroup, __VA_ARGS__); \
    14741474            } \
    14751475        } \
     
    14821482   do \
    14831483   { \
    1484        PRTLOGGER LogRelIt_pLogger = RTLogRelGetDefaultInstanceEx(RT_MAKE_U32(a_fFlags, a_iGroup)); \
     1484       PRTLOGGER LogRelIt_pLogger = RTLogRelGetDefaultInstanceExWeak(RT_MAKE_U32(a_fFlags, a_iGroup)); \
    14851485       if (LogRelIt_pLogger) \
    14861486       { \
     
    14921492   do \
    14931493   { \
    1494        PRTLOGGER LogRelIt_pLogger = RTLogRelGetDefaultInstanceEx(RT_MAKE_U32(a_fFlags, a_iGroup)); \
     1494       PRTLOGGER LogRelIt_pLogger = RTLogRelGetDefaultInstanceExWeak(RT_MAKE_U32(a_fFlags, a_iGroup)); \
    14951495       if (RT_LIKELY(!LogRelIt_pLogger)) \
    14961496       { /* likely */ } \
     
    15041504   do \
    15051505   { \
    1506        PRTLOGGER LogRelIt_pLogger = RTLogRelGetDefaultInstanceEx(RT_MAKE_U32(a_fFlags, a_iGroup)); \
     1506       PRTLOGGER LogRelIt_pLogger = RTLogRelGetDefaultInstanceExWeak(RT_MAKE_U32(a_fFlags, a_iGroup)); \
    15071507       if (LogRelIt_pLogger) \
    15081508       { \
     
    18081808RTDECL(PRTLOGGER) RTLogRelGetDefaultInstance(void);
    18091809
     1810/** @copydoc RTLogRelGetDefaultInstance   */
     1811typedef DECLCALLBACKTYPE(PRTLOGGER, FNLOGRELGETDEFAULTINSTANCE,(void));
     1812/** Pointer to RTLogRelGetDefaultInstance. */
     1813typedef FNLOGRELGETDEFAULTINSTANCE *PFNLOGRELGETDEFAULTINSTANCE;
     1814
     1815/** "Weak symbol" emulation for RTLogRelGetDefaultInstance.
     1816 * @note This is first set when RTLogRelSetDefaultInstance is called. */
     1817extern RTDATADECL(PFNLOGRELGETDEFAULTINSTANCE) g_pfnRTLogRelGetDefaultInstance;
     1818
     1819/** "Weak symbol" wrapper for RTLogRelGetDefaultInstance. */
     1820DECL_FORCE_INLINE(PRTLOGGER) RTLogRelGetDefaultInstanceWeak(void)
     1821{
     1822#if defined(IN_RING3) && (defined(IN_RT_STATIC) || defined(IPRT_NO_CRT))
     1823    if (g_pfnRTLogRelGetDefaultInstance)
     1824        return g_pfnRTLogRelGetDefaultInstance();
     1825    return NULL;
     1826#else
     1827    return RTLogRelGetDefaultInstance();
     1828#endif
     1829}
     1830
    18101831/**
    18111832 * Gets the default release logger instance.
     
    18161837 */
    18171838RTDECL(PRTLOGGER) RTLogRelGetDefaultInstanceEx(uint32_t fFlagsAndGroup);
     1839
     1840/** @copydoc RTLogRelGetDefaultInstanceEx   */
     1841typedef DECLCALLBACKTYPE(PRTLOGGER, FNLOGRELGETDEFAULTINSTANCEEX,(uint32_t fFlagsAndGroup));
     1842/** Pointer to RTLogRelGetDefaultInstanceEx. */
     1843typedef FNLOGRELGETDEFAULTINSTANCEEX *PFNLOGRELGETDEFAULTINSTANCEEX;
     1844
     1845/** "Weak symbol" emulation for RTLogRelGetDefaultInstanceEx.
     1846 * @note This is first set when RTLogRelSetDefaultInstance is called. */
     1847extern RTDATADECL(PFNLOGRELGETDEFAULTINSTANCEEX) g_pfnRTLogRelGetDefaultInstanceEx;
     1848
     1849/** "Weak symbol" wrapper for RTLogRelGetDefaultInstanceEx. */
     1850DECL_FORCE_INLINE(PRTLOGGER) RTLogRelGetDefaultInstanceExWeak(uint32_t fFlagsAndGroup)
     1851{
     1852#if defined(IN_RING3) && (defined(IN_RT_STATIC) || defined(IPRT_NO_CRT))
     1853    if (g_pfnRTLogRelGetDefaultInstanceEx)
     1854        return g_pfnRTLogRelGetDefaultInstanceEx(fFlagsAndGroup);
     1855    return NULL;
     1856#else
     1857    return RTLogRelGetDefaultInstanceEx(fFlagsAndGroup);
     1858#endif
     1859}
     1860
    18181861
    18191862/**
     
    20162059RTDECL(PRTLOGGER)   RTLogGetDefaultInstance(void);
    20172060
     2061/** @copydoc RTLogGetDefaultInstance   */
     2062typedef DECLCALLBACKTYPE(PRTLOGGER, FNLOGGETDEFAULTINSTANCE,(void));
     2063/** Pointer to RTLogGetDefaultInstance. */
     2064typedef FNLOGGETDEFAULTINSTANCE *PFNLOGGETDEFAULTINSTANCE;
     2065
     2066/** "Weak symbol" emulation for RTLogGetDefaultInstance.
     2067 * @note This is first set when RTLogSetDefaultInstance is called. */
     2068extern RTDATADECL(PFNLOGGETDEFAULTINSTANCE) g_pfnRTLogGetDefaultInstance;
     2069
     2070/** "Weak symbol" wrapper for RTLogGetDefaultInstance. */
     2071DECL_FORCE_INLINE(PRTLOGGER) RTLogGetDefaultInstanceWeak(void)
     2072{
     2073#if defined(IN_RING3) && (defined(IN_RT_STATIC) || defined(IPRT_NO_CRT))
     2074    if (g_pfnRTLogGetDefaultInstance)
     2075        return g_pfnRTLogGetDefaultInstance();
     2076    return NULL;
     2077#else
     2078    return RTLogGetDefaultInstance();
     2079#endif
     2080}
     2081
    20182082/**
    20192083 * Gets the default logger instance if enabled (does not create one).
     
    20252089 */
    20262090RTDECL(PRTLOGGER)   RTLogGetDefaultInstanceEx(uint32_t fFlagsAndGroup);
     2091
     2092/** @copydoc RTLogGetDefaultInstanceEx   */
     2093typedef DECLCALLBACKTYPE(PRTLOGGER, FNLOGGETDEFAULTINSTANCEEX,(uint32_t fFlagsAndGroup));
     2094/** Pointer to RTLogGetDefaultInstanceEx. */
     2095typedef FNLOGGETDEFAULTINSTANCEEX *PFNLOGGETDEFAULTINSTANCEEX;
     2096
     2097/** "Weak symbol" emulation for RTLogGetDefaultInstanceEx.
     2098 * @note This is first set when RTLogSetDefaultInstance is called. */
     2099extern RTDATADECL(PFNLOGGETDEFAULTINSTANCEEX) g_pfnRTLogGetDefaultInstanceEx;
     2100
     2101/** "Weak symbol" wrapper for RTLogGetDefaultInstanceEx. */
     2102DECL_FORCE_INLINE(PRTLOGGER) RTLogGetDefaultInstanceExWeak(uint32_t fFlagsAndGroup)
     2103{
     2104#if defined(IN_RING3) && (defined(IN_RT_STATIC) || defined(IPRT_NO_CRT))
     2105    if (g_pfnRTLogGetDefaultInstanceEx)
     2106        return g_pfnRTLogGetDefaultInstanceEx(fFlagsAndGroup);
     2107    return NULL;
     2108#else
     2109    return RTLogGetDefaultInstanceEx(fFlagsAndGroup);
     2110#endif
     2111}
    20272112
    20282113/**
     
    24612546
    24622547/**
     2548 * Write to a logger instance, weak version.
     2549 *
     2550 * @param   pLogger     Pointer to logger instance.
     2551 * @param   pvCallerRet Ignored.
     2552 * @param   pszFormat   Format string.
     2553 * @param   ...         Format arguments.
     2554 */
     2555#if defined(IN_RING3) && (defined(IN_RT_STATIC) || defined(IPRT_NO_CRT))
     2556RTDECL(void) RTLogLoggerWeak(PRTLOGGER pLogger, void *pvCallerRet, const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(3, 4);
     2557#else /* Cannot use a DECL_FORCE_INLINE because older GCC versions doesn't support inlining va_start. */
     2558# undef  RTLogLoggerWeak /* in case of mangling */
     2559# define RTLogLoggerWeak RTLogLogger
     2560#endif
     2561
     2562/**
    24632563 * Write to a logger instance.
    24642564 *
     
    24862586RTDECL(void) RTLogLoggerEx(PRTLOGGER pLogger, unsigned fFlags, unsigned iGroup,
    24872587                           const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(4, 5);
     2588
     2589/**
     2590 * Write to a logger instance, weak version.
     2591 *
     2592 * This function will check whether the instance, group and flags makes up a
     2593 * logging kind which is currently enabled before writing anything to the log.
     2594 *
     2595 * @param   pLogger     Pointer to logger instance. If NULL the default logger instance will be attempted.
     2596 * @param   fFlags      The logging flags.
     2597 * @param   iGroup      The group.
     2598 *                      The value ~0U is reserved for compatibility with RTLogLogger[V] and is
     2599 *                      only for internal usage!
     2600 * @param   pszFormat   Format string.
     2601 * @param   ...         Format arguments.
     2602 * @remark  This is a worker function of LogIt.
     2603 */
     2604#if defined(IN_RING3) && (defined(IN_RT_STATIC) || defined(IPRT_NO_CRT))
     2605RTDECL(void) RTLogLoggerExWeak(PRTLOGGER pLogger, unsigned fFlags, unsigned iGroup,
     2606                               const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(4, 5);
     2607#else /* Cannot use a DECL_FORCE_INLINE because older GCC versions doesn't support inlining va_start. */
     2608# undef  RTLogLoggerExWeak /* in case of mangling */
     2609# define RTLogLoggerExWeak RTLogLoggerEx
     2610#endif
    24882611
    24892612/**
     
    25062629                           const char *pszFormat, va_list args) RT_IPRT_FORMAT_ATTR(4, 0);
    25072630
     2631/** @copydoc RTLogLoggerExV */
     2632typedef DECLCALLBACKTYPE(int, FNRTLOGLOGGEREXV,(PRTLOGGER pLogger, unsigned fFlags, unsigned iGroup,
     2633                                                const char *pszFormat, va_list args)) RT_IPRT_FORMAT_ATTR(4, 0);
     2634/** Pointer to RTLogLoggerExV. */
     2635typedef FNRTLOGLOGGEREXV *PFNRTLOGLOGGEREXV;
     2636/** "Weak symbol" emulation for RTLogLoggerExV.
     2637 * @note This is first set when RTLogCreateEx or RTLogCreate is called. */
     2638extern RTDATADECL(PFNRTLOGLOGGEREXV)  g_pfnRTLogLoggerExV;
     2639
     2640/** "Weak symbol" wrapper for RTLogLoggerExV. */
     2641DECL_FORCE_INLINE(int) RTLogLoggerExVWeak(PRTLOGGER pLogger, unsigned fFlags, unsigned iGroup,
     2642                                          const char *pszFormat, va_list args) /* RT_IPRT_FORMAT_ATTR(4, 0) */
     2643{
     2644#if defined(IN_RING3) && (defined(IN_RT_STATIC) || defined(IPRT_NO_CRT))
     2645    if (g_pfnRTLogLoggerExV)
     2646        return g_pfnRTLogLoggerExV(pLogger, fFlags, iGroup, pszFormat, args);
     2647    return 22301; /* VINF_LOG_DISABLED, don't want err.h dependency here. */
     2648#else
     2649    return RTLogLoggerExV(pLogger, fFlags, iGroup, pszFormat, args);
     2650#endif
     2651}
     2652
    25082653/**
    25092654 * printf like function for writing to the default log.
     
    25352680 */
    25362681RTDECL(void) RTLogDumpPrintfV(void *pvUser, const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(2, 0);
     2682
     2683/**
     2684 * Used for logging assertions, debug and release log as appropriate.
     2685 *
     2686 * Implies flushing.
     2687 *
     2688 * @param   pszFormat   Format string.
     2689 * @param   ...         Format arguments.
     2690 */
     2691typedef DECLCALLBACKTYPE(void, FNRTLOGASSERTION,(const char *pszFormat, ...)) RT_IPRT_FORMAT_ATTR(1, 2);
     2692/** Pointer to an assertion logger, ellipsis variant. */
     2693typedef FNRTLOGASSERTION *PFNRTLOGASSERTION;
     2694
     2695/**
     2696 * Used for logging assertions, debug and release log as appropriate.
     2697 *
     2698 * Implies flushing.
     2699 *
     2700 * @param   pszFormat   Format string.
     2701 * @param   va          Format arguments.
     2702 */
     2703typedef DECLCALLBACKTYPE(void, FNRTLOGASSERTIONV,(const char *pszFormat, va_list va)) RT_IPRT_FORMAT_ATTR(1, 0);
     2704/** Pointer to an assertion logger, va_list variant. */
     2705typedef FNRTLOGASSERTIONV *PFNRTLOGASSERTIONV;
     2706
     2707/** @copydoc FNRTLOGASSERTION */
     2708RTDECL(void) RTLogAssert(const char *pszFormat, ...) RT_IPRT_FORMAT_ATTR(1, 2);
     2709/** @copydoc FNRTLOGASSERTIONV */
     2710RTDECL(void) RTLogAssertV(const char *pszFormat, va_list va) RT_IPRT_FORMAT_ATTR(1, 0);
     2711
     2712/** "Weak symbol" emulation for RTLogAssert. */
     2713extern RTDATADECL(PFNRTLOGASSERTION)  g_pfnRTLogAssert;
     2714/** "Weak symbol" emulation for RTLogAssertV. */
     2715extern RTDATADECL(PFNRTLOGASSERTIONV) g_pfnRTLogAssertV;
    25372716
    25382717
  • trunk/include/iprt/mangling.h

    r96407 r96448  
    14471447# define RTLockValidatorWriteLockGetCount               RT_MANGLER(RTLockValidatorWriteLockGetCount)
    14481448# define RTLockValidatorWriteLockInc                    RT_MANGLER(RTLockValidatorWriteLockInc)
     1449# define RTLogAssert                                    RT_MANGLER(RTLogAssert)
     1450# define RTLogAssertV                                   RT_MANGLER(RTLogAssertV)
    14491451# define RTLogBackdoorPrintf                            RT_MANGLER(RTLogBackdoorPrintf) /* r0drv-guest */
    14501452# define RTLogBackdoorPrintfV                           RT_MANGLER(RTLogBackdoorPrintfV) /* r0drv-guest */
     
    14751477# define RTLogGroupSettings                             RT_MANGLER(RTLogGroupSettings)
    14761478# define RTLogLogger                                    RT_MANGLER(RTLogLogger)
     1479# define RTLogLoggerWeak                                RT_MANGLER(RTLogLoggerWeak)
    14771480# define RTLogLoggerEx                                  RT_MANGLER(RTLogLoggerEx)
     1481# define RTLogLoggerExWeak                              RT_MANGLER(RTLogLoggerExWeak)
    14781482# define RTLogLoggerExV                                 RT_MANGLER(RTLogLoggerExV)
    14791483# define RTLogLoggerV                                   RT_MANGLER(RTLogLoggerV)
     
    42414245# define g_pStdIn                                       RT_MANGLER(g_pStdIn)
    42424246# define g_pStdOut                                      RT_MANGLER(g_pStdOut)
     4247# define g_pfnRTLogAssert                               RT_MANGLER(g_pfnRTLogAssert)
     4248# define g_pfnRTLogAssertV                              RT_MANGLER(g_pfnRTLogAssertV)
     4249# define g_pfnRTLogGetDefaultInstance                   RT_MANGLER(g_pfnRTLogGetDefaultInstance)
     4250# define g_pfnRTLogGetDefaultInstanceEx                 RT_MANGLER(g_pfnRTLogGetDefaultInstanceEx)
     4251# define g_pfnRTLogLoggerExV                            RT_MANGLER(g_pfnRTLogLoggerExV)
     4252# define g_pfnRTLogRelGetDefaultInstance                RT_MANGLER(g_pfnRTLogRelGetDefaultInstance)
     4253# define g_pfnRTLogRelGetDefaultInstanceEx              RT_MANGLER(g_pfnRTLogRelGetDefaultInstanceEx)
    42434254# define g_pszRTAssertExpr                              RT_MANGLER(g_pszRTAssertExpr)
    42444255# define g_pszRTAssertFile                              RT_MANGLER(g_pszRTAssertFile)
  • trunk/src/VBox/Runtime/Makefile.kmk

    r96444 r96448  
    520520        common/ldr/ldrPE.cpp \
    521521        common/log/log.cpp \
     522        common/log/log-weak.cpp \
     523        common/log/log-weak-assert.cpp \
     524        common/log/log-weak-rel.cpp \
    522525        common/log/logellipsis.cpp \
    523526        common/log/logrel.cpp \
     
    22732276        common/ldr/ldrVfsFile.cpp \
    22742277        common/log/log.cpp \
     2278        common/log/log-weak.cpp \
     2279        common/log/log-weak-assert.cpp \
     2280        common/log/log-weak-rel.cpp \
    22752281        common/log/logellipsis.cpp \
    22762282        common/log/logformat.cpp \
     
    34283434        common/err/errinfo.cpp \
    34293435        common/log/log.cpp \
     3436        common/log/log-weak.cpp \
     3437        common/log/log-weak-assert.cpp \
     3438        common/log/log-weak-rel.cpp \
    34303439        common/log/logellipsis.cpp \
    34313440        common/log/logrel.cpp \
     
    41724181        common/checksum/crc64.cpp \
    41734182        common/log/log.cpp \
     4183        common/log/log-weak.cpp \
     4184        common/log/log-weak-assert.cpp \
     4185        common/log/log-weak-rel.cpp \
    41744186        common/log/logellipsis.cpp \
    41754187        common/log/logrel.cpp \
  • trunk/src/VBox/Runtime/common/err/errinfolog.cpp

    r96407 r96448  
    5252    if (fFlags & RTERRINFO_LOG_F_RELEASE)
    5353    {
    54         PRTLOGGER pLogger = RTLogRelGetDefaultInstanceEx(RT_MAKE_U32(RTLOGGRPFLAGS_LEVEL_1, iLogGroup));
     54        PRTLOGGER pLogger = RTLogRelGetDefaultInstanceExWeak(RT_MAKE_U32(RTLOGGRPFLAGS_LEVEL_1, iLogGroup));
    5555        if (pLogger)
    56             RTLogLoggerEx(pLogger, RTLOGGRPFLAGS_LEVEL_1, iLogGroup, "RTErrInfoSet(%Rrc): %s\n", rc, pszMsg);
     56            RTLogLoggerExWeak(pLogger, RTLOGGRPFLAGS_LEVEL_1, iLogGroup, "RTErrInfoSet(%Rrc): %s\n", rc, pszMsg);
    5757    }
    5858
    59     PRTLOGGER pLogger = RTLogGetDefaultInstanceEx(RT_MAKE_U32(RTLOGGRPFLAGS_LEVEL_1, iLogGroup));
     59    PRTLOGGER pLogger = RTLogGetDefaultInstanceExWeak(RT_MAKE_U32(RTLOGGRPFLAGS_LEVEL_1, iLogGroup));
    6060    if (pLogger)
    61         RTLogLoggerEx(pLogger, RTLOGGRPFLAGS_LEVEL_1, iLogGroup, "RTErrInfoSet(%Rrc): %s\n", rc, pszMsg);
     61        RTLogLoggerExWeak(pLogger, RTLOGGRPFLAGS_LEVEL_1, iLogGroup, "RTErrInfoSet(%Rrc): %s\n", rc, pszMsg);
    6262
    6363    /* The setting: */
     
    9090    if (fFlags & RTERRINFO_LOG_F_RELEASE)
    9191    {
    92         PRTLOGGER pLogger = RTLogRelGetDefaultInstanceEx(RT_MAKE_U32(RTLOGGRPFLAGS_LEVEL_1, iLogGroup));
     92        PRTLOGGER pLogger = RTLogRelGetDefaultInstanceExWeak(RT_MAKE_U32(RTLOGGRPFLAGS_LEVEL_1, iLogGroup));
    9393        if (pLogger)
    94             RTLogLoggerEx(pLogger, RTLOGGRPFLAGS_LEVEL_1, iLogGroup, "RTErrInfoSet(%Rrc): %N\n", rc, pszFormat, &va);
     94            RTLogLoggerExWeak(pLogger, RTLOGGRPFLAGS_LEVEL_1, iLogGroup, "RTErrInfoSet(%Rrc): %N\n", rc, pszFormat, &va);
    9595    }
    9696
    97     PRTLOGGER pLogger = RTLogGetDefaultInstanceEx(RT_MAKE_U32(RTLOGGRPFLAGS_LEVEL_1, iLogGroup));
     97    PRTLOGGER pLogger = RTLogGetDefaultInstanceExWeak(RT_MAKE_U32(RTLOGGRPFLAGS_LEVEL_1, iLogGroup));
    9898    if (pLogger)
    99         RTLogLoggerEx(pLogger, RTLOGGRPFLAGS_LEVEL_1, iLogGroup, "RTErrInfoSet(%Rrc): %N\n", rc, pszFormat, &va);
     99        RTLogLoggerExWeak(pLogger, RTLOGGRPFLAGS_LEVEL_1, iLogGroup, "RTErrInfoSet(%Rrc): %N\n", rc, pszFormat, &va);
    100100
    101101    /* The setting: */
     
    131131    if (fFlags & RTERRINFO_LOG_F_RELEASE)
    132132    {
    133         PRTLOGGER pLogger = RTLogRelGetDefaultInstanceEx(RT_MAKE_U32(RTLOGGRPFLAGS_LEVEL_1, iLogGroup));
     133        PRTLOGGER pLogger = RTLogRelGetDefaultInstanceExWeak(RT_MAKE_U32(RTLOGGRPFLAGS_LEVEL_1, iLogGroup));
    134134        if (pLogger)
    135             RTLogLoggerEx(pLogger, RTLOGGRPFLAGS_LEVEL_1, iLogGroup, "RTErrInfoAdd(%Rrc): %s\n", rc, pszMsg);
     135            RTLogLoggerExWeak(pLogger, RTLOGGRPFLAGS_LEVEL_1, iLogGroup, "RTErrInfoAdd(%Rrc): %s\n", rc, pszMsg);
    136136    }
    137137
    138     PRTLOGGER pLogger = RTLogGetDefaultInstanceEx(RT_MAKE_U32(RTLOGGRPFLAGS_LEVEL_1, iLogGroup));
     138    PRTLOGGER pLogger = RTLogGetDefaultInstanceExWeak(RT_MAKE_U32(RTLOGGRPFLAGS_LEVEL_1, iLogGroup));
    139139    if (pLogger)
    140         RTLogLoggerEx(pLogger, RTLOGGRPFLAGS_LEVEL_1, iLogGroup, "RTErrInfoAdd(%Rrc): %s\n", rc, pszMsg);
     140        RTLogLoggerExWeak(pLogger, RTLOGGRPFLAGS_LEVEL_1, iLogGroup, "RTErrInfoAdd(%Rrc): %s\n", rc, pszMsg);
    141141
    142142    return rc;
     
    182182    if (fFlags & RTERRINFO_LOG_F_RELEASE)
    183183    {
    184         PRTLOGGER pLogger = RTLogRelGetDefaultInstanceEx(RT_MAKE_U32(RTLOGGRPFLAGS_LEVEL_1, iLogGroup));
     184        PRTLOGGER pLogger = RTLogRelGetDefaultInstanceExWeak(RT_MAKE_U32(RTLOGGRPFLAGS_LEVEL_1, iLogGroup));
    185185        if (pLogger)
    186             RTLogLoggerEx(pLogger, RTLOGGRPFLAGS_LEVEL_1, iLogGroup, "RTErrInfoAdd(%Rrc): %N\n", rc, pszFormat, &va);
     186            RTLogLoggerExWeak(pLogger, RTLOGGRPFLAGS_LEVEL_1, iLogGroup, "RTErrInfoAdd(%Rrc): %N\n", rc, pszFormat, &va);
    187187    }
    188188
    189     PRTLOGGER pLogger = RTLogGetDefaultInstanceEx(RT_MAKE_U32(RTLOGGRPFLAGS_LEVEL_1, iLogGroup));
     189    PRTLOGGER pLogger = RTLogGetDefaultInstanceExWeak(RT_MAKE_U32(RTLOGGRPFLAGS_LEVEL_1, iLogGroup));
    190190    if (pLogger)
    191         RTLogLoggerEx(pLogger, RTLOGGRPFLAGS_LEVEL_1, iLogGroup, "RTErrInfoAdd(%Rrc): %N\n", rc, pszFormat, &va);
     191        RTLogLoggerExWeak(pLogger, RTLOGGRPFLAGS_LEVEL_1, iLogGroup, "RTErrInfoAdd(%Rrc): %N\n", rc, pszFormat, &va);
    192192
    193193    return rc;
  • trunk/src/VBox/Runtime/common/log/log.cpp

    r96407 r96448  
    600600RTDECL(PRTLOGGER) RTLogSetDefaultInstance(PRTLOGGER pLogger)
    601601{
     602#if defined(IN_RING3) && (defined(IN_RT_STATIC) || defined(IPRT_NO_CRT))
     603    /* Set the pointers for emulating "weak symbols" the first time we're
     604       called with something useful: */
     605    if (pLogger != NULL && g_pfnRTLogGetDefaultInstanceEx == NULL)
     606    {
     607        g_pfnRTLogGetDefaultInstance   = RTLogGetDefaultInstance;
     608        g_pfnRTLogGetDefaultInstanceEx = RTLogGetDefaultInstanceEx;
     609    }
     610#endif
    602611    return ASMAtomicXchgPtrT(&g_pLogger, pLogger, PRTLOGGER);
    603612}
     
    717726RTDECL(PRTLOGGER) RTLogRelSetDefaultInstance(PRTLOGGER pLogger)
    718727{
     728#if defined(IN_RING3) && (defined(IN_RT_STATIC) || defined(IPRT_NO_CRT))
     729    /* Set the pointers for emulating "weak symbols" the first time we're
     730       called with something useful: */
     731    if (pLogger != NULL && g_pfnRTLogRelGetDefaultInstanceEx == NULL)
     732    {
     733        g_pfnRTLogRelGetDefaultInstance   = RTLogRelGetDefaultInstance;
     734        g_pfnRTLogRelGetDefaultInstanceEx = RTLogRelGetDefaultInstanceEx;
     735    }
     736#endif
    719737    return ASMAtomicXchgPtrT(&g_pRelLogger, pLogger, PRTLOGGER);
    720738}
     
    14461464                    pLoggerInt->fCreated = true;
    14471465                    *ppLogger = &pLoggerInt->Core;
     1466
     1467# if defined(IN_RING3) && (defined(IN_RT_STATIC) || defined(IPRT_NO_CRT))
     1468                    /* Make sure the weak symbol emulation bits are ready before returning. */
     1469                    if (!g_pfnRTLogLoggerExV)
     1470                        g_pfnRTLogLoggerExV = RTLogLoggerExV;
     1471# endif
    14481472                    return VINF_SUCCESS;
    14491473                }
     
    43284352RT_EXPORT_SYMBOL(RTLogDumpPrintfV);
    43294353
     4354
     4355RTDECL(void) RTLogAssert(const char *pszFormat, ...)
     4356{
     4357    va_list va;
     4358    va_start(va, pszFormat);
     4359    RTLogAssertV(pszFormat,va);
     4360    va_end(va);
     4361}
     4362
     4363
     4364RTDECL(void) RTLogAssertV(const char *pszFormat, va_list va)
     4365{
     4366    /*
     4367     * To the release log if we got one.
     4368     */
     4369    PRTLOGGER pLogger = RTLogRelGetDefaultInstance();
     4370    if (pLogger)
     4371    {
     4372        va_list vaCopy;
     4373        va_copy(vaCopy, va);
     4374        RTLogLoggerExV(pLogger, 0 /*fFlags*/, ~0U /*uGroup*/, pszFormat, vaCopy);
     4375        va_end(vaCopy);
     4376#ifndef IN_RC
     4377        RTLogFlush(pLogger);
     4378#endif
     4379    }
     4380
     4381    /*
     4382     * To the debug log if we got one, however when LOG_ENABLE (debug builds and
     4383     * such) we'll allow it to be created here.
     4384     */
     4385#ifdef LOG_ENABLED
     4386    pLogger = RTLogDefaultInstance();
     4387#else
     4388    pLogger = RTLogGetDefaultInstance();
     4389#endif
     4390    if (pLogger)
     4391    {
     4392        RTLogLoggerExV(pLogger, 0 /*fFlags*/, ~0U /*uGroup*/, pszFormat, va);
     4393# ifndef IN_RC /* flushing is done automatically in RC */
     4394        RTLogFlush(pLogger);
     4395#endif
     4396    }
     4397}
     4398
     4399
     4400#if defined(IN_RING3) && (defined(IN_RT_STATIC) || defined(IPRT_NO_CRT))
     4401/**
     4402 * "Weak symbol" emulation to prevent dragging in log.cpp and all its friends
     4403 * just because some code is using Assert() in a statically linked binary.
     4404 *
     4405 * The pointers are in log-assert-pfn.cpp, so users only drag in that file and
     4406 * they remain NULL unless this file is also linked into the binary.
     4407 */
     4408class RTLogAssertWeakSymbolEmulator
     4409{
     4410public:
     4411    RTLogAssertWeakSymbolEmulator(void)
     4412    {
     4413        g_pfnRTLogAssert  = RTLogAssert;
     4414        g_pfnRTLogAssertV = RTLogAssertV;
     4415    }
     4416};
     4417static RTLogAssertWeakSymbolEmulator rtLogInitWeakSymbolPointers;
     4418#endif
     4419
     4420
    43304421#ifdef IN_RING3
    43314422
  • trunk/src/VBox/Runtime/common/misc/assert.cpp

    r96407 r96448  
    186186
    187187#else  /* !IN_RING0 */
    188 # if !defined(IN_RING3) && !defined(LOG_NO_COM)
    189 #  if 0 /* Enable this iff you have a COM port and really want this debug info. */
    190         RTLogComPrintf("\n!!Assertion Failed!!\n"
    191                        "Expression: %s\n"
    192                        "Location  : %s(%d) %s\n",
    193                        pszExpr, pszFile, uLine, pszFunction);
    194 #  endif
    195 # endif
    196 
    197         PRTLOGGER pLog = RTLogRelGetDefaultInstance();
    198         if (pLog)
    199         {
    200             RTLogRelPrintf("\n!!Assertion Failed!!\n"
    201                            "Expression: %s\n"
    202                            "Location  : %s(%d) %s\n",
    203                            pszExpr, pszFile, uLine, pszFunction);
     188
     189
     190# if defined(IN_RING3) && (defined(IN_RT_STATIC) || defined(IPRT_NO_CRT)) /* ugly */
     191        if (g_pfnRTLogAssert)
     192            g_pfnRTLogAssert(
     193# else
     194        RTLogAssert(
     195# endif
     196                             "\n!!Assertion Failed!!\n"
     197                             "Expression: %s\n"
     198                             "Location  : %s(%d) %s\n"
    204199# ifdef IPRT_WITH_ASSERT_STACK
    205             RTLogRelPrintf("Stack     :\n%s\n", szStack);
    206 # endif
    207 # ifndef IN_RC /* flushing is done automatically in RC */
    208             RTLogFlush(pLog);
    209 # endif
    210         }
    211 
    212 # ifndef LOG_ENABLED
    213         if (!pLog)
    214 # endif
    215         {
    216             pLog = RTLogDefaultInstance();
    217             if (pLog)
    218             {
    219                 RTLogPrintf("\n!!Assertion Failed!!\n"
    220                             "Expression: %s\n"
    221                             "Location  : %s(%d) %s\n",
    222                             pszExpr, pszFile, uLine, pszFunction);
     200                             "Stack     :\n%s\n"
     201# endif
     202                             , pszExpr, pszFile, uLine, pszFunction
    223203# ifdef IPRT_WITH_ASSERT_STACK
    224                 RTLogPrintf("Stack     :\n%s\n", szStack);
    225 # endif
    226 # ifndef IN_RC /* flushing is done automatically in RC */
    227                 RTLogFlush(pLog);
    228 # endif
    229             }
    230         }
     204                             , szStack
     205# endif
     206                             );
    231207
    232208# ifdef IN_RING3
     
    323299
    324300#else  /* !IN_RING0 */
    325 # if !defined(IN_RING3) && !defined(LOG_NO_COM)
    326 #  if 0 /* Enable this iff you have a COM port and really want this debug info. */
    327         va_copy(vaCopy, va);
    328         RTLogComPrintfV(pszFormat, vaCopy);
    329         va_end(vaCopy);
    330 #  endif
    331 # endif
    332 
    333         PRTLOGGER pLog = RTLogRelGetDefaultInstance();
    334         if (pLog)
     301
     302# if defined(IN_RING3) && (defined(IN_RT_STATIC) || defined(IPRT_NO_CRT))
     303        if (g_pfnRTLogAssert)
     304# endif
    335305        {
    336306            va_copy(vaCopy, va);
    337             RTLogRelPrintfV(pszFormat, vaCopy);
     307# if defined(IN_RING3) && (defined(IN_RT_STATIC) || defined(IPRT_NO_CRT))
     308            g_pfnRTLogAssertV(pszFormat, vaCopy);
     309# else
     310            RTLogAssertV(pszFormat, vaCopy);
     311# endif
    338312            va_end(vaCopy);
    339 # ifndef IN_RC /* flushing is done automatically in RC */
    340             RTLogFlush(pLog);
    341 # endif
    342         }
    343 
    344         pLog = RTLogDefaultInstance();
    345         if (pLog)
    346         {
    347             va_copy(vaCopy, va);
    348             RTLogPrintfV(pszFormat, vaCopy);
    349             va_end(vaCopy);
    350 # ifndef IN_RC /* flushing is done automatically in RC */
    351             RTLogFlush(pLog);
    352 #endif
    353313        }
    354314
  • trunk/src/VBox/Runtime/r3/win/init-win.cpp

    r96407 r96448  
    576576     * Try get the logger and log exception details.
    577577     *
    578      * Note! We'll be using RTLogLogger for now, though we should probably add
     578     * Note! We'll be using RTLogLoggerWeak for now, though we should probably add
    579579     *       a less deadlock prone API here and gives up pretty fast if it
    580580     *       cannot get the lock...
    581581     */
    582     PRTLOGGER pLogger = RTLogRelGetDefaultInstance();
     582    PRTLOGGER pLogger = RTLogRelGetDefaultInstanceWeak();
    583583    if (!pLogger)
    584         pLogger = RTLogGetDefaultInstance();
     584        pLogger = RTLogGetDefaultInstanceWeak();
    585585    if (pLogger)
    586586    {
    587         RTLogLogger(pLogger, NULL, "\n!!! rtR3WinUnhandledXcptFilter caught an exception on thread %p in %u !!!\n",
    588                     RTThreadNativeSelf(), RTProcSelf());
     587        RTLogLoggerWeak(pLogger, NULL, "\n!!! rtR3WinUnhandledXcptFilter caught an exception on thread %p in %u !!!\n",
     588                        RTThreadNativeSelf(), RTProcSelf());
    589589
    590590        /*
     
    595595        if (pXcptRec)
    596596        {
    597             RTLogLogger(pLogger, NULL, "\nExceptionCode=%#010x ExceptionFlags=%#010x ExceptionAddress=%p\n",
    598                         pXcptRec->ExceptionCode, pXcptRec->ExceptionFlags, pXcptRec->ExceptionAddress);
     597            RTLogLoggerWeak(pLogger, NULL, "\nExceptionCode=%#010x ExceptionFlags=%#010x ExceptionAddress=%p\n",
     598                            pXcptRec->ExceptionCode, pXcptRec->ExceptionFlags, pXcptRec->ExceptionAddress);
    599599            for (uint32_t i = 0; i < RT_MIN(pXcptRec->NumberParameters, EXCEPTION_MAXIMUM_PARAMETERS); i++)
    600                 RTLogLogger(pLogger, NULL, "ExceptionInformation[%d]=%p\n", i, pXcptRec->ExceptionInformation[i]);
     600                RTLogLoggerWeak(pLogger, NULL, "ExceptionInformation[%d]=%p\n", i, pXcptRec->ExceptionInformation[i]);
    601601            uXcptPC = (uintptr_t)pXcptRec->ExceptionAddress;
    602602
     
    605605            if (RT_VALID_PTR(pNestedRec))
    606606            {
    607                 RTLogLogger(pLogger, NULL, "Nested: ExceptionCode=%#010x ExceptionFlags=%#010x ExceptionAddress=%p (nested %p)\n",
    608                             pNestedRec->ExceptionCode, pNestedRec->ExceptionFlags, pNestedRec->ExceptionAddress,
    609                             pNestedRec->ExceptionRecord);
     607                RTLogLoggerWeak(pLogger, NULL, "Nested: ExceptionCode=%#010x ExceptionFlags=%#010x ExceptionAddress=%p (nested %p)\n",
     608                                pNestedRec->ExceptionCode, pNestedRec->ExceptionFlags, pNestedRec->ExceptionAddress,
     609                                pNestedRec->ExceptionRecord);
    610610                for (uint32_t i = 0; i < RT_MIN(pNestedRec->NumberParameters, EXCEPTION_MAXIMUM_PARAMETERS); i++)
    611                     RTLogLogger(pLogger, NULL, "Nested: ExceptionInformation[%d]=%p\n", i, pNestedRec->ExceptionInformation[i]);
     611                    RTLogLoggerWeak(pLogger, NULL, "Nested: ExceptionInformation[%d]=%p\n", i, pNestedRec->ExceptionInformation[i]);
    612612                uXcptPC = (uintptr_t)pNestedRec->ExceptionAddress;
    613613            }
     
    623623        {
    624624#ifdef RT_ARCH_AMD64
    625             RTLogLogger(pLogger, NULL, "\ncs:rip=%04x:%016RX64\n", pXcptCtx->SegCs, pXcptCtx->Rip);
    626             RTLogLogger(pLogger, NULL, "ss:rsp=%04x:%016RX64 rbp=%016RX64\n", pXcptCtx->SegSs, pXcptCtx->Rsp, pXcptCtx->Rbp);
    627             RTLogLogger(pLogger, NULL, "rax=%016RX64 rcx=%016RX64 rdx=%016RX64 rbx=%016RX64\n",
    628                         pXcptCtx->Rax, pXcptCtx->Rcx, pXcptCtx->Rdx, pXcptCtx->Rbx);
    629             RTLogLogger(pLogger, NULL, "rsi=%016RX64 rdi=%016RX64 rsp=%016RX64 rbp=%016RX64\n",
    630                         pXcptCtx->Rsi, pXcptCtx->Rdi, pXcptCtx->Rsp, pXcptCtx->Rbp);
    631             RTLogLogger(pLogger, NULL, "r8 =%016RX64 r9 =%016RX64 r10=%016RX64 r11=%016RX64\n",
    632                         pXcptCtx->R8,  pXcptCtx->R9,  pXcptCtx->R10, pXcptCtx->R11);
    633             RTLogLogger(pLogger, NULL, "r12=%016RX64 r13=%016RX64 r14=%016RX64 r15=%016RX64\n",
    634                         pXcptCtx->R12,  pXcptCtx->R13,  pXcptCtx->R14, pXcptCtx->R15);
    635             RTLogLogger(pLogger, NULL, "ds=%04x es=%04x fs=%04x gs=%04x eflags=%08x\n",
    636                         pXcptCtx->SegDs, pXcptCtx->SegEs, pXcptCtx->SegFs, pXcptCtx->SegGs, pXcptCtx->EFlags);
    637             RTLogLogger(pLogger, NULL, "p1home=%016RX64 p2home=%016RX64 pe3home=%016RX64\n",
    638                         pXcptCtx->P1Home, pXcptCtx->P2Home, pXcptCtx->P3Home);
    639             RTLogLogger(pLogger, NULL, "p4home=%016RX64 p5home=%016RX64 pe6home=%016RX64\n",
    640                         pXcptCtx->P4Home, pXcptCtx->P5Home, pXcptCtx->P6Home);
    641             RTLogLogger(pLogger, NULL, "   LastBranchToRip=%016RX64    LastBranchFromRip=%016RX64\n",
    642                         pXcptCtx->LastBranchToRip, pXcptCtx->LastBranchFromRip);
    643             RTLogLogger(pLogger, NULL, "LastExceptionToRip=%016RX64 LastExceptionFromRip=%016RX64\n",
    644                         pXcptCtx->LastExceptionToRip, pXcptCtx->LastExceptionFromRip);
     625            RTLogLoggerWeak(pLogger, NULL, "\ncs:rip=%04x:%016RX64\n", pXcptCtx->SegCs, pXcptCtx->Rip);
     626            RTLogLoggerWeak(pLogger, NULL, "ss:rsp=%04x:%016RX64 rbp=%016RX64\n", pXcptCtx->SegSs, pXcptCtx->Rsp, pXcptCtx->Rbp);
     627            RTLogLoggerWeak(pLogger, NULL, "rax=%016RX64 rcx=%016RX64 rdx=%016RX64 rbx=%016RX64\n",
     628                            pXcptCtx->Rax, pXcptCtx->Rcx, pXcptCtx->Rdx, pXcptCtx->Rbx);
     629            RTLogLoggerWeak(pLogger, NULL, "rsi=%016RX64 rdi=%016RX64 rsp=%016RX64 rbp=%016RX64\n",
     630                            pXcptCtx->Rsi, pXcptCtx->Rdi, pXcptCtx->Rsp, pXcptCtx->Rbp);
     631            RTLogLoggerWeak(pLogger, NULL, "r8 =%016RX64 r9 =%016RX64 r10=%016RX64 r11=%016RX64\n",
     632                            pXcptCtx->R8,  pXcptCtx->R9,  pXcptCtx->R10, pXcptCtx->R11);
     633            RTLogLoggerWeak(pLogger, NULL, "r12=%016RX64 r13=%016RX64 r14=%016RX64 r15=%016RX64\n",
     634                            pXcptCtx->R12,  pXcptCtx->R13,  pXcptCtx->R14, pXcptCtx->R15);
     635            RTLogLoggerWeak(pLogger, NULL, "ds=%04x es=%04x fs=%04x gs=%04x eflags=%08x\n",
     636                            pXcptCtx->SegDs, pXcptCtx->SegEs, pXcptCtx->SegFs, pXcptCtx->SegGs, pXcptCtx->EFlags);
     637            RTLogLoggerWeak(pLogger, NULL, "p1home=%016RX64 p2home=%016RX64 pe3home=%016RX64\n",
     638                            pXcptCtx->P1Home, pXcptCtx->P2Home, pXcptCtx->P3Home);
     639            RTLogLoggerWeak(pLogger, NULL, "p4home=%016RX64 p5home=%016RX64 pe6home=%016RX64\n",
     640                            pXcptCtx->P4Home, pXcptCtx->P5Home, pXcptCtx->P6Home);
     641            RTLogLoggerWeak(pLogger, NULL, "   LastBranchToRip=%016RX64    LastBranchFromRip=%016RX64\n",
     642                            pXcptCtx->LastBranchToRip, pXcptCtx->LastBranchFromRip);
     643            RTLogLoggerWeak(pLogger, NULL, "LastExceptionToRip=%016RX64 LastExceptionFromRip=%016RX64\n",
     644                            pXcptCtx->LastExceptionToRip, pXcptCtx->LastExceptionFromRip);
    645645            uXcptSP = pXcptCtx->Rsp;
    646646            uXcptPC = pXcptCtx->Rip;
    647647
    648648#elif defined(RT_ARCH_X86)
    649             RTLogLogger(pLogger, NULL, "\ncs:eip=%04x:%08RX32\n", pXcptCtx->SegCs, pXcptCtx->Eip);
    650             RTLogLogger(pLogger, NULL, "ss:esp=%04x:%08RX32 ebp=%08RX32\n", pXcptCtx->SegSs, pXcptCtx->Esp, pXcptCtx->Ebp);
    651             RTLogLogger(pLogger, NULL, "eax=%08RX32 ecx=%08RX32 edx=%08RX32 ebx=%08RX32\n",
    652                         pXcptCtx->Eax, pXcptCtx->Ecx,  pXcptCtx->Edx,  pXcptCtx->Ebx);
    653             RTLogLogger(pLogger, NULL, "esi=%08RX32 edi=%08RX32 esp=%08RX32 ebp=%08RX32\n",
    654                         pXcptCtx->Esi, pXcptCtx->Edi,  pXcptCtx->Esp,  pXcptCtx->Ebp);
    655             RTLogLogger(pLogger, NULL, "ds=%04x es=%04x fs=%04x gs=%04x eflags=%08x\n",
    656                         pXcptCtx->SegDs, pXcptCtx->SegEs, pXcptCtx->SegFs, pXcptCtx->SegGs, pXcptCtx->EFlags);
     649            RTLogLoggerWeak(pLogger, NULL, "\ncs:eip=%04x:%08RX32\n", pXcptCtx->SegCs, pXcptCtx->Eip);
     650            RTLogLoggerWeak(pLogger, NULL, "ss:esp=%04x:%08RX32 ebp=%08RX32\n", pXcptCtx->SegSs, pXcptCtx->Esp, pXcptCtx->Ebp);
     651            RTLogLoggerWeak(pLogger, NULL, "eax=%08RX32 ecx=%08RX32 edx=%08RX32 ebx=%08RX32\n",
     652                            pXcptCtx->Eax, pXcptCtx->Ecx,  pXcptCtx->Edx,  pXcptCtx->Ebx);
     653            RTLogLoggerWeak(pLogger, NULL, "esi=%08RX32 edi=%08RX32 esp=%08RX32 ebp=%08RX32\n",
     654                            pXcptCtx->Esi, pXcptCtx->Edi,  pXcptCtx->Esp,  pXcptCtx->Ebp);
     655            RTLogLoggerWeak(pLogger, NULL, "ds=%04x es=%04x fs=%04x gs=%04x eflags=%08x\n",
     656                            pXcptCtx->SegDs, pXcptCtx->SegEs, pXcptCtx->SegFs, pXcptCtx->SegGs, pXcptCtx->EFlags);
    657657            uXcptSP = pXcptCtx->Esp;
    658658            uXcptPC = pXcptCtx->Eip;
     
    682682        }
    683683
    684         RTLogLogger(pLogger, NULL, "\nStack %p, dumping %#x bytes (low=%p, high=%p)\n", uStack, cbToDump, uLow, uHigh);
    685         RTLogLogger(pLogger, NULL, "%.*RhxD\n", cbToDump, uStack);
     684        RTLogLoggerWeak(pLogger, NULL, "\nStack %p, dumping %#x bytes (low=%p, high=%p)\n", uStack, cbToDump, uLow, uHigh);
     685        RTLogLoggerWeak(pLogger, NULL, "%.*RhxD\n", cbToDump, uStack);
    686686
    687687        /*
     
    691691         *       is why it's at the end.
    692692         */
    693         RTLogLogger(pLogger, NULL,  "Thread ID:   %p\n", RTThreadNativeSelf());
    694         RTLogLogger(pLogger, NULL,  "Thread name: %s\n", RTThreadSelfName());
    695         RTLogLogger(pLogger, NULL,  "Thread IPRT: %p\n", RTThreadSelf());
     693        RTLogLoggerWeak(pLogger, NULL,  "Thread ID:   %p\n", RTThreadNativeSelf());
     694        RTLogLoggerWeak(pLogger, NULL,  "Thread name: %s\n", RTThreadSelfName());
     695        RTLogLoggerWeak(pLogger, NULL,  "Thread IPRT: %p\n", RTThreadSelf());
    696696
    697697        /*
     
    708708                LIST_ENTRY           *pListEntry = pList->Flink;
    709709                uint32_t              cLoops     = 0;
    710                 RTLogLogger(pLogger, NULL,
    711                             "\nLoaded Modules:\n"
    712                             "%-*s[*] Timestamp Path\n", sizeof(void *) * 4 + 2 - 1, "Address range"
    713                             );
     710                RTLogLoggerWeak(pLogger, NULL,
     711                                "\nLoaded Modules:\n"
     712                                "%-*s[*] Timestamp Path\n", sizeof(void *) * 4 + 2 - 1, "Address range"
     713                                );
    714714                while (pListEntry != pList && RT_VALID_PTR(pListEntry) && cLoops < 1024)
    715715                {
     
    728728                        && (pLdrEntry->FullDllName.Length & 1) == 0
    729729                        && pLdrEntry->FullDllName.Length <= pLdrEntry->FullDllName.MaximumLength)
    730                         RTLogLogger(pLogger, NULL, "%p..%p%c  %08RX32  %.*ls\n",
    731                                     pLdrEntry->DllBase, (uintptr_t)pLdrEntry->DllBase + cbLength - 1, chInd,
    732                                     pLdrEntry->TimeDateStamp, pLdrEntry->FullDllName.Length / sizeof(RTUTF16),
    733                                     pLdrEntry->FullDllName.Buffer);
     730                        RTLogLoggerWeak(pLogger, NULL, "%p..%p%c  %08RX32  %.*ls\n",
     731                                        pLdrEntry->DllBase, (uintptr_t)pLdrEntry->DllBase + cbLength - 1, chInd,
     732                                        pLdrEntry->TimeDateStamp, pLdrEntry->FullDllName.Length / sizeof(RTUTF16),
     733                                        pLdrEntry->FullDllName.Buffer);
    734734                    else
    735                         RTLogLogger(pLogger, NULL, "%p..%p%c  %08RX32  <bad or missing: %p LB %#x max %#x\n",
    736                                     pLdrEntry->DllBase, (uintptr_t)pLdrEntry->DllBase + cbLength - 1, chInd,
    737                                     pLdrEntry->TimeDateStamp, pLdrEntry->FullDllName.Buffer, pLdrEntry->FullDllName.Length,
    738                                     pLdrEntry->FullDllName.MaximumLength);
     735                        RTLogLoggerWeak(pLogger, NULL, "%p..%p%c  %08RX32  <bad or missing: %p LB %#x max %#x\n",
     736                                        pLdrEntry->DllBase, (uintptr_t)pLdrEntry->DllBase + cbLength - 1, chInd,
     737                                        pLdrEntry->TimeDateStamp, pLdrEntry->FullDllName.Buffer, pLdrEntry->FullDllName.Length,
     738                                        pLdrEntry->FullDllName.MaximumLength);
    739739
    740740                    /* advance */
     
    749749                    && uXcptSP - uStack < cbToDump)
    750750                {
    751                     RTLogLogger(pLogger, NULL, "\nPotential code addresses on the stack:\n");
     751                    RTLogLoggerWeak(pLogger, NULL, "\nPotential code addresses on the stack:\n");
    752752                    if (pFound)
    753753                    {
     
    757757                            && (pFound->FullDllName.Length & 1) == 0
    758758                            && pFound->FullDllName.Length <= pFound->FullDllName.MaximumLength)
    759                             RTLogLogger(pLogger, NULL, "%-*s: %p - %#010RX32 bytes into %.*ls\n",
    760                                         sizeof(void *) * 2, "Xcpt PC", uXcptPC, (uint32_t)(uXcptPC - (uintptr_t)pFound->DllBase),
    761                                         pFound->FullDllName.Length / sizeof(RTUTF16), pFound->FullDllName.Buffer);
     759                            RTLogLoggerWeak(pLogger, NULL, "%-*s: %p - %#010RX32 bytes into %.*ls\n",
     760                                            sizeof(void *) * 2, "Xcpt PC", uXcptPC, (uint32_t)(uXcptPC - (uintptr_t)pFound->DllBase),
     761                                            pFound->FullDllName.Length / sizeof(RTUTF16), pFound->FullDllName.Buffer);
    762762                        else
    763                             RTLogLogger(pLogger, NULL, "%-*s: %p - %08RX32 into module at %p\n",
    764                                         sizeof(void *) * 2, "Xcpt PC", uXcptPC, (uint32_t)(uXcptPC - (uintptr_t)pFound->DllBase),
    765                                         pFound->DllBase);
     763                            RTLogLoggerWeak(pLogger, NULL, "%-*s: %p - %08RX32 into module at %p\n",
     764                                            sizeof(void *) * 2, "Xcpt PC", uXcptPC, (uint32_t)(uXcptPC - (uintptr_t)pFound->DllBase),
     765                                            pFound->DllBase);
    766766                    }
    767767
     
    799799                                    && (pFound->FullDllName.Length & 1) == 0
    800800                                    && pFound->FullDllName.Length <= pFound->FullDllName.MaximumLength)
    801                                     RTLogLogger(pLogger, NULL, "%p: %p - %#010RX32 bytes into %.*ls\n",
    802                                                 puStack, uPtr, (uint32_t)(uPtr - (uintptr_t)pFound->DllBase),
    803                                                 pFound->FullDllName.Length / sizeof(RTUTF16), pFound->FullDllName.Buffer);
     801                                    RTLogLoggerWeak(pLogger, NULL, "%p: %p - %#010RX32 bytes into %.*ls\n",
     802                                                    puStack, uPtr, (uint32_t)(uPtr - (uintptr_t)pFound->DllBase),
     803                                                    pFound->FullDllName.Length / sizeof(RTUTF16), pFound->FullDllName.Buffer);
    804804                                else
    805                                     RTLogLogger(pLogger, NULL, "%p: %p - %08RX32 into module at %p\n",
    806                                                 puStack, uPtr, (uint32_t)(uPtr - (uintptr_t)pFound->DllBase), pFound->DllBase);
     805                                    RTLogLoggerWeak(pLogger, NULL, "%p: %p - %08RX32 into module at %p\n",
     806                                                    puStack, uPtr, (uint32_t)(uPtr - (uintptr_t)pFound->DllBase), pFound->DllBase);
    807807                            }
    808808                        }
     
    824824                    && !(pProcParams->CommandLine.Length & 1)
    825825                    && !(pProcParams->CommandLine.MaximumLength & 1))
    826                     RTLogLogger(pLogger, NULL, "PEB/CommandLine: %.*ls\n",
    827                                 pProcParams->CommandLine.Length / sizeof(RTUTF16), pProcParams->CommandLine.Buffer);
     826                    RTLogLoggerWeak(pLogger, NULL, "PEB/CommandLine: %.*ls\n",
     827                                    pProcParams->CommandLine.Length / sizeof(RTUTF16), pProcParams->CommandLine.Buffer);
    828828            }
    829829        }
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