From e8b9d988fe7d75bf594ac8773784ed14251d8103 Mon Sep 17 00:00:00 2001 From: Matias Pequeno Date: Tue, 4 Jul 2023 12:14:09 -0300 Subject: [PATCH 1/4] Renamed KSCrash files to RollbarCrash to avoid potential name collisions --- .../{KSCrashInstallation.m => RollbarCrashInstallation.m} | 0 .../Monitors/{KSCrashMonitor.c => RollbarCrashMonitor.c} | 0 .../Monitors/{KSCrashMonitorType.c => RollbarCrashMonitorType.c} | 0 .../{KSCrashMonitor_AppState.c => RollbarCrashMonitor_AppState.c} | 0 .../{KSCrashMonitor_AppState.h => RollbarCrashMonitor_AppState.h} | 0 ...itor_CPPException.cpp => RollbarCrashMonitor_CPPException.cpp} | 0 ...hMonitor_CPPException.h => RollbarCrashMonitor_CPPException.h} | 0 .../{KSCrashMonitor_Deadlock.h => RollbarCrashMonitor_Deadlock.h} | 0 .../{KSCrashMonitor_Deadlock.m => RollbarCrashMonitor_Deadlock.m} | 0 ...onitor_MachException.c => RollbarCrashMonitor_MachException.c} | 0 ...onitor_MachException.h => RollbarCrashMonitor_MachException.h} | 0 ...ashMonitor_NSException.h => RollbarCrashMonitor_NSException.h} | 0 ...ashMonitor_NSException.m => RollbarCrashMonitor_NSException.m} | 0 .../{KSCrashMonitor_Signal.c => RollbarCrashMonitor_Signal.c} | 0 .../{KSCrashMonitor_Signal.h => RollbarCrashMonitor_Signal.h} | 0 .../{KSCrashMonitor_System.m => RollbarCrashMonitor_System.m} | 0 .../{KSCrashMonitor_User.c => RollbarCrashMonitor_User.c} | 0 .../{KSCrashMonitor_User.h => RollbarCrashMonitor_User.h} | 0 .../{KSCrashMonitor_Zombie.c => RollbarCrashMonitor_Zombie.c} | 0 .../{KSCrashMonitor_Zombie.h => RollbarCrashMonitor_Zombie.h} | 0 .../Sources/RollbarCrash/Recording/{KSCrash.m => RollbarCrash.m} | 0 .../RollbarCrash/Recording/{KSCrashC.c => RollbarCrashC.c} | 0 .../Recording/{KSCrashCachedData.c => RollbarCrashCachedData.c} | 0 .../Recording/{KSCrashCachedData.h => RollbarCrashCachedData.h} | 0 .../Recording/{KSCrashDoctor.h => RollbarCrashDoctor.h} | 0 .../Recording/{KSCrashDoctor.m => RollbarCrashDoctor.m} | 0 .../Recording/{KSCrashReport.c => RollbarCrashReport.c} | 0 .../Recording/{KSCrashReport.h => RollbarCrashReport.h} | 0 .../Recording/{KSCrashReportFixer.c => RollbarCrashReportFixer.c} | 0 .../Recording/{KSCrashReportFixer.h => RollbarCrashReportFixer.h} | 0 .../Recording/{KSCrashReportStore.c => RollbarCrashReportStore.c} | 0 .../Recording/{KSCrashReportStore.h => RollbarCrashReportStore.h} | 0 .../{KSCrashReportVersion.h => RollbarCrashReportVersion.h} | 0 .../{KSSystemCapabilities.h => RollbarCrashSystemCapabilities.h} | 0 .../RollbarCrash/Recording/Tools/{KSCPU.c => RollbarCrashCPU.c} | 0 .../RollbarCrash/Recording/Tools/{KSCPU.h => RollbarCrashCPU.h} | 0 .../Recording/Tools/{KSCPU_Apple.h => RollbarCrashCPU_Apple.h} | 0 .../Recording/Tools/{KSCPU_arm.c => RollbarCrashCPU_arm.c} | 0 .../Recording/Tools/{KSCPU_arm64.c => RollbarCrashCPU_arm64.c} | 0 .../Recording/Tools/{KSCPU_x86_32.c => RollbarCrashCPU_x86_32.c} | 0 .../Recording/Tools/{KSCPU_x86_64.c => RollbarCrashCPU_x86_64.c} | 0 .../Tools/{KSCxaThrowSwapper.c => RollbarCrashCxaThrowSwapper.c} | 0 .../Tools/{KSCxaThrowSwapper.h => RollbarCrashCxaThrowSwapper.h} | 0 .../RollbarCrash/Recording/Tools/{KSDate.c => RollbarCrashDate.c} | 0 .../RollbarCrash/Recording/Tools/{KSDate.h => RollbarCrashDate.h} | 0 .../Recording/Tools/{KSDebug.c => RollbarCrashDebug.c} | 0 .../Recording/Tools/{KSDebug.h => RollbarCrashDebug.h} | 0 .../Tools/{KSDynamicLinker.c => RollbarCrashDynamicLinker.c} | 0 .../Tools/{KSDynamicLinker.h => RollbarCrashDynamicLinker.h} | 0 .../Recording/Tools/{KSFileUtils.c => RollbarCrashFileUtils.c} | 0 .../Recording/Tools/{KSFileUtils.h => RollbarCrashFileUtils.h} | 0 .../RollbarCrash/Recording/Tools/{KSID.c => RollbarCrashID.c} | 0 .../RollbarCrash/Recording/Tools/{KSID.h => RollbarCrashID.h} | 0 .../Recording/Tools/{KSJSONCodec.c => RollbarCrashJSONCodec.c} | 0 .../Recording/Tools/{KSJSONCodec.h => RollbarCrashJSONCodec.h} | 0 .../Tools/{KSJSONCodecObjC.m => RollbarCrashJSONCodecObjC.m} | 0 .../Recording/Tools/{KSLogger.c => RollbarCrashLogger.c} | 0 .../Recording/Tools/{KSLogger.h => RollbarCrashLogger.h} | 0 .../RollbarCrash/Recording/Tools/{KSMach.c => RollbarCrashMach.c} | 0 .../RollbarCrash/Recording/Tools/{KSMach.h => RollbarCrashMach.h} | 0 .../Tools/{KSMachineContext.c => RollbarCrashMachineContext.c} | 0 ...SMachineContext_Apple.h => RollbarCrashMachineContext_Apple.h} | 0 .../Recording/Tools/{KSMemory.c => RollbarCrashMemory.c} | 0 .../Recording/Tools/{KSMemory.h => RollbarCrashMemory.h} | 0 .../RollbarCrash/Recording/Tools/{KSObjC.c => RollbarCrashObjC.c} | 0 .../RollbarCrash/Recording/Tools/{KSObjC.h => RollbarCrashObjC.h} | 0 .../Recording/Tools/{KSObjCApple.h => RollbarCrashObjCApple.h} | 0 ...ormSpecificDefines.h => RollbarCrashPlatformSpecificDefines.h} | 0 .../Recording/Tools/{KSSignalInfo.c => RollbarCrashSignalInfo.c} | 0 .../Recording/Tools/{KSSignalInfo.h => RollbarCrashSignalInfo.h} | 0 .../Tools/{KSStackCursor.c => RollbarCrashStackCursor.c} | 0 .../Tools/{KSStackCursor.h => RollbarCrashStackCursor.h} | 0 ...tackCursor_Backtrace.c => RollbarCrashStackCursor_Backtrace.c} | 0 ...tackCursor_Backtrace.h => RollbarCrashStackCursor_Backtrace.h} | 0 ..._MachineContext.c => RollbarCrashStackCursor_MachineContext.c} | 0 ..._MachineContext.h => RollbarCrashStackCursor_MachineContext.h} | 0 ...ckCursor_SelfThread.c => RollbarCrashStackCursor_SelfThread.c} | 0 ...ckCursor_SelfThread.h => RollbarCrashStackCursor_SelfThread.h} | 0 .../Recording/Tools/{KSString.c => RollbarCrashString.c} | 0 .../Recording/Tools/{KSString.h => RollbarCrashString.h} | 0 .../Tools/{KSSymbolicator.c => RollbarCrashSymbolicator.c} | 0 .../Tools/{KSSymbolicator.h => RollbarCrashSymbolicator.h} | 0 .../Recording/Tools/{KSSysCtl.c => RollbarCrashSysCtl.c} | 0 .../Recording/Tools/{KSSysCtl.h => RollbarCrashSysCtl.h} | 0 .../Recording/Tools/{KSThread.c => RollbarCrashThread.c} | 0 .../Recording/Tools/{KSgetsect.c => RollbarCrashgetsect.c} | 0 .../Recording/Tools/{KSgetsect.h => RollbarCrashgetsect.h} | 0 ...KSCrashReportFilterBasic.m => RollbarCrashReportFilterBasic.m} | 0 .../Filters/Tools/{KSVarArgs.h => RollbarCrashVarArgs.h} | 0 .../Reporting/Tools/{KSCString.h => RollbarCrashCString.h} | 0 .../Reporting/Tools/{KSCString.m => RollbarCrashCString.m} | 0 .../Sources/RollbarCrash/include/{KSCrash.h => RollbarCrash.h} | 0 .../Sources/RollbarCrash/include/{KSCrashC.h => RollbarCrashC.h} | 0 ...hInstallation+Private.h => RollbarCrashInstallation+Private.h} | 0 .../include/{KSCrashInstallation.h => RollbarCrashInstallation.h} | 0 .../include/{KSJSONCodecObjC.h => RollbarCrashJSONCodecObjC.h} | 0 .../include/{KSMachineContext.h => RollbarCrashMachineContext.h} | 0 .../include/{KSCrashMonitor.h => RollbarCrashMonitor.h} | 0 .../{KSCrashMonitorContext.h => RollbarCrashMonitorContext.h} | 0 .../include/{KSCrashMonitorType.h => RollbarCrashMonitorType.h} | 0 .../{KSCrashMonitor_System.h => RollbarCrashMonitor_System.h} | 0 .../include/{KSCrashReportFields.h => RollbarCrashReportFields.h} | 0 .../include/{KSCrashReportFilter.h => RollbarCrashReportFilter.h} | 0 ...KSCrashReportFilterBasic.h => RollbarCrashReportFilterBasic.h} | 0 .../include/{KSCrashReportWriter.h => RollbarCrashReportWriter.h} | 0 .../RollbarCrash/include/{KSThread.h => RollbarCrashThread.h} | 0 106 files changed, 0 insertions(+), 0 deletions(-) rename RollbarNotifier/Sources/RollbarCrash/Installations/{KSCrashInstallation.m => RollbarCrashInstallation.m} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/{KSCrashMonitor.c => RollbarCrashMonitor.c} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/{KSCrashMonitorType.c => RollbarCrashMonitorType.c} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/{KSCrashMonitor_AppState.c => RollbarCrashMonitor_AppState.c} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/{KSCrashMonitor_AppState.h => RollbarCrashMonitor_AppState.h} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/{KSCrashMonitor_CPPException.cpp => RollbarCrashMonitor_CPPException.cpp} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/{KSCrashMonitor_CPPException.h => RollbarCrashMonitor_CPPException.h} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/{KSCrashMonitor_Deadlock.h => RollbarCrashMonitor_Deadlock.h} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/{KSCrashMonitor_Deadlock.m => RollbarCrashMonitor_Deadlock.m} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/{KSCrashMonitor_MachException.c => RollbarCrashMonitor_MachException.c} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/{KSCrashMonitor_MachException.h => RollbarCrashMonitor_MachException.h} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/{KSCrashMonitor_NSException.h => RollbarCrashMonitor_NSException.h} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/{KSCrashMonitor_NSException.m => RollbarCrashMonitor_NSException.m} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/{KSCrashMonitor_Signal.c => RollbarCrashMonitor_Signal.c} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/{KSCrashMonitor_Signal.h => RollbarCrashMonitor_Signal.h} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/{KSCrashMonitor_System.m => RollbarCrashMonitor_System.m} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/{KSCrashMonitor_User.c => RollbarCrashMonitor_User.c} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/{KSCrashMonitor_User.h => RollbarCrashMonitor_User.h} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/{KSCrashMonitor_Zombie.c => RollbarCrashMonitor_Zombie.c} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/{KSCrashMonitor_Zombie.h => RollbarCrashMonitor_Zombie.h} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/{KSCrash.m => RollbarCrash.m} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/{KSCrashC.c => RollbarCrashC.c} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/{KSCrashCachedData.c => RollbarCrashCachedData.c} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/{KSCrashCachedData.h => RollbarCrashCachedData.h} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/{KSCrashDoctor.h => RollbarCrashDoctor.h} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/{KSCrashDoctor.m => RollbarCrashDoctor.m} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/{KSCrashReport.c => RollbarCrashReport.c} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/{KSCrashReport.h => RollbarCrashReport.h} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/{KSCrashReportFixer.c => RollbarCrashReportFixer.c} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/{KSCrashReportFixer.h => RollbarCrashReportFixer.h} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/{KSCrashReportStore.c => RollbarCrashReportStore.c} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/{KSCrashReportStore.h => RollbarCrashReportStore.h} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/{KSCrashReportVersion.h => RollbarCrashReportVersion.h} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/{KSSystemCapabilities.h => RollbarCrashSystemCapabilities.h} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/Tools/{KSCPU.c => RollbarCrashCPU.c} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/Tools/{KSCPU.h => RollbarCrashCPU.h} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/Tools/{KSCPU_Apple.h => RollbarCrashCPU_Apple.h} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/Tools/{KSCPU_arm.c => RollbarCrashCPU_arm.c} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/Tools/{KSCPU_arm64.c => RollbarCrashCPU_arm64.c} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/Tools/{KSCPU_x86_32.c => RollbarCrashCPU_x86_32.c} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/Tools/{KSCPU_x86_64.c => RollbarCrashCPU_x86_64.c} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/Tools/{KSCxaThrowSwapper.c => RollbarCrashCxaThrowSwapper.c} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/Tools/{KSCxaThrowSwapper.h => RollbarCrashCxaThrowSwapper.h} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/Tools/{KSDate.c => RollbarCrashDate.c} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/Tools/{KSDate.h => RollbarCrashDate.h} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/Tools/{KSDebug.c => RollbarCrashDebug.c} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/Tools/{KSDebug.h => RollbarCrashDebug.h} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/Tools/{KSDynamicLinker.c => RollbarCrashDynamicLinker.c} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/Tools/{KSDynamicLinker.h => RollbarCrashDynamicLinker.h} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/Tools/{KSFileUtils.c => RollbarCrashFileUtils.c} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/Tools/{KSFileUtils.h => RollbarCrashFileUtils.h} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/Tools/{KSID.c => RollbarCrashID.c} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/Tools/{KSID.h => RollbarCrashID.h} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/Tools/{KSJSONCodec.c => RollbarCrashJSONCodec.c} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/Tools/{KSJSONCodec.h => RollbarCrashJSONCodec.h} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/Tools/{KSJSONCodecObjC.m => RollbarCrashJSONCodecObjC.m} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/Tools/{KSLogger.c => RollbarCrashLogger.c} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/Tools/{KSLogger.h => RollbarCrashLogger.h} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/Tools/{KSMach.c => RollbarCrashMach.c} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/Tools/{KSMach.h => RollbarCrashMach.h} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/Tools/{KSMachineContext.c => RollbarCrashMachineContext.c} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/Tools/{KSMachineContext_Apple.h => RollbarCrashMachineContext_Apple.h} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/Tools/{KSMemory.c => RollbarCrashMemory.c} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/Tools/{KSMemory.h => RollbarCrashMemory.h} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/Tools/{KSObjC.c => RollbarCrashObjC.c} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/Tools/{KSObjC.h => RollbarCrashObjC.h} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/Tools/{KSObjCApple.h => RollbarCrashObjCApple.h} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/Tools/{KSPlatformSpecificDefines.h => RollbarCrashPlatformSpecificDefines.h} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/Tools/{KSSignalInfo.c => RollbarCrashSignalInfo.c} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/Tools/{KSSignalInfo.h => RollbarCrashSignalInfo.h} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/Tools/{KSStackCursor.c => RollbarCrashStackCursor.c} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/Tools/{KSStackCursor.h => RollbarCrashStackCursor.h} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/Tools/{KSStackCursor_Backtrace.c => RollbarCrashStackCursor_Backtrace.c} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/Tools/{KSStackCursor_Backtrace.h => RollbarCrashStackCursor_Backtrace.h} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/Tools/{KSStackCursor_MachineContext.c => RollbarCrashStackCursor_MachineContext.c} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/Tools/{KSStackCursor_MachineContext.h => RollbarCrashStackCursor_MachineContext.h} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/Tools/{KSStackCursor_SelfThread.c => RollbarCrashStackCursor_SelfThread.c} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/Tools/{KSStackCursor_SelfThread.h => RollbarCrashStackCursor_SelfThread.h} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/Tools/{KSString.c => RollbarCrashString.c} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/Tools/{KSString.h => RollbarCrashString.h} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/Tools/{KSSymbolicator.c => RollbarCrashSymbolicator.c} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/Tools/{KSSymbolicator.h => RollbarCrashSymbolicator.h} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/Tools/{KSSysCtl.c => RollbarCrashSysCtl.c} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/Tools/{KSSysCtl.h => RollbarCrashSysCtl.h} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/Tools/{KSThread.c => RollbarCrashThread.c} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/Tools/{KSgetsect.c => RollbarCrashgetsect.c} (100%) rename RollbarNotifier/Sources/RollbarCrash/Recording/Tools/{KSgetsect.h => RollbarCrashgetsect.h} (100%) rename RollbarNotifier/Sources/RollbarCrash/Reporting/Filters/{KSCrashReportFilterBasic.m => RollbarCrashReportFilterBasic.m} (100%) rename RollbarNotifier/Sources/RollbarCrash/Reporting/Filters/Tools/{KSVarArgs.h => RollbarCrashVarArgs.h} (100%) rename RollbarNotifier/Sources/RollbarCrash/Reporting/Tools/{KSCString.h => RollbarCrashCString.h} (100%) rename RollbarNotifier/Sources/RollbarCrash/Reporting/Tools/{KSCString.m => RollbarCrashCString.m} (100%) rename RollbarNotifier/Sources/RollbarCrash/include/{KSCrash.h => RollbarCrash.h} (100%) rename RollbarNotifier/Sources/RollbarCrash/include/{KSCrashC.h => RollbarCrashC.h} (100%) rename RollbarNotifier/Sources/RollbarCrash/include/{KSCrashInstallation+Private.h => RollbarCrashInstallation+Private.h} (100%) rename RollbarNotifier/Sources/RollbarCrash/include/{KSCrashInstallation.h => RollbarCrashInstallation.h} (100%) rename RollbarNotifier/Sources/RollbarCrash/include/{KSJSONCodecObjC.h => RollbarCrashJSONCodecObjC.h} (100%) rename RollbarNotifier/Sources/RollbarCrash/include/{KSMachineContext.h => RollbarCrashMachineContext.h} (100%) rename RollbarNotifier/Sources/RollbarCrash/include/{KSCrashMonitor.h => RollbarCrashMonitor.h} (100%) rename RollbarNotifier/Sources/RollbarCrash/include/{KSCrashMonitorContext.h => RollbarCrashMonitorContext.h} (100%) rename RollbarNotifier/Sources/RollbarCrash/include/{KSCrashMonitorType.h => RollbarCrashMonitorType.h} (100%) rename RollbarNotifier/Sources/RollbarCrash/include/{KSCrashMonitor_System.h => RollbarCrashMonitor_System.h} (100%) rename RollbarNotifier/Sources/RollbarCrash/include/{KSCrashReportFields.h => RollbarCrashReportFields.h} (100%) rename RollbarNotifier/Sources/RollbarCrash/include/{KSCrashReportFilter.h => RollbarCrashReportFilter.h} (100%) rename RollbarNotifier/Sources/RollbarCrash/include/{KSCrashReportFilterBasic.h => RollbarCrashReportFilterBasic.h} (100%) rename RollbarNotifier/Sources/RollbarCrash/include/{KSCrashReportWriter.h => RollbarCrashReportWriter.h} (100%) rename RollbarNotifier/Sources/RollbarCrash/include/{KSThread.h => RollbarCrashThread.h} (100%) diff --git a/RollbarNotifier/Sources/RollbarCrash/Installations/KSCrashInstallation.m b/RollbarNotifier/Sources/RollbarCrash/Installations/RollbarCrashInstallation.m similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Installations/KSCrashInstallation.m rename to RollbarNotifier/Sources/RollbarCrash/Installations/RollbarCrashInstallation.m diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/KSCrashMonitor.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor.c similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/KSCrashMonitor.c rename to RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor.c diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/KSCrashMonitorType.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitorType.c similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/KSCrashMonitorType.c rename to RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitorType.c diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/KSCrashMonitor_AppState.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_AppState.c similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/KSCrashMonitor_AppState.c rename to RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_AppState.c diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/KSCrashMonitor_AppState.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_AppState.h similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/KSCrashMonitor_AppState.h rename to RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_AppState.h diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/KSCrashMonitor_CPPException.cpp b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_CPPException.cpp similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/KSCrashMonitor_CPPException.cpp rename to RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_CPPException.cpp diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/KSCrashMonitor_CPPException.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_CPPException.h similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/KSCrashMonitor_CPPException.h rename to RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_CPPException.h diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/KSCrashMonitor_Deadlock.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_Deadlock.h similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/KSCrashMonitor_Deadlock.h rename to RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_Deadlock.h diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/KSCrashMonitor_Deadlock.m b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_Deadlock.m similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/KSCrashMonitor_Deadlock.m rename to RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_Deadlock.m diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/KSCrashMonitor_MachException.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_MachException.c similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/KSCrashMonitor_MachException.c rename to RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_MachException.c diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/KSCrashMonitor_MachException.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_MachException.h similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/KSCrashMonitor_MachException.h rename to RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_MachException.h diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/KSCrashMonitor_NSException.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_NSException.h similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/KSCrashMonitor_NSException.h rename to RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_NSException.h diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/KSCrashMonitor_NSException.m b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_NSException.m similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/KSCrashMonitor_NSException.m rename to RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_NSException.m diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/KSCrashMonitor_Signal.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_Signal.c similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/KSCrashMonitor_Signal.c rename to RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_Signal.c diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/KSCrashMonitor_Signal.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_Signal.h similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/KSCrashMonitor_Signal.h rename to RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_Signal.h diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/KSCrashMonitor_System.m b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_System.m similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/KSCrashMonitor_System.m rename to RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_System.m diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/KSCrashMonitor_User.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_User.c similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/KSCrashMonitor_User.c rename to RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_User.c diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/KSCrashMonitor_User.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_User.h similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/KSCrashMonitor_User.h rename to RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_User.h diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/KSCrashMonitor_Zombie.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_Zombie.c similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/KSCrashMonitor_Zombie.c rename to RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_Zombie.c diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/KSCrashMonitor_Zombie.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_Zombie.h similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/KSCrashMonitor_Zombie.h rename to RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_Zombie.h diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/KSCrash.m b/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrash.m similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/KSCrash.m rename to RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrash.m diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/KSCrashC.c b/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashC.c similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/KSCrashC.c rename to RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashC.c diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/KSCrashCachedData.c b/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashCachedData.c similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/KSCrashCachedData.c rename to RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashCachedData.c diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/KSCrashCachedData.h b/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashCachedData.h similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/KSCrashCachedData.h rename to RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashCachedData.h diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/KSCrashDoctor.h b/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashDoctor.h similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/KSCrashDoctor.h rename to RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashDoctor.h diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/KSCrashDoctor.m b/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashDoctor.m similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/KSCrashDoctor.m rename to RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashDoctor.m diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/KSCrashReport.c b/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashReport.c similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/KSCrashReport.c rename to RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashReport.c diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/KSCrashReport.h b/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashReport.h similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/KSCrashReport.h rename to RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashReport.h diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/KSCrashReportFixer.c b/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashReportFixer.c similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/KSCrashReportFixer.c rename to RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashReportFixer.c diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/KSCrashReportFixer.h b/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashReportFixer.h similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/KSCrashReportFixer.h rename to RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashReportFixer.h diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/KSCrashReportStore.c b/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashReportStore.c similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/KSCrashReportStore.c rename to RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashReportStore.c diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/KSCrashReportStore.h b/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashReportStore.h similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/KSCrashReportStore.h rename to RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashReportStore.h diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/KSCrashReportVersion.h b/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashReportVersion.h similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/KSCrashReportVersion.h rename to RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashReportVersion.h diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/KSSystemCapabilities.h b/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashSystemCapabilities.h similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/KSSystemCapabilities.h rename to RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashSystemCapabilities.h diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSCPU.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU.c similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSCPU.c rename to RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU.c diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSCPU.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU.h similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSCPU.h rename to RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU.h diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSCPU_Apple.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU_Apple.h similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSCPU_Apple.h rename to RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU_Apple.h diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSCPU_arm.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU_arm.c similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSCPU_arm.c rename to RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU_arm.c diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSCPU_arm64.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU_arm64.c similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSCPU_arm64.c rename to RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU_arm64.c diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSCPU_x86_32.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU_x86_32.c similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSCPU_x86_32.c rename to RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU_x86_32.c diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSCPU_x86_64.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU_x86_64.c similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSCPU_x86_64.c rename to RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU_x86_64.c diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSCxaThrowSwapper.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCxaThrowSwapper.c similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSCxaThrowSwapper.c rename to RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCxaThrowSwapper.c diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSCxaThrowSwapper.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCxaThrowSwapper.h similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSCxaThrowSwapper.h rename to RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCxaThrowSwapper.h diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSDate.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashDate.c similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSDate.c rename to RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashDate.c diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSDate.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashDate.h similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSDate.h rename to RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashDate.h diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSDebug.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashDebug.c similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSDebug.c rename to RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashDebug.c diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSDebug.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashDebug.h similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSDebug.h rename to RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashDebug.h diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSDynamicLinker.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashDynamicLinker.c similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSDynamicLinker.c rename to RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashDynamicLinker.c diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSDynamicLinker.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashDynamicLinker.h similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSDynamicLinker.h rename to RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashDynamicLinker.h diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSFileUtils.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashFileUtils.c similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSFileUtils.c rename to RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashFileUtils.c diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSFileUtils.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashFileUtils.h similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSFileUtils.h rename to RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashFileUtils.h diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSID.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashID.c similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSID.c rename to RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashID.c diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSID.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashID.h similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSID.h rename to RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashID.h diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSJSONCodec.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashJSONCodec.c similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSJSONCodec.c rename to RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashJSONCodec.c diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSJSONCodec.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashJSONCodec.h similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSJSONCodec.h rename to RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashJSONCodec.h diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSJSONCodecObjC.m b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashJSONCodecObjC.m similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSJSONCodecObjC.m rename to RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashJSONCodecObjC.m diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSLogger.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashLogger.c similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSLogger.c rename to RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashLogger.c diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSLogger.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashLogger.h similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSLogger.h rename to RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashLogger.h diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSMach.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashMach.c similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSMach.c rename to RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashMach.c diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSMach.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashMach.h similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSMach.h rename to RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashMach.h diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSMachineContext.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashMachineContext.c similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSMachineContext.c rename to RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashMachineContext.c diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSMachineContext_Apple.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashMachineContext_Apple.h similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSMachineContext_Apple.h rename to RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashMachineContext_Apple.h diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSMemory.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashMemory.c similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSMemory.c rename to RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashMemory.c diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSMemory.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashMemory.h similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSMemory.h rename to RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashMemory.h diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSObjC.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashObjC.c similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSObjC.c rename to RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashObjC.c diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSObjC.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashObjC.h similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSObjC.h rename to RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashObjC.h diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSObjCApple.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashObjCApple.h similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSObjCApple.h rename to RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashObjCApple.h diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSPlatformSpecificDefines.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashPlatformSpecificDefines.h similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSPlatformSpecificDefines.h rename to RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashPlatformSpecificDefines.h diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSSignalInfo.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashSignalInfo.c similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSSignalInfo.c rename to RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashSignalInfo.c diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSSignalInfo.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashSignalInfo.h similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSSignalInfo.h rename to RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashSignalInfo.h diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSStackCursor.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor.c similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSStackCursor.c rename to RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor.c diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSStackCursor.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor.h similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSStackCursor.h rename to RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor.h diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSStackCursor_Backtrace.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor_Backtrace.c similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSStackCursor_Backtrace.c rename to RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor_Backtrace.c diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSStackCursor_Backtrace.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor_Backtrace.h similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSStackCursor_Backtrace.h rename to RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor_Backtrace.h diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSStackCursor_MachineContext.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor_MachineContext.c similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSStackCursor_MachineContext.c rename to RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor_MachineContext.c diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSStackCursor_MachineContext.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor_MachineContext.h similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSStackCursor_MachineContext.h rename to RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor_MachineContext.h diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSStackCursor_SelfThread.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor_SelfThread.c similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSStackCursor_SelfThread.c rename to RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor_SelfThread.c diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSStackCursor_SelfThread.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor_SelfThread.h similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSStackCursor_SelfThread.h rename to RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor_SelfThread.h diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSString.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashString.c similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSString.c rename to RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashString.c diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSString.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashString.h similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSString.h rename to RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashString.h diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSSymbolicator.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashSymbolicator.c similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSSymbolicator.c rename to RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashSymbolicator.c diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSSymbolicator.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashSymbolicator.h similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSSymbolicator.h rename to RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashSymbolicator.h diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSSysCtl.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashSysCtl.c similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSSysCtl.c rename to RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashSysCtl.c diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSSysCtl.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashSysCtl.h similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSSysCtl.h rename to RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashSysCtl.h diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSThread.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashThread.c similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSThread.c rename to RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashThread.c diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSgetsect.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashgetsect.c similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSgetsect.c rename to RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashgetsect.c diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSgetsect.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashgetsect.h similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Recording/Tools/KSgetsect.h rename to RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashgetsect.h diff --git a/RollbarNotifier/Sources/RollbarCrash/Reporting/Filters/KSCrashReportFilterBasic.m b/RollbarNotifier/Sources/RollbarCrash/Reporting/Filters/RollbarCrashReportFilterBasic.m similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Reporting/Filters/KSCrashReportFilterBasic.m rename to RollbarNotifier/Sources/RollbarCrash/Reporting/Filters/RollbarCrashReportFilterBasic.m diff --git a/RollbarNotifier/Sources/RollbarCrash/Reporting/Filters/Tools/KSVarArgs.h b/RollbarNotifier/Sources/RollbarCrash/Reporting/Filters/Tools/RollbarCrashVarArgs.h similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Reporting/Filters/Tools/KSVarArgs.h rename to RollbarNotifier/Sources/RollbarCrash/Reporting/Filters/Tools/RollbarCrashVarArgs.h diff --git a/RollbarNotifier/Sources/RollbarCrash/Reporting/Tools/KSCString.h b/RollbarNotifier/Sources/RollbarCrash/Reporting/Tools/RollbarCrashCString.h similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Reporting/Tools/KSCString.h rename to RollbarNotifier/Sources/RollbarCrash/Reporting/Tools/RollbarCrashCString.h diff --git a/RollbarNotifier/Sources/RollbarCrash/Reporting/Tools/KSCString.m b/RollbarNotifier/Sources/RollbarCrash/Reporting/Tools/RollbarCrashCString.m similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/Reporting/Tools/KSCString.m rename to RollbarNotifier/Sources/RollbarCrash/Reporting/Tools/RollbarCrashCString.m diff --git a/RollbarNotifier/Sources/RollbarCrash/include/KSCrash.h b/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrash.h similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/include/KSCrash.h rename to RollbarNotifier/Sources/RollbarCrash/include/RollbarCrash.h diff --git a/RollbarNotifier/Sources/RollbarCrash/include/KSCrashC.h b/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashC.h similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/include/KSCrashC.h rename to RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashC.h diff --git a/RollbarNotifier/Sources/RollbarCrash/include/KSCrashInstallation+Private.h b/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashInstallation+Private.h similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/include/KSCrashInstallation+Private.h rename to RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashInstallation+Private.h diff --git a/RollbarNotifier/Sources/RollbarCrash/include/KSCrashInstallation.h b/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashInstallation.h similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/include/KSCrashInstallation.h rename to RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashInstallation.h diff --git a/RollbarNotifier/Sources/RollbarCrash/include/KSJSONCodecObjC.h b/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashJSONCodecObjC.h similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/include/KSJSONCodecObjC.h rename to RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashJSONCodecObjC.h diff --git a/RollbarNotifier/Sources/RollbarCrash/include/KSMachineContext.h b/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashMachineContext.h similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/include/KSMachineContext.h rename to RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashMachineContext.h diff --git a/RollbarNotifier/Sources/RollbarCrash/include/KSCrashMonitor.h b/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashMonitor.h similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/include/KSCrashMonitor.h rename to RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashMonitor.h diff --git a/RollbarNotifier/Sources/RollbarCrash/include/KSCrashMonitorContext.h b/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashMonitorContext.h similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/include/KSCrashMonitorContext.h rename to RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashMonitorContext.h diff --git a/RollbarNotifier/Sources/RollbarCrash/include/KSCrashMonitorType.h b/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashMonitorType.h similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/include/KSCrashMonitorType.h rename to RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashMonitorType.h diff --git a/RollbarNotifier/Sources/RollbarCrash/include/KSCrashMonitor_System.h b/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashMonitor_System.h similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/include/KSCrashMonitor_System.h rename to RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashMonitor_System.h diff --git a/RollbarNotifier/Sources/RollbarCrash/include/KSCrashReportFields.h b/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashReportFields.h similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/include/KSCrashReportFields.h rename to RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashReportFields.h diff --git a/RollbarNotifier/Sources/RollbarCrash/include/KSCrashReportFilter.h b/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashReportFilter.h similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/include/KSCrashReportFilter.h rename to RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashReportFilter.h diff --git a/RollbarNotifier/Sources/RollbarCrash/include/KSCrashReportFilterBasic.h b/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashReportFilterBasic.h similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/include/KSCrashReportFilterBasic.h rename to RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashReportFilterBasic.h diff --git a/RollbarNotifier/Sources/RollbarCrash/include/KSCrashReportWriter.h b/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashReportWriter.h similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/include/KSCrashReportWriter.h rename to RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashReportWriter.h diff --git a/RollbarNotifier/Sources/RollbarCrash/include/KSThread.h b/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashThread.h similarity index 100% rename from RollbarNotifier/Sources/RollbarCrash/include/KSThread.h rename to RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashThread.h From d606606aaa573fb989089cba712ae0c6e674c8b5 Mon Sep 17 00:00:00 2001 From: Matias Pequeno Date: Tue, 4 Jul 2023 12:19:31 -0300 Subject: [PATCH 2/4] Renamed KSCrash types to RollbarCrash to avoid potential name collisions --- .../Installations/RollbarCrashInstallation.m | 78 +- .../Recording/Monitors/RollbarCrashMonitor.c | 118 ++-- .../Monitors/RollbarCrashMonitorType.c | 26 +- .../Monitors/RollbarCrashMonitor_AppState.c | 96 +-- .../Monitors/RollbarCrashMonitor_AppState.h | 18 +- .../RollbarCrashMonitor_CPPException.cpp | 44 +- .../RollbarCrashMonitor_CPPException.h | 12 +- .../Monitors/RollbarCrashMonitor_Deadlock.h | 12 +- .../Monitors/RollbarCrashMonitor_Deadlock.m | 54 +- .../RollbarCrashMonitor_MachException.c | 124 ++-- .../RollbarCrashMonitor_MachException.h | 12 +- .../RollbarCrashMonitor_NSException.h | 12 +- .../RollbarCrashMonitor_NSException.m | 50 +- .../Monitors/RollbarCrashMonitor_Signal.c | 82 +-- .../Monitors/RollbarCrashMonitor_Signal.h | 12 +- .../Monitors/RollbarCrashMonitor_System.m | 46 +- .../Monitors/RollbarCrashMonitor_User.c | 32 +- .../Monitors/RollbarCrashMonitor_User.h | 12 +- .../Monitors/RollbarCrashMonitor_Zombie.c | 28 +- .../Monitors/RollbarCrashMonitor_Zombie.h | 16 +- .../RollbarCrash/Recording/RollbarCrash.m | 116 +-- .../RollbarCrash/Recording/RollbarCrashC.c | 118 ++-- .../Recording/RollbarCrashCachedData.c | 34 +- .../Recording/RollbarCrashCachedData.h | 10 +- .../Recording/RollbarCrashDoctor.h | 8 +- .../Recording/RollbarCrashDoctor.m | 144 ++-- .../Recording/RollbarCrashReport.c | 666 +++++++++--------- .../Recording/RollbarCrashReport.h | 18 +- .../Recording/RollbarCrashReportFixer.c | 42 +- .../Recording/RollbarCrashReportFixer.h | 8 +- .../Recording/RollbarCrashReportStore.c | 26 +- .../Recording/RollbarCrashReportStore.h | 12 +- .../Recording/RollbarCrashReportVersion.h | 10 +- .../RollbarCrashSystemCapabilities.h | 132 ++-- .../Recording/Tools/RollbarCrashCPU.c | 16 +- .../Recording/Tools/RollbarCrashCPU.h | 26 +- .../Recording/Tools/RollbarCrashCPU_Apple.h | 8 +- .../Recording/Tools/RollbarCrashCPU_arm.c | 36 +- .../Recording/Tools/RollbarCrashCPU_arm64.c | 40 +- .../Recording/Tools/RollbarCrashCPU_x86_32.c | 36 +- .../Recording/Tools/RollbarCrashCPU_x86_64.c | 36 +- .../Tools/RollbarCrashCxaThrowSwapper.c | 22 +- .../Tools/RollbarCrashCxaThrowSwapper.h | 8 +- .../Recording/Tools/RollbarCrashDate.c | 4 +- .../Recording/Tools/RollbarCrashDate.h | 8 +- .../Recording/Tools/RollbarCrashDebug.c | 10 +- .../Recording/Tools/RollbarCrashDebug.h | 8 +- .../Tools/RollbarCrashDynamicLinker.c | 40 +- .../Tools/RollbarCrashDynamicLinker.h | 14 +- .../Recording/Tools/RollbarCrashFileUtils.c | 74 +- .../Recording/Tools/RollbarCrashFileUtils.h | 30 +- .../Recording/Tools/RollbarCrashID.c | 2 +- .../Recording/Tools/RollbarCrashID.h | 8 +- .../Recording/Tools/RollbarCrashJSONCodec.c | 338 ++++----- .../Recording/Tools/RollbarCrashJSONCodec.h | 144 ++-- .../Tools/RollbarCrashJSONCodecObjC.m | 120 ++-- .../Recording/Tools/RollbarCrashLogger.c | 24 +- .../Recording/Tools/RollbarCrashLogger.h | 214 +++--- .../Recording/Tools/RollbarCrashMach.c | 4 +- .../Recording/Tools/RollbarCrashMach.h | 8 +- .../Tools/RollbarCrashMachineContext.c | 102 +-- .../Tools/RollbarCrashMachineContext_Apple.h | 12 +- .../Recording/Tools/RollbarCrashMemory.c | 8 +- .../Recording/Tools/RollbarCrashMemory.h | 2 +- .../Recording/Tools/RollbarCrashObjC.c | 88 +-- .../Recording/Tools/RollbarCrashObjC.h | 54 +- .../Recording/Tools/RollbarCrashObjCApple.h | 12 +- .../RollbarCrashPlatformSpecificDefines.h | 8 +- .../Recording/Tools/RollbarCrashSignalInfo.c | 22 +- .../Recording/Tools/RollbarCrashSignalInfo.h | 8 +- .../Recording/Tools/RollbarCrashStackCursor.c | 22 +- .../Recording/Tools/RollbarCrashStackCursor.h | 36 +- .../Tools/RollbarCrashStackCursor_Backtrace.c | 18 +- .../Tools/RollbarCrashStackCursor_Backtrace.h | 14 +- .../RollbarCrashStackCursor_MachineContext.c | 20 +- .../RollbarCrashStackCursor_MachineContext.h | 12 +- .../RollbarCrashStackCursor_SelfThread.c | 16 +- .../RollbarCrashStackCursor_SelfThread.h | 12 +- .../Recording/Tools/RollbarCrashString.c | 8 +- .../Recording/Tools/RollbarCrashString.h | 8 +- .../Tools/RollbarCrashSymbolicator.c | 8 +- .../Tools/RollbarCrashSymbolicator.h | 12 +- .../Recording/Tools/RollbarCrashSysCtl.c | 26 +- .../Recording/Tools/RollbarCrashSysCtl.h | 8 +- .../Recording/Tools/RollbarCrashThread.c | 36 +- .../Recording/Tools/RollbarCrashgetsect.c | 4 +- .../Recording/Tools/RollbarCrashgetsect.h | 10 +- .../Filters/RollbarCrashReportFilterBasic.m | 100 +-- .../Filters/Tools/RollbarCrashVarArgs.h | 10 +- .../Reporting/Tools/RollbarCrashCString.h | 12 +- .../Reporting/Tools/RollbarCrashCString.m | 14 +- .../RollbarCrash/include/RollbarCrash.h | 66 +- .../RollbarCrash/include/RollbarCrashC.h | 32 +- .../RollbarCrashInstallation+Private.h | 8 +- .../include/RollbarCrashInstallation.h | 22 +- .../include/RollbarCrashJSONCodecObjC.h | 30 +- .../include/RollbarCrashMachineContext.h | 42 +- .../include/RollbarCrashMonitor.h | 26 +- .../include/RollbarCrashMonitorContext.h | 22 +- .../include/RollbarCrashMonitorType.h | 88 +-- .../include/RollbarCrashMonitor_System.h | 10 +- .../include/RollbarCrashReportFields.h | 272 +++---- .../include/RollbarCrashReportFilter.h | 10 +- .../include/RollbarCrashReportFilterBasic.h | 42 +- .../include/RollbarCrashReportWriter.h | 48 +- .../RollbarCrash/include/RollbarCrashThread.h | 16 +- .../RollbarCrashDiagnosticFilter.swift | 12 +- .../RollbarCrashFormattingFilter.swift | 10 +- .../RollbarNotifier/RollbarCrashCollector.h | 2 +- .../RollbarNotifier/RollbarCrashCollector.m | 38 +- 110 files changed, 2512 insertions(+), 2512 deletions(-) diff --git a/RollbarNotifier/Sources/RollbarCrash/Installations/RollbarCrashInstallation.m b/RollbarNotifier/Sources/RollbarCrash/Installations/RollbarCrashInstallation.m index d638bfdc..155f0858 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Installations/RollbarCrashInstallation.m +++ b/RollbarNotifier/Sources/RollbarCrash/Installations/RollbarCrashInstallation.m @@ -1,5 +1,5 @@ // -// KSCrashInstallation.m +// RollbarCrashInstallation.m // // Created by Karl Stenerud on 2013-02-10. // @@ -25,13 +25,13 @@ // -#import "KSCrashInstallation.h" -#import "KSCrashInstallation+Private.h" -#import "KSCrashReportFilterBasic.h" -#import "KSCrash.h" -#import "KSCString.h" -#import "KSJSONCodecObjC.h" -#import "KSLogger.h" +#import "RollbarCrashInstallation.h" +#import "RollbarCrashInstallation+Private.h" +#import "RollbarCrashReportFilterBasic.h" +#import "RollbarCrash.h" +#import "RollbarCrashCString.h" +#import "RollbarCrashJSONCodecObjC.h" +#import "RollbarCrashLogger.h" #import "NSError+SimpleConstructor.h" #import @@ -48,7 +48,7 @@ typedef struct { - KSReportWriteCallback userCrashCallback; + RollbarCrashReportWriteCallback userCrashCallback; int reportFieldsCount; ReportField* reportFields[0]; } CrashHandlerData; @@ -57,7 +57,7 @@ static CrashHandlerData* g_crashHandlerData; -static void crashCallback(const KSCrashReportWriter* writer) +static void crashCallback(const RollbarCrashReportWriter* writer) { for(int i = 0; i < g_crashHandlerData->reportFieldsCount; i++) { @@ -74,7 +74,7 @@ static void crashCallback(const KSCrashReportWriter* writer) } -@interface KSCrashInstReportField: NSObject +@interface RollbarCrashInstReportField: NSObject @property(nonatomic,readonly,assign) int index; @property(nonatomic,readonly,assign) ReportField* field; @@ -83,12 +83,12 @@ @interface KSCrashInstReportField: NSObject @property(nonatomic,readwrite,retain) id value; @property(nonatomic,readwrite,retain) NSMutableData* fieldBacking; -@property(nonatomic,readwrite,retain) KSCString* keyBacking; -@property(nonatomic,readwrite,retain) KSCString* valueBacking; +@property(nonatomic,readwrite,retain) RollbarCrashCString* keyBacking; +@property(nonatomic,readwrite,retain) RollbarCrashCString* valueBacking; @end -@implementation KSCrashInstReportField +@implementation RollbarCrashInstReportField @synthesize index = _index; @synthesize key = _key; @@ -97,9 +97,9 @@ @implementation KSCrashInstReportField @synthesize keyBacking = _keyBacking; @synthesize valueBacking= _valueBacking; -+ (KSCrashInstReportField*) fieldWithIndex:(int) index ++ (RollbarCrashInstReportField*) fieldWithIndex:(int) index { - return [(KSCrashInstReportField*)[self alloc] initWithIndex:index]; + return [(RollbarCrashInstReportField*)[self alloc] initWithIndex:index]; } - (id) initWithIndex:(int) index @@ -126,7 +126,7 @@ - (void) setKey:(NSString*) key } else { - self.keyBacking = [KSCString stringWithString:key]; + self.keyBacking = [RollbarCrashCString stringWithString:key]; } self.field->key = self.keyBacking.bytes; } @@ -141,34 +141,34 @@ - (void) setValue:(id) value } NSError* error = nil; - NSData* jsonData = [KSJSONCodec encode:value options:KSJSONEncodeOptionPretty | KSJSONEncodeOptionSorted error:&error]; + NSData* jsonData = [RollbarCrashJSONCodec encode:value options:RollbarCrashJSONEncodeOptionPretty | RollbarCrashJSONEncodeOptionSorted error:&error]; if(jsonData == nil) { - KSLOG_ERROR(@"Could not set value %@ for property %@: %@", value, self.key, error); + RollbarCrashLOG_ERROR(@"Could not set value %@ for property %@: %@", value, self.key, error); } else { _value = value; - self.valueBacking = [KSCString stringWithData:jsonData]; + self.valueBacking = [RollbarCrashCString stringWithData:jsonData]; self.field->value = self.valueBacking.bytes; } } @end -@interface KSCrashInstallation () +@interface RollbarCrashInstallation () @property(nonatomic,readwrite,assign) int nextFieldIndex; @property(nonatomic,readonly,assign) CrashHandlerData* crashHandlerData; @property(nonatomic,readwrite,retain) NSMutableData* crashHandlerDataBacking; @property(nonatomic,readwrite,retain) NSMutableDictionary* fields; @property(nonatomic,readwrite,retain) NSArray* requiredProperties; -@property(nonatomic,readwrite,retain) KSCrashReportFilterPipeline* prependedFilters; +@property(nonatomic,readwrite,retain) RollbarCrashReportFilterPipeline* prependedFilters; @end -@implementation KSCrashInstallation +@implementation RollbarCrashInstallation @synthesize nextFieldIndex = _nextFieldIndex; @synthesize crashHandlerDataBacking = _crashHandlerDataBacking; @@ -191,14 +191,14 @@ - (id) initWithRequiredProperties:(NSArray*) requiredProperties sizeof(*self.crashHandlerData->reportFields) * kMaxProperties]; self.fields = [NSMutableDictionary dictionary]; self.requiredProperties = requiredProperties; - self.prependedFilters = [KSCrashReportFilterPipeline filterWithFilters:nil]; + self.prependedFilters = [RollbarCrashReportFilterPipeline filterWithFilters:nil]; } return self; } - (void) dealloc { - KSCrash* handler = [KSCrash sharedInstance]; + RollbarCrash* handler = [RollbarCrash sharedInstance]; @synchronized(handler) { if(g_crashHandlerData == self.crashHandlerData) @@ -214,12 +214,12 @@ - (CrashHandlerData*) crashHandlerData return (CrashHandlerData*)self.crashHandlerDataBacking.mutableBytes; } -- (KSCrashInstReportField*) reportFieldForProperty:(NSString*) propertyName +- (RollbarCrashInstReportField*) reportFieldForProperty:(NSString*) propertyName { - KSCrashInstReportField* field = [self.fields objectForKey:propertyName]; + RollbarCrashInstReportField* field = [self.fields objectForKey:propertyName]; if(field == nil) { - field = [KSCrashInstReportField fieldWithIndex:self.nextFieldIndex]; + field = [RollbarCrashInstReportField fieldWithIndex:self.nextFieldIndex]; self.nextFieldIndex++; self.crashHandlerData->reportFieldsCount = self.nextFieldIndex; self.crashHandlerData->reportFields[field.index] = field.field; @@ -230,13 +230,13 @@ - (KSCrashInstReportField*) reportFieldForProperty:(NSString*) propertyName - (void) reportFieldForProperty:(NSString*) propertyName setKey:(id) key { - KSCrashInstReportField* field = [self reportFieldForProperty:propertyName]; + RollbarCrashInstReportField* field = [self reportFieldForProperty:propertyName]; field.key = key; } - (void) reportFieldForProperty:(NSString*) propertyName setValue:(id) value { - KSCrashInstReportField* field = [self reportFieldForProperty:propertyName]; + RollbarCrashInstReportField* field = [self reportFieldForProperty:propertyName]; field.value = value; } @@ -300,7 +300,7 @@ - (NSArray*) makeKeyPaths:(NSArray*) keyPaths return result; } -- (KSReportWriteCallback) onCrash +- (RollbarCrashReportWriteCallback) onCrash { @synchronized(self) { @@ -308,7 +308,7 @@ - (KSReportWriteCallback) onCrash } } -- (void) setOnCrash:(KSReportWriteCallback)onCrash +- (void) setOnCrash:(RollbarCrashReportWriteCallback)onCrash { @synchronized(self) { @@ -318,7 +318,7 @@ - (void) setOnCrash:(KSReportWriteCallback)onCrash - (void) install { - KSCrash* handler = [KSCrash sharedInstance]; + RollbarCrash* handler = [RollbarCrash sharedInstance]; @synchronized(handler) { g_crashHandlerData = self.crashHandlerData; @@ -327,7 +327,7 @@ - (void) install } } -- (void) sendAllReportsWithCompletion:(KSCrashReportFilterCompletion) onCompletion +- (void) sendAllReportsWithCompletion:(RollbarCrashReportFilterCompletion) onCompletion { NSError* error = [self validateProperties]; if(error != nil) @@ -339,7 +339,7 @@ - (void) sendAllReportsWithCompletion:(KSCrashReportFilterCompletion) onCompleti return; } - id sink = [self sink]; + id sink = [self sink]; if(sink == nil) { onCompletion(nil, NO, [NSError errorWithDomain:[[self class] description] @@ -348,19 +348,19 @@ - (void) sendAllReportsWithCompletion:(KSCrashReportFilterCompletion) onCompleti return; } - sink = [KSCrashReportFilterPipeline filterWithFilters:self.prependedFilters, sink, nil]; + sink = [RollbarCrashReportFilterPipeline filterWithFilters:self.prependedFilters, sink, nil]; - KSCrash* handler = [KSCrash sharedInstance]; + RollbarCrash* handler = [RollbarCrash sharedInstance]; handler.sink = sink; [handler sendAllReportsWithCompletion:onCompletion]; } -- (void) addPreFilter:(id) filter +- (void) addPreFilter:(id) filter { [self.prependedFilters addFilter:filter]; } -- (id) sink +- (id) sink { return nil; } diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor.c index baff0f3f..78d4421b 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor.c @@ -1,5 +1,5 @@ // -// KSCrashMonitor.c +// RollbarCrashMonitor.c // // Created by Karl Stenerud on 2012-02-12. // @@ -25,27 +25,27 @@ // -#include "KSCrashMonitor.h" -#include "KSCrashMonitorContext.h" -#include "KSCrashMonitorType.h" +#include "RollbarCrashMonitor.h" +#include "RollbarCrashMonitorContext.h" +#include "RollbarCrashMonitorType.h" -#include "KSCrashMonitor_Deadlock.h" -#include "KSCrashMonitor_MachException.h" -#include "KSCrashMonitor_CPPException.h" -#include "KSCrashMonitor_NSException.h" -#include "KSCrashMonitor_Signal.h" -#include "KSCrashMonitor_System.h" -#include "KSCrashMonitor_User.h" -#include "KSCrashMonitor_AppState.h" -#include "KSCrashMonitor_Zombie.h" -#include "KSDebug.h" -#include "KSThread.h" -#include "KSSystemCapabilities.h" +#include "RollbarCrashMonitor_Deadlock.h" +#include "RollbarCrashMonitor_MachException.h" +#include "RollbarCrashMonitor_CPPException.h" +#include "RollbarCrashMonitor_NSException.h" +#include "RollbarCrashMonitor_Signal.h" +#include "RollbarCrashMonitor_System.h" +#include "RollbarCrashMonitor_User.h" +#include "RollbarCrashMonitor_AppState.h" +#include "RollbarCrashMonitor_Zombie.h" +#include "RollbarCrashDebug.h" +#include "RollbarCrashThread.h" +#include "RollbarCrashSystemCapabilities.h" #include -//#define KSLogger_LocalLevel TRACE -#include "KSLogger.h" +//#define RollbarCrashLogger_LocalLevel TRACE +#include "RollbarCrashLogger.h" // ============================================================================ @@ -54,70 +54,70 @@ typedef struct { - KSCrashMonitorType monitorType; - KSCrashMonitorAPI* (*getAPI)(void); + RollbarCrashMonitorType monitorType; + RollbarCrashMonitorAPI* (*getAPI)(void); } Monitor; static Monitor g_monitors[] = { -#if KSCRASH_HAS_MACH +#if RollbarCrashCRASH_HAS_MACH { - .monitorType = KSCrashMonitorTypeMachException, + .monitorType = RollbarCrashMonitorTypeMachException, .getAPI = kscm_machexception_getAPI, }, #endif -#if KSCRASH_HAS_SIGNAL +#if RollbarCrashCRASH_HAS_SIGNAL { - .monitorType = KSCrashMonitorTypeSignal, + .monitorType = RollbarCrashMonitorTypeSignal, .getAPI = kscm_signal_getAPI, }, #endif -#if KSCRASH_HAS_OBJC +#if RollbarCrashCRASH_HAS_OBJC { - .monitorType = KSCrashMonitorTypeNSException, + .monitorType = RollbarCrashMonitorTypeNSException, .getAPI = kscm_nsexception_getAPI, }, { - .monitorType = KSCrashMonitorTypeMainThreadDeadlock, + .monitorType = RollbarCrashMonitorTypeMainThreadDeadlock, .getAPI = kscm_deadlock_getAPI, }, { - .monitorType = KSCrashMonitorTypeZombie, + .monitorType = RollbarCrashMonitorTypeZombie, .getAPI = kscm_zombie_getAPI, }, #endif { - .monitorType = KSCrashMonitorTypeCPPException, + .monitorType = RollbarCrashMonitorTypeCPPException, .getAPI = kscm_cppexception_getAPI, }, { - .monitorType = KSCrashMonitorTypeUserReported, + .monitorType = RollbarCrashMonitorTypeUserReported, .getAPI = kscm_user_getAPI, }, { - .monitorType = KSCrashMonitorTypeSystem, + .monitorType = RollbarCrashMonitorTypeSystem, .getAPI = kscm_system_getAPI, }, { - .monitorType = KSCrashMonitorTypeApplicationState, + .monitorType = RollbarCrashMonitorTypeApplicationState, .getAPI = kscm_appstate_getAPI, }, }; static int g_monitorsCount = sizeof(g_monitors) / sizeof(*g_monitors); -static KSCrashMonitorType g_activeMonitors = KSCrashMonitorTypeNone; +static RollbarCrashMonitorType g_activeMonitors = RollbarCrashMonitorTypeNone; static bool g_handlingFatalException = false; static bool g_crashedDuringExceptionHandling = false; static bool g_requiresAsyncSafety = false; -static void (*g_onExceptionEvent)(struct KSCrash_MonitorContext* monitorContext); +static void (*g_onExceptionEvent)(struct RollbarCrash_MonitorContext* monitorContext); // ============================================================================ #pragma mark - API - // ============================================================================ -static inline KSCrashMonitorAPI* getAPI(Monitor* monitor) +static inline RollbarCrashMonitorAPI* getAPI(Monitor* monitor) { if(monitor != NULL && monitor->getAPI != NULL) { @@ -128,7 +128,7 @@ static inline KSCrashMonitorAPI* getAPI(Monitor* monitor) static inline void setMonitorEnabled(Monitor* monitor, bool isEnabled) { - KSCrashMonitorAPI* api = getAPI(monitor); + RollbarCrashMonitorAPI* api = getAPI(monitor); if(api != NULL && api->setEnabled != NULL) { api->setEnabled(isEnabled); @@ -137,7 +137,7 @@ static inline void setMonitorEnabled(Monitor* monitor, bool isEnabled) static inline bool isMonitorEnabled(Monitor* monitor) { - KSCrashMonitorAPI* api = getAPI(monitor); + RollbarCrashMonitorAPI* api = getAPI(monitor); if(api != NULL && api->isEnabled != NULL) { return api->isEnabled(); @@ -145,44 +145,44 @@ static inline bool isMonitorEnabled(Monitor* monitor) return false; } -static inline void addContextualInfoToEvent(Monitor* monitor, struct KSCrash_MonitorContext* eventContext) +static inline void addContextualInfoToEvent(Monitor* monitor, struct RollbarCrash_MonitorContext* eventContext) { - KSCrashMonitorAPI* api = getAPI(monitor); + RollbarCrashMonitorAPI* api = getAPI(monitor); if(api != NULL && api->addContextualInfoToEvent != NULL) { api->addContextualInfoToEvent(eventContext); } } -void kscm_setEventCallback(void (*onEvent)(struct KSCrash_MonitorContext* monitorContext)) +void kscm_setEventCallback(void (*onEvent)(struct RollbarCrash_MonitorContext* monitorContext)) { g_onExceptionEvent = onEvent; } -void kscm_setActiveMonitors(KSCrashMonitorType monitorTypes) +void kscm_setActiveMonitors(RollbarCrashMonitorType monitorTypes) { - if(ksdebug_isBeingTraced() && (monitorTypes & KSCrashMonitorTypeDebuggerUnsafe)) + if(ksdebug_isBeingTraced() && (monitorTypes & RollbarCrashMonitorTypeDebuggerUnsafe)) { static bool hasWarned = false; if(!hasWarned) { hasWarned = true; - KSLOGBASIC_WARN(" ************************ Crash Handler Notice ************************"); - KSLOGBASIC_WARN(" * App is running in a debugger. Masking out unsafe monitors. *"); - KSLOGBASIC_WARN(" * This means that most crashes WILL NOT BE RECORDED while debugging! *"); - KSLOGBASIC_WARN(" **********************************************************************"); + RollbarCrashLOGBASIC_WARN(" ************************ Crash Handler Notice ************************"); + RollbarCrashLOGBASIC_WARN(" * App is running in a debugger. Masking out unsafe monitors. *"); + RollbarCrashLOGBASIC_WARN(" * This means that most crashes WILL NOT BE RECORDED while debugging! *"); + RollbarCrashLOGBASIC_WARN(" **********************************************************************"); } - monitorTypes &= KSCrashMonitorTypeDebuggerSafe; + monitorTypes &= RollbarCrashMonitorTypeDebuggerSafe; } - if(g_requiresAsyncSafety && (monitorTypes & KSCrashMonitorTypeAsyncUnsafe)) + if(g_requiresAsyncSafety && (monitorTypes & RollbarCrashMonitorTypeAsyncUnsafe)) { - KSLOG_DEBUG("Async-safe environment detected. Masking out unsafe monitors."); - monitorTypes &= KSCrashMonitorTypeAsyncSafe; + RollbarCrashLOG_DEBUG("Async-safe environment detected. Masking out unsafe monitors."); + monitorTypes &= RollbarCrashMonitorTypeAsyncSafe; } - KSLOG_DEBUG("Changing active monitors from 0x%x tp 0x%x.", g_activeMonitors, monitorTypes); + RollbarCrashLOG_DEBUG("Changing active monitors from 0x%x tp 0x%x.", g_activeMonitors, monitorTypes); - KSCrashMonitorType activeMonitors = KSCrashMonitorTypeNone; + RollbarCrashMonitorType activeMonitors = RollbarCrashMonitorTypeNone; for(int i = 0; i < g_monitorsCount; i++) { Monitor* monitor = &g_monitors[i]; @@ -198,11 +198,11 @@ void kscm_setActiveMonitors(KSCrashMonitorType monitorTypes) } } - KSLOG_DEBUG("Active monitors are now 0x%x.", activeMonitors); + RollbarCrashLOG_DEBUG("Active monitors are now 0x%x.", activeMonitors); g_activeMonitors = activeMonitors; } -KSCrashMonitorType kscm_getActiveMonitors() +RollbarCrashMonitorType kscm_getActiveMonitors() { return g_activeMonitors; } @@ -222,13 +222,13 @@ bool kscm_notifyFatalExceptionCaptured(bool isAsyncSafeEnvironment) g_handlingFatalException = true; if(g_crashedDuringExceptionHandling) { - KSLOG_INFO("Detected crash in the crash reporter. Uninstalling KSCrash."); - kscm_setActiveMonitors(KSCrashMonitorTypeNone); + RollbarCrashLOG_INFO("Detected crash in the crash reporter. Uninstalling RollbarCrash."); + kscm_setActiveMonitors(RollbarCrashMonitorTypeNone); } return g_crashedDuringExceptionHandling; } -void kscm_handleException(struct KSCrash_MonitorContext* context) +void kscm_handleException(struct RollbarCrash_MonitorContext* context) { context->requiresAsyncSafety = g_requiresAsyncSafety; if(g_crashedDuringExceptionHandling) @@ -250,8 +250,8 @@ void kscm_handleException(struct KSCrash_MonitorContext* context) g_handlingFatalException = false; } else { if(g_handlingFatalException && !g_crashedDuringExceptionHandling) { - KSLOG_DEBUG("Exception is fatal. Restoring original handlers."); - kscm_setActiveMonitors(KSCrashMonitorTypeNone); + RollbarCrashLOG_DEBUG("Exception is fatal. Restoring original handlers."); + kscm_setActiveMonitors(RollbarCrashMonitorTypeNone); } } } diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitorType.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitorType.c index ec370b53..24abc4b5 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitorType.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitorType.c @@ -1,5 +1,5 @@ // -// KSCrashMonitorType.c +// RollbarCrashMonitorType.c // // Copyright (c) 2012 Karl Stenerud. All rights reserved. // @@ -23,32 +23,32 @@ // -#include "KSCrashMonitorType.h" +#include "RollbarCrashMonitorType.h" #include static const struct { - const KSCrashMonitorType type; + const RollbarCrashMonitorType type; const char* const name; } g_monitorTypes[] = { #define MONITORTYPE(NAME) {NAME, #NAME} - MONITORTYPE(KSCrashMonitorTypeMachException), - MONITORTYPE(KSCrashMonitorTypeSignal), - MONITORTYPE(KSCrashMonitorTypeCPPException), - MONITORTYPE(KSCrashMonitorTypeNSException), - MONITORTYPE(KSCrashMonitorTypeMainThreadDeadlock), - MONITORTYPE(KSCrashMonitorTypeUserReported), - MONITORTYPE(KSCrashMonitorTypeSystem), - MONITORTYPE(KSCrashMonitorTypeApplicationState), - MONITORTYPE(KSCrashMonitorTypeZombie), + MONITORTYPE(RollbarCrashMonitorTypeMachException), + MONITORTYPE(RollbarCrashMonitorTypeSignal), + MONITORTYPE(RollbarCrashMonitorTypeCPPException), + MONITORTYPE(RollbarCrashMonitorTypeNSException), + MONITORTYPE(RollbarCrashMonitorTypeMainThreadDeadlock), + MONITORTYPE(RollbarCrashMonitorTypeUserReported), + MONITORTYPE(RollbarCrashMonitorTypeSystem), + MONITORTYPE(RollbarCrashMonitorTypeApplicationState), + MONITORTYPE(RollbarCrashMonitorTypeZombie), }; static const int g_monitorTypesCount = sizeof(g_monitorTypes) / sizeof(*g_monitorTypes); -const char* kscrashmonitortype_name(const KSCrashMonitorType monitorType) +const char* kscrashmonitortype_name(const RollbarCrashMonitorType monitorType) { for(int i = 0; i < g_monitorTypesCount; i++) { diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_AppState.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_AppState.c index 2bc9b958..535eb177 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_AppState.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_AppState.c @@ -1,5 +1,5 @@ // -// KSCrashMonitor_AppState.c +// RollbarCrashMonitor_AppState.c // // Created by Karl Stenerud on 2012-02-05. // @@ -25,14 +25,14 @@ // -#include "KSCrashMonitor_AppState.h" +#include "RollbarCrashMonitor_AppState.h" -#include "KSFileUtils.h" -#include "KSJSONCodec.h" -#include "KSCrashMonitorContext.h" +#include "RollbarCrashFileUtils.h" +#include "RollbarCrashJSONCodec.h" +#include "RollbarCrashMonitorContext.h" -//#define KSLogger_LocalLevel TRACE -#include "KSLogger.h" +//#define RollbarCrashLogger_LocalLevel TRACE +#include "RollbarCrashLogger.h" #include #include @@ -67,7 +67,7 @@ static const char* g_stateFilePath; /** Current state. */ -static KSCrash_AppState g_state; +static RollbarCrash_AppState g_state; static volatile bool g_isEnabled = false; @@ -77,19 +77,19 @@ static volatile bool g_isEnabled = false; static int onBooleanElement(const char* const name, const bool value, void* const userData) { - KSCrash_AppState* state = userData; + RollbarCrash_AppState* state = userData; if(strcmp(name, kKeyCrashedLastLaunch) == 0) { state->crashedLastLaunch = value; } - return KSJSON_OK; + return RollbarCrashJSON_OK; } static int onFloatingPointElement(const char* const name, const double value, void* const userData) { - KSCrash_AppState* state = userData; + RollbarCrash_AppState* state = userData; if(strcmp(name, kKeyActiveDurationSinceLastCrash) == 0) { @@ -100,19 +100,19 @@ static int onFloatingPointElement(const char* const name, const double value, vo state->backgroundDurationSinceLastCrash = value; } - return KSJSON_OK; + return RollbarCrashJSON_OK; } static int onIntegerElement(const char* const name, const int64_t value, void* const userData) { - KSCrash_AppState* state = userData; + RollbarCrash_AppState* state = userData; if(strcmp(name, kKeyFormatVersion) == 0) { if(value != kFormatVersion) { - KSLOG_ERROR("Expected version 1 but got %" PRId64, value); - return KSJSON_ERROR_INVALID_DATA; + RollbarCrashLOG_ERROR("Expected version 1 but got %" PRId64, value); + return RollbarCrashJSON_ERROR_INVALID_DATA; } } else if(strcmp(name, kKeyLaunchesSinceLastCrash) == 0) @@ -130,34 +130,34 @@ static int onIntegerElement(const char* const name, const int64_t value, void* c static int onNullElement(__unused const char* const name, __unused void* const userData) { - return KSJSON_OK; + return RollbarCrashJSON_OK; } static int onStringElement(__unused const char* const name, __unused const char* const value, __unused void* const userData) { - return KSJSON_OK; + return RollbarCrashJSON_OK; } static int onBeginObject(__unused const char* const name, __unused void* const userData) { - return KSJSON_OK; + return RollbarCrashJSON_OK; } static int onBeginArray(__unused const char* const name, __unused void* const userData) { - return KSJSON_OK; + return RollbarCrashJSON_OK; } static int onEndContainer(__unused void* const userData) { - return KSJSON_OK; + return RollbarCrashJSON_OK; } static int onEndData(__unused void* const userData) { - return KSJSON_OK; + return RollbarCrashJSON_OK; } @@ -167,7 +167,7 @@ static int addJSONData(const char* const data, const int length, void* const use { const int fd = *((int*)userData); const bool success = ksfu_writeBytesToFD(fd, data, length); - return success ? KSJSON_OK : KSJSON_ERROR_CANNOT_ADD_DATA; + return success ? RollbarCrashJSON_OK : RollbarCrashJSON_ERROR_CANNOT_ADD_DATA; } @@ -208,11 +208,11 @@ static bool loadState(const char* const path) int length; if(!ksfu_readEntireFile(path, &data, &length, 50000)) { - KSLOG_ERROR("%s: Could not load file", path); + RollbarCrashLOG_ERROR("%s: Could not load file", path); return false; } - KSJSONDecodeCallbacks callbacks; + RollbarCrashJSONDecodeCallbacks callbacks; callbacks.onBeginArray = onBeginArray; callbacks.onBeginObject = onBeginObject; callbacks.onBooleanElement = onBooleanElement; @@ -234,9 +234,9 @@ static bool loadState(const char* const path) &g_state, &errorOffset); free(data); - if(result != KSJSON_OK) + if(result != RollbarCrashJSON_OK) { - KSLOG_ERROR("%s, offset %d: %s", + RollbarCrashLOG_ERROR("%s, offset %d: %s", path, errorOffset, ksjson_stringForError(result)); return false; } @@ -254,57 +254,57 @@ static bool saveState(const char* const path) int fd = open(path, O_RDWR | O_CREAT | O_TRUNC, 0644); if(fd < 0) { - KSLOG_ERROR("Could not open file %s for writing: %s", + RollbarCrashLOG_ERROR("Could not open file %s for writing: %s", path, strerror(errno)); return false; } - KSJSONEncodeContext JSONContext; + RollbarCrashJSONEncodeContext JSONContext; ksjson_beginEncode(&JSONContext, true, addJSONData, &fd); int result; - if((result = ksjson_beginObject(&JSONContext, NULL)) != KSJSON_OK) + if((result = ksjson_beginObject(&JSONContext, NULL)) != RollbarCrashJSON_OK) { goto done; } if((result = ksjson_addIntegerElement(&JSONContext, kKeyFormatVersion, - kFormatVersion)) != KSJSON_OK) + kFormatVersion)) != RollbarCrashJSON_OK) { goto done; } // Record this launch crashed state into "crashed last launch" field. if((result = ksjson_addBooleanElement(&JSONContext, kKeyCrashedLastLaunch, - g_state.crashedThisLaunch)) != KSJSON_OK) + g_state.crashedThisLaunch)) != RollbarCrashJSON_OK) { goto done; } if((result = ksjson_addFloatingPointElement(&JSONContext, kKeyActiveDurationSinceLastCrash, - g_state.activeDurationSinceLastCrash)) != KSJSON_OK) + g_state.activeDurationSinceLastCrash)) != RollbarCrashJSON_OK) { goto done; } if((result = ksjson_addFloatingPointElement(&JSONContext, kKeyBackgroundDurationSinceLastCrash, - g_state.backgroundDurationSinceLastCrash)) != KSJSON_OK) + g_state.backgroundDurationSinceLastCrash)) != RollbarCrashJSON_OK) { goto done; } if((result = ksjson_addIntegerElement(&JSONContext, kKeyLaunchesSinceLastCrash, - g_state.launchesSinceLastCrash)) != KSJSON_OK) + g_state.launchesSinceLastCrash)) != RollbarCrashJSON_OK) { goto done; } if((result = ksjson_addIntegerElement(&JSONContext, kKeySessionsSinceLastCrash, - g_state.sessionsSinceLastCrash)) != KSJSON_OK) + g_state.sessionsSinceLastCrash)) != RollbarCrashJSON_OK) { goto done; } @@ -312,9 +312,9 @@ static bool saveState(const char* const path) done: close(fd); - if(result != KSJSON_OK) + if(result != RollbarCrashJSON_OK) { - KSLOG_ERROR("%s: %s", + RollbarCrashLOG_ERROR("%s: %s", path, ksjson_stringForError(result)); return false; } @@ -328,14 +328,14 @@ static void updateAppState(void) if(g_state.applicationIsActive) { - KSLOG_TRACE("Updating activeDurationSinceLaunch: %f and activeDurationSinceLastCrash: %f with duration: %f", + RollbarCrashLOG_TRACE("Updating activeDurationSinceLaunch: %f and activeDurationSinceLastCrash: %f with duration: %f", g_state.activeDurationSinceLaunch, g_state.activeDurationSinceLastCrash, duration); g_state.activeDurationSinceLaunch += duration; g_state.activeDurationSinceLastCrash += duration; } else if(!g_state.applicationIsInForeground) { - KSLOG_TRACE("Updating backgroundDurationSinceLaunch: %f and backgroundDurationSinceLastCrash: %f with duration: %f", + RollbarCrashLOG_TRACE("Updating backgroundDurationSinceLaunch: %f and backgroundDurationSinceLastCrash: %f with duration: %f", g_state.backgroundDurationSinceLaunch, g_state.backgroundDurationSinceLastCrash, duration); g_state.backgroundDurationSinceLaunch += duration; g_state.backgroundDurationSinceLastCrash += duration; @@ -380,7 +380,7 @@ bool kscrashstate_reset() void kscrashstate_notifyObjCLoad(void) { - KSLOG_TRACE("KSCrash has been loaded!"); + RollbarCrashLOG_TRACE("RollbarCrash has been loaded!"); memset(&g_state, 0, sizeof(g_state)); g_state.applicationIsInForeground = false; g_state.applicationIsActive = true; @@ -394,13 +394,13 @@ void kscrashstate_notifyAppActive(const bool isActive) g_state.applicationIsActive = isActive; if(isActive) { - KSLOG_TRACE("Updating transition time from: %f to: %f", g_state.appStateTransitionTime, getCurrentTime()); + RollbarCrashLOG_TRACE("Updating transition time from: %f to: %f", g_state.appStateTransitionTime, getCurrentTime()); g_state.appStateTransitionTime = getCurrentTime(); } else { double duration = timeSince(g_state.appStateTransitionTime); - KSLOG_TRACE("Updating activeDurationSinceLaunch: %f and activeDurationSinceLastCrash: %f with duration: %f", + RollbarCrashLOG_TRACE("Updating activeDurationSinceLaunch: %f and activeDurationSinceLastCrash: %f with duration: %f", g_state.activeDurationSinceLaunch, g_state.activeDurationSinceLastCrash, duration); g_state.activeDurationSinceLaunch += duration; g_state.activeDurationSinceLastCrash += duration; @@ -418,7 +418,7 @@ void kscrashstate_notifyAppInForeground(const bool isInForeground) if(isInForeground) { double duration = getCurrentTime() - g_state.appStateTransitionTime; - KSLOG_TRACE("Updating backgroundDurationSinceLaunch: %f and backgroundDurationSinceLastCrash: %f with duration: %f", + RollbarCrashLOG_TRACE("Updating backgroundDurationSinceLaunch: %f and backgroundDurationSinceLastCrash: %f with duration: %f", g_state.backgroundDurationSinceLaunch, g_state.backgroundDurationSinceLastCrash, duration); g_state.backgroundDurationSinceLaunch += duration; g_state.backgroundDurationSinceLastCrash += duration; @@ -445,7 +445,7 @@ void kscrashstate_notifyAppTerminate(void) void kscrashstate_notifyAppCrash(void) { - KSLOG_TRACE("Trying to update AppState. g_isEnabled: %d", g_isEnabled); + RollbarCrashLOG_TRACE("Trying to update AppState. g_isEnabled: %d", g_isEnabled); if(g_isEnabled) { const char* const stateFilePath = g_stateFilePath; @@ -455,7 +455,7 @@ void kscrashstate_notifyAppCrash(void) } } -const KSCrash_AppState* const kscrashstate_currentState(void) +const RollbarCrash_AppState* const kscrashstate_currentState(void) { return &g_state; } @@ -478,7 +478,7 @@ static bool isEnabled() } -static void addContextualInfoToEvent(KSCrash_MonitorContext* eventContext) +static void addContextualInfoToEvent(RollbarCrash_MonitorContext* eventContext) { if(g_isEnabled) { @@ -498,9 +498,9 @@ static void addContextualInfoToEvent(KSCrash_MonitorContext* eventContext) } } -KSCrashMonitorAPI* kscm_appstate_getAPI() +RollbarCrashMonitorAPI* kscm_appstate_getAPI() { - static KSCrashMonitorAPI api = + static RollbarCrashMonitorAPI api = { .setEnabled = setEnabled, .isEnabled = isEnabled, diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_AppState.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_AppState.h index 54c95604..17d2635d 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_AppState.h +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_AppState.h @@ -1,5 +1,5 @@ // -// KSCrashMonitor_AppState.h +// RollbarCrashMonitor_AppState.h // // Created by Karl Stenerud on 2012-02-05. // @@ -30,14 +30,14 @@ */ -#ifndef HDR_KSCrashMonitor_AppState_h -#define HDR_KSCrashMonitor_AppState_h +#ifndef HDR_RollbarCrashMonitor_AppState_h +#define HDR_RollbarCrashMonitor_AppState_h #ifdef __cplusplus extern "C" { #endif -#include "KSCrashMonitor.h" +#include "RollbarCrashMonitor.h" #include @@ -85,7 +85,7 @@ typedef struct /** If true, the application is currently in the foreground. */ bool applicationIsInForeground; -} KSCrash_AppState; +} RollbarCrash_AppState; /** Initialize the state monitor. @@ -98,7 +98,7 @@ void kscrashstate_initialize(const char* stateFilePath); */ bool kscrashstate_reset(void); -/** Notify the crash reporter of KSCrash being added to Objective-C runtime system. +/** Notify the crash reporter of RollbarCrash being added to Objective-C runtime system. */ void kscrashstate_notifyObjCLoad(void); @@ -125,15 +125,15 @@ void kscrashstate_notifyAppCrash(void); /** Read-only access into the current state. */ -const KSCrash_AppState* const kscrashstate_currentState(void); +const RollbarCrash_AppState* const kscrashstate_currentState(void); /** Access the Monitor API. */ -KSCrashMonitorAPI* kscm_appstate_getAPI(void); +RollbarCrashMonitorAPI* kscm_appstate_getAPI(void); #ifdef __cplusplus } #endif -#endif // HDR_KSCrashMonitor_AppState_h +#endif // HDR_RollbarCrashMonitor_AppState_h diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_CPPException.cpp b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_CPPException.cpp index c19c0242..f4d560ec 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_CPPException.cpp +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_CPPException.cpp @@ -1,5 +1,5 @@ // -// KSCrashMonitor_CPPException.c +// RollbarCrashMonitor_CPPException.c // // Copyright (c) 2012 Karl Stenerud. All rights reserved. // @@ -22,17 +22,17 @@ // THE SOFTWARE. // -#include "KSCrashMonitor_CPPException.h" -#include "KSCrashMonitorContext.h" -#include "KSID.h" -#include "KSThread.h" -#include "KSMachineContext.h" -#include "KSStackCursor_SelfThread.h" +#include "RollbarCrashMonitor_CPPException.h" +#include "RollbarCrashMonitorContext.h" +#include "RollbarCrashID.h" +#include "RollbarCrashThread.h" +#include "RollbarCrashMachineContext.h" +#include "RollbarCrashStackCursor_SelfThread.h" -//#define KSLogger_LocalLevel TRACE -#include "KSLogger.h" +//#define RollbarCrashLogger_LocalLevel TRACE +#include "RollbarCrashLogger.h" -#include "KSCxaThrowSwapper.h" +#include "RollbarCrashCxaThrowSwapper.h" #include #include @@ -67,11 +67,11 @@ static std::terminate_handler g_originalTerminateHandler; static char g_eventID[37]; -static KSCrash_MonitorContext g_monitorContext; +static RollbarCrash_MonitorContext g_monitorContext; // TODO: Thread local storage is not supported < ios 9. // Find some other way to do thread local. Maybe storage with lookup by tid? -static KSStackCursor g_stackCursor; +static RollbarCrashStackCursor g_stackCursor; // ============================================================================ #pragma mark - Callbacks - @@ -112,7 +112,7 @@ static void CPPExceptionTerminate(void) thread_act_array_t threads = NULL; mach_msg_type_number_t numThreads = 0; ksmc_suspendEnvironment(&threads, &numThreads); - KSLOG_DEBUG("Trapped c++ exception"); + RollbarCrashLOG_DEBUG("Trapped c++ exception"); const char* name = NULL; std::type_info* tinfo = __cxxabiv1::__cxa_current_exception_type(); if(tinfo != NULL) @@ -123,14 +123,14 @@ static void CPPExceptionTerminate(void) if(name == NULL || strcmp(name, "NSException") != 0) { kscm_notifyFatalExceptionCaptured(false); - KSCrash_MonitorContext* crashContext = &g_monitorContext; + RollbarCrash_MonitorContext* crashContext = &g_monitorContext; memset(crashContext, 0, sizeof(*crashContext)); char descriptionBuff[DESCRIPTION_BUFFER_LENGTH]; const char* description = descriptionBuff; descriptionBuff[0] = 0; - KSLOG_DEBUG("Discovering what kind of exception was thrown."); + RollbarCrashLOG_DEBUG("Discovering what kind of exception was thrown."); g_captureNextStackTrace = false; try { @@ -166,11 +166,11 @@ catch(TYPE value)\ g_captureNextStackTrace = g_isEnabled; // TODO: Should this be done here? Maybe better in the exception handler? - KSMC_NEW_CONTEXT(machineContext); + RollbarCrashMC_NEW_CONTEXT(machineContext); ksmc_getContextForThread(ksthread_self(), machineContext, true); - KSLOG_DEBUG("Filling out context."); - crashContext->crashType = KSCrashMonitorTypeCPPException; + RollbarCrashLOG_DEBUG("Filling out context."); + crashContext->crashType = RollbarCrashMonitorTypeCPPException; crashContext->eventID = g_eventID; crashContext->registersAreValid = false; crashContext->stackCursor = &g_stackCursor; @@ -183,11 +183,11 @@ catch(TYPE value)\ } else { - KSLOG_DEBUG("Detected NSException. Letting the current NSException handler deal with it."); + RollbarCrashLOG_DEBUG("Detected NSException. Letting the current NSException handler deal with it."); } ksmc_resumeEnvironment(threads, numThreads); - KSLOG_DEBUG("Calling original terminate handler."); + RollbarCrashLOG_DEBUG("Calling original terminate handler."); g_originalTerminateHandler(); } @@ -240,9 +240,9 @@ extern "C" void kscm_enableSwapCxaThrow(void) } } -extern "C" KSCrashMonitorAPI* kscm_cppexception_getAPI() +extern "C" RollbarCrashMonitorAPI* kscm_cppexception_getAPI() { - static KSCrashMonitorAPI api = + static RollbarCrashMonitorAPI api = { .setEnabled = setEnabled, .isEnabled = isEnabled diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_CPPException.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_CPPException.h index d599d74c..92177661 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_CPPException.h +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_CPPException.h @@ -1,5 +1,5 @@ // -// KSCrashMonitor_CPPException.h +// RollbarCrashMonitor_CPPException.h // // Copyright (c) 2012 Karl Stenerud. All rights reserved. // @@ -22,14 +22,14 @@ // THE SOFTWARE. // -#ifndef HDR_KSCrashMonitor_CPPException_h -#define HDR_KSCrashMonitor_CPPException_h +#ifndef HDR_RollbarCrashMonitor_CPPException_h +#define HDR_RollbarCrashMonitor_CPPException_h #ifdef __cplusplus extern "C" { #endif -#include "KSCrashMonitor.h" +#include "RollbarCrashMonitor.h" /** Enable swapping of __cxa_trow symbol with lazy symbols table */ @@ -37,11 +37,11 @@ void kscm_enableSwapCxaThrow(void); /** Access the Monitor API. */ -KSCrashMonitorAPI* kscm_cppexception_getAPI(void); +RollbarCrashMonitorAPI* kscm_cppexception_getAPI(void); #ifdef __cplusplus } #endif -#endif // HDR_KSCrashMonitor_CPPException_h +#endif // HDR_RollbarCrashMonitor_CPPException_h diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_Deadlock.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_Deadlock.h index 697a91b6..f70babd9 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_Deadlock.h +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_Deadlock.h @@ -1,5 +1,5 @@ // -// KSCrashMonitor_Deadlock.h +// RollbarCrashMonitor_Deadlock.h // // Created by Karl Stenerud on 2012-12-09. // @@ -28,15 +28,15 @@ */ -#ifndef HDR_KSCrashMonitor_Deadlock_h -#define HDR_KSCrashMonitor_Deadlock_h +#ifndef HDR_RollbarCrashMonitor_Deadlock_h +#define HDR_RollbarCrashMonitor_Deadlock_h #ifdef __cplusplus extern "C" { #endif -#include "KSCrashMonitor.h" +#include "RollbarCrashMonitor.h" #include @@ -50,11 +50,11 @@ void kscm_setDeadlockHandlerWatchdogInterval(double value); /** Access the Monitor API. */ -KSCrashMonitorAPI* kscm_deadlock_getAPI(void); +RollbarCrashMonitorAPI* kscm_deadlock_getAPI(void); #ifdef __cplusplus } #endif -#endif // HDR_KSCrashMonitor_Deadlock_h +#endif // HDR_RollbarCrashMonitor_Deadlock_h diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_Deadlock.m b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_Deadlock.m index e5300bfe..6e3147fb 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_Deadlock.m +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_Deadlock.m @@ -1,5 +1,5 @@ // -// KSCrashMonitor_Deadlock.m +// RollbarCrashMonitor_Deadlock.m // // Created by Karl Stenerud on 2012-12-09. // @@ -24,21 +24,21 @@ // THE SOFTWARE. // -#import "KSCrashMonitor_Deadlock.h" -#import "KSCrashMonitorContext.h" -#import "KSID.h" -#import "KSThread.h" -#import "KSStackCursor_MachineContext.h" +#import "RollbarCrashMonitor_Deadlock.h" +#import "RollbarCrashMonitorContext.h" +#import "RollbarCrashID.h" +#import "RollbarCrashThread.h" +#import "RollbarCrashStackCursor_MachineContext.h" #import -//#define KSLogger_LocalLevel TRACE -#import "KSLogger.h" +//#define RollbarCrashLogger_LocalLevel TRACE +#import "RollbarCrashLogger.h" #define kIdleInterval 5.0f -@class KSCrashDeadlockMonitor; +@class RollbarCrashDeadlockMonitor; // ============================================================================ #pragma mark - Globals - @@ -46,12 +46,12 @@ static volatile bool g_isEnabled = false; -static KSCrash_MonitorContext g_monitorContext; +static RollbarCrash_MonitorContext g_monitorContext; /** Thread which monitors other threads. */ -static KSCrashDeadlockMonitor* g_monitor; +static RollbarCrashDeadlockMonitor* g_monitor; -static KSThread g_mainQueueThread; +static RollbarCrashThread g_mainQueueThread; /** Interval between watchdog pulses. */ static NSTimeInterval g_watchdogInterval = 0; @@ -61,14 +61,14 @@ #pragma mark - X - // ============================================================================ -@interface KSCrashDeadlockMonitor: NSObject +@interface RollbarCrashDeadlockMonitor: NSObject @property(nonatomic, readwrite, retain) NSThread* monitorThread; @property(atomic, readwrite, assign) BOOL awaitingResponse; @end -@implementation KSCrashDeadlockMonitor +@implementation RollbarCrashDeadlockMonitor @synthesize monitorThread = _monitorThread; @synthesize awaitingResponse = _awaitingResponse; @@ -79,7 +79,7 @@ - (id) init { // target (self) is retained until selector (runMonitor) exits. self.monitorThread = [[NSThread alloc] initWithTarget:self selector:@selector(runMonitor) object:nil]; - self.monitorThread.name = @"KSCrash Deadlock Detection Thread"; + self.monitorThread.name = @"RollbarCrash Deadlock Detection Thread"; [self.monitorThread start]; } return self; @@ -112,17 +112,17 @@ - (void) handleDeadlock ksmc_suspendEnvironment(&threads, &numThreads); kscm_notifyFatalExceptionCaptured(false); - KSMC_NEW_CONTEXT(machineContext); + RollbarCrashMC_NEW_CONTEXT(machineContext); ksmc_getContextForThread(g_mainQueueThread, machineContext, false); - KSStackCursor stackCursor; - kssc_initWithMachineContext(&stackCursor, KSSC_MAX_STACK_DEPTH, machineContext); + RollbarCrashStackCursor stackCursor; + kssc_initWithMachineContext(&stackCursor, RollbarCrashSC_MAX_STACK_DEPTH, machineContext); char eventID[37]; ksid_generate(eventID); - KSLOG_DEBUG(@"Filling out context."); - KSCrash_MonitorContext* crashContext = &g_monitorContext; + RollbarCrashLOG_DEBUG(@"Filling out context."); + RollbarCrash_MonitorContext* crashContext = &g_monitorContext; memset(crashContext, 0, sizeof(*crashContext)); - crashContext->crashType = KSCrashMonitorTypeMainThreadDeadlock; + crashContext->crashType = RollbarCrashMonitorTypeMainThreadDeadlock; crashContext->eventID = eventID; crashContext->registersAreValid = false; crashContext->offendingMachineContext = machineContext; @@ -131,7 +131,7 @@ - (void) handleDeadlock kscm_handleException(crashContext); ksmc_resumeEnvironment(threads, numThreads); - KSLOG_DEBUG(@"Calling abort()"); + RollbarCrashLOG_DEBUG(@"Calling abort()"); abort(); } @@ -189,13 +189,13 @@ static void setEnabled(bool isEnabled) g_isEnabled = isEnabled; if(isEnabled) { - KSLOG_DEBUG(@"Creating new deadlock monitor."); + RollbarCrashLOG_DEBUG(@"Creating new deadlock monitor."); initialize(); - g_monitor = [[KSCrashDeadlockMonitor alloc] init]; + g_monitor = [[RollbarCrashDeadlockMonitor alloc] init]; } else { - KSLOG_DEBUG(@"Stopping deadlock monitor."); + RollbarCrashLOG_DEBUG(@"Stopping deadlock monitor."); [g_monitor cancel]; g_monitor = nil; } @@ -207,9 +207,9 @@ static bool isEnabled() return g_isEnabled; } -KSCrashMonitorAPI* kscm_deadlock_getAPI() +RollbarCrashMonitorAPI* kscm_deadlock_getAPI() { - static KSCrashMonitorAPI api = + static RollbarCrashMonitorAPI api = { .setEnabled = setEnabled, .isEnabled = isEnabled diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_MachException.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_MachException.c index 93d23030..cef15a61 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_MachException.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_MachException.c @@ -1,5 +1,5 @@ // -// KSCrashMonitor_MachException.c +// RollbarCrashMonitor_MachException.c // // Created by Karl Stenerud on 2012-02-04. // @@ -25,18 +25,18 @@ // -#include "KSCrashMonitor_MachException.h" -#include "KSCrashMonitorContext.h" -#include "KSCPU.h" -#include "KSID.h" -#include "KSThread.h" -#include "KSSystemCapabilities.h" -#include "KSStackCursor_MachineContext.h" +#include "RollbarCrashMonitor_MachException.h" +#include "RollbarCrashMonitorContext.h" +#include "RollbarCrashCPU.h" +#include "RollbarCrashID.h" +#include "RollbarCrashThread.h" +#include "RollbarCrashSystemCapabilities.h" +#include "RollbarCrashStackCursor_MachineContext.h" -//#define KSLogger_LocalLevel TRACE -#include "KSLogger.h" +//#define RollbarCrashLogger_LocalLevel TRACE +#include "RollbarCrashLogger.h" -#if KSCRASH_HAS_MACH +#if RollbarCrashCRASH_HAS_MACH #include #include @@ -47,8 +47,8 @@ #pragma mark - Constants - // ============================================================================ -static const char* kThreadPrimary = "KSCrash Exception Handler (Primary)"; -static const char* kThreadSecondary = "KSCrash Exception Handler (Secondary)"; +static const char* kThreadPrimary = "RollbarCrash Exception Handler (Primary)"; +static const char* kThreadSecondary = "RollbarCrash Exception Handler (Secondary)"; #if __LP64__ #define MACH_ERROR_CODE_MASK 0xFFFFFFFFFFFFFFFF @@ -124,8 +124,8 @@ typedef struct static volatile bool g_isEnabled = false; -static KSCrash_MonitorContext g_monitorContext; -static KSStackCursor g_stackCursor; +static RollbarCrash_MonitorContext g_monitorContext; +static RollbarCrashStackCursor g_stackCursor; static bool g_isHandlingCrash = false; @@ -163,10 +163,10 @@ static char g_secondaryEventID[37]; */ static void restoreExceptionPorts(void) { - KSLOG_DEBUG("Restoring original exception ports."); + RollbarCrashLOG_DEBUG("Restoring original exception ports."); if(g_previousExceptionPorts.count == 0) { - KSLOG_DEBUG("Original exception ports were already restored."); + RollbarCrashLOG_DEBUG("Original exception ports were already restored."); return; } @@ -176,7 +176,7 @@ static void restoreExceptionPorts(void) // Reinstall old exception ports. for(mach_msg_type_number_t i = 0; i < g_previousExceptionPorts.count; i++) { - KSLOG_TRACE("Restoring port index %d", i); + RollbarCrashLOG_TRACE("Restoring port index %d", i); kr = task_set_exception_ports(thisTask, g_previousExceptionPorts.masks[i], g_previousExceptionPorts.ports[i], @@ -184,11 +184,11 @@ static void restoreExceptionPorts(void) g_previousExceptionPorts.flavors[i]); if(kr != KERN_SUCCESS) { - KSLOG_ERROR("task_set_exception_ports: %s", + RollbarCrashLOG_ERROR("task_set_exception_ports: %s", mach_error_string(kr)); } } - KSLOG_DEBUG("Exception ports restored."); + RollbarCrashLOG_DEBUG("Exception ports restored."); g_previousExceptionPorts.count = 0; } @@ -276,14 +276,14 @@ static void* handleExceptions(void* const userData) pthread_setname_np(threadName); if(threadName == kThreadSecondary) { - KSLOG_DEBUG("This is the secondary thread. Suspending."); + RollbarCrashLOG_DEBUG("This is the secondary thread. Suspending."); thread_suspend((thread_t)ksthread_self()); eventID = g_secondaryEventID; } for(;;) { - KSLOG_DEBUG("Waiting for mach exception"); + RollbarCrashLOG_DEBUG("Waiting for mach exception"); // Wait for a message. kern_return_t kr = mach_msg(&exceptionMessage.header, @@ -299,10 +299,10 @@ static void* handleExceptions(void* const userData) } // Loop and try again on failure. - KSLOG_ERROR("mach_msg: %s", mach_error_string(kr)); + RollbarCrashLOG_ERROR("mach_msg: %s", mach_error_string(kr)); } - KSLOG_DEBUG("Trapped mach exception code 0x%llx, subcode 0x%llx", + RollbarCrashLOG_DEBUG("Trapped mach exception code 0x%llx, subcode 0x%llx", exceptionMessage.code[0], exceptionMessage.code[1]); if(g_isEnabled) { @@ -312,37 +312,37 @@ static void* handleExceptions(void* const userData) g_isHandlingCrash = true; kscm_notifyFatalExceptionCaptured(true); - KSLOG_DEBUG("Exception handler is installed. Continuing exception handling."); + RollbarCrashLOG_DEBUG("Exception handler is installed. Continuing exception handling."); // Switch to the secondary thread if necessary, or uninstall the handler // to avoid a death loop. if(ksthread_self() == g_primaryMachThread) { - KSLOG_DEBUG("This is the primary exception thread. Activating secondary thread."); + RollbarCrashLOG_DEBUG("This is the primary exception thread. Activating secondary thread."); // TODO: This was put here to avoid a freeze. Does secondary thread ever fire? restoreExceptionPorts(); if(thread_resume(g_secondaryMachThread) != KERN_SUCCESS) { - KSLOG_DEBUG("Could not activate secondary thread. Restoring original exception ports."); + RollbarCrashLOG_DEBUG("Could not activate secondary thread. Restoring original exception ports."); } } else { - KSLOG_DEBUG("This is the secondary exception thread.");// Restoring original exception ports."); + RollbarCrashLOG_DEBUG("This is the secondary exception thread.");// Restoring original exception ports."); // restoreExceptionPorts(); } // Fill out crash information - KSLOG_DEBUG("Fetching machine state."); - KSMC_NEW_CONTEXT(machineContext); - KSCrash_MonitorContext* crashContext = &g_monitorContext; + RollbarCrashLOG_DEBUG("Fetching machine state."); + RollbarCrashMC_NEW_CONTEXT(machineContext); + RollbarCrash_MonitorContext* crashContext = &g_monitorContext; crashContext->offendingMachineContext = machineContext; kssc_initCursor(&g_stackCursor, NULL, NULL); if(ksmc_getContextForThread(exceptionMessage.thread.name, machineContext, true)) { - kssc_initWithMachineContext(&g_stackCursor, KSSC_MAX_STACK_DEPTH, machineContext); - KSLOG_TRACE("Fault address %p, instruction address %p", + kssc_initWithMachineContext(&g_stackCursor, RollbarCrashSC_MAX_STACK_DEPTH, machineContext); + RollbarCrashLOG_TRACE("Fault address %p, instruction address %p", kscpu_faultAddress(machineContext), kscpu_instructionAddress(machineContext)); if(exceptionMessage.exception == EXC_BAD_ACCESS) { @@ -354,8 +354,8 @@ static void* handleExceptions(void* const userData) } } - KSLOG_DEBUG("Filling out context."); - crashContext->crashType = KSCrashMonitorTypeMachException; + RollbarCrashLOG_DEBUG("Filling out context."); + crashContext->crashType = RollbarCrashMonitorTypeMachException; crashContext->eventID = eventID; crashContext->registersAreValid = true; crashContext->mach.type = exceptionMessage.exception; @@ -373,12 +373,12 @@ static void* handleExceptions(void* const userData) kscm_handleException(crashContext); - KSLOG_DEBUG("Crash handling complete. Restoring original handlers."); + RollbarCrashLOG_DEBUG("Crash handling complete. Restoring original handlers."); g_isHandlingCrash = false; ksmc_resumeEnvironment(threads, numThreads); } - KSLOG_DEBUG("Replying to mach exception message."); + RollbarCrashLOG_DEBUG("Replying to mach exception message."); // Send a reply saying "I didn't handle this exception". replyMessage.header = exceptionMessage.header; replyMessage.NDR = exceptionMessage.NDR; @@ -402,7 +402,7 @@ static void* handleExceptions(void* const userData) static void uninstallExceptionHandler() { - KSLOG_DEBUG("Uninstalling mach exception handler."); + RollbarCrashLOG_DEBUG("Uninstalling mach exception handler."); // NOTE: Do not deallocate the exception port. If a secondary crash occurs // it will hang the process. @@ -413,7 +413,7 @@ static void uninstallExceptionHandler() if(g_primaryPThread != 0 && g_primaryMachThread != thread_self) { - KSLOG_DEBUG("Canceling primary exception thread."); + RollbarCrashLOG_DEBUG("Canceling primary exception thread."); if(g_isHandlingCrash) { thread_terminate(g_primaryMachThread); @@ -427,7 +427,7 @@ static void uninstallExceptionHandler() } if(g_secondaryPThread != 0 && g_secondaryMachThread != thread_self) { - KSLOG_DEBUG("Canceling secondary exception thread."); + RollbarCrashLOG_DEBUG("Canceling secondary exception thread."); if(g_isHandlingCrash) { thread_terminate(g_secondaryMachThread); @@ -441,12 +441,12 @@ static void uninstallExceptionHandler() } g_exceptionPort = MACH_PORT_NULL; - KSLOG_DEBUG("Mach exception handlers uninstalled."); + RollbarCrashLOG_DEBUG("Mach exception handlers uninstalled."); } static bool installExceptionHandler() { - KSLOG_DEBUG("Installing mach exception handler."); + RollbarCrashLOG_DEBUG("Installing mach exception handler."); bool attributes_created = false; pthread_attr_t attr; @@ -461,7 +461,7 @@ static bool installExceptionHandler() EXC_MASK_SOFTWARE | EXC_MASK_BREAKPOINT; - KSLOG_DEBUG("Backing up original exception ports."); + RollbarCrashLOG_DEBUG("Backing up original exception ports."); kr = task_get_exception_ports(thisTask, mask, g_previousExceptionPorts.masks, @@ -471,35 +471,35 @@ static bool installExceptionHandler() g_previousExceptionPorts.flavors); if(kr != KERN_SUCCESS) { - KSLOG_ERROR("task_get_exception_ports: %s", mach_error_string(kr)); + RollbarCrashLOG_ERROR("task_get_exception_ports: %s", mach_error_string(kr)); goto failed; } if(g_exceptionPort == MACH_PORT_NULL) { - KSLOG_DEBUG("Allocating new port with receive rights."); + RollbarCrashLOG_DEBUG("Allocating new port with receive rights."); kr = mach_port_allocate(thisTask, MACH_PORT_RIGHT_RECEIVE, &g_exceptionPort); if(kr != KERN_SUCCESS) { - KSLOG_ERROR("mach_port_allocate: %s", mach_error_string(kr)); + RollbarCrashLOG_ERROR("mach_port_allocate: %s", mach_error_string(kr)); goto failed; } - KSLOG_DEBUG("Adding send rights to port."); + RollbarCrashLOG_DEBUG("Adding send rights to port."); kr = mach_port_insert_right(thisTask, g_exceptionPort, g_exceptionPort, MACH_MSG_TYPE_MAKE_SEND); if(kr != KERN_SUCCESS) { - KSLOG_ERROR("mach_port_insert_right: %s", mach_error_string(kr)); + RollbarCrashLOG_ERROR("mach_port_insert_right: %s", mach_error_string(kr)); goto failed; } } - KSLOG_DEBUG("Installing port as exception handler."); + RollbarCrashLOG_DEBUG("Installing port as exception handler."); kr = task_set_exception_ports(thisTask, mask, g_exceptionPort, @@ -507,11 +507,11 @@ static bool installExceptionHandler() THREAD_STATE_NONE); if(kr != KERN_SUCCESS) { - KSLOG_ERROR("task_set_exception_ports: %s", mach_error_string(kr)); + RollbarCrashLOG_ERROR("task_set_exception_ports: %s", mach_error_string(kr)); goto failed; } - KSLOG_DEBUG("Creating secondary exception thread (suspended)."); + RollbarCrashLOG_DEBUG("Creating secondary exception thread (suspended)."); pthread_attr_init(&attr); attributes_created = true; pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); @@ -521,32 +521,32 @@ static bool installExceptionHandler() (void*)kThreadSecondary); if(error != 0) { - KSLOG_ERROR("pthread_create_suspended_np: %s", strerror(error)); + RollbarCrashLOG_ERROR("pthread_create_suspended_np: %s", strerror(error)); goto failed; } g_secondaryMachThread = pthread_mach_thread_np(g_secondaryPThread); ksmc_addReservedThread(g_secondaryMachThread); - KSLOG_DEBUG("Creating primary exception thread."); + RollbarCrashLOG_DEBUG("Creating primary exception thread."); error = pthread_create(&g_primaryPThread, &attr, &handleExceptions, (void*)kThreadPrimary); if(error != 0) { - KSLOG_ERROR("pthread_create: %s", strerror(error)); + RollbarCrashLOG_ERROR("pthread_create: %s", strerror(error)); goto failed; } pthread_attr_destroy(&attr); g_primaryMachThread = pthread_mach_thread_np(g_primaryPThread); ksmc_addReservedThread(g_primaryMachThread); - KSLOG_DEBUG("Mach exception handler installed."); + RollbarCrashLOG_DEBUG("Mach exception handler installed."); return true; failed: - KSLOG_DEBUG("Failed to install mach exception handler."); + RollbarCrashLOG_DEBUG("Failed to install mach exception handler."); if(attributes_created) { pthread_attr_destroy(&attr); @@ -581,13 +581,13 @@ static bool isEnabled() return g_isEnabled; } -static void addContextualInfoToEvent(struct KSCrash_MonitorContext* eventContext) +static void addContextualInfoToEvent(struct RollbarCrash_MonitorContext* eventContext) { - if(eventContext->crashType == KSCrashMonitorTypeSignal) + if(eventContext->crashType == RollbarCrashMonitorTypeSignal) { eventContext->mach.type = machExceptionForSignal(eventContext->signal.signum); } - else if(eventContext->crashType != KSCrashMonitorTypeMachException) + else if(eventContext->crashType != RollbarCrashMonitorTypeMachException) { eventContext->mach.type = EXC_CRASH; } @@ -595,11 +595,11 @@ static void addContextualInfoToEvent(struct KSCrash_MonitorContext* eventContext #endif -KSCrashMonitorAPI* kscm_machexception_getAPI() +RollbarCrashMonitorAPI* kscm_machexception_getAPI() { - static KSCrashMonitorAPI api = + static RollbarCrashMonitorAPI api = { -#if KSCRASH_HAS_MACH +#if RollbarCrashCRASH_HAS_MACH .setEnabled = setEnabled, .isEnabled = isEnabled, .addContextualInfoToEvent = addContextualInfoToEvent diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_MachException.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_MachException.h index 883166be..1db8e74d 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_MachException.h +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_MachException.h @@ -1,5 +1,5 @@ // -// KSCrashMonitor_MachException.h +// RollbarCrashMonitor_MachException.h // // Created by Karl Stenerud on 2012-02-04. // @@ -29,24 +29,24 @@ */ -#ifndef HDR_KSCrashMonitor_MachException_h -#define HDR_KSCrashMonitor_MachException_h +#ifndef HDR_RollbarCrashMonitor_MachException_h +#define HDR_RollbarCrashMonitor_MachException_h #ifdef __cplusplus extern "C" { #endif -#include "KSCrashMonitor.h" +#include "RollbarCrashMonitor.h" #include /** Access the Monitor API. */ -KSCrashMonitorAPI* kscm_machexception_getAPI(void); +RollbarCrashMonitorAPI* kscm_machexception_getAPI(void); #ifdef __cplusplus } #endif -#endif // HDR_KSCrashMonitor_MachException_h +#endif // HDR_RollbarCrashMonitor_MachException_h diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_NSException.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_NSException.h index e30cbbd0..f3ddba25 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_NSException.h +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_NSException.h @@ -1,5 +1,5 @@ // -// KSCrashMonitor_NSException.h +// RollbarCrashMonitor_NSException.h // // Created by Karl Stenerud on 2012-01-28. // @@ -29,24 +29,24 @@ */ -#ifndef HDR_KSCrashMonitor_NSException_h -#define HDR_KSCrashMonitor_NSException_h +#ifndef HDR_RollbarCrashMonitor_NSException_h +#define HDR_RollbarCrashMonitor_NSException_h #ifdef __cplusplus extern "C" { #endif -#include "KSCrashMonitor.h" +#include "RollbarCrashMonitor.h" /** Access the Monitor API. */ -KSCrashMonitorAPI* kscm_nsexception_getAPI(void); +RollbarCrashMonitorAPI* kscm_nsexception_getAPI(void); #ifdef __cplusplus } #endif -#endif // HDR_KSCrashMonitor_NSException_h +#endif // HDR_RollbarCrashMonitor_NSException_h diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_NSException.m b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_NSException.m index 823dab4b..e963c67c 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_NSException.m +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_NSException.m @@ -1,5 +1,5 @@ // -// KSCrashMonitor_NSException.m +// RollbarCrashMonitor_NSException.m // // Created by Karl Stenerud on 2012-01-28. // @@ -24,16 +24,16 @@ // THE SOFTWARE. // -#import "KSCrash.h" -#import "KSCrashMonitor_NSException.h" -#import "KSStackCursor_Backtrace.h" -#include "KSCrashMonitorContext.h" -#include "KSID.h" -#include "KSThread.h" +#import "RollbarCrash.h" +#import "RollbarCrashMonitor_NSException.h" +#import "RollbarCrashStackCursor_Backtrace.h" +#include "RollbarCrashMonitorContext.h" +#include "RollbarCrashID.h" +#include "RollbarCrashThread.h" #import -//#define KSLogger_LocalLevel TRACE -#import "KSLogger.h" +//#define RollbarCrashLogger_LocalLevel TRACE +#import "RollbarCrashLogger.h" // ============================================================================ @@ -42,7 +42,7 @@ static volatile bool g_isEnabled = 0; -static KSCrash_MonitorContext g_monitorContext; +static RollbarCrash_MonitorContext g_monitorContext; /** The exception handler that was in place before we installed ours. */ static NSUncaughtExceptionHandler* g_previousUncaughtExceptionHandler; @@ -59,7 +59,7 @@ */ static void handleException(NSException* exception, BOOL currentSnapshotUserReported) { - KSLOG_DEBUG(@"Trapped exception %@", exception); + RollbarCrashLOG_DEBUG(@"Trapped exception %@", exception); if(g_isEnabled) { thread_act_array_t threads = NULL; @@ -67,7 +67,7 @@ static void handleException(NSException* exception, BOOL currentSnapshotUserRepo ksmc_suspendEnvironment(&threads, &numThreads); kscm_notifyFatalExceptionCaptured(false); - KSLOG_DEBUG(@"Filling out context."); + RollbarCrashLOG_DEBUG(@"Filling out context."); NSArray* addresses = [exception callStackReturnAddresses]; NSUInteger numFrames = addresses.count; uintptr_t* callstack = malloc(numFrames * sizeof(*callstack)); @@ -78,14 +78,14 @@ static void handleException(NSException* exception, BOOL currentSnapshotUserRepo char eventID[37]; ksid_generate(eventID); - KSMC_NEW_CONTEXT(machineContext); + RollbarCrashMC_NEW_CONTEXT(machineContext); ksmc_getContextForThread(ksthread_self(), machineContext, true); - KSStackCursor cursor; + RollbarCrashStackCursor cursor; kssc_initWithBacktrace(&cursor, callstack, (int)numFrames, 0); - KSCrash_MonitorContext* crashContext = &g_monitorContext; + RollbarCrash_MonitorContext* crashContext = &g_monitorContext; memset(crashContext, 0, sizeof(*crashContext)); - crashContext->crashType = KSCrashMonitorTypeNSException; + crashContext->crashType = RollbarCrashMonitorTypeNSException; crashContext->eventID = eventID; crashContext->offendingMachineContext = machineContext; crashContext->registersAreValid = false; @@ -96,7 +96,7 @@ static void handleException(NSException* exception, BOOL currentSnapshotUserRepo crashContext->stackCursor = &cursor; crashContext->currentSnapshotUserReported = currentSnapshotUserReported; - KSLOG_DEBUG(@"Calling main crash handler."); + RollbarCrashLOG_DEBUG(@"Calling main crash handler."); kscm_handleException(crashContext); free(callstack); @@ -105,7 +105,7 @@ static void handleException(NSException* exception, BOOL currentSnapshotUserRepo } if (g_previousUncaughtExceptionHandler != NULL) { - KSLOG_DEBUG(@"Calling original exception handler."); + RollbarCrashLOG_DEBUG(@"Calling original exception handler."); g_previousUncaughtExceptionHandler(exception); } } @@ -130,17 +130,17 @@ static void setEnabled(bool isEnabled) g_isEnabled = isEnabled; if(isEnabled) { - KSLOG_DEBUG(@"Backing up original handler."); + RollbarCrashLOG_DEBUG(@"Backing up original handler."); g_previousUncaughtExceptionHandler = NSGetUncaughtExceptionHandler(); - KSLOG_DEBUG(@"Setting new handler."); + RollbarCrashLOG_DEBUG(@"Setting new handler."); NSSetUncaughtExceptionHandler(&handleUncaughtException); - KSCrash.sharedInstance.uncaughtExceptionHandler = &handleUncaughtException; - KSCrash.sharedInstance.currentSnapshotUserReportedExceptionHandler = &handleCurrentSnapshotUserReportedException; + RollbarCrash.sharedInstance.uncaughtExceptionHandler = &handleUncaughtException; + RollbarCrash.sharedInstance.currentSnapshotUserReportedExceptionHandler = &handleCurrentSnapshotUserReportedException; } else { - KSLOG_DEBUG(@"Restoring original handler."); + RollbarCrashLOG_DEBUG(@"Restoring original handler."); NSSetUncaughtExceptionHandler(g_previousUncaughtExceptionHandler); } } @@ -151,9 +151,9 @@ static bool isEnabled() return g_isEnabled; } -KSCrashMonitorAPI* kscm_nsexception_getAPI() +RollbarCrashMonitorAPI* kscm_nsexception_getAPI() { - static KSCrashMonitorAPI api = + static RollbarCrashMonitorAPI api = { .setEnabled = setEnabled, .isEnabled = isEnabled diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_Signal.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_Signal.c index c0534825..d0f1d685 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_Signal.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_Signal.c @@ -1,5 +1,5 @@ // -// KSCrashMonitor_Signal.c +// RollbarCrashMonitor_Signal.c // // Created by Karl Stenerud on 2012-01-28. // @@ -24,18 +24,18 @@ // THE SOFTWARE. // -#include "KSCrashMonitor_Signal.h" -#include "KSCrashMonitorContext.h" -#include "KSID.h" -#include "KSSignalInfo.h" -#include "KSMachineContext.h" -#include "KSSystemCapabilities.h" -#include "KSStackCursor_MachineContext.h" +#include "RollbarCrashMonitor_Signal.h" +#include "RollbarCrashMonitorContext.h" +#include "RollbarCrashID.h" +#include "RollbarCrashSignalInfo.h" +#include "RollbarCrashMachineContext.h" +#include "RollbarCrashSystemCapabilities.h" +#include "RollbarCrashStackCursor_MachineContext.h" -//#define KSLogger_LocalLevel TRACE -#include "KSLogger.h" +//#define RollbarCrashLogger_LocalLevel TRACE +#include "RollbarCrashLogger.h" -#if KSCRASH_HAS_SIGNAL +#if RollbarCrashCRASH_HAS_SIGNAL #include #include @@ -50,10 +50,10 @@ static volatile bool g_isEnabled = false; -static KSCrash_MonitorContext g_monitorContext; -static KSStackCursor g_stackCursor; +static RollbarCrash_MonitorContext g_monitorContext; +static RollbarCrashStackCursor g_stackCursor; -#if KSCRASH_HAS_SIGNAL_STACK +#if RollbarCrashCRASH_HAS_SIGNAL_STACK /** Our custom signal stack. The signal handler will use this as its stack. */ static stack_t g_signalStack = {0}; #endif @@ -81,7 +81,7 @@ static char g_eventID[37]; */ static void handleSignal(int sigNum, siginfo_t* signalInfo, void* userContext) { - KSLOG_DEBUG("Trapped signal %d", sigNum); + RollbarCrashLOG_DEBUG("Trapped signal %d", sigNum); if(g_isEnabled) { thread_act_array_t threads = NULL; @@ -89,14 +89,14 @@ static void handleSignal(int sigNum, siginfo_t* signalInfo, void* userContext) ksmc_suspendEnvironment(&threads, &numThreads); kscm_notifyFatalExceptionCaptured(false); - KSLOG_DEBUG("Filling out context."); - KSMC_NEW_CONTEXT(machineContext); + RollbarCrashLOG_DEBUG("Filling out context."); + RollbarCrashMC_NEW_CONTEXT(machineContext); ksmc_getContextForSignal(userContext, machineContext); - kssc_initWithMachineContext(&g_stackCursor, KSSC_MAX_STACK_DEPTH, machineContext); + kssc_initWithMachineContext(&g_stackCursor, RollbarCrashSC_MAX_STACK_DEPTH, machineContext); - KSCrash_MonitorContext* crashContext = &g_monitorContext; + RollbarCrash_MonitorContext* crashContext = &g_monitorContext; memset(crashContext, 0, sizeof(*crashContext)); - crashContext->crashType = KSCrashMonitorTypeSignal; + crashContext->crashType = RollbarCrashMonitorTypeSignal; crashContext->eventID = g_eventID; crashContext->offendingMachineContext = machineContext; crashContext->registersAreValid = true; @@ -110,7 +110,7 @@ static void handleSignal(int sigNum, siginfo_t* signalInfo, void* userContext) ksmc_resumeEnvironment(threads, numThreads); } - KSLOG_DEBUG("Re-raising signal for regular handlers to catch."); + RollbarCrashLOG_DEBUG("Re-raising signal for regular handlers to catch."); raise(sigNum); } @@ -121,21 +121,21 @@ static void handleSignal(int sigNum, siginfo_t* signalInfo, void* userContext) static bool installSignalHandler() { - KSLOG_DEBUG("Installing signal handler."); + RollbarCrashLOG_DEBUG("Installing signal handler."); -#if KSCRASH_HAS_SIGNAL_STACK +#if RollbarCrashCRASH_HAS_SIGNAL_STACK if(g_signalStack.ss_size == 0) { - KSLOG_DEBUG("Allocating signal stack area."); + RollbarCrashLOG_DEBUG("Allocating signal stack area."); g_signalStack.ss_size = SIGSTKSZ; g_signalStack.ss_sp = malloc(g_signalStack.ss_size); } - KSLOG_DEBUG("Setting signal stack area."); + RollbarCrashLOG_DEBUG("Setting signal stack area."); if(sigaltstack(&g_signalStack, NULL) != 0) { - KSLOG_ERROR("signalstack: %s", strerror(errno)); + RollbarCrashLOG_ERROR("signalstack: %s", strerror(errno)); goto failed; } #endif @@ -145,14 +145,14 @@ static bool installSignalHandler() if(g_previousSignalHandlers == NULL) { - KSLOG_DEBUG("Allocating memory to store previous signal handlers."); + RollbarCrashLOG_DEBUG("Allocating memory to store previous signal handlers."); g_previousSignalHandlers = malloc(sizeof(*g_previousSignalHandlers) * (unsigned)fatalSignalsCount); } struct sigaction action = {{0}}; action.sa_flags = SA_SIGINFO | SA_ONSTACK; -#if KSCRASH_HOST_APPLE && defined(__LP64__) +#if RollbarCrashCRASH_HOST_APPLE && defined(__LP64__) action.sa_flags |= SA_64REGSET; #endif sigemptyset(&action.sa_mask); @@ -160,7 +160,7 @@ static bool installSignalHandler() for(int i = 0; i < fatalSignalsCount; i++) { - KSLOG_DEBUG("Assigning handler for signal %d", fatalSignals[i]); + RollbarCrashLOG_DEBUG("Assigning handler for signal %d", fatalSignals[i]); if(sigaction(fatalSignals[i], &action, &g_previousSignalHandlers[i]) != 0) { char sigNameBuff[30]; @@ -170,7 +170,7 @@ static bool installSignalHandler() snprintf(sigNameBuff, sizeof(sigNameBuff), "%d", fatalSignals[i]); sigName = sigNameBuff; } - KSLOG_ERROR("sigaction (%s): %s", sigName, strerror(errno)); + RollbarCrashLOG_ERROR("sigaction (%s): %s", sigName, strerror(errno)); // Try to reverse the damage for(i--;i >= 0; i--) { @@ -179,31 +179,31 @@ static bool installSignalHandler() goto failed; } } - KSLOG_DEBUG("Signal handlers installed."); + RollbarCrashLOG_DEBUG("Signal handlers installed."); return true; failed: - KSLOG_DEBUG("Failed to install signal handlers."); + RollbarCrashLOG_DEBUG("Failed to install signal handlers."); return false; } static void uninstallSignalHandler(void) { - KSLOG_DEBUG("Uninstalling signal handlers."); + RollbarCrashLOG_DEBUG("Uninstalling signal handlers."); const int* fatalSignals = kssignal_fatalSignals(); int fatalSignalsCount = kssignal_numFatalSignals(); for(int i = 0; i < fatalSignalsCount; i++) { - KSLOG_DEBUG("Restoring original handler for signal %d", fatalSignals[i]); + RollbarCrashLOG_DEBUG("Restoring original handler for signal %d", fatalSignals[i]); sigaction(fatalSignals[i], &g_previousSignalHandlers[i], NULL); } -#if KSCRASH_HAS_SIGNAL_STACK +#if RollbarCrashCRASH_HAS_SIGNAL_STACK g_signalStack = (stack_t){0}; #endif - KSLOG_DEBUG("Signal handlers uninstalled."); + RollbarCrashLOG_DEBUG("Signal handlers uninstalled."); } static void setEnabled(bool isEnabled) @@ -231,9 +231,9 @@ static bool isEnabled() return g_isEnabled; } -static void addContextualInfoToEvent(struct KSCrash_MonitorContext* eventContext) +static void addContextualInfoToEvent(struct RollbarCrash_MonitorContext* eventContext) { - if(!(eventContext->crashType & (KSCrashMonitorTypeSignal | KSCrashMonitorTypeMachException))) + if(!(eventContext->crashType & (RollbarCrashMonitorTypeSignal | RollbarCrashMonitorTypeMachException))) { eventContext->signal.signum = SIGABRT; } @@ -241,11 +241,11 @@ static void addContextualInfoToEvent(struct KSCrash_MonitorContext* eventContext #endif -KSCrashMonitorAPI* kscm_signal_getAPI() +RollbarCrashMonitorAPI* kscm_signal_getAPI() { - static KSCrashMonitorAPI api = + static RollbarCrashMonitorAPI api = { -#if KSCRASH_HAS_SIGNAL +#if RollbarCrashCRASH_HAS_SIGNAL .setEnabled = setEnabled, .isEnabled = isEnabled, .addContextualInfoToEvent = addContextualInfoToEvent diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_Signal.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_Signal.h index 13a6f805..88adf9ba 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_Signal.h +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_Signal.h @@ -1,5 +1,5 @@ // -// KSCrashMonitor_Signal.h +// RollbarCrashMonitor_Signal.h // // Created by Karl Stenerud on 2012-01-28. // @@ -29,24 +29,24 @@ */ -#ifndef HDR_KSCrashMonitor_Signal_h -#define HDR_KSCrashMonitor_Signal_h +#ifndef HDR_RollbarCrashMonitor_Signal_h +#define HDR_RollbarCrashMonitor_Signal_h #ifdef __cplusplus extern "C" { #endif -#include "KSCrashMonitor.h" +#include "RollbarCrashMonitor.h" /** Access the Monitor API. */ -KSCrashMonitorAPI* kscm_signal_getAPI(void); +RollbarCrashMonitorAPI* kscm_signal_getAPI(void); #ifdef __cplusplus } #endif -#endif // HDR_KSCrashMonitor_Signal_h +#endif // HDR_RollbarCrashMonitor_Signal_h diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_System.m b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_System.m index 16787bf2..1930238e 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_System.m +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_System.m @@ -1,5 +1,5 @@ // -// KSCrashMonitor_System.m +// RollbarCrashMonitor_System.m // // Created by Karl Stenerud on 2012-02-05. // @@ -25,21 +25,21 @@ // -#import "KSCrashMonitor_System.h" +#import "RollbarCrashMonitor_System.h" -#import "KSCPU.h" -#import "KSCrashMonitorContext.h" -#import "KSDate.h" -#import "KSDynamicLinker.h" -#import "KSSysCtl.h" -#import "KSSystemCapabilities.h" +#import "RollbarCrashCPU.h" +#import "RollbarCrashMonitorContext.h" +#import "RollbarCrashDate.h" +#import "RollbarCrashDynamicLinker.h" +#import "RollbarCrashSysCtl.h" +#import "RollbarCrashSystemCapabilities.h" -//#define KSLogger_LocalLevel TRACE -#import "KSLogger.h" +//#define RollbarCrashLogger_LocalLevel TRACE +#import "RollbarCrashLogger.h" #import #import -#if KSCRASH_HAS_UIKIT +#if RollbarCrashCRASH_HAS_UIKIT #import #endif #include @@ -171,7 +171,7 @@ static bool VMStats(vm_statistics_data_t* const vmStats, vm_size_t* const pageSi if((kr = host_page_size(hostPort, pageSize)) != KERN_SUCCESS) { - KSLOG_ERROR(@"host_page_size: %s", mach_error_string(kr)); + RollbarCrashLOG_ERROR(@"host_page_size: %s", mach_error_string(kr)); return false; } @@ -182,7 +182,7 @@ static bool VMStats(vm_statistics_data_t* const vmStats, vm_size_t* const pageSi &hostSize); if(kr != KERN_SUCCESS) { - KSLOG_ERROR(@"host_statistics: %s", mach_error_string(kr)); + RollbarCrashLOG_ERROR(@"host_statistics: %s", mach_error_string(kr)); return false; } @@ -372,7 +372,7 @@ static bool isSimulatorBuild() static NSString* getReceiptUrlPath() { NSString* path = nil; -#if KSCRASH_HOST_IOS +#if RollbarCrashCRASH_HOST_IOS // For iOS 6 compatibility #ifdef __IPHONE_11_0 if (@available(iOS 7, *)) { @@ -381,7 +381,7 @@ static bool isSimulatorBuild() #endif #endif path = [NSBundle mainBundle].appStoreReceiptURL.path; -#if KSCRASH_HOST_IOS +#if RollbarCrashCRASH_HOST_IOS } #endif return path; @@ -397,7 +397,7 @@ static bool isSimulatorBuild() { NSMutableData* data = nil; -#if KSCRASH_HAS_UIDEVICE +#if RollbarCrashCRASH_HAS_UIDEVICE if([[UIDevice currentDevice] respondsToSelector:@selector(identifierForVendor)]) { data = [NSMutableData dataWithLength:16]; @@ -506,14 +506,14 @@ static void initialize() NSDictionary* infoDict = [mainBundle infoDictionary]; const struct mach_header* header = _dyld_get_image_header(0); -#if KSCRASH_HAS_UIDEVICE +#if RollbarCrashCRASH_HAS_UIDEVICE g_systemData.systemName = cString([UIDevice currentDevice].systemName); g_systemData.systemVersion = cString([UIDevice currentDevice].systemVersion); #else -#if KSCRASH_HOST_MAC +#if RollbarCrashCRASH_HOST_MAC g_systemData.systemName = "macOS"; #endif -#if KSCRASH_HOST_WATCH +#if RollbarCrashCRASH_HOST_WATCH g_systemData.systemName = "watchOS"; #endif NSOperatingSystemVersion version = {0, 0, 0}; @@ -539,7 +539,7 @@ static void initialize() } else { -#if KSCRASH_HOST_MAC +#if RollbarCrashCRASH_HOST_MAC // MacOS has the machine in the model field, and no model g_systemData.machine = stringSysctl("hw.model"); #else @@ -593,7 +593,7 @@ static bool isEnabled() return g_isEnabled; } -static void addContextualInfoToEvent(KSCrash_MonitorContext* eventContext) +static void addContextualInfoToEvent(RollbarCrash_MonitorContext* eventContext) { if(g_isEnabled) { @@ -632,9 +632,9 @@ static void addContextualInfoToEvent(KSCrash_MonitorContext* eventContext) } } -KSCrashMonitorAPI* kscm_system_getAPI() +RollbarCrashMonitorAPI* kscm_system_getAPI() { - static KSCrashMonitorAPI api = + static RollbarCrashMonitorAPI api = { .setEnabled = setEnabled, .isEnabled = isEnabled, diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_User.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_User.c index 5a824519..ca80f0b1 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_User.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_User.c @@ -1,5 +1,5 @@ // -// KSCrashMonitor_User.c +// RollbarCrashMonitor_User.c // // Copyright (c) 2012 Karl Stenerud. All rights reserved. // @@ -22,14 +22,14 @@ // THE SOFTWARE. // -#include "KSCrashMonitor_User.h" -#include "KSCrashMonitorContext.h" -#include "KSID.h" -#include "KSThread.h" -#include "KSStackCursor_SelfThread.h" +#include "RollbarCrashMonitor_User.h" +#include "RollbarCrashMonitorContext.h" +#include "RollbarCrashID.h" +#include "RollbarCrashThread.h" +#include "RollbarCrashStackCursor_SelfThread.h" -//#define KSLogger_LocalLevel TRACE -#include "KSLogger.h" +//#define RollbarCrashLogger_LocalLevel TRACE +#include "RollbarCrashLogger.h" #include #include @@ -50,7 +50,7 @@ void kscm_reportUserException(const char* name, { if(!g_isEnabled) { - KSLOG_WARN("User-reported exception monitor is not installed. Exception has not been recorded."); + RollbarCrashLOG_WARN("User-reported exception monitor is not installed. Exception has not been recorded."); } else { @@ -67,16 +67,16 @@ void kscm_reportUserException(const char* name, char eventID[37]; ksid_generate(eventID); - KSMC_NEW_CONTEXT(machineContext); + RollbarCrashMC_NEW_CONTEXT(machineContext); ksmc_getContextForThread(ksthread_self(), machineContext, true); - KSStackCursor stackCursor; + RollbarCrashStackCursor stackCursor; kssc_initSelfThread(&stackCursor, 0); - KSLOG_DEBUG("Filling out context."); - KSCrash_MonitorContext context; + RollbarCrashLOG_DEBUG("Filling out context."); + RollbarCrash_MonitorContext context; memset(&context, 0, sizeof(context)); - context.crashType = KSCrashMonitorTypeUserReported; + context.crashType = RollbarCrashMonitorTypeUserReported; context.eventID = eventID; context.offendingMachineContext = machineContext; context.registersAreValid = false; @@ -110,9 +110,9 @@ static bool isEnabled() return g_isEnabled; } -KSCrashMonitorAPI* kscm_user_getAPI() +RollbarCrashMonitorAPI* kscm_user_getAPI() { - static KSCrashMonitorAPI api = + static RollbarCrashMonitorAPI api = { .setEnabled = setEnabled, .isEnabled = isEnabled diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_User.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_User.h index d7b64a7f..ff9e2a3b 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_User.h +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_User.h @@ -1,5 +1,5 @@ // -// KSCrashMonitor_User.h +// RollbarCrashMonitor_User.h // // Copyright (c) 2012 Karl Stenerud. All rights reserved. // @@ -22,15 +22,15 @@ // THE SOFTWARE. // -#ifndef HDR_KSCrashMonitor_User_h -#define HDR_KSCrashMonitor_User_h +#ifndef HDR_RollbarCrashMonitor_User_h +#define HDR_RollbarCrashMonitor_User_h #ifdef __cplusplus extern "C" { #endif -#include "KSCrashMonitor.h" +#include "RollbarCrashMonitor.h" #include @@ -65,11 +65,11 @@ void kscm_reportUserException(const char* name, /** Access the Monitor API. */ -KSCrashMonitorAPI* kscm_user_getAPI(void); +RollbarCrashMonitorAPI* kscm_user_getAPI(void); #ifdef __cplusplus } #endif -#endif // HDR_KSCrashMonitor_User_h +#endif // HDR_RollbarCrashMonitor_User_h diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_Zombie.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_Zombie.c index 8931d947..dd19ec55 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_Zombie.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_Zombie.c @@ -1,5 +1,5 @@ // -// KSZombie.m +// RollbarCrashZombie.m // // Created by Karl Stenerud on 2012-09-15. // @@ -25,10 +25,10 @@ // -#include "KSCrashMonitor_Zombie.h" -#include "KSCrashMonitorContext.h" -#include "KSObjC.h" -#include "KSLogger.h" +#include "RollbarCrashMonitor_Zombie.h" +#include "RollbarCrashMonitorContext.h" +#include "RollbarCrashObjC.h" +#include "RollbarCrashLogger.h" #include #include @@ -70,7 +70,7 @@ static inline unsigned hashIndex(const void* object) static bool copyStringIvar(const void* self, const char* ivarName, char* buffer, int bufferLength) { Class class = object_getClass((id)self); - KSObjCIvar ivar = {0}; + RollbarCrashObjCIvar ivar = {0}; likely_if(ksobjc_ivarNamed(class, ivarName, &ivar)) { void* pointer; @@ -84,22 +84,22 @@ static bool copyStringIvar(const void* self, const char* ivarName, char* buffer, } else { - KSLOG_DEBUG("ksobjc_copyStringContents %s failed", ivarName); + RollbarCrashLOG_DEBUG("ksobjc_copyStringContents %s failed", ivarName); } } else { - KSLOG_DEBUG("ksobjc_isValidObject %s failed", ivarName); + RollbarCrashLOG_DEBUG("ksobjc_isValidObject %s failed", ivarName); } } else { - KSLOG_DEBUG("ksobjc_ivarValue %s failed", ivarName); + RollbarCrashLOG_DEBUG("ksobjc_ivarValue %s failed", ivarName); } } else { - KSLOG_DEBUG("ksobjc_ivarNamed %s failed", ivarName); + RollbarCrashLOG_DEBUG("ksobjc_ivarNamed %s failed", ivarName); } return false; } @@ -161,7 +161,7 @@ static void install() g_zombieCache = calloc(cacheSize, sizeof(*g_zombieCache)); if(g_zombieCache == NULL) { - KSLOG_ERROR("Error: Could not allocate %u bytes of memory. KSZombie NOT installed!", + RollbarCrashLOG_ERROR("Error: Could not allocate %u bytes of memory. RollbarCrashZombie NOT installed!", cacheSize * sizeof(*g_zombieCache)); return; } @@ -229,7 +229,7 @@ static bool isEnabled() return g_isEnabled; } -static void addContextualInfoToEvent(KSCrash_MonitorContext* eventContext) +static void addContextualInfoToEvent(RollbarCrash_MonitorContext* eventContext) { if(g_isEnabled) { @@ -239,9 +239,9 @@ static void addContextualInfoToEvent(KSCrash_MonitorContext* eventContext) } } -KSCrashMonitorAPI* kscm_zombie_getAPI() +RollbarCrashMonitorAPI* kscm_zombie_getAPI() { - static KSCrashMonitorAPI api = + static RollbarCrashMonitorAPI api = { .setEnabled = setEnabled, .isEnabled = isEnabled, diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_Zombie.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_Zombie.h index 0356ba78..22b3b501 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_Zombie.h +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_Zombie.h @@ -1,5 +1,5 @@ // -// KSCrashMonitor_Zombie.h +// RollbarCrashMonitor_Zombie.h // // Created by Karl Stenerud on 2012-09-15. // @@ -34,18 +34,18 @@ * Limitations: * - Not guaranteed to catch all zombies. * - Can generate false positives or incorrect class names. - * - KSZombie itself must be compiled with ARC disabled. You can enable ARC in - * your app, but KSZombie must be compiled in a separate library if you do. + * - RollbarCrashZombie itself must be compiled with ARC disabled. You can enable ARC in + * your app, but RollbarCrashZombie must be compiled in a separate library if you do. */ -#ifndef HDR_KSZombie_h -#define HDR_KSZombie_h +#ifndef HDR_RollbarCrashZombie_h +#define HDR_RollbarCrashZombie_h #ifdef __cplusplus extern "C" { #endif -#include "KSCrashMonitor.h" +#include "RollbarCrashMonitor.h" #include @@ -59,11 +59,11 @@ const char* kszombie_className(const void* object); /** Access the Monitor API. */ -KSCrashMonitorAPI* kscm_zombie_getAPI(void); +RollbarCrashMonitorAPI* kscm_zombie_getAPI(void); #ifdef __cplusplus } #endif -#endif // HDR_KSZombie_h +#endif // HDR_RollbarCrashZombie_h diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrash.m b/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrash.m index a0464d26..e0e8b6c1 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrash.m +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrash.m @@ -1,5 +1,5 @@ // -// KSCrash.m +// RollbarCrash.m // // Created by Karl Stenerud on 2012-01-28. // @@ -25,23 +25,23 @@ // -#import "KSCrash.h" +#import "RollbarCrash.h" -#import "KSCrashC.h" -#import "KSCrashDoctor.h" -#import "KSCrashReportFields.h" -#import "KSCrashMonitor_AppState.h" -#import "KSJSONCodecObjC.h" +#import "RollbarCrashC.h" +#import "RollbarCrashDoctor.h" +#import "RollbarCrashReportFields.h" +#import "RollbarCrashMonitor_AppState.h" +#import "RollbarCrashJSONCodecObjC.h" #import "NSError+SimpleConstructor.h" -#import "KSCrashMonitorContext.h" -#import "KSCrashMonitor_System.h" -#import "KSSystemCapabilities.h" +#import "RollbarCrashMonitorContext.h" +#import "RollbarCrashMonitor_System.h" +#import "RollbarCrashSystemCapabilities.h" -//#define KSLogger_LocalLevel TRACE -#import "KSLogger.h" +//#define RollbarCrashLogger_LocalLevel TRACE +#import "RollbarCrashLogger.h" #include -#if KSCRASH_HAS_UIKIT +#if RollbarCrashCRASH_HAS_UIKIT #import #endif @@ -50,7 +50,7 @@ #pragma mark - Globals - // ============================================================================ -@interface KSCrash () +@interface RollbarCrash () @property(nonatomic,readwrite,retain) NSString* bundleName; @property(nonatomic,readwrite,retain) NSString* basePath; @@ -75,21 +75,21 @@ @interface KSCrash () YES); if([directories count] == 0) { - KSLOG_ERROR(@"Could not locate cache directory path."); + RollbarCrashLOG_ERROR(@"Could not locate cache directory path."); return nil; } NSString* cachePath = [directories objectAtIndex:0]; if([cachePath length] == 0) { - KSLOG_ERROR(@"Could not locate cache directory path."); + RollbarCrashLOG_ERROR(@"Could not locate cache directory path."); return nil; } - NSString* pathEnd = [@"KSCrash" stringByAppendingPathComponent:getBundleName()]; + NSString* pathEnd = [@"RollbarCrash" stringByAppendingPathComponent:getBundleName()]; return [cachePath stringByAppendingPathComponent:pathEnd]; } -@implementation KSCrash +@implementation RollbarCrash // ============================================================================ #pragma mark - Properties - @@ -123,18 +123,18 @@ + (void)load + (void)initialize { - if (self == [KSCrash class]) { + if (self == [RollbarCrash class]) { [[self class] subscribeToNotifications]; } } + (instancetype) sharedInstance { - static KSCrash *sharedInstance = nil; + static RollbarCrash *sharedInstance = nil; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ - sharedInstance = [[KSCrash alloc] init]; + sharedInstance = [[RollbarCrash alloc] init]; }); return sharedInstance; } @@ -152,15 +152,15 @@ - (id) initWithBasePath:(NSString *)basePath self.basePath = basePath; if(self.basePath == nil) { - KSLOG_ERROR(@"Failed to initialize crash handler. Crash reporting disabled."); + RollbarCrashLOG_ERROR(@"Failed to initialize crash handler. Crash reporting disabled."); return nil; } - self.deleteBehaviorAfterSendAll = KSCDeleteAlways; + self.deleteBehaviorAfterSendAll = RollbarCrashDeleteAlways; self.introspectMemory = YES; self.catchZombies = NO; self.maxReportCount = 5; self.searchQueueNames = NO; - self.monitoring = KSCrashMonitorTypeProductionSafeMinimal; + self.monitoring = RollbarCrashMonitorTypeProductionSafeMinimal; } return self; } @@ -183,12 +183,12 @@ - (void) setUserInfo:(NSDictionary*) userInfo NSData* userInfoJSON = nil; if(userInfo != nil) { - userInfoJSON = [self nullTerminated:[KSJSONCodec encode:userInfo - options:KSJSONEncodeOptionSorted + userInfoJSON = [self nullTerminated:[RollbarCrashJSONCodec encode:userInfo + options:RollbarCrashJSONEncodeOptionSorted error:&error]]; if(error != NULL) { - KSLOG_ERROR(@"Could not serialize user info: %@", error); + RollbarCrashLOG_ERROR(@"Could not serialize user info: %@", error); return; } } @@ -198,7 +198,7 @@ - (void) setUserInfo:(NSDictionary*) userInfo } } -- (void) setMonitoring:(KSCrashMonitorType)monitoring +- (void) setMonitoring:(RollbarCrashMonitorType)monitoring { _monitoring = kscrash_setMonitoring(monitoring); } @@ -215,7 +215,7 @@ - (void) setSearchQueueNames:(BOOL) searchQueueNames kscrash_setSearchQueueNames(searchQueueNames); } -- (void) setOnCrash:(KSReportWriteCallback) onCrash +- (void) setOnCrash:(RollbarCrashReportWriteCallback) onCrash { _onCrash = onCrash; kscrash_setCrashNotifyCallback(onCrash); @@ -229,18 +229,18 @@ - (void) setIntrospectMemory:(BOOL) introspectMemory - (BOOL) catchZombies { - return (self.monitoring & KSCrashMonitorTypeZombie) != 0; + return (self.monitoring & RollbarCrashMonitorTypeZombie) != 0; } - (void) setCatchZombies:(BOOL)catchZombies { if(catchZombies) { - self.monitoring |= KSCrashMonitorTypeZombie; + self.monitoring |= RollbarCrashMonitorTypeZombie; } else { - self.monitoring &= (KSCrashMonitorType)~KSCrashMonitorTypeZombie; + self.monitoring &= (RollbarCrashMonitorType)~RollbarCrashMonitorTypeZombie; } } @@ -272,7 +272,7 @@ - (void) setMaxReportCount:(int)maxReportCount - (NSDictionary*) systemInfo { - KSCrash_MonitorContext fakeEvent = {0}; + RollbarCrash_MonitorContext fakeEvent = {0}; kscm_system_getAPI()->addContextualInfoToEvent(&fakeEvent); NSMutableDictionary* dict = [NSMutableDictionary new]; @@ -325,22 +325,22 @@ - (BOOL) install return true; } -- (void) sendAllReportsWithCompletion:(KSCrashReportFilterCompletion) onCompletion +- (void) sendAllReportsWithCompletion:(RollbarCrashReportFilterCompletion) onCompletion { NSArray* reports = [self allReports]; - KSLOG_INFO(@"Sending %d crash reports", [reports count]); + RollbarCrashLOG_INFO(@"Sending %d crash reports", [reports count]); [self sendReports:reports onCompletion:^(NSArray* filteredReports, BOOL completed, NSError* error) { - KSLOG_DEBUG(@"Process finished with completion: %d", completed); + RollbarCrashLOG_DEBUG(@"Process finished with completion: %d", completed); if(error != nil) { - KSLOG_ERROR(@"Failed to send reports: %@", error); + RollbarCrashLOG_ERROR(@"Failed to send reports: %@", error); } - if((self.deleteBehaviorAfterSendAll == KSCDeleteOnSucess && completed) || - self.deleteBehaviorAfterSendAll == KSCDeleteAlways) + if((self.deleteBehaviorAfterSendAll == RollbarCrashDeleteOnSucess && completed) || + self.deleteBehaviorAfterSendAll == RollbarCrashDeleteAlways) { kscrash_deleteAllReports(); } @@ -375,10 +375,10 @@ - (void) reportUserException:(NSString*) name if(stackTrace != nil) { NSError* error = nil; - NSData* jsonData = [KSJSONCodec encode:stackTrace options:0 error:&error]; + NSData* jsonData = [RollbarCrashJSONCodec encode:stackTrace options:0 error:&error]; if(jsonData == nil || error != nil) { - KSLOG_ERROR(@"Error encoding stack trace to JSON: %@", error); + RollbarCrashLOG_ERROR(@"Error encoding stack trace to JSON: %@", error); // Don't return, since we can still record other useful information. } NSString* jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]; @@ -423,7 +423,7 @@ - (int) reportCount return kscrash_getReportCount(); } -- (void) sendReports:(NSArray*) reports onCompletion:(KSCrashReportFilterCompletion) onCompletion +- (void) sendReports:(NSArray*) reports onCompletion:(RollbarCrashReportFilterCompletion) onCompletion { if([reports count] == 0) { @@ -459,15 +459,15 @@ - (NSData*) loadCrashReportJSONWithID:(int64_t) reportID - (void) doctorReport:(NSMutableDictionary*) report { - NSMutableDictionary* crashReport = report[@KSCrashField_Crash]; + NSMutableDictionary* crashReport = report[@RollbarCrashField_Crash]; if(crashReport != nil) { - crashReport[@KSCrashField_Diagnosis] = [[KSCrashDoctor doctor] diagnoseCrash:report]; + crashReport[@RollbarCrashField_Diagnosis] = [[RollbarCrashDoctor doctor] diagnoseCrash:report]; } - crashReport = report[@KSCrashField_RecrashReport][@KSCrashField_Crash]; + crashReport = report[@RollbarCrashField_RecrashReport][@RollbarCrashField_Crash]; if(crashReport != nil) { - crashReport[@KSCrashField_Diagnosis] = [[KSCrashDoctor doctor] diagnoseCrash:report]; + crashReport[@RollbarCrashField_Diagnosis] = [[RollbarCrashDoctor doctor] diagnoseCrash:report]; } } @@ -498,18 +498,18 @@ - (NSDictionary*) reportWithIntID:(int64_t) reportID } NSError* error = nil; - NSMutableDictionary* crashReport = [KSJSONCodec decode:jsonData - options:KSJSONDecodeOptionIgnoreNullInArray | - KSJSONDecodeOptionIgnoreNullInObject | - KSJSONDecodeOptionKeepPartialObject + NSMutableDictionary* crashReport = [RollbarCrashJSONCodec decode:jsonData + options:RollbarCrashJSONDecodeOptionIgnoreNullInArray | + RollbarCrashJSONDecodeOptionIgnoreNullInObject | + RollbarCrashJSONDecodeOptionKeepPartialObject error:&error]; if(error != nil) { - KSLOG_ERROR(@"Encountered error loading crash report %" PRIx64 ": %@", reportID, error); + RollbarCrashLOG_ERROR(@"Encountered error loading crash report %" PRIx64 ": %@", reportID, error); } if(crashReport == nil) { - KSLOG_ERROR(@"Could not load crash report"); + RollbarCrashLOG_ERROR(@"Could not load crash report"); return nil; } [self doctorReport:crashReport]; @@ -570,7 +570,7 @@ - (NSMutableData*) nullTerminated:(NSData*) data + (void) subscribeToNotifications { -#if KSCRASH_HAS_UIAPPLICATION +#if RollbarCrashCRASH_HAS_UIAPPLICATION NSNotificationCenter* nCenter = [NSNotificationCenter defaultCenter]; [nCenter addObserver:self selector:@selector(applicationDidBecomeActive) @@ -593,7 +593,7 @@ + (void) subscribeToNotifications name:UIApplicationWillTerminateNotification object:nil]; #endif -#if KSCRASH_HAS_NSEXTENSION +#if RollbarCrashCRASH_HAS_NSEXTENSION NSNotificationCenter* nCenter = [NSNotificationCenter defaultCenter]; [nCenter addObserver:self selector:@selector(applicationDidBecomeActive) @@ -647,8 +647,8 @@ + (void) applicationWillTerminate @end -//! Project version number for KSCrashFramework. -const double KSCrashFrameworkVersionNumber = 1.1527; +//! Project version number for RollbarCrashFramework. +const double RollbarCrashFrameworkVersionNumber = 1.1527; -//! Project version string for KSCrashFramework. -const unsigned char KSCrashFrameworkVersionString[] = "1.15.27"; +//! Project version string for RollbarCrashFramework. +const unsigned char RollbarCrashFrameworkVersionString[] = "1.15.27"; diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashC.c b/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashC.c index bfe89b98..476be01c 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashC.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashC.c @@ -1,5 +1,5 @@ // -// KSCrashC.c +// RollbarCrashC.c // // Created by Karl Stenerud on 2012-01-28. // @@ -25,26 +25,26 @@ // -#include "KSCrashC.h" +#include "RollbarCrashC.h" -#include "KSCrashCachedData.h" -#include "KSCrashReport.h" -#include "KSCrashReportFixer.h" -#include "KSCrashReportStore.h" -#include "KSCrashMonitor_CPPException.h" -#include "KSCrashMonitor_Deadlock.h" -#include "KSCrashMonitor_User.h" -#include "KSFileUtils.h" -#include "KSObjC.h" -#include "KSString.h" -#include "KSCrashMonitor_System.h" -#include "KSCrashMonitor_Zombie.h" -#include "KSCrashMonitor_AppState.h" -#include "KSCrashMonitorContext.h" -#include "KSSystemCapabilities.h" +#include "RollbarCrashCachedData.h" +#include "RollbarCrashReport.h" +#include "RollbarCrashReportFixer.h" +#include "RollbarCrashReportStore.h" +#include "RollbarCrashMonitor_CPPException.h" +#include "RollbarCrashMonitor_Deadlock.h" +#include "RollbarCrashMonitor_User.h" +#include "RollbarCrashFileUtils.h" +#include "RollbarCrashObjC.h" +#include "RollbarCrashString.h" +#include "RollbarCrashMonitor_System.h" +#include "RollbarCrashMonitor_Zombie.h" +#include "RollbarCrashMonitor_AppState.h" +#include "RollbarCrashMonitorContext.h" +#include "RollbarCrashSystemCapabilities.h" -//#define KSLogger_LocalLevel TRACE -#include "KSLogger.h" +//#define RollbarCrashLogger_LocalLevel TRACE +#include "RollbarCrashLogger.h" #include #include @@ -53,28 +53,28 @@ typedef enum { - KSApplicationStateNone, - KSApplicationStateDidBecomeActive, - KSApplicationStateWillResignActiveActive, - KSApplicationStateDidEnterBackground, - KSApplicationStateWillEnterForeground, - KSApplicationStateWillTerminate -} KSApplicationState; + RollbarCrashApplicationStateNone, + RollbarCrashApplicationStateDidBecomeActive, + RollbarCrashApplicationStateWillResignActiveActive, + RollbarCrashApplicationStateDidEnterBackground, + RollbarCrashApplicationStateWillEnterForeground, + RollbarCrashApplicationStateWillTerminate +} RollbarCrashApplicationState; // ============================================================================ #pragma mark - Globals - // ============================================================================ -/** True if KSCrash has been installed. */ +/** True if RollbarCrash has been installed. */ static volatile bool g_installed = 0; static bool g_shouldAddConsoleLogToReport = false; static bool g_shouldPrintPreviousLog = false; -static char g_consoleLogPath[KSFU_MAX_PATH_LENGTH]; -static KSCrashMonitorType g_monitoring = KSCrashMonitorTypeProductionSafeMinimal; -static char g_lastCrashReportFilePath[KSFU_MAX_PATH_LENGTH]; -static KSReportWrittenCallback g_reportWrittenCallback; -static KSApplicationState g_lastApplicationState = KSApplicationStateNone; +static char g_consoleLogPath[RollbarCrashFU_MAX_PATH_LENGTH]; +static RollbarCrashMonitorType g_monitoring = RollbarCrashMonitorTypeProductionSafeMinimal; +static char g_lastCrashReportFilePath[RollbarCrashFU_MAX_PATH_LENGTH]; +static RollbarCrashReportWrittenCallback g_reportWrittenCallback; +static RollbarCrashApplicationState g_lastApplicationState = RollbarCrashApplicationStateNone; // ============================================================================ #pragma mark - Utility - @@ -96,18 +96,18 @@ static void printPreviousLog(const char* filePath) static void notifyOfBeforeInstallationState(void) { - KSLOG_DEBUG("Notifying of pre-installation state"); + RollbarCrashLOG_DEBUG("Notifying of pre-installation state"); switch (g_lastApplicationState) { - case KSApplicationStateDidBecomeActive: + case RollbarCrashApplicationStateDidBecomeActive: return kscrash_notifyAppActive(true); - case KSApplicationStateWillResignActiveActive: + case RollbarCrashApplicationStateWillResignActiveActive: return kscrash_notifyAppActive(false); - case KSApplicationStateDidEnterBackground: + case RollbarCrashApplicationStateDidEnterBackground: return kscrash_notifyAppInForeground(false); - case KSApplicationStateWillEnterForeground: + case RollbarCrashApplicationStateWillEnterForeground: return kscrash_notifyAppInForeground(true); - case KSApplicationStateWillTerminate: + case RollbarCrashApplicationStateWillTerminate: return kscrash_notifyAppTerminate(); default: return; @@ -122,10 +122,10 @@ static void notifyOfBeforeInstallationState(void) * * This function gets passed as a callback to a crash handler. */ -static void onCrash(struct KSCrash_MonitorContext* monitorContext) +static void onCrash(struct RollbarCrash_MonitorContext* monitorContext) { if (monitorContext->currentSnapshotUserReported == false) { - KSLOG_DEBUG("Updating application state to note crash."); + RollbarCrashLOG_DEBUG("Updating application state to note crash."); kscrashstate_notifyAppCrash(); } monitorContext->consoleLogPath = g_shouldAddConsoleLogToReport ? g_consoleLogPath : NULL; @@ -136,7 +136,7 @@ static void onCrash(struct KSCrash_MonitorContext* monitorContext) } else { - char crashReportFilePath[KSFU_MAX_PATH_LENGTH]; + char crashReportFilePath[RollbarCrashFU_MAX_PATH_LENGTH]; int64_t reportID = kscrs_getNextCrashReport(crashReportFilePath); strncpy(g_lastCrashReportFilePath, crashReportFilePath, sizeof(g_lastCrashReportFilePath)); kscrashreport_writeStandardReport(monitorContext, crashReportFilePath); @@ -153,18 +153,18 @@ static void onCrash(struct KSCrash_MonitorContext* monitorContext) #pragma mark - API - // ============================================================================ -KSCrashMonitorType kscrash_install(const char* appName, const char* const installPath) +RollbarCrashMonitorType kscrash_install(const char* appName, const char* const installPath) { - KSLOG_DEBUG("Installing crash reporter."); + RollbarCrashLOG_DEBUG("Installing crash reporter."); if(g_installed) { - KSLOG_DEBUG("Crash reporter already installed."); + RollbarCrashLOG_DEBUG("Crash reporter already installed."); return g_monitoring; } g_installed = 1; - char path[KSFU_MAX_PATH_LENGTH]; + char path[RollbarCrashFU_MAX_PATH_LENGTH]; snprintf(path, sizeof(path), "%s/Reports", installPath); ksfu_makePath(path); kscrs_initialize(appName, path); @@ -184,16 +184,16 @@ KSCrashMonitorType kscrash_install(const char* appName, const char* const instal ksccd_init(60); kscm_setEventCallback(onCrash); - KSCrashMonitorType monitors = kscrash_setMonitoring(g_monitoring); + RollbarCrashMonitorType monitors = kscrash_setMonitoring(g_monitoring); - KSLOG_DEBUG("Installation complete."); + RollbarCrashLOG_DEBUG("Installation complete."); notifyOfBeforeInstallationState(); return monitors; } -KSCrashMonitorType kscrash_setMonitoring(KSCrashMonitorType monitors) +RollbarCrashMonitorType kscrash_setMonitoring(RollbarCrashMonitorType monitors) { g_monitoring = monitors; @@ -213,7 +213,7 @@ void kscrash_setUserInfoJSON(const char* const userInfoJSON) void kscrash_setDeadlockWatchdogInterval(double deadlockWatchdogInterval) { -#if KSCRASH_HAS_OBJC +#if RollbarCrashCRASH_HAS_OBJC kscm_setDeadlockHandlerWatchdogInterval(deadlockWatchdogInterval); #endif } @@ -233,12 +233,12 @@ void kscrash_setDoNotIntrospectClasses(const char** doNotIntrospectClasses, int kscrashreport_setDoNotIntrospectClasses(doNotIntrospectClasses, length); } -void kscrash_setCrashNotifyCallback(const KSReportWriteCallback onCrashNotify) +void kscrash_setCrashNotifyCallback(const RollbarCrashReportWriteCallback onCrashNotify) { kscrashreport_setUserSectionWriteCallback(onCrashNotify); } -void kscrash_setReportWrittenCallback(const KSReportWrittenCallback onReportWrittenNotify) +void kscrash_setReportWrittenCallback(const RollbarCrashReportWrittenCallback onReportWrittenNotify) { g_reportWrittenCallback = onReportWrittenNotify; } @@ -296,8 +296,8 @@ void kscrash_notifyAppActive(bool isActive) kscrashstate_notifyAppActive(isActive); } g_lastApplicationState = isActive - ? KSApplicationStateDidBecomeActive - : KSApplicationStateWillResignActiveActive; + ? RollbarCrashApplicationStateDidBecomeActive + : RollbarCrashApplicationStateWillResignActiveActive; } void kscrash_notifyAppInForeground(bool isInForeground) @@ -307,8 +307,8 @@ void kscrash_notifyAppInForeground(bool isInForeground) kscrashstate_notifyAppInForeground(isInForeground); } g_lastApplicationState = isInForeground - ? KSApplicationStateWillEnterForeground - : KSApplicationStateDidEnterBackground; + ? RollbarCrashApplicationStateWillEnterForeground + : RollbarCrashApplicationStateDidEnterBackground; } void kscrash_notifyAppTerminate(void) @@ -317,7 +317,7 @@ void kscrash_notifyAppTerminate(void) { kscrashstate_notifyAppTerminate(); } - g_lastApplicationState = KSApplicationStateWillTerminate; + g_lastApplicationState = RollbarCrashApplicationStateWillTerminate; } void kscrash_notifyAppCrash(void) @@ -339,21 +339,21 @@ char* kscrash_readReport(int64_t reportID) { if(reportID <= 0) { - KSLOG_ERROR("Report ID was %" PRIx64, reportID); + RollbarCrashLOG_ERROR("Report ID was %" PRIx64, reportID); return NULL; } char* rawReport = kscrs_readReport(reportID); if(rawReport == NULL) { - KSLOG_ERROR("Failed to load report ID %" PRIx64, reportID); + RollbarCrashLOG_ERROR("Failed to load report ID %" PRIx64, reportID); return NULL; } char* fixedReport = kscrf_fixupCrashReport(rawReport); if(fixedReport == NULL) { - KSLOG_ERROR("Failed to fixup report ID %" PRIx64, reportID); + RollbarCrashLOG_ERROR("Failed to fixup report ID %" PRIx64, reportID); } free(rawReport); diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashCachedData.c b/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashCachedData.c index 1092dcb5..f8e6c92c 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashCachedData.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashCachedData.c @@ -1,5 +1,5 @@ // -// KSCrashCachedData.c +// RollbarCrashCachedData.c // // Copyright (c) 2012 Karl Stenerud. All rights reserved. // @@ -23,10 +23,10 @@ // -#include "KSCrashCachedData.h" +#include "RollbarCrashCachedData.h" -//#define KSLogger_LocalLevel TRACE -#include "KSLogger.h" +//#define RollbarCrashLogger_LocalLevel TRACE +#include "RollbarCrashLogger.h" #include #include @@ -46,8 +46,8 @@ static int g_pollingIntervalInSeconds; static pthread_t g_cacheThread; -static KSThread* g_allMachThreads; -static KSThread* g_allPThreads; +static RollbarCrashThread* g_allMachThreads; +static RollbarCrashThread* g_allPThreads; static const char** g_allThreadNames; static const char** g_allQueueNames; static int g_allThreadsCount; @@ -59,8 +59,8 @@ static void updateThreadList() { const task_t thisTask = mach_task_self(); int oldThreadsCount = g_allThreadsCount; - KSThread* allMachThreads = NULL; - KSThread* allPThreads = NULL; + RollbarCrashThread* allMachThreads = NULL; + RollbarCrashThread* allPThreads = NULL; static const char** allThreadNames; static const char** allQueueNames; @@ -69,7 +69,7 @@ static void updateThreadList() kern_return_t kr; if((kr = task_threads(thisTask, &threads, &allThreadsCount)) != KERN_SUCCESS) { - KSLOG_ERROR("task_threads: %s", mach_error_string(kr)); + RollbarCrashLOG_ERROR("task_threads: %s", mach_error_string(kr)); return; } @@ -83,13 +83,13 @@ static void updateThreadList() char buffer[1000]; thread_t thread = threads[i]; pthread_t pthread = pthread_from_mach_thread_np(thread); - allMachThreads[i] = (KSThread)thread; - allPThreads[i] = (KSThread)pthread; + allMachThreads[i] = (RollbarCrashThread)thread; + allPThreads[i] = (RollbarCrashThread)pthread; if(pthread != 0 && pthread_getname_np(pthread, buffer, sizeof(buffer)) == 0 && buffer[0] != 0) { allThreadNames[i] = strdup(buffer); } - if(g_searchQueueNames && ksthread_getQueueName((KSThread)thread, buffer, sizeof(buffer)) && buffer[0] != 0) + if(g_searchQueueNames && ksthread_getQueueName((RollbarCrashThread)thread, buffer, sizeof(buffer)) && buffer[0] != 0) { allQueueNames[i] = strdup(buffer); } @@ -177,10 +177,10 @@ void ksccd_init(int pollingIntervalInSeconds) int error = pthread_create(&g_cacheThread, &attr, &monitorCachedData, - "KSCrash Cached Data Monitor"); + "RollbarCrash Cached Data Monitor"); if(error != 0) { - KSLOG_ERROR("pthread_create_suspended_np: %s", strerror(error)); + RollbarCrashLOG_ERROR("pthread_create_suspended_np: %s", strerror(error)); } pthread_attr_destroy(&attr); } @@ -208,7 +208,7 @@ void ksccd_setSearchQueueNames(bool searchQueueNames) g_searchQueueNames = searchQueueNames; } -KSThread* ksccd_getAllThreads(int* threadCount) +RollbarCrashThread* ksccd_getAllThreads(int* threadCount) { if(threadCount != NULL) { @@ -217,7 +217,7 @@ KSThread* ksccd_getAllThreads(int* threadCount) return g_allMachThreads; } -const char* ksccd_getThreadName(KSThread thread) +const char* ksccd_getThreadName(RollbarCrashThread thread) { if(g_allThreadNames != NULL) { @@ -232,7 +232,7 @@ const char* ksccd_getThreadName(KSThread thread) return NULL; } -const char* ksccd_getQueueName(KSThread thread) +const char* ksccd_getQueueName(RollbarCrashThread thread) { if(g_allQueueNames != NULL) { diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashCachedData.h b/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashCachedData.h index 0becbd6f..1cdad054 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashCachedData.h +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashCachedData.h @@ -1,5 +1,5 @@ // -// KSCrashCachedData.h +// RollbarCrashCachedData.h // // Copyright (c) 2012 Karl Stenerud. All rights reserved. // @@ -27,7 +27,7 @@ */ -#include "KSThread.h" +#include "RollbarCrashThread.h" void ksccd_init(int pollingIntervalInSeconds); @@ -36,8 +36,8 @@ void ksccd_unfreeze(void); void ksccd_setSearchQueueNames(bool searchQueueNames); -KSThread* ksccd_getAllThreads(int* threadCount); +RollbarCrashThread* ksccd_getAllThreads(int* threadCount); -const char* ksccd_getThreadName(KSThread thread); +const char* ksccd_getThreadName(RollbarCrashThread thread); -const char* ksccd_getQueueName(KSThread thread); +const char* ksccd_getQueueName(RollbarCrashThread thread); diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashDoctor.h b/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashDoctor.h index abac9373..7554660c 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashDoctor.h +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashDoctor.h @@ -1,6 +1,6 @@ // -// KSCrashDoctor.h -// KSCrash +// RollbarCrashDoctor.h +// RollbarCrash // // Created by Karl Stenerud on 2012-11-10. // Copyright (c) 2012 Karl Stenerud. All rights reserved. @@ -8,9 +8,9 @@ #import -@interface KSCrashDoctor : NSObject +@interface RollbarCrashDoctor : NSObject -+ (KSCrashDoctor*) doctor; ++ (RollbarCrashDoctor*) doctor; - (NSString*) diagnoseCrash:(NSDictionary*) crashReport; diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashDoctor.m b/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashDoctor.m index 603ca165..147ab439 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashDoctor.m +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashDoctor.m @@ -1,14 +1,14 @@ // -// KSCrashDoctor.m -// KSCrash +// RollbarCrashDoctor.m +// RollbarCrash // // Created by Karl Stenerud on 2012-11-10. // Copyright (c) 2012 Karl Stenerud. All rights reserved. // -#import "KSCrashDoctor.h" -#import "KSCrashReportFields.h" -#import "KSCrashMonitor_System.h" +#import "RollbarCrashDoctor.h" +#import "RollbarCrashReportFields.h" +#import "RollbarCrashMonitor_System.h" typedef enum @@ -19,7 +19,7 @@ CPUFamilyX86_64 } CPUFamily; -@interface KSCrashDoctorParam: NSObject +@interface RollbarCrashDoctorParam: NSObject @property(nonatomic, readwrite, retain) NSString* className; @property(nonatomic, readwrite, retain) NSString* previousClassName; @@ -30,7 +30,7 @@ @interface KSCrashDoctorParam: NSObject @end -@implementation KSCrashDoctorParam +@implementation RollbarCrashDoctorParam @synthesize className = _className; @synthesize previousClassName = _previousClassName; @@ -41,14 +41,14 @@ @implementation KSCrashDoctorParam @end -@interface KSCrashDoctorFunctionCall: NSObject +@interface RollbarCrashDoctorFunctionCall: NSObject @property(nonatomic, readwrite, retain) NSString* name; @property(nonatomic, readwrite, retain) NSArray* params; @end -@implementation KSCrashDoctorFunctionCall +@implementation RollbarCrashDoctorFunctionCall @synthesize name = _name; @synthesize params = _params; @@ -59,7 +59,7 @@ - (NSString*) descriptionForObjCCall { return nil; } - KSCrashDoctorParam* receiverParam = [self.params objectAtIndex:0]; + RollbarCrashDoctorParam* receiverParam = [self.params objectAtIndex:0]; NSString* receiver = receiverParam.previousClassName; if(receiver == nil) { @@ -70,8 +70,8 @@ - (NSString*) descriptionForObjCCall } } - KSCrashDoctorParam* selectorParam = [self.params objectAtIndex:1]; - if(![selectorParam.type isEqualToString:@KSCrashMemType_String]) + RollbarCrashDoctorParam* selectorParam = [self.params objectAtIndex:1]; + if(![selectorParam.type isEqualToString:@RollbarCrashMemType_String]) { return nil; } @@ -84,10 +84,10 @@ - (NSString*) descriptionForObjCCall [string appendString:@":"]; if(paramNum < 2) { - KSCrashDoctorParam* param = [self.params objectAtIndex:(NSUInteger)paramNum + 2]; + RollbarCrashDoctorParam* param = [self.params objectAtIndex:(NSUInteger)paramNum + 2]; if(param.value != nil) { - if([param.type isEqualToString:@KSCrashMemType_String]) + if([param.type isEqualToString:@RollbarCrashMemType_String]) { [string appendFormat:@"\"%@\"", param.value]; } @@ -139,7 +139,7 @@ - (NSString*) descriptionWithParamCount:(int) paramCount [str appendFormat:@"Function: %@\n", self.name]; for(int i = 0; i < paramCount; i++) { - KSCrashDoctorParam* param = [self.params objectAtIndex:(NSUInteger)i]; + RollbarCrashDoctorParam* param = [self.params objectAtIndex:(NSUInteger)i]; [str appendFormat:@"Param %d: ", i + 1]; if(param.className != nil) { @@ -165,42 +165,42 @@ - (NSString*) descriptionWithParamCount:(int) paramCount -@implementation KSCrashDoctor +@implementation RollbarCrashDoctor -+ (KSCrashDoctor*) doctor ++ (RollbarCrashDoctor*) doctor { return [[self alloc] init]; } - (NSDictionary*) recrashReport:(NSDictionary*) report { - return [report objectForKey:@KSCrashField_RecrashReport]; + return [report objectForKey:@RollbarCrashField_RecrashReport]; } - (NSDictionary*) systemReport:(NSDictionary*) report { - return [report objectForKey:@KSCrashField_System]; + return [report objectForKey:@RollbarCrashField_System]; } - (NSDictionary*) crashReport:(NSDictionary*) report { - return [report objectForKey:@KSCrashField_Crash]; + return [report objectForKey:@RollbarCrashField_Crash]; } - (NSDictionary*) infoReport:(NSDictionary*) report { - return [report objectForKey:@KSCrashField_Report]; + return [report objectForKey:@RollbarCrashField_Report]; } - (NSDictionary*) errorReport:(NSDictionary*) report { - return [[self crashReport:report] objectForKey:@KSCrashField_Error]; + return [[self crashReport:report] objectForKey:@RollbarCrashField_Error]; } - (CPUFamily) cpuFamily:(NSDictionary*) report { NSDictionary* system = [self systemReport:report]; - NSString* cpuArch = [system objectForKey:@KSCrashField_CPUArch]; + NSString* cpuArch = [system objectForKey:@RollbarCrashField_CPUArch]; if([cpuArch rangeOfString:@"arm"].location == 0) { return CPUFamilyArm; @@ -270,21 +270,21 @@ - (NSString*) registerNameForFamily:(CPUFamily) family paramIndex:(int) index - (NSString*) mainExecutableNameForReport:(NSDictionary*) report { NSDictionary* info = [self infoReport:report]; - return [info objectForKey:@KSCrashField_ProcessName]; + return [info objectForKey:@RollbarCrashField_ProcessName]; } - (NSDictionary*) crashedThreadReport:(NSDictionary*) report { NSDictionary* crashReport = [self crashReport:report]; - NSDictionary* crashedThread = [crashReport objectForKey:@KSCrashField_CrashedThread]; + NSDictionary* crashedThread = [crashReport objectForKey:@RollbarCrashField_CrashedThread]; if(crashedThread != nil) { return crashedThread; } - for(NSDictionary* thread in [crashReport objectForKey:@KSCrashField_Threads]) + for(NSDictionary* thread in [crashReport objectForKey:@RollbarCrashField_Threads]) { - if([[thread objectForKey:@KSCrashField_Crashed] boolValue]) + if([[thread objectForKey:@RollbarCrashField_Crashed] boolValue]) { return thread; } @@ -294,14 +294,14 @@ - (NSDictionary*) crashedThreadReport:(NSDictionary*) report - (NSArray*) backtraceFromThreadReport:(NSDictionary*) threadReport { - NSDictionary* backtrace = [threadReport objectForKey:@KSCrashField_Backtrace]; - return [backtrace objectForKey:@KSCrashField_Contents]; + NSDictionary* backtrace = [threadReport objectForKey:@RollbarCrashField_Backtrace]; + return [backtrace objectForKey:@RollbarCrashField_Contents]; } - (NSDictionary*) basicRegistersFromThreadReport:(NSDictionary*) threadReport { - NSDictionary* registers = [threadReport objectForKey:@KSCrashField_Registers]; - NSDictionary* basic = [registers objectForKey:@KSCrashField_Basic]; + NSDictionary* registers = [threadReport objectForKey:@RollbarCrashField_Registers]; + NSDictionary* basic = [registers objectForKey:@RollbarCrashField_Basic]; return basic; } @@ -312,7 +312,7 @@ - (NSDictionary*) lastInAppStackEntry:(NSDictionary*) report NSArray* backtrace = [self backtraceFromThreadReport:crashedThread]; for(NSDictionary* entry in backtrace) { - NSString* objectName = [entry objectForKey:@KSCrashField_ObjectName]; + NSString* objectName = [entry objectForKey:@RollbarCrashField_ObjectName]; if([objectName isEqualToString:executableName]) { return entry; @@ -334,40 +334,40 @@ - (NSDictionary*) lastStackEntry:(NSDictionary*) report - (BOOL) isInvalidAddress:(NSDictionary*) errorReport { - NSDictionary* machError = [errorReport objectForKey:@KSCrashField_Mach]; + NSDictionary* machError = [errorReport objectForKey:@RollbarCrashField_Mach]; if(machError != nil) { - NSString* exceptionName = [machError objectForKey:@KSCrashField_ExceptionName]; + NSString* exceptionName = [machError objectForKey:@RollbarCrashField_ExceptionName]; return [exceptionName isEqualToString:@"EXC_BAD_ACCESS"]; } - NSDictionary* signal = [errorReport objectForKey:@KSCrashField_Signal]; - NSString* sigName = [signal objectForKey:@KSCrashField_Name]; + NSDictionary* signal = [errorReport objectForKey:@RollbarCrashField_Signal]; + NSString* sigName = [signal objectForKey:@RollbarCrashField_Name]; return [sigName isEqualToString:@"SIGSEGV"]; } - (BOOL) isMathError:(NSDictionary*) errorReport { - NSDictionary* machError = [errorReport objectForKey:@KSCrashField_Mach]; + NSDictionary* machError = [errorReport objectForKey:@RollbarCrashField_Mach]; if(machError != nil) { - NSString* exceptionName = [machError objectForKey:@KSCrashField_ExceptionName]; + NSString* exceptionName = [machError objectForKey:@RollbarCrashField_ExceptionName]; return [exceptionName isEqualToString:@"EXC_ARITHMETIC"]; } - NSDictionary* signal = [errorReport objectForKey:@KSCrashField_Signal]; - NSString* sigName = [signal objectForKey:@KSCrashField_Name]; + NSDictionary* signal = [errorReport objectForKey:@RollbarCrashField_Signal]; + NSString* sigName = [signal objectForKey:@RollbarCrashField_Name]; return [sigName isEqualToString:@"SIGFPE"]; } - (BOOL) isMemoryCorruption:(NSDictionary*) report { NSDictionary* crashedThread = [self crashedThreadReport:report]; - NSArray* notableAddresses = [crashedThread objectForKey:@KSCrashField_NotableAddresses]; + NSArray* notableAddresses = [crashedThread objectForKey:@RollbarCrashField_NotableAddresses]; for(NSDictionary* address in [notableAddresses objectEnumerator]) { - NSString* type = [address objectForKey:@KSCrashField_Type]; + NSString* type = [address objectForKey:@RollbarCrashField_Type]; if([type isEqualToString:@"string"]) { - NSString* value = [address objectForKey:@KSCrashField_Value]; + NSString* value = [address objectForKey:@RollbarCrashField_Value]; if([value rangeOfString:@"autorelease pool page"].location != NSNotFound && [value rangeOfString:@"corrupted"].location != NSNotFound) { @@ -383,8 +383,8 @@ - (BOOL) isMemoryCorruption:(NSDictionary*) report NSArray* backtrace = [self backtraceFromThreadReport:crashedThread]; for(NSDictionary* entry in backtrace) { - NSString* objectName = [entry objectForKey:@KSCrashField_ObjectName]; - NSString* symbolName = [entry objectForKey:@KSCrashField_SymbolName]; + NSString* objectName = [entry objectForKey:@RollbarCrashField_ObjectName]; + NSString* symbolName = [entry objectForKey:@RollbarCrashField_SymbolName]; if([symbolName isEqualToString:@"objc_autoreleasePoolPush"]) { return YES; @@ -406,14 +406,14 @@ - (BOOL) isMemoryCorruption:(NSDictionary*) report return NO; } -- (KSCrashDoctorFunctionCall*) lastFunctionCall:(NSDictionary*) report +- (RollbarCrashDoctorFunctionCall*) lastFunctionCall:(NSDictionary*) report { - KSCrashDoctorFunctionCall* function = [[KSCrashDoctorFunctionCall alloc] init]; + RollbarCrashDoctorFunctionCall* function = [[RollbarCrashDoctorFunctionCall alloc] init]; NSDictionary* lastStackEntry = [self lastStackEntry:report]; - function.name = [lastStackEntry objectForKey:@KSCrashField_SymbolName]; + function.name = [lastStackEntry objectForKey:@RollbarCrashField_SymbolName]; NSDictionary* crashedThread = [self crashedThreadReport:report]; - NSDictionary* notableAddresses = [crashedThread objectForKey:@KSCrashField_NotableAddresses]; + NSDictionary* notableAddresses = [crashedThread objectForKey:@RollbarCrashField_NotableAddresses]; CPUFamily family = [self cpuFamily:report]; NSDictionary* registers = [self basicRegistersFromThreadReport:crashedThread]; NSArray* regNames = [NSArray arrayWithObjects: @@ -425,7 +425,7 @@ - (KSCrashDoctorFunctionCall*) lastFunctionCall:(NSDictionary*) report NSMutableArray* params = [NSMutableArray arrayWithCapacity:4]; for(NSString* regName in regNames) { - KSCrashDoctorParam* param = [[KSCrashDoctorParam alloc] init]; + RollbarCrashDoctorParam* param = [[RollbarCrashDoctorParam alloc] init]; param.address = (uintptr_t)[[registers objectForKey:regName] unsignedLongLongValue]; NSDictionary* notableAddress = [notableAddresses objectForKey:regName]; if(notableAddress == nil) @@ -434,21 +434,21 @@ - (KSCrashDoctorFunctionCall*) lastFunctionCall:(NSDictionary*) report } else { - param.type = [notableAddress objectForKey:@KSCrashField_Type]; - NSString* className = [notableAddress objectForKey:@KSCrashField_Class]; - NSString* previousClass = [notableAddress objectForKey:@KSCrashField_LastDeallocObject]; - NSString* value = [notableAddress objectForKey:@KSCrashField_Value]; + param.type = [notableAddress objectForKey:@RollbarCrashField_Type]; + NSString* className = [notableAddress objectForKey:@RollbarCrashField_Class]; + NSString* previousClass = [notableAddress objectForKey:@RollbarCrashField_LastDeallocObject]; + NSString* value = [notableAddress objectForKey:@RollbarCrashField_Value]; - if([param.type isEqualToString:@KSCrashMemType_String]) + if([param.type isEqualToString:@RollbarCrashMemType_String]) { param.value = value; } - else if([param.type isEqualToString:@KSCrashMemType_Object]) + else if([param.type isEqualToString:@RollbarCrashMemType_Object]) { param.className = className; param.isInstance = YES; } - else if([param.type isEqualToString:@KSCrashMemType_Class]) + else if([param.type isEqualToString:@RollbarCrashMemType_Class]) { param.className = className; param.isInstance = NO; @@ -463,7 +463,7 @@ - (KSCrashDoctorFunctionCall*) lastFunctionCall:(NSDictionary*) report return function; } -- (NSString*) zombieCall:(KSCrashDoctorFunctionCall*) functionCall +- (NSString*) zombieCall:(RollbarCrashDoctorFunctionCall*) functionCall { if([functionCall.name isEqualToString:@"objc_msgSend"] && functionCall.params.count > 0 && [[functionCall.params objectAtIndex:0] previousClassName] != nil) { @@ -478,15 +478,15 @@ - (NSString*) zombieCall:(KSCrashDoctorFunctionCall*) functionCall - (BOOL) isStackOverflow:(NSDictionary*) crashedThreadReport { - NSDictionary* stack = [crashedThreadReport objectForKey:@KSCrashField_Stack]; - return [[stack objectForKey:@KSCrashField_Overflow] boolValue]; + NSDictionary* stack = [crashedThreadReport objectForKey:@RollbarCrashField_Stack]; + return [[stack objectForKey:@RollbarCrashField_Overflow] boolValue]; } - (BOOL) isDeadlock:(NSDictionary*) report { NSDictionary* errorReport = [self errorReport:report]; - NSString* crashType = [errorReport objectForKey:@KSCrashField_Type]; - return [@KSCrashExcType_Deadlock isEqualToString:crashType]; + NSString* crashType = [errorReport objectForKey:@RollbarCrashField_Type]; + return [@RollbarCrashExcType_Deadlock isEqualToString:crashType]; } - (NSString*) appendOriginatingCall:(NSString*) string callName:(NSString*) callName @@ -502,7 +502,7 @@ - (NSString*) diagnoseCrash:(NSDictionary*) report { @try { - NSString* lastFunctionName = [[self lastInAppStackEntry:report] objectForKey:@KSCrashField_SymbolName]; + NSString* lastFunctionName = [[self lastInAppStackEntry:report] objectForKey:@RollbarCrashField_SymbolName]; NSDictionary* crashedThreadReport = [self crashedThreadReport:report]; NSDictionary* errorReport = [self errorReport:report]; @@ -516,12 +516,12 @@ - (NSString*) diagnoseCrash:(NSDictionary*) report return [NSString stringWithFormat:@"Stack overflow in %@", lastFunctionName]; } - NSString* crashType = [errorReport objectForKey:@KSCrashField_Type]; - if([crashType isEqualToString:@KSCrashExcType_NSException]) + NSString* crashType = [errorReport objectForKey:@RollbarCrashField_Type]; + if([crashType isEqualToString:@RollbarCrashExcType_NSException]) { - NSDictionary* exception = [errorReport objectForKey:@KSCrashField_NSException]; - NSString* name = [exception objectForKey:@KSCrashField_Name]; - NSString* reason = [exception objectForKey:@KSCrashField_Reason]? [exception objectForKey:@KSCrashField_Reason]:[errorReport objectForKey:@KSCrashField_Reason]; + NSDictionary* exception = [errorReport objectForKey:@RollbarCrashField_NSException]; + NSString* name = [exception objectForKey:@RollbarCrashField_Name]; + NSString* reason = [exception objectForKey:@RollbarCrashField_Reason]? [exception objectForKey:@RollbarCrashField_Reason]:[errorReport objectForKey:@RollbarCrashField_Reason]; return [self appendOriginatingCall:[NSString stringWithFormat:@"Application threw exception %@: %@", name, reason] callName:lastFunctionName]; @@ -538,7 +538,7 @@ - (NSString*) diagnoseCrash:(NSDictionary*) report callName:lastFunctionName]; } - KSCrashDoctorFunctionCall* functionCall = [self lastFunctionCall:report]; + RollbarCrashDoctorFunctionCall* functionCall = [self lastFunctionCall:report]; NSString* zombieCall = [self zombieCall:functionCall]; if(zombieCall != nil) { @@ -548,7 +548,7 @@ - (NSString*) diagnoseCrash:(NSDictionary*) report if([self isInvalidAddress:errorReport]) { - uintptr_t address = (uintptr_t)[[errorReport objectForKey:@KSCrashField_Address] unsignedLongLongValue]; + uintptr_t address = (uintptr_t)[[errorReport objectForKey:@RollbarCrashField_Address] unsignedLongLongValue]; if(address == 0) { return [self appendOriginatingCall:@"Attempted to dereference null pointer." @@ -565,9 +565,9 @@ - (NSString*) diagnoseCrash:(NSDictionary*) report NSArray* symbols = [e callStackSymbols]; if(symbols) { - return [NSString stringWithFormat:@"No diagnosis due to exception %@:\n%@\nPlease file a bug report to the KSCrash project.", e, symbols]; + return [NSString stringWithFormat:@"No diagnosis due to exception %@:\n%@\nPlease file a bug report to the RollbarCrash project.", e, symbols]; } - return [NSString stringWithFormat:@"No diagnosis due to exception %@\nPlease file a bug report to the KSCrash project.", e]; + return [NSString stringWithFormat:@"No diagnosis due to exception %@\nPlease file a bug report to the RollbarCrash project.", e]; } } diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashReport.c b/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashReport.c index 75e767c0..48da6f85 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashReport.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashReport.c @@ -1,5 +1,5 @@ // -// KSCrashReport.m +// RollbarCrashReport.m // // Created by Karl Stenerud on 2012-01-28. // @@ -25,29 +25,29 @@ // -#include "KSCrashReport.h" - -#include "KSCrashReportFields.h" -#include "KSCrashReportWriter.h" -#include "KSDynamicLinker.h" -#include "KSFileUtils.h" -#include "KSJSONCodec.h" -#include "KSCPU.h" -#include "KSMemory.h" -#include "KSMach.h" -#include "KSThread.h" -#include "KSObjC.h" -#include "KSSignalInfo.h" -#include "KSCrashMonitor_Zombie.h" -#include "KSString.h" -#include "KSCrashReportVersion.h" -#include "KSStackCursor_Backtrace.h" -#include "KSStackCursor_MachineContext.h" -#include "KSSystemCapabilities.h" -#include "KSCrashCachedData.h" - -//#define KSLogger_LocalLevel TRACE -#include "KSLogger.h" +#include "RollbarCrashReport.h" + +#include "RollbarCrashReportFields.h" +#include "RollbarCrashReportWriter.h" +#include "RollbarCrashDynamicLinker.h" +#include "RollbarCrashFileUtils.h" +#include "RollbarCrashJSONCodec.h" +#include "RollbarCrashCPU.h" +#include "RollbarCrashMemory.h" +#include "RollbarCrashMach.h" +#include "RollbarCrashThread.h" +#include "RollbarCrashObjC.h" +#include "RollbarCrashSignalInfo.h" +#include "RollbarCrashMonitor_Zombie.h" +#include "RollbarCrashString.h" +#include "RollbarCrashReportVersion.h" +#include "RollbarCrashStackCursor_Backtrace.h" +#include "RollbarCrashStackCursor_MachineContext.h" +#include "RollbarCrashSystemCapabilities.h" +#include "RollbarCrashCachedData.h" + +//#define RollbarCrashLogger_LocalLevel TRACE +#include "RollbarCrashLogger.h" #include #include @@ -82,7 +82,7 @@ #pragma mark - JSON Encoding - // ============================================================================ -#define getJsonContext(REPORT_WRITER) ((KSJSONEncodeContext*)((REPORT_WRITER)->context)) +#define getJsonContext(REPORT_WRITER) ((RollbarCrashJSONEncodeContext*)((REPORT_WRITER)->context)) /** Used for writing hex string values. */ static const char g_hexNybbles[] = @@ -109,52 +109,52 @@ typedef struct */ const char** restrictedClasses; int restrictedClassesCount; -} KSCrash_IntrospectionRules; +} RollbarCrash_IntrospectionRules; static const char* g_userInfoJSON; -static KSCrash_IntrospectionRules g_introspectionRules; -static KSReportWriteCallback g_userSectionWriteCallback; +static RollbarCrash_IntrospectionRules g_introspectionRules; +static RollbarCrashReportWriteCallback g_userSectionWriteCallback; #pragma mark Callbacks -static void addBooleanElement(const KSCrashReportWriter* const writer, const char* const key, const bool value) +static void addBooleanElement(const RollbarCrashReportWriter* const writer, const char* const key, const bool value) { ksjson_addBooleanElement(getJsonContext(writer), key, value); } -static void addFloatingPointElement(const KSCrashReportWriter* const writer, const char* const key, const double value) +static void addFloatingPointElement(const RollbarCrashReportWriter* const writer, const char* const key, const double value) { ksjson_addFloatingPointElement(getJsonContext(writer), key, value); } -static void addIntegerElement(const KSCrashReportWriter* const writer, const char* const key, const int64_t value) +static void addIntegerElement(const RollbarCrashReportWriter* const writer, const char* const key, const int64_t value) { ksjson_addIntegerElement(getJsonContext(writer), key, value); } -static void addUIntegerElement(const KSCrashReportWriter* const writer, const char* const key, const uint64_t value) +static void addUIntegerElement(const RollbarCrashReportWriter* const writer, const char* const key, const uint64_t value) { ksjson_addUIntegerElement(getJsonContext(writer), key, value); } -static void addStringElement(const KSCrashReportWriter* const writer, const char* const key, const char* const value) +static void addStringElement(const RollbarCrashReportWriter* const writer, const char* const key, const char* const value) { - ksjson_addStringElement(getJsonContext(writer), key, value, KSJSON_SIZE_AUTOMATIC); + ksjson_addStringElement(getJsonContext(writer), key, value, RollbarCrashJSON_SIZE_AUTOMATIC); } -static void addTextFileElement(const KSCrashReportWriter* const writer, const char* const key, const char* const filePath) +static void addTextFileElement(const RollbarCrashReportWriter* const writer, const char* const key, const char* const filePath) { const int fd = open(filePath, O_RDONLY); if(fd < 0) { - KSLOG_ERROR("Could not open file %s: %s", filePath, strerror(errno)); + RollbarCrashLOG_ERROR("Could not open file %s: %s", filePath, strerror(errno)); return; } - if(ksjson_beginStringElement(getJsonContext(writer), key) != KSJSON_OK) + if(ksjson_beginStringElement(getJsonContext(writer), key) != RollbarCrashJSON_OK) { - KSLOG_ERROR("Could not start string element"); + RollbarCrashLOG_ERROR("Could not start string element"); goto done; } @@ -164,9 +164,9 @@ static void addTextFileElement(const KSCrashReportWriter* const writer, const ch bytesRead > 0; bytesRead = (int)read(fd, buffer, sizeof(buffer))) { - if(ksjson_appendStringElement(getJsonContext(writer), buffer, bytesRead) != KSJSON_OK) + if(ksjson_appendStringElement(getJsonContext(writer), buffer, bytesRead) != RollbarCrashJSON_OK) { - KSLOG_ERROR("Could not append string element"); + RollbarCrashLOG_ERROR("Could not append string element"); goto done; } } @@ -176,7 +176,7 @@ static void addTextFileElement(const KSCrashReportWriter* const writer, const ch close(fd); } -static void addDataElement(const KSCrashReportWriter* const writer, +static void addDataElement(const RollbarCrashReportWriter* const writer, const char* const key, const char* const value, const int length) @@ -184,22 +184,22 @@ static void addDataElement(const KSCrashReportWriter* const writer, ksjson_addDataElement(getJsonContext(writer), key, value, length); } -static void beginDataElement(const KSCrashReportWriter* const writer, const char* const key) +static void beginDataElement(const RollbarCrashReportWriter* const writer, const char* const key) { ksjson_beginDataElement(getJsonContext(writer), key); } -static void appendDataElement(const KSCrashReportWriter* const writer, const char* const value, const int length) +static void appendDataElement(const RollbarCrashReportWriter* const writer, const char* const value, const int length) { ksjson_appendDataElement(getJsonContext(writer), value, length); } -static void endDataElement(const KSCrashReportWriter* const writer) +static void endDataElement(const RollbarCrashReportWriter* const writer) { ksjson_endDataElement(getJsonContext(writer)); } -static void addUUIDElement(const KSCrashReportWriter* const writer, const char* const key, const unsigned char* const value) +static void addUUIDElement(const RollbarCrashReportWriter* const writer, const char* const key, const unsigned char* const value) { if(value == NULL) { @@ -244,7 +244,7 @@ static void addUUIDElement(const KSCrashReportWriter* const writer, const char* } } -static void addJSONElement(const KSCrashReportWriter* const writer, +static void addJSONElement(const RollbarCrashReportWriter* const writer, const char* const key, const char* const jsonElement, bool closeLastContainer) @@ -254,7 +254,7 @@ static void addJSONElement(const KSCrashReportWriter* const writer, jsonElement, (int)strlen(jsonElement), closeLastContainer); - if(jsonResult != KSJSON_OK) + if(jsonResult != RollbarCrashJSON_OK) { char errorBuff[100]; snprintf(errorBuff, @@ -263,18 +263,18 @@ static void addJSONElement(const KSCrashReportWriter* const writer, ksjson_stringForError(jsonResult)); ksjson_beginObject(getJsonContext(writer), key); ksjson_addStringElement(getJsonContext(writer), - KSCrashField_Error, + RollbarCrashField_Error, errorBuff, - KSJSON_SIZE_AUTOMATIC); + RollbarCrashJSON_SIZE_AUTOMATIC); ksjson_addStringElement(getJsonContext(writer), - KSCrashField_JSONData, + RollbarCrashField_JSONData, jsonElement, - KSJSON_SIZE_AUTOMATIC); + RollbarCrashJSON_SIZE_AUTOMATIC); ksjson_endContainer(getJsonContext(writer)); } } -static void addJSONElementFromFile(const KSCrashReportWriter* const writer, +static void addJSONElementFromFile(const RollbarCrashReportWriter* const writer, const char* const key, const char* const filePath, bool closeLastContainer) @@ -282,26 +282,26 @@ static void addJSONElementFromFile(const KSCrashReportWriter* const writer, ksjson_addJSONFromFile(getJsonContext(writer), key, filePath, closeLastContainer); } -static void beginObject(const KSCrashReportWriter* const writer, const char* const key) +static void beginObject(const RollbarCrashReportWriter* const writer, const char* const key) { ksjson_beginObject(getJsonContext(writer), key); } -static void beginArray(const KSCrashReportWriter* const writer, const char* const key) +static void beginArray(const RollbarCrashReportWriter* const writer, const char* const key) { ksjson_beginArray(getJsonContext(writer), key); } -static void endContainer(const KSCrashReportWriter* const writer) +static void endContainer(const RollbarCrashReportWriter* const writer) { ksjson_endContainer(getJsonContext(writer)); } -static void addTextLinesFromFile(const KSCrashReportWriter* const writer, const char* const key, const char* const filePath) +static void addTextLinesFromFile(const RollbarCrashReportWriter* const writer, const char* const key, const char* const filePath) { char readBuffer[1024]; - KSBufferedReader reader; + RollbarCrashBufferedReader reader; if(!ksfu_openBufferedReader(&reader, filePath, readBuffer, sizeof(readBuffer))) { return; @@ -318,7 +318,7 @@ static void addTextLinesFromFile(const KSCrashReportWriter* const writer, const break; } buffer[length - 1] = '\0'; - ksjson_addStringElement(getJsonContext(writer), NULL, buffer, KSJSON_SIZE_AUTOMATIC); + ksjson_addStringElement(getJsonContext(writer), NULL, buffer, RollbarCrashJSON_SIZE_AUTOMATIC); } } endContainer(writer); @@ -327,9 +327,9 @@ static void addTextLinesFromFile(const KSCrashReportWriter* const writer, const static int addJSONData(const char* restrict const data, const int length, void* restrict userData) { - KSBufferedWriter* writer = (KSBufferedWriter*)userData; + RollbarCrashBufferedWriter* writer = (RollbarCrashBufferedWriter*)userData; const bool success = ksfu_writeBufferedWriter(writer, data, length); - return success ? KSJSON_OK : KSJSON_ERROR_CANNOT_ADD_DATA; + return success ? RollbarCrashJSON_OK : RollbarCrashJSON_ERROR_CANNOT_ADD_DATA; } @@ -378,17 +378,17 @@ static bool isValidString(const void* const address) * * @return True if the cursor was filled. */ -static bool getStackCursor(const KSCrash_MonitorContext* const crash, - const struct KSMachineContext* const machineContext, - KSStackCursor *cursor) +static bool getStackCursor(const RollbarCrash_MonitorContext* const crash, + const struct RollbarCrashMachineContext* const machineContext, + RollbarCrashStackCursor *cursor) { if(ksmc_getThreadFromContext(machineContext) == ksmc_getThreadFromContext(crash->offendingMachineContext)) { - *cursor = *((KSStackCursor*)crash->stackCursor); + *cursor = *((RollbarCrashStackCursor*)crash->stackCursor); return true; } - kssc_initWithMachineContext(cursor, KSSC_STACK_OVERFLOW_THRESHOLD, machineContext); + kssc_initWithMachineContext(cursor, RollbarCrashSC_STACK_OVERFLOW_THRESHOLD, machineContext); return true; } @@ -408,7 +408,7 @@ static bool getStackCursor(const KSCrash_MonitorContext* const crash, * * @param limit How many more subreferenced objects to write, if any. */ -static void writeMemoryContents(const KSCrashReportWriter* const writer, +static void writeMemoryContents(const RollbarCrashReportWriter* const writer, const char* const key, const uintptr_t address, int* limit); @@ -424,7 +424,7 @@ static void writeMemoryContents(const KSCrashReportWriter* const writer, * * @param limit How many more subreferenced objects to write, if any. */ -static void writeNSStringContents(const KSCrashReportWriter* const writer, +static void writeNSStringContents(const RollbarCrashReportWriter* const writer, const char* const key, const uintptr_t objectAddress, __unused int* limit) @@ -448,7 +448,7 @@ static void writeNSStringContents(const KSCrashReportWriter* const writer, * * @param limit How many more subreferenced objects to write, if any. */ -static void writeURLContents(const KSCrashReportWriter* const writer, +static void writeURLContents(const RollbarCrashReportWriter* const writer, const char* const key, const uintptr_t objectAddress, __unused int* limit) @@ -472,7 +472,7 @@ static void writeURLContents(const KSCrashReportWriter* const writer, * * @param limit How many more subreferenced objects to write, if any. */ -static void writeDateContents(const KSCrashReportWriter* const writer, +static void writeDateContents(const RollbarCrashReportWriter* const writer, const char* const key, const uintptr_t objectAddress, __unused int* limit) @@ -492,7 +492,7 @@ static void writeDateContents(const KSCrashReportWriter* const writer, * * @param limit How many more subreferenced objects to write, if any. */ -static void writeNumberContents(const KSCrashReportWriter* const writer, +static void writeNumberContents(const RollbarCrashReportWriter* const writer, const char* const key, const uintptr_t objectAddress, __unused int* limit) @@ -512,7 +512,7 @@ static void writeNumberContents(const KSCrashReportWriter* const writer, * * @param limit How many more subreferenced objects to write, if any. */ -static void writeArrayContents(const KSCrashReportWriter* const writer, +static void writeArrayContents(const RollbarCrashReportWriter* const writer, const char* const key, const uintptr_t objectAddress, int* limit) @@ -535,14 +535,14 @@ static void writeArrayContents(const KSCrashReportWriter* const writer, * * @param limit How many more subreferenced objects to write, if any. */ -static void writeUnknownObjectContents(const KSCrashReportWriter* const writer, +static void writeUnknownObjectContents(const RollbarCrashReportWriter* const writer, const char* const key, const uintptr_t objectAddress, int* limit) { (*limit)--; const void* object = (const void*)objectAddress; - KSObjCIvar ivars[10]; + RollbarCrashObjCIvar ivars[10]; int8_t s8; int16_t s16; int sInt; @@ -572,7 +572,7 @@ static void writeUnknownObjectContents(const KSCrashReportWriter* const writer, *limit -= ivarCount; for(int i = 0; i < ivarCount; i++) { - KSObjCIvar* ivar = &ivars[i]; + RollbarCrashObjCIvar* ivar = &ivars[i]; switch(ivar->type[0]) { case 'c': @@ -635,7 +635,7 @@ static void writeUnknownObjectContents(const KSCrashReportWriter* const writer, writeMemoryContents(writer, ivar->name, (uintptr_t)pointer, limit); break; default: - KSLOG_DEBUG("%s: Unknown ivar type [%s]", ivar->name, ivar->type); + RollbarCrashLOG_DEBUG("%s: Unknown ivar type [%s]", ivar->name, ivar->type); } } } @@ -658,11 +658,11 @@ static bool isRestrictedClass(const char* name) return false; } -static void writeZombieIfPresent(const KSCrashReportWriter* const writer, +static void writeZombieIfPresent(const RollbarCrashReportWriter* const writer, const char* const key, const uintptr_t address) { -#if KSCRASH_HAS_OBJC +#if RollbarCrashCRASH_HAS_OBJC const void* object = (const void*)address; const char* zombieClassName = kszombie_className(object); if(zombieClassName != NULL) @@ -672,69 +672,69 @@ static void writeZombieIfPresent(const KSCrashReportWriter* const writer, #endif } -static bool writeObjCObject(const KSCrashReportWriter* const writer, +static bool writeObjCObject(const RollbarCrashReportWriter* const writer, const uintptr_t address, int* limit) { -#if KSCRASH_HAS_OBJC +#if RollbarCrashCRASH_HAS_OBJC const void* object = (const void*)address; switch(ksobjc_objectType(object)) { - case KSObjCTypeClass: - writer->addStringElement(writer, KSCrashField_Type, KSCrashMemType_Class); - writer->addStringElement(writer, KSCrashField_Class, ksobjc_className(object)); + case RollbarCrashObjCTypeClass: + writer->addStringElement(writer, RollbarCrashField_Type, RollbarCrashMemType_Class); + writer->addStringElement(writer, RollbarCrashField_Class, ksobjc_className(object)); return true; - case KSObjCTypeObject: + case RollbarCrashObjCTypeObject: { - writer->addStringElement(writer, KSCrashField_Type, KSCrashMemType_Object); + writer->addStringElement(writer, RollbarCrashField_Type, RollbarCrashMemType_Object); const char* className = ksobjc_objectClassName(object); - writer->addStringElement(writer, KSCrashField_Class, className); + writer->addStringElement(writer, RollbarCrashField_Class, className); if(!isRestrictedClass(className)) { switch(ksobjc_objectClassType(object)) { - case KSObjCClassTypeString: - writeNSStringContents(writer, KSCrashField_Value, address, limit); + case RollbarCrashObjCClassTypeString: + writeNSStringContents(writer, RollbarCrashField_Value, address, limit); return true; - case KSObjCClassTypeURL: - writeURLContents(writer, KSCrashField_Value, address, limit); + case RollbarCrashObjCClassTypeURL: + writeURLContents(writer, RollbarCrashField_Value, address, limit); return true; - case KSObjCClassTypeDate: - writeDateContents(writer, KSCrashField_Value, address, limit); + case RollbarCrashObjCClassTypeDate: + writeDateContents(writer, RollbarCrashField_Value, address, limit); return true; - case KSObjCClassTypeArray: + case RollbarCrashObjCClassTypeArray: if(*limit > 0) { - writeArrayContents(writer, KSCrashField_FirstObject, address, limit); + writeArrayContents(writer, RollbarCrashField_FirstObject, address, limit); } return true; - case KSObjCClassTypeNumber: - writeNumberContents(writer, KSCrashField_Value, address, limit); + case RollbarCrashObjCClassTypeNumber: + writeNumberContents(writer, RollbarCrashField_Value, address, limit); return true; - case KSObjCClassTypeDictionary: - case KSObjCClassTypeException: + case RollbarCrashObjCClassTypeDictionary: + case RollbarCrashObjCClassTypeException: // TODO: Implement these. if(*limit > 0) { - writeUnknownObjectContents(writer, KSCrashField_Ivars, address, limit); + writeUnknownObjectContents(writer, RollbarCrashField_Ivars, address, limit); } return true; - case KSObjCClassTypeUnknown: + case RollbarCrashObjCClassTypeUnknown: if(*limit > 0) { - writeUnknownObjectContents(writer, KSCrashField_Ivars, address, limit); + writeUnknownObjectContents(writer, RollbarCrashField_Ivars, address, limit); } return true; } } break; } - case KSObjCTypeBlock: - writer->addStringElement(writer, KSCrashField_Type, KSCrashMemType_Block); + case RollbarCrashObjCTypeBlock: + writer->addStringElement(writer, RollbarCrashField_Type, RollbarCrashMemType_Block); const char* className = ksobjc_objectClassName(object); - writer->addStringElement(writer, KSCrashField_Class, className); + writer->addStringElement(writer, RollbarCrashField_Class, className); return true; - case KSObjCTypeUnknown: + case RollbarCrashObjCTypeUnknown: break; } #endif @@ -753,7 +753,7 @@ static bool writeObjCObject(const KSCrashReportWriter* const writer, * * @param limit How many more subreferenced objects to write, if any. */ -static void writeMemoryContents(const KSCrashReportWriter* const writer, +static void writeMemoryContents(const RollbarCrashReportWriter* const writer, const char* const key, const uintptr_t address, int* limit) @@ -762,22 +762,22 @@ static void writeMemoryContents(const KSCrashReportWriter* const writer, const void* object = (const void*)address; writer->beginObject(writer, key); { - writer->addUIntegerElement(writer, KSCrashField_Address, address); - writeZombieIfPresent(writer, KSCrashField_LastDeallocObject, address); + writer->addUIntegerElement(writer, RollbarCrashField_Address, address); + writeZombieIfPresent(writer, RollbarCrashField_LastDeallocObject, address); if(!writeObjCObject(writer, address, limit)) { if(object == NULL) { - writer->addStringElement(writer, KSCrashField_Type, KSCrashMemType_NullPointer); + writer->addStringElement(writer, RollbarCrashField_Type, RollbarCrashMemType_NullPointer); } else if(isValidString(object)) { - writer->addStringElement(writer, KSCrashField_Type, KSCrashMemType_String); - writer->addStringElement(writer, KSCrashField_Value, (const char*)object); + writer->addStringElement(writer, RollbarCrashField_Type, RollbarCrashMemType_String); + writer->addStringElement(writer, RollbarCrashField_Value, (const char*)object); } else { - writer->addStringElement(writer, KSCrashField_Type, KSCrashMemType_Unknown); + writer->addStringElement(writer, RollbarCrashField_Type, RollbarCrashMemType_Unknown); } } } @@ -791,7 +791,7 @@ static bool isValidPointer(const uintptr_t address) return false; } -#if KSCRASH_HAS_OBJC +#if RollbarCrashCRASH_HAS_OBJC if(ksobjc_isTaggedPointer((const void*)address)) { if(!ksobjc_isValidTaggedPointer((const void*)address)) @@ -813,13 +813,13 @@ static bool isNotableAddress(const uintptr_t address) const void* object = (const void*)address; -#if KSCRASH_HAS_OBJC +#if RollbarCrashCRASH_HAS_OBJC if(kszombie_className(object) != NULL) { return true; } - if(ksobjc_objectType(object) != KSObjCTypeUnknown) + if(ksobjc_objectType(object) != RollbarCrashObjCTypeUnknown) { return true; } @@ -842,7 +842,7 @@ static bool isNotableAddress(const uintptr_t address) * * @param address The memory address. */ -static void writeMemoryContentsIfNotable(const KSCrashReportWriter* const writer, +static void writeMemoryContentsIfNotable(const RollbarCrashReportWriter* const writer, const char* const key, const uintptr_t address) { @@ -861,7 +861,7 @@ static void writeMemoryContentsIfNotable(const KSCrashReportWriter* const writer * * @param string The string to search. */ -static void writeAddressReferencedByString(const KSCrashReportWriter* const writer, +static void writeAddressReferencedByString(const RollbarCrashReportWriter* const writer, const char* const key, const char* string) { @@ -885,13 +885,13 @@ static void writeAddressReferencedByString(const KSCrashReportWriter* const writ * * @param stackCursor The stack cursor to read from. */ -static void writeBacktrace(const KSCrashReportWriter* const writer, +static void writeBacktrace(const RollbarCrashReportWriter* const writer, const char* const key, - KSStackCursor* stackCursor) + RollbarCrashStackCursor* stackCursor) { writer->beginObject(writer, key); { - writer->beginArray(writer, KSCrashField_Contents); + writer->beginArray(writer, RollbarCrashField_Contents); { while(stackCursor->advanceCursor(stackCursor)) { @@ -901,22 +901,22 @@ static void writeBacktrace(const KSCrashReportWriter* const writer, { if(stackCursor->stackEntry.imageName != NULL) { - writer->addStringElement(writer, KSCrashField_ObjectName, ksfu_lastPathEntry(stackCursor->stackEntry.imageName)); + writer->addStringElement(writer, RollbarCrashField_ObjectName, ksfu_lastPathEntry(stackCursor->stackEntry.imageName)); } - writer->addUIntegerElement(writer, KSCrashField_ObjectAddr, stackCursor->stackEntry.imageAddress); + writer->addUIntegerElement(writer, RollbarCrashField_ObjectAddr, stackCursor->stackEntry.imageAddress); if(stackCursor->stackEntry.symbolName != NULL) { - writer->addStringElement(writer, KSCrashField_SymbolName, stackCursor->stackEntry.symbolName); + writer->addStringElement(writer, RollbarCrashField_SymbolName, stackCursor->stackEntry.symbolName); } - writer->addUIntegerElement(writer, KSCrashField_SymbolAddr, stackCursor->stackEntry.symbolAddress); + writer->addUIntegerElement(writer, RollbarCrashField_SymbolAddr, stackCursor->stackEntry.symbolAddress); } - writer->addUIntegerElement(writer, KSCrashField_InstructionAddr, stackCursor->stackEntry.address); + writer->addUIntegerElement(writer, RollbarCrashField_InstructionAddr, stackCursor->stackEntry.address); } writer->endContainer(writer); } } writer->endContainer(writer); - writer->addIntegerElement(writer, KSCrashField_Skipped, 0); + writer->addIntegerElement(writer, RollbarCrashField_Skipped, 0); } writer->endContainer(writer); } @@ -934,9 +934,9 @@ static void writeBacktrace(const KSCrashReportWriter* const writer, * * @param isStackOverflow If true, the stack has overflowed. */ -static void writeStackContents(const KSCrashReportWriter* const writer, +static void writeStackContents(const RollbarCrashReportWriter* const writer, const char* const key, - const struct KSMachineContext* const machineContext, + const struct RollbarCrashMachineContext* const machineContext, const bool isStackOverflow) { uintptr_t sp = kscpu_stackPointer(machineContext); @@ -955,20 +955,20 @@ static void writeStackContents(const KSCrashReportWriter* const writer, } writer->beginObject(writer, key); { - writer->addStringElement(writer, KSCrashField_GrowDirection, kscpu_stackGrowDirection() > 0 ? "+" : "-"); - writer->addUIntegerElement(writer, KSCrashField_DumpStart, lowAddress); - writer->addUIntegerElement(writer, KSCrashField_DumpEnd, highAddress); - writer->addUIntegerElement(writer, KSCrashField_StackPtr, sp); - writer->addBooleanElement(writer, KSCrashField_Overflow, isStackOverflow); + writer->addStringElement(writer, RollbarCrashField_GrowDirection, kscpu_stackGrowDirection() > 0 ? "+" : "-"); + writer->addUIntegerElement(writer, RollbarCrashField_DumpStart, lowAddress); + writer->addUIntegerElement(writer, RollbarCrashField_DumpEnd, highAddress); + writer->addUIntegerElement(writer, RollbarCrashField_StackPtr, sp); + writer->addBooleanElement(writer, RollbarCrashField_Overflow, isStackOverflow); uint8_t stackBuffer[kStackContentsTotalDistance * sizeof(sp)]; int copyLength = (int)(highAddress - lowAddress); if(ksmem_copySafely((void*)lowAddress, stackBuffer, copyLength)) { - writer->addDataElement(writer, KSCrashField_Contents, (void*)stackBuffer, copyLength); + writer->addDataElement(writer, RollbarCrashField_Contents, (void*)stackBuffer, copyLength); } else { - writer->addStringElement(writer, KSCrashField_Error, "Stack contents not accessible"); + writer->addStringElement(writer, RollbarCrashField_Error, "Stack contents not accessible"); } } writer->endContainer(writer); @@ -984,8 +984,8 @@ static void writeStackContents(const KSCrashReportWriter* const writer, * * @param forwardDistance The distance past the end of the stack to check. */ -static void writeNotableStackContents(const KSCrashReportWriter* const writer, - const struct KSMachineContext* const machineContext, +static void writeNotableStackContents(const RollbarCrashReportWriter* const writer, + const struct RollbarCrashMachineContext* const machineContext, const int backDistance, const int forwardDistance) { @@ -1026,9 +1026,9 @@ static void writeNotableStackContents(const KSCrashReportWriter* const writer, * * @param machineContext The context to retrieve the registers from. */ -static void writeBasicRegisters(const KSCrashReportWriter* const writer, +static void writeBasicRegisters(const RollbarCrashReportWriter* const writer, const char* const key, - const struct KSMachineContext* const machineContext) + const struct RollbarCrashMachineContext* const machineContext) { char registerNameBuff[30]; const char* registerName; @@ -1058,9 +1058,9 @@ static void writeBasicRegisters(const KSCrashReportWriter* const writer, * * @param machineContext The context to retrieve the registers from. */ -static void writeExceptionRegisters(const KSCrashReportWriter* const writer, +static void writeExceptionRegisters(const RollbarCrashReportWriter* const writer, const char* const key, - const struct KSMachineContext* const machineContext) + const struct RollbarCrashMachineContext* const machineContext) { char registerNameBuff[30]; const char* registerName; @@ -1090,16 +1090,16 @@ static void writeExceptionRegisters(const KSCrashReportWriter* const writer, * * @param machineContext The context to retrieve the registers from. */ -static void writeRegisters(const KSCrashReportWriter* const writer, +static void writeRegisters(const RollbarCrashReportWriter* const writer, const char* const key, - const struct KSMachineContext* const machineContext) + const struct RollbarCrashMachineContext* const machineContext) { writer->beginObject(writer, key); { - writeBasicRegisters(writer, KSCrashField_Basic, machineContext); + writeBasicRegisters(writer, RollbarCrashField_Basic, machineContext); if(ksmc_hasValidExceptionRegisters(machineContext)) { - writeExceptionRegisters(writer, KSCrashField_Exception, machineContext); + writeExceptionRegisters(writer, RollbarCrashField_Exception, machineContext); } } writer->endContainer(writer); @@ -1111,8 +1111,8 @@ static void writeRegisters(const KSCrashReportWriter* const writer, * * @param machineContext The context to retrieve the registers from. */ -static void writeNotableRegisters(const KSCrashReportWriter* const writer, - const struct KSMachineContext* const machineContext) +static void writeNotableRegisters(const RollbarCrashReportWriter* const writer, + const struct RollbarCrashMachineContext* const machineContext) { char registerNameBuff[30]; const char* registerName; @@ -1141,9 +1141,9 @@ static void writeNotableRegisters(const KSCrashReportWriter* const writer, * * @param machineContext The context to retrieve the registers from. */ -static void writeNotableAddresses(const KSCrashReportWriter* const writer, +static void writeNotableAddresses(const RollbarCrashReportWriter* const writer, const char* const key, - const struct KSMachineContext* const machineContext) + const struct RollbarCrashMachineContext* const machineContext) { writer->beginObject(writer, key); { @@ -1168,49 +1168,49 @@ static void writeNotableAddresses(const KSCrashReportWriter* const writer, * * @param shouldWriteNotableAddresses If true, write any notable addresses found. */ -static void writeThread(const KSCrashReportWriter* const writer, +static void writeThread(const RollbarCrashReportWriter* const writer, const char* const key, - const KSCrash_MonitorContext* const crash, - const struct KSMachineContext* const machineContext, + const RollbarCrash_MonitorContext* const crash, + const struct RollbarCrashMachineContext* const machineContext, const int threadIndex, const bool shouldWriteNotableAddresses) { bool isCrashedThread = ksmc_isCrashedContext(machineContext); - KSThread thread = ksmc_getThreadFromContext(machineContext); - KSLOG_DEBUG("Writing thread %x (index %d). is crashed: %d", thread, threadIndex, isCrashedThread); + RollbarCrashThread thread = ksmc_getThreadFromContext(machineContext); + RollbarCrashLOG_DEBUG("Writing thread %x (index %d). is crashed: %d", thread, threadIndex, isCrashedThread); - KSStackCursor stackCursor; + RollbarCrashStackCursor stackCursor; bool hasBacktrace = getStackCursor(crash, machineContext, &stackCursor); writer->beginObject(writer, key); { if(hasBacktrace) { - writeBacktrace(writer, KSCrashField_Backtrace, &stackCursor); + writeBacktrace(writer, RollbarCrashField_Backtrace, &stackCursor); } if(ksmc_canHaveCPUState(machineContext)) { - writeRegisters(writer, KSCrashField_Registers, machineContext); + writeRegisters(writer, RollbarCrashField_Registers, machineContext); } - writer->addIntegerElement(writer, KSCrashField_Index, threadIndex); + writer->addIntegerElement(writer, RollbarCrashField_Index, threadIndex); const char* name = ksccd_getThreadName(thread); if(name != NULL) { - writer->addStringElement(writer, KSCrashField_Name, name); + writer->addStringElement(writer, RollbarCrashField_Name, name); } name = ksccd_getQueueName(thread); if(name != NULL) { - writer->addStringElement(writer, KSCrashField_DispatchQueue, name); + writer->addStringElement(writer, RollbarCrashField_DispatchQueue, name); } - writer->addBooleanElement(writer, KSCrashField_Crashed, isCrashedThread); - writer->addBooleanElement(writer, KSCrashField_CurrentThread, thread == ksthread_self()); + writer->addBooleanElement(writer, RollbarCrashField_Crashed, isCrashedThread); + writer->addBooleanElement(writer, RollbarCrashField_CurrentThread, thread == ksthread_self()); if(isCrashedThread) { - writeStackContents(writer, KSCrashField_Stack, machineContext, stackCursor.state.hasGivenUp); + writeStackContents(writer, RollbarCrashField_Stack, machineContext, stackCursor.state.hasGivenUp); if(shouldWriteNotableAddresses) { - writeNotableAddresses(writer, KSCrashField_NotableAddresses, machineContext); + writeNotableAddresses(writer, RollbarCrashField_NotableAddresses, machineContext); } } } @@ -1225,23 +1225,23 @@ static void writeThread(const KSCrashReportWriter* const writer, * * @param crash The crash handler context. */ -static void writeAllThreads(const KSCrashReportWriter* const writer, +static void writeAllThreads(const RollbarCrashReportWriter* const writer, const char* const key, - const KSCrash_MonitorContext* const crash, + const RollbarCrash_MonitorContext* const crash, bool writeNotableAddresses) { - const struct KSMachineContext* const context = crash->offendingMachineContext; - KSThread offendingThread = ksmc_getThreadFromContext(context); + const struct RollbarCrashMachineContext* const context = crash->offendingMachineContext; + RollbarCrashThread offendingThread = ksmc_getThreadFromContext(context); int threadCount = ksmc_getThreadCount(context); - KSMC_NEW_CONTEXT(machineContext); + RollbarCrashMC_NEW_CONTEXT(machineContext); // Fetch info for all threads. writer->beginArray(writer, key); { - KSLOG_DEBUG("Writing %d threads.", threadCount); + RollbarCrashLOG_DEBUG("Writing %d threads.", threadCount); for(int i = 0; i < threadCount; i++) { - KSThread thread = ksmc_getThreadAtIndex(context, i); + RollbarCrashThread thread = ksmc_getThreadAtIndex(context, i); if(thread == offendingThread) { writeThread(writer, NULL, crash, context, i, writeNotableAddresses); @@ -1266,11 +1266,11 @@ static void writeAllThreads(const KSCrashReportWriter* const writer, * * @param index Which image to write about. */ -static void writeBinaryImage(const KSCrashReportWriter* const writer, +static void writeBinaryImage(const RollbarCrashReportWriter* const writer, const char* const key, const int index) { - KSBinaryImage image = {0}; + RollbarCrashBinaryImage image = {0}; if(!ksdl_getBinaryImage(index, &image)) { return; @@ -1278,23 +1278,23 @@ static void writeBinaryImage(const KSCrashReportWriter* const writer, writer->beginObject(writer, key); { - writer->addUIntegerElement(writer, KSCrashField_ImageAddress, image.address); - writer->addUIntegerElement(writer, KSCrashField_ImageVmAddress, image.vmAddress); - writer->addUIntegerElement(writer, KSCrashField_ImageSize, image.size); - writer->addStringElement(writer, KSCrashField_Name, image.name); - writer->addUUIDElement(writer, KSCrashField_UUID, image.uuid); - writer->addIntegerElement(writer, KSCrashField_CPUType, image.cpuType); - writer->addIntegerElement(writer, KSCrashField_CPUSubType, image.cpuSubType); - writer->addUIntegerElement(writer, KSCrashField_ImageMajorVersion, image.majorVersion); - writer->addUIntegerElement(writer, KSCrashField_ImageMinorVersion, image.minorVersion); - writer->addUIntegerElement(writer, KSCrashField_ImageRevisionVersion, image.revisionVersion); + writer->addUIntegerElement(writer, RollbarCrashField_ImageAddress, image.address); + writer->addUIntegerElement(writer, RollbarCrashField_ImageVmAddress, image.vmAddress); + writer->addUIntegerElement(writer, RollbarCrashField_ImageSize, image.size); + writer->addStringElement(writer, RollbarCrashField_Name, image.name); + writer->addUUIDElement(writer, RollbarCrashField_UUID, image.uuid); + writer->addIntegerElement(writer, RollbarCrashField_CPUType, image.cpuType); + writer->addIntegerElement(writer, RollbarCrashField_CPUSubType, image.cpuSubType); + writer->addUIntegerElement(writer, RollbarCrashField_ImageMajorVersion, image.majorVersion); + writer->addUIntegerElement(writer, RollbarCrashField_ImageMinorVersion, image.minorVersion); + writer->addUIntegerElement(writer, RollbarCrashField_ImageRevisionVersion, image.revisionVersion); if(image.crashInfoMessage != NULL) { - writer->addStringElement(writer, KSCrashField_ImageCrashInfoMessage, image.crashInfoMessage); + writer->addStringElement(writer, RollbarCrashField_ImageCrashInfoMessage, image.crashInfoMessage); } if(image.crashInfoMessage2 != NULL) { - writer->addStringElement(writer, KSCrashField_ImageCrashInfoMessage2, image.crashInfoMessage2); + writer->addStringElement(writer, RollbarCrashField_ImageCrashInfoMessage2, image.crashInfoMessage2); } } writer->endContainer(writer); @@ -1306,7 +1306,7 @@ static void writeBinaryImage(const KSCrashReportWriter* const writer, * * @param key The object key, if needed. */ -static void writeBinaryImages(const KSCrashReportWriter* const writer, const char* const key) +static void writeBinaryImages(const RollbarCrashReportWriter* const writer, const char* const key) { const int imageCount = ksdl_imageCount(); @@ -1326,15 +1326,15 @@ static void writeBinaryImages(const KSCrashReportWriter* const writer, const cha * * @param key The object key, if needed. */ -static void writeMemoryInfo(const KSCrashReportWriter* const writer, +static void writeMemoryInfo(const RollbarCrashReportWriter* const writer, const char* const key, - const KSCrash_MonitorContext* const monitorContext) + const RollbarCrash_MonitorContext* const monitorContext) { writer->beginObject(writer, key); { - writer->addUIntegerElement(writer, KSCrashField_Size, monitorContext->System.memorySize); - writer->addUIntegerElement(writer, KSCrashField_Usable, monitorContext->System.usableMemory); - writer->addUIntegerElement(writer, KSCrashField_Free, monitorContext->System.freeMemory); + writer->addUIntegerElement(writer, RollbarCrashField_Size, monitorContext->System.memorySize); + writer->addUIntegerElement(writer, RollbarCrashField_Usable, monitorContext->System.usableMemory); + writer->addUIntegerElement(writer, RollbarCrashField_Free, monitorContext->System.freeMemory); } writer->endContainer(writer); } @@ -1347,117 +1347,117 @@ static void writeMemoryInfo(const KSCrashReportWriter* const writer, * * @param crash The crash handler context. */ -static void writeError(const KSCrashReportWriter* const writer, +static void writeError(const RollbarCrashReportWriter* const writer, const char* const key, - const KSCrash_MonitorContext* const crash) + const RollbarCrash_MonitorContext* const crash) { writer->beginObject(writer, key); { -#if KSCRASH_HOST_APPLE - writer->beginObject(writer, KSCrashField_Mach); +#if RollbarCrashCRASH_HOST_APPLE + writer->beginObject(writer, RollbarCrashField_Mach); { const char* machExceptionName = ksmach_exceptionName(crash->mach.type); const char* machCodeName = crash->mach.code == 0 ? NULL : ksmach_kernelReturnCodeName(crash->mach.code); - writer->addUIntegerElement(writer, KSCrashField_Exception, (unsigned)crash->mach.type); + writer->addUIntegerElement(writer, RollbarCrashField_Exception, (unsigned)crash->mach.type); if(machExceptionName != NULL) { - writer->addStringElement(writer, KSCrashField_ExceptionName, machExceptionName); + writer->addStringElement(writer, RollbarCrashField_ExceptionName, machExceptionName); } - writer->addUIntegerElement(writer, KSCrashField_Code, (unsigned)crash->mach.code); + writer->addUIntegerElement(writer, RollbarCrashField_Code, (unsigned)crash->mach.code); if(machCodeName != NULL) { - writer->addStringElement(writer, KSCrashField_CodeName, machCodeName); + writer->addStringElement(writer, RollbarCrashField_CodeName, machCodeName); } - writer->addUIntegerElement(writer, KSCrashField_Subcode, (size_t)crash->mach.subcode); + writer->addUIntegerElement(writer, RollbarCrashField_Subcode, (size_t)crash->mach.subcode); } writer->endContainer(writer); #endif - writer->beginObject(writer, KSCrashField_Signal); + writer->beginObject(writer, RollbarCrashField_Signal); { const char* sigName = kssignal_signalName(crash->signal.signum); const char* sigCodeName = kssignal_signalCodeName(crash->signal.signum, crash->signal.sigcode); - writer->addUIntegerElement(writer, KSCrashField_Signal, (unsigned)crash->signal.signum); + writer->addUIntegerElement(writer, RollbarCrashField_Signal, (unsigned)crash->signal.signum); if(sigName != NULL) { - writer->addStringElement(writer, KSCrashField_Name, sigName); + writer->addStringElement(writer, RollbarCrashField_Name, sigName); } - writer->addUIntegerElement(writer, KSCrashField_Code, (unsigned)crash->signal.sigcode); + writer->addUIntegerElement(writer, RollbarCrashField_Code, (unsigned)crash->signal.sigcode); if(sigCodeName != NULL) { - writer->addStringElement(writer, KSCrashField_CodeName, sigCodeName); + writer->addStringElement(writer, RollbarCrashField_CodeName, sigCodeName); } } writer->endContainer(writer); - writer->addUIntegerElement(writer, KSCrashField_Address, crash->faultAddress); + writer->addUIntegerElement(writer, RollbarCrashField_Address, crash->faultAddress); if(crash->crashReason != NULL) { - writer->addStringElement(writer, KSCrashField_Reason, crash->crashReason); + writer->addStringElement(writer, RollbarCrashField_Reason, crash->crashReason); } // Gather specific info. switch(crash->crashType) { - case KSCrashMonitorTypeMainThreadDeadlock: - writer->addStringElement(writer, KSCrashField_Type, KSCrashExcType_Deadlock); + case RollbarCrashMonitorTypeMainThreadDeadlock: + writer->addStringElement(writer, RollbarCrashField_Type, RollbarCrashExcType_Deadlock); break; - case KSCrashMonitorTypeMachException: - writer->addStringElement(writer, KSCrashField_Type, KSCrashExcType_Mach); + case RollbarCrashMonitorTypeMachException: + writer->addStringElement(writer, RollbarCrashField_Type, RollbarCrashExcType_Mach); break; - case KSCrashMonitorTypeCPPException: + case RollbarCrashMonitorTypeCPPException: { - writer->addStringElement(writer, KSCrashField_Type, KSCrashExcType_CPPException); - writer->beginObject(writer, KSCrashField_CPPException); + writer->addStringElement(writer, RollbarCrashField_Type, RollbarCrashExcType_CPPException); + writer->beginObject(writer, RollbarCrashField_CPPException); { - writer->addStringElement(writer, KSCrashField_Name, crash->CPPException.name); + writer->addStringElement(writer, RollbarCrashField_Name, crash->CPPException.name); } writer->endContainer(writer); break; } - case KSCrashMonitorTypeNSException: + case RollbarCrashMonitorTypeNSException: { - writer->addStringElement(writer, KSCrashField_Type, KSCrashExcType_NSException); - writer->beginObject(writer, KSCrashField_NSException); + writer->addStringElement(writer, RollbarCrashField_Type, RollbarCrashExcType_NSException); + writer->beginObject(writer, RollbarCrashField_NSException); { - writer->addStringElement(writer, KSCrashField_Name, crash->NSException.name); - writer->addStringElement(writer, KSCrashField_UserInfo, crash->NSException.userInfo); - writeAddressReferencedByString(writer, KSCrashField_ReferencedObject, crash->crashReason); + writer->addStringElement(writer, RollbarCrashField_Name, crash->NSException.name); + writer->addStringElement(writer, RollbarCrashField_UserInfo, crash->NSException.userInfo); + writeAddressReferencedByString(writer, RollbarCrashField_ReferencedObject, crash->crashReason); } writer->endContainer(writer); break; } - case KSCrashMonitorTypeSignal: - writer->addStringElement(writer, KSCrashField_Type, KSCrashExcType_Signal); + case RollbarCrashMonitorTypeSignal: + writer->addStringElement(writer, RollbarCrashField_Type, RollbarCrashExcType_Signal); break; - case KSCrashMonitorTypeUserReported: + case RollbarCrashMonitorTypeUserReported: { - writer->addStringElement(writer, KSCrashField_Type, KSCrashExcType_User); - writer->beginObject(writer, KSCrashField_UserReported); + writer->addStringElement(writer, RollbarCrashField_Type, RollbarCrashExcType_User); + writer->beginObject(writer, RollbarCrashField_UserReported); { - writer->addStringElement(writer, KSCrashField_Name, crash->userException.name); + writer->addStringElement(writer, RollbarCrashField_Name, crash->userException.name); if(crash->userException.language != NULL) { - writer->addStringElement(writer, KSCrashField_Language, crash->userException.language); + writer->addStringElement(writer, RollbarCrashField_Language, crash->userException.language); } if(crash->userException.lineOfCode != NULL) { - writer->addStringElement(writer, KSCrashField_LineOfCode, crash->userException.lineOfCode); + writer->addStringElement(writer, RollbarCrashField_LineOfCode, crash->userException.lineOfCode); } if(crash->userException.customStackTrace != NULL) { - writer->addJSONElement(writer, KSCrashField_Backtrace, crash->userException.customStackTrace, true); + writer->addJSONElement(writer, RollbarCrashField_Backtrace, crash->userException.customStackTrace, true); } } writer->endContainer(writer); break; } - case KSCrashMonitorTypeSystem: - case KSCrashMonitorTypeApplicationState: - case KSCrashMonitorTypeZombie: - KSLOG_ERROR("Crash monitor type 0x%x shouldn't be able to cause events!", crash->crashType); + case RollbarCrashMonitorTypeSystem: + case RollbarCrashMonitorTypeApplicationState: + case RollbarCrashMonitorTypeZombie: + RollbarCrashLOG_ERROR("Crash monitor type 0x%x shouldn't be able to cause events!", crash->crashType); break; } } @@ -1472,23 +1472,23 @@ static void writeError(const KSCrashReportWriter* const writer, * * @param monitorContext The event monitor context. */ -static void writeAppStats(const KSCrashReportWriter* const writer, +static void writeAppStats(const RollbarCrashReportWriter* const writer, const char* const key, - const KSCrash_MonitorContext* const monitorContext) + const RollbarCrash_MonitorContext* const monitorContext) { writer->beginObject(writer, key); { - writer->addBooleanElement(writer, KSCrashField_AppActive, monitorContext->AppState.applicationIsActive); - writer->addBooleanElement(writer, KSCrashField_AppInFG, monitorContext->AppState.applicationIsInForeground); + writer->addBooleanElement(writer, RollbarCrashField_AppActive, monitorContext->AppState.applicationIsActive); + writer->addBooleanElement(writer, RollbarCrashField_AppInFG, monitorContext->AppState.applicationIsInForeground); - writer->addIntegerElement(writer, KSCrashField_LaunchesSinceCrash, monitorContext->AppState.launchesSinceLastCrash); - writer->addIntegerElement(writer, KSCrashField_SessionsSinceCrash, monitorContext->AppState.sessionsSinceLastCrash); - writer->addFloatingPointElement(writer, KSCrashField_ActiveTimeSinceCrash, monitorContext->AppState.activeDurationSinceLastCrash); - writer->addFloatingPointElement(writer, KSCrashField_BGTimeSinceCrash, monitorContext->AppState.backgroundDurationSinceLastCrash); + writer->addIntegerElement(writer, RollbarCrashField_LaunchesSinceCrash, monitorContext->AppState.launchesSinceLastCrash); + writer->addIntegerElement(writer, RollbarCrashField_SessionsSinceCrash, monitorContext->AppState.sessionsSinceLastCrash); + writer->addFloatingPointElement(writer, RollbarCrashField_ActiveTimeSinceCrash, monitorContext->AppState.activeDurationSinceLastCrash); + writer->addFloatingPointElement(writer, RollbarCrashField_BGTimeSinceCrash, monitorContext->AppState.backgroundDurationSinceLastCrash); - writer->addIntegerElement(writer, KSCrashField_SessionsSinceLaunch, monitorContext->AppState.sessionsSinceLaunch); - writer->addFloatingPointElement(writer, KSCrashField_ActiveTimeSinceLaunch, monitorContext->AppState.activeDurationSinceLaunch); - writer->addFloatingPointElement(writer, KSCrashField_BGTimeSinceLaunch, monitorContext->AppState.backgroundDurationSinceLaunch); + writer->addIntegerElement(writer, RollbarCrashField_SessionsSinceLaunch, monitorContext->AppState.sessionsSinceLaunch); + writer->addFloatingPointElement(writer, RollbarCrashField_ActiveTimeSinceLaunch, monitorContext->AppState.activeDurationSinceLaunch); + writer->addFloatingPointElement(writer, RollbarCrashField_BGTimeSinceLaunch, monitorContext->AppState.backgroundDurationSinceLaunch); } writer->endContainer(writer); } @@ -1499,20 +1499,20 @@ static void writeAppStats(const KSCrashReportWriter* const writer, * * @param key The object key, if needed. */ -static void writeProcessState(const KSCrashReportWriter* const writer, +static void writeProcessState(const RollbarCrashReportWriter* const writer, const char* const key, - const KSCrash_MonitorContext* const monitorContext) + const RollbarCrash_MonitorContext* const monitorContext) { writer->beginObject(writer, key); { if(monitorContext->ZombieException.address != 0) { - writer->beginObject(writer, KSCrashField_LastDeallocedNSException); + writer->beginObject(writer, RollbarCrashField_LastDeallocedNSException); { - writer->addUIntegerElement(writer, KSCrashField_Address, monitorContext->ZombieException.address); - writer->addStringElement(writer, KSCrashField_Name, monitorContext->ZombieException.name); - writer->addStringElement(writer, KSCrashField_Reason, monitorContext->ZombieException.reason); - writeAddressReferencedByString(writer, KSCrashField_ReferencedObject, monitorContext->ZombieException.reason); + writer->addUIntegerElement(writer, RollbarCrashField_Address, monitorContext->ZombieException.address); + writer->addStringElement(writer, RollbarCrashField_Name, monitorContext->ZombieException.name); + writer->addStringElement(writer, RollbarCrashField_Reason, monitorContext->ZombieException.reason); + writeAddressReferencedByString(writer, RollbarCrashField_ReferencedObject, monitorContext->ZombieException.reason); } writer->endContainer(writer); } @@ -1530,7 +1530,7 @@ static void writeProcessState(const KSCrashReportWriter* const writer, * * @param reportID The report ID. */ -static void writeReportInfo(const KSCrashReportWriter* const writer, +static void writeReportInfo(const RollbarCrashReportWriter* const writer, const char* const key, const char* const type, const char* const reportID, @@ -1542,16 +1542,16 @@ static void writeReportInfo(const KSCrashReportWriter* const writer, gettimeofday(&tp, NULL); int64_t microseconds = ((int64_t)tp.tv_sec) * 1000000 + tp.tv_usec; - writer->addStringElement(writer, KSCrashField_Version, KSCRASH_REPORT_VERSION); - writer->addStringElement(writer, KSCrashField_ID, reportID); - writer->addStringElement(writer, KSCrashField_ProcessName, processName); - writer->addIntegerElement(writer, KSCrashField_Timestamp, microseconds); - writer->addStringElement(writer, KSCrashField_Type, type); + writer->addStringElement(writer, RollbarCrashField_Version, RollbarCrashCRASH_REPORT_VERSION); + writer->addStringElement(writer, RollbarCrashField_ID, reportID); + writer->addStringElement(writer, RollbarCrashField_ProcessName, processName); + writer->addIntegerElement(writer, RollbarCrashField_Timestamp, microseconds); + writer->addStringElement(writer, RollbarCrashField_Type, type); } writer->endContainer(writer); } -static void writeRecrash(const KSCrashReportWriter* const writer, +static void writeRecrash(const RollbarCrashReportWriter* const writer, const char* const key, const char* crashReportPath) { @@ -1567,7 +1567,7 @@ static void writeRecrash(const KSCrashReportWriter* const writer, * * @param context JSON writer contextual information. */ -static void prepareReportWriter(KSCrashReportWriter* const writer, KSJSONEncodeContext* const context) +static void prepareReportWriter(RollbarCrashReportWriter* const writer, RollbarCrashJSONEncodeContext* const context) { writer->addBooleanElement = addBooleanElement; writer->addFloatingPointElement = addFloatingPointElement; @@ -1594,18 +1594,18 @@ static void prepareReportWriter(KSCrashReportWriter* const writer, KSJSONEncodeC #pragma mark - Main API - // ============================================================================ -void kscrashreport_writeRecrashReport(const KSCrash_MonitorContext* const monitorContext, const char* const path) +void kscrashreport_writeRecrashReport(const RollbarCrash_MonitorContext* const monitorContext, const char* const path) { char writeBuffer[1024]; - KSBufferedWriter bufferedWriter; - static char tempPath[KSFU_MAX_PATH_LENGTH]; + RollbarCrashBufferedWriter bufferedWriter; + static char tempPath[RollbarCrashFU_MAX_PATH_LENGTH]; strncpy(tempPath, path, sizeof(tempPath) - 10); strncpy(tempPath + strlen(tempPath) - 5, ".old", 5); - KSLOG_INFO("Writing recrash report to %s", path); + RollbarCrashLOG_INFO("Writing recrash report to %s", path); if(rename(path, tempPath) < 0) { - KSLOG_ERROR("Could not rename %s to %s: %s", path, tempPath, strerror(errno)); + RollbarCrashLOG_ERROR("Could not rename %s to %s: %s", path, tempPath, strerror(errno)); } if(!ksfu_openBufferedWriter(&bufferedWriter, path, writeBuffer, sizeof(writeBuffer))) { @@ -1614,37 +1614,37 @@ void kscrashreport_writeRecrashReport(const KSCrash_MonitorContext* const monito ksccd_freeze(); - KSJSONEncodeContext jsonContext; + RollbarCrashJSONEncodeContext jsonContext; jsonContext.userData = &bufferedWriter; - KSCrashReportWriter concreteWriter; - KSCrashReportWriter* writer = &concreteWriter; + RollbarCrashReportWriter concreteWriter; + RollbarCrashReportWriter* writer = &concreteWriter; prepareReportWriter(writer, &jsonContext); ksjson_beginEncode(getJsonContext(writer), true, addJSONData, &bufferedWriter); - writer->beginObject(writer, KSCrashField_Report); + writer->beginObject(writer, RollbarCrashField_Report); { - writeRecrash(writer, KSCrashField_RecrashReport, tempPath); + writeRecrash(writer, RollbarCrashField_RecrashReport, tempPath); ksfu_flushBufferedWriter(&bufferedWriter); if(remove(tempPath) < 0) { - KSLOG_ERROR("Could not remove %s: %s", tempPath, strerror(errno)); + RollbarCrashLOG_ERROR("Could not remove %s: %s", tempPath, strerror(errno)); } writeReportInfo(writer, - KSCrashField_Report, - KSCrashReportType_Minimal, + RollbarCrashField_Report, + RollbarCrashReportType_Minimal, monitorContext->eventID, monitorContext->System.processName); ksfu_flushBufferedWriter(&bufferedWriter); - writer->beginObject(writer, KSCrashField_Crash); + writer->beginObject(writer, RollbarCrashField_Crash); { - writeError(writer, KSCrashField_Error, monitorContext); + writeError(writer, RollbarCrashField_Error, monitorContext); ksfu_flushBufferedWriter(&bufferedWriter); int threadIndex = ksmc_indexOfThread(monitorContext->offendingMachineContext, ksmc_getThreadFromContext(monitorContext->offendingMachineContext)); writeThread(writer, - KSCrashField_CrashedThread, + RollbarCrashField_CrashedThread, monitorContext, monitorContext->offendingMachineContext, threadIndex, @@ -1660,68 +1660,68 @@ void kscrashreport_writeRecrashReport(const KSCrash_MonitorContext* const monito ksccd_unfreeze(); } -static void writeSystemInfo(const KSCrashReportWriter* const writer, +static void writeSystemInfo(const RollbarCrashReportWriter* const writer, const char* const key, - const KSCrash_MonitorContext* const monitorContext) + const RollbarCrash_MonitorContext* const monitorContext) { writer->beginObject(writer, key); { - writer->addStringElement(writer, KSCrashField_SystemName, monitorContext->System.systemName); - writer->addStringElement(writer, KSCrashField_SystemVersion, monitorContext->System.systemVersion); - writer->addStringElement(writer, KSCrashField_Machine, monitorContext->System.machine); - writer->addStringElement(writer, KSCrashField_Model, monitorContext->System.model); - writer->addStringElement(writer, KSCrashField_KernelVersion, monitorContext->System.kernelVersion); - writer->addStringElement(writer, KSCrashField_OSVersion, monitorContext->System.osVersion); - writer->addBooleanElement(writer, KSCrashField_Jailbroken, monitorContext->System.isJailbroken); - writer->addStringElement(writer, KSCrashField_BootTime, monitorContext->System.bootTime); - writer->addStringElement(writer, KSCrashField_AppStartTime, monitorContext->System.appStartTime); - writer->addStringElement(writer, KSCrashField_ExecutablePath, monitorContext->System.executablePath); - writer->addStringElement(writer, KSCrashField_Executable, monitorContext->System.executableName); - writer->addStringElement(writer, KSCrashField_BundleID, monitorContext->System.bundleID); - writer->addStringElement(writer, KSCrashField_BundleName, monitorContext->System.bundleName); - writer->addStringElement(writer, KSCrashField_BundleVersion, monitorContext->System.bundleVersion); - writer->addStringElement(writer, KSCrashField_BundleShortVersion, monitorContext->System.bundleShortVersion); - writer->addStringElement(writer, KSCrashField_AppUUID, monitorContext->System.appID); - writer->addStringElement(writer, KSCrashField_CPUArch, monitorContext->System.cpuArchitecture); - writer->addIntegerElement(writer, KSCrashField_CPUType, monitorContext->System.cpuType); - writer->addIntegerElement(writer, KSCrashField_CPUSubType, monitorContext->System.cpuSubType); - writer->addIntegerElement(writer, KSCrashField_BinaryCPUType, monitorContext->System.binaryCPUType); - writer->addIntegerElement(writer, KSCrashField_BinaryCPUSubType, monitorContext->System.binaryCPUSubType); - writer->addStringElement(writer, KSCrashField_TimeZone, monitorContext->System.timezone); - writer->addStringElement(writer, KSCrashField_ProcessName, monitorContext->System.processName); - writer->addIntegerElement(writer, KSCrashField_ProcessID, monitorContext->System.processID); - writer->addIntegerElement(writer, KSCrashField_ParentProcessID, monitorContext->System.parentProcessID); - writer->addStringElement(writer, KSCrashField_DeviceAppHash, monitorContext->System.deviceAppHash); - writer->addStringElement(writer, KSCrashField_BuildType, monitorContext->System.buildType); - writer->addIntegerElement(writer, KSCrashField_Storage, (int64_t)monitorContext->System.storageSize); - - writeMemoryInfo(writer, KSCrashField_Memory, monitorContext); - writeAppStats(writer, KSCrashField_AppStats, monitorContext); + writer->addStringElement(writer, RollbarCrashField_SystemName, monitorContext->System.systemName); + writer->addStringElement(writer, RollbarCrashField_SystemVersion, monitorContext->System.systemVersion); + writer->addStringElement(writer, RollbarCrashField_Machine, monitorContext->System.machine); + writer->addStringElement(writer, RollbarCrashField_Model, monitorContext->System.model); + writer->addStringElement(writer, RollbarCrashField_KernelVersion, monitorContext->System.kernelVersion); + writer->addStringElement(writer, RollbarCrashField_OSVersion, monitorContext->System.osVersion); + writer->addBooleanElement(writer, RollbarCrashField_Jailbroken, monitorContext->System.isJailbroken); + writer->addStringElement(writer, RollbarCrashField_BootTime, monitorContext->System.bootTime); + writer->addStringElement(writer, RollbarCrashField_AppStartTime, monitorContext->System.appStartTime); + writer->addStringElement(writer, RollbarCrashField_ExecutablePath, monitorContext->System.executablePath); + writer->addStringElement(writer, RollbarCrashField_Executable, monitorContext->System.executableName); + writer->addStringElement(writer, RollbarCrashField_BundleID, monitorContext->System.bundleID); + writer->addStringElement(writer, RollbarCrashField_BundleName, monitorContext->System.bundleName); + writer->addStringElement(writer, RollbarCrashField_BundleVersion, monitorContext->System.bundleVersion); + writer->addStringElement(writer, RollbarCrashField_BundleShortVersion, monitorContext->System.bundleShortVersion); + writer->addStringElement(writer, RollbarCrashField_AppUUID, monitorContext->System.appID); + writer->addStringElement(writer, RollbarCrashField_CPUArch, monitorContext->System.cpuArchitecture); + writer->addIntegerElement(writer, RollbarCrashField_CPUType, monitorContext->System.cpuType); + writer->addIntegerElement(writer, RollbarCrashField_CPUSubType, monitorContext->System.cpuSubType); + writer->addIntegerElement(writer, RollbarCrashField_BinaryCPUType, monitorContext->System.binaryCPUType); + writer->addIntegerElement(writer, RollbarCrashField_BinaryCPUSubType, monitorContext->System.binaryCPUSubType); + writer->addStringElement(writer, RollbarCrashField_TimeZone, monitorContext->System.timezone); + writer->addStringElement(writer, RollbarCrashField_ProcessName, monitorContext->System.processName); + writer->addIntegerElement(writer, RollbarCrashField_ProcessID, monitorContext->System.processID); + writer->addIntegerElement(writer, RollbarCrashField_ParentProcessID, monitorContext->System.parentProcessID); + writer->addStringElement(writer, RollbarCrashField_DeviceAppHash, monitorContext->System.deviceAppHash); + writer->addStringElement(writer, RollbarCrashField_BuildType, monitorContext->System.buildType); + writer->addIntegerElement(writer, RollbarCrashField_Storage, (int64_t)monitorContext->System.storageSize); + + writeMemoryInfo(writer, RollbarCrashField_Memory, monitorContext); + writeAppStats(writer, RollbarCrashField_AppStats, monitorContext); } writer->endContainer(writer); } -static void writeDebugInfo(const KSCrashReportWriter* const writer, +static void writeDebugInfo(const RollbarCrashReportWriter* const writer, const char* const key, - const KSCrash_MonitorContext* const monitorContext) + const RollbarCrash_MonitorContext* const monitorContext) { writer->beginObject(writer, key); { if(monitorContext->consoleLogPath != NULL) { - addTextLinesFromFile(writer, KSCrashField_ConsoleLog, monitorContext->consoleLogPath); + addTextLinesFromFile(writer, RollbarCrashField_ConsoleLog, monitorContext->consoleLogPath); } } writer->endContainer(writer); } -void kscrashreport_writeStandardReport(const KSCrash_MonitorContext* const monitorContext, const char* const path) +void kscrashreport_writeStandardReport(const RollbarCrash_MonitorContext* const monitorContext, const char* const path) { - KSLOG_INFO("Writing crash report to %s", path); + RollbarCrashLOG_INFO("Writing crash report to %s", path); char writeBuffer[1024]; - KSBufferedWriter bufferedWriter; + RollbarCrashBufferedWriter bufferedWriter; if(!ksfu_openBufferedWriter(&bufferedWriter, path, writeBuffer, sizeof(writeBuffer))) { @@ -1730,38 +1730,38 @@ void kscrashreport_writeStandardReport(const KSCrash_MonitorContext* const monit ksccd_freeze(); - KSJSONEncodeContext jsonContext; + RollbarCrashJSONEncodeContext jsonContext; jsonContext.userData = &bufferedWriter; - KSCrashReportWriter concreteWriter; - KSCrashReportWriter* writer = &concreteWriter; + RollbarCrashReportWriter concreteWriter; + RollbarCrashReportWriter* writer = &concreteWriter; prepareReportWriter(writer, &jsonContext); ksjson_beginEncode(getJsonContext(writer), true, addJSONData, &bufferedWriter); - writer->beginObject(writer, KSCrashField_Report); + writer->beginObject(writer, RollbarCrashField_Report); { writeReportInfo(writer, - KSCrashField_Report, - KSCrashReportType_Standard, + RollbarCrashField_Report, + RollbarCrashReportType_Standard, monitorContext->eventID, monitorContext->System.processName); ksfu_flushBufferedWriter(&bufferedWriter); - writeBinaryImages(writer, KSCrashField_BinaryImages); + writeBinaryImages(writer, RollbarCrashField_BinaryImages); ksfu_flushBufferedWriter(&bufferedWriter); - writeProcessState(writer, KSCrashField_ProcessState, monitorContext); + writeProcessState(writer, RollbarCrashField_ProcessState, monitorContext); ksfu_flushBufferedWriter(&bufferedWriter); - writeSystemInfo(writer, KSCrashField_System, monitorContext); + writeSystemInfo(writer, RollbarCrashField_System, monitorContext); ksfu_flushBufferedWriter(&bufferedWriter); - writer->beginObject(writer, KSCrashField_Crash); + writer->beginObject(writer, RollbarCrashField_Crash); { - writeError(writer, KSCrashField_Error, monitorContext); + writeError(writer, RollbarCrashField_Error, monitorContext); ksfu_flushBufferedWriter(&bufferedWriter); writeAllThreads(writer, - KSCrashField_Threads, + RollbarCrashField_Threads, monitorContext, g_introspectionRules.enabled); ksfu_flushBufferedWriter(&bufferedWriter); @@ -1770,12 +1770,12 @@ void kscrashreport_writeStandardReport(const KSCrash_MonitorContext* const monit if(g_userInfoJSON != NULL) { - addJSONElement(writer, KSCrashField_User, g_userInfoJSON, false); + addJSONElement(writer, RollbarCrashField_User, g_userInfoJSON, false); ksfu_flushBufferedWriter(&bufferedWriter); } else { - writer->beginObject(writer, KSCrashField_User); + writer->beginObject(writer, RollbarCrashField_User); } if(g_userSectionWriteCallback != NULL) { @@ -1787,7 +1787,7 @@ void kscrashreport_writeStandardReport(const KSCrash_MonitorContext* const monit writer->endContainer(writer); ksfu_flushBufferedWriter(&bufferedWriter); - writeDebugInfo(writer, KSCrashField_Debug, monitorContext); + writeDebugInfo(writer, RollbarCrashField_Debug, monitorContext); } writer->endContainer(writer); @@ -1801,7 +1801,7 @@ void kscrashreport_writeStandardReport(const KSCrash_MonitorContext* const monit void kscrashreport_setUserInfoJSON(const char* const userInfoJSON) { static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; - KSLOG_TRACE("set userInfoJSON to %p", userInfoJSON); + RollbarCrashLOG_TRACE("set userInfoJSON to %p", userInfoJSON); pthread_mutex_lock(&mutex); if(g_userInfoJSON != NULL) @@ -1837,7 +1837,7 @@ void kscrashreport_setDoNotIntrospectClasses(const char** doNotIntrospectClasses newClasses = malloc(sizeof(*newClasses) * (unsigned)newClassesLength); if(newClasses == NULL) { - KSLOG_ERROR("Could not allocate memory"); + RollbarCrashLOG_ERROR("Could not allocate memory"); return; } @@ -1860,8 +1860,8 @@ void kscrashreport_setDoNotIntrospectClasses(const char** doNotIntrospectClasses } } -void kscrashreport_setUserSectionWriteCallback(const KSReportWriteCallback userSectionWriteCallback) +void kscrashreport_setUserSectionWriteCallback(const RollbarCrashReportWriteCallback userSectionWriteCallback) { - KSLOG_TRACE("Set userSectionWriteCallback to %p", userSectionWriteCallback); + RollbarCrashLOG_TRACE("Set userSectionWriteCallback to %p", userSectionWriteCallback); g_userSectionWriteCallback = userSectionWriteCallback; } diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashReport.h b/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashReport.h index 94143393..31071ac2 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashReport.h +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashReport.h @@ -1,5 +1,5 @@ // -// KSCrashReport.h +// RollbarCrashReport.h // // Created by Karl Stenerud on 2012-01-28. // @@ -29,15 +29,15 @@ */ -#ifndef HDR_KSCrashReport_h -#define HDR_KSCrashReport_h +#ifndef HDR_RollbarCrashReport_h +#define HDR_RollbarCrashReport_h #ifdef __cplusplus extern "C" { #endif -#import "KSCrashReportWriter.h" -#import "KSCrashMonitorContext.h" +#import "RollbarCrashReportWriter.h" +#import "RollbarCrashMonitorContext.h" #include @@ -72,7 +72,7 @@ void kscrashreport_setDoNotIntrospectClasses(const char** doNotIntrospectClasses * * @param userSectionWriteCallback The user section write callback. */ -void kscrashreport_setUserSectionWriteCallback(const KSReportWriteCallback userSectionWriteCallback); +void kscrashreport_setUserSectionWriteCallback(const RollbarCrashReportWriteCallback userSectionWriteCallback); // ============================================================================ @@ -86,7 +86,7 @@ void kscrashreport_setUserSectionWriteCallback(const KSReportWriteCallback userS * * @param path The file to write to. */ -void kscrashreport_writeStandardReport(const struct KSCrash_MonitorContext* const monitorContext, +void kscrashreport_writeStandardReport(const struct RollbarCrash_MonitorContext* const monitorContext, const char* path); /** Write a minimal crash report to a file. @@ -96,7 +96,7 @@ void kscrashreport_writeStandardReport(const struct KSCrash_MonitorContext* cons * * @param path The file to write to. */ -void kscrashreport_writeRecrashReport(const struct KSCrash_MonitorContext* const monitorContext, +void kscrashreport_writeRecrashReport(const struct RollbarCrash_MonitorContext* const monitorContext, const char* path); @@ -104,4 +104,4 @@ void kscrashreport_writeRecrashReport(const struct KSCrash_MonitorContext* const } #endif -#endif // HDR_KSCrashReport_h +#endif // HDR_RollbarCrashReport_h diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashReportFixer.c b/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashReportFixer.c index 17fcdbcc..cbad31c7 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashReportFixer.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashReportFixer.c @@ -1,5 +1,5 @@ // -// KSCrashReportFixer.c +// RollbarCrashReportFixer.c // // Created by Karl Stenerud on 2016-11-07. // @@ -24,11 +24,11 @@ // THE SOFTWARE. // -#include "KSCrashReportFields.h" -#include "KSSystemCapabilities.h" -#include "KSJSONCodec.h" -#include "KSDate.h" -#include "KSLogger.h" +#include "RollbarCrashReportFields.h" +#include "RollbarCrashSystemCapabilities.h" +#include "RollbarCrashJSONCodec.h" +#include "RollbarCrashDate.h" +#include "RollbarCrashLogger.h" #include #include @@ -39,21 +39,21 @@ static char* datePaths[][MAX_DEPTH] = { - {"", KSCrashField_Report, KSCrashField_Timestamp}, - {"", KSCrashField_RecrashReport, KSCrashField_Report, KSCrashField_Timestamp}, + {"", RollbarCrashField_Report, RollbarCrashField_Timestamp}, + {"", RollbarCrashField_RecrashReport, RollbarCrashField_Report, RollbarCrashField_Timestamp}, }; static int datePathsCount = sizeof(datePaths) / sizeof(*datePaths); static char* versionPaths[][MAX_DEPTH] = { - {"", KSCrashField_Report, KSCrashField_Version}, - {"", KSCrashField_RecrashReport, KSCrashField_Report, KSCrashField_Version}, + {"", RollbarCrashField_Report, RollbarCrashField_Version}, + {"", RollbarCrashField_RecrashReport, RollbarCrashField_Report, RollbarCrashField_Version}, }; static int versionPathsCount = sizeof(versionPaths) / sizeof(*versionPaths); typedef struct { - KSJSONEncodeContext* encodeContext; + RollbarCrashJSONEncodeContext* encodeContext; int reportVersionComponents[REPORT_VERSION_COMPONENTS_COUNT]; char objectPath[MAX_DEPTH][MAX_NAME_LENGTH]; int currentDepth; @@ -124,7 +124,7 @@ static bool matchesAPath(FixupContext* context, const char* name, char* paths[][ static bool matchesMinVersion(FixupContext* context, int major, int minor, int patch) { - // Works only for report version 3.1.0 and above. See KSCrashReportVersion.h + // Works only for report version 3.1.0 and above. See RollbarCrashReportVersion.h bool result = false; int *parts = context->reportVersionComponents; result = result || (parts[0] > major); @@ -164,7 +164,7 @@ static int onIntegerElement(const char* const name, void* const userData) { FixupContext* context = (FixupContext*)userData; - int result = KSJSON_OK; + int result = RollbarCrashJSON_OK; if(shouldFixDate(context, name)) { char buffer[28]; @@ -224,7 +224,7 @@ static int onBeginObject(const char* const name, int result = ksjson_beginObject(context->encodeContext, name); if(!increaseDepth(context, name)) { - return KSJSON_ERROR_DATA_TOO_LONG; + return RollbarCrashJSON_ERROR_DATA_TOO_LONG; } return result; } @@ -236,7 +236,7 @@ static int onBeginArray(const char* const name, int result = ksjson_beginArray(context->encodeContext, name); if(!increaseDepth(context, name)) { - return KSJSON_ERROR_DATA_TOO_LONG; + return RollbarCrashJSON_ERROR_DATA_TOO_LONG; } return result; } @@ -263,13 +263,13 @@ static int addJSONData(const char* data, int length, void* userData) FixupContext* context = (FixupContext*)userData; if(length > context->outputBytesLeft) { - return KSJSON_ERROR_DATA_TOO_LONG; + return RollbarCrashJSON_ERROR_DATA_TOO_LONG; } memcpy(context->outputPtr, data, length); context->outputPtr += length; context->outputBytesLeft -= length; - return KSJSON_OK; + return RollbarCrashJSON_OK; } char* kscrf_fixupCrashReport(const char* crashReport) @@ -279,7 +279,7 @@ char* kscrf_fixupCrashReport(const char* crashReport) return NULL; } - KSJSONDecodeCallbacks callbacks = + RollbarCrashJSONDecodeCallbacks callbacks = { .onBeginArray = onBeginArray, .onBeginObject = onBeginObject, @@ -296,7 +296,7 @@ char* kscrf_fixupCrashReport(const char* crashReport) int crashReportLength = (int)strlen(crashReport); int fixedReportLength = (int)(crashReportLength * 1.5); char* fixedReport = malloc((unsigned)fixedReportLength); - KSJSONEncodeContext encodeContext; + RollbarCrashJSONEncodeContext encodeContext; FixupContext fixupContext = { .encodeContext = &encodeContext, @@ -312,9 +312,9 @@ char* kscrf_fixupCrashReport(const char* crashReport) int result = ksjson_decode(crashReport, (int)strlen(crashReport), stringBuffer, stringBufferLength, &callbacks, &fixupContext, &errorOffset); *fixupContext.outputPtr = '\0'; free(stringBuffer); - if(result != KSJSON_OK) + if(result != RollbarCrashJSON_OK) { - KSLOG_ERROR("Could not decode report: %s", ksjson_stringForError(result)); + RollbarCrashLOG_ERROR("Could not decode report: %s", ksjson_stringForError(result)); free(fixedReport); return NULL; } diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashReportFixer.h b/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashReportFixer.h index ba8d9645..1655d22b 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashReportFixer.h +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashReportFixer.h @@ -1,5 +1,5 @@ // -// KSCrashReportFixer.c +// RollbarCrashReportFixer.c // // Created by Karl Stenerud on 2016-11-07. // @@ -24,8 +24,8 @@ // THE SOFTWARE. // -#ifndef HDR_KSCrashReportFixer_h -#define HDR_KSCrashReportFixer_h +#ifndef HDR_RollbarCrashReportFixer_h +#define HDR_RollbarCrashReportFixer_h #ifdef __cplusplus extern "C" { @@ -48,4 +48,4 @@ char* kscrf_fixupCrashReport(const char* crashReport); } #endif -#endif // HDR_KSCrashReportFixer_h +#endif // HDR_RollbarCrashReportFixer_h diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashReportStore.c b/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashReportStore.c index 4df422b7..5f55c28c 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashReportStore.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashReportStore.c @@ -1,5 +1,5 @@ // -// KSCrashReportStore.c +// RollbarCrashReportStore.c // // Created by Karl Stenerud on 2012-02-05. // @@ -24,9 +24,9 @@ // THE SOFTWARE. // -#include "KSCrashReportStore.h" -#include "KSLogger.h" -#include "KSFileUtils.h" +#include "RollbarCrashReportStore.h" +#include "RollbarCrashLogger.h" +#include "RollbarCrashFileUtils.h" #include #include @@ -68,7 +68,7 @@ static inline int64_t getNextUniqueID() static void getCrashReportPathByID(int64_t id, char* pathBuffer) { - snprintf(pathBuffer, KSCRS_MAX_PATH_LENGTH, "%s/%s-report-%016llx.json", g_reportsPath, g_appName, id); + snprintf(pathBuffer, RollbarCrashCRS_MAX_PATH_LENGTH, "%s/%s-report-%016llx.json", g_reportsPath, g_appName, id); } @@ -88,7 +88,7 @@ static int getReportCount() DIR* dir = opendir(g_reportsPath); if(dir == NULL) { - KSLOG_ERROR("Could not open directory %s", g_reportsPath); + RollbarCrashLOG_ERROR("Could not open directory %s", g_reportsPath); goto done; } struct dirent* ent; @@ -114,7 +114,7 @@ static int getReportIDs(int64_t* reportIDs, int count) DIR* dir = opendir(g_reportsPath); if(dir == NULL) { - KSLOG_ERROR("Could not open directory %s", g_reportsPath); + RollbarCrashLOG_ERROR("Could not open directory %s", g_reportsPath); goto done; } @@ -213,7 +213,7 @@ int kscrs_getReportIDs(int64_t* reportIDs, int count) char* kscrs_readReport(int64_t reportID) { pthread_mutex_lock(&g_mutex); - char path[KSCRS_MAX_PATH_LENGTH]; + char path[RollbarCrashCRS_MAX_PATH_LENGTH]; getCrashReportPathByID(reportID, path); char* result; ksfu_readEntireFile(path, &result, NULL, 2000000); @@ -225,25 +225,25 @@ int64_t kscrs_addUserReport(const char* report, int reportLength) { pthread_mutex_lock(&g_mutex); int64_t currentID = getNextUniqueID(); - char crashReportPath[KSCRS_MAX_PATH_LENGTH]; + char crashReportPath[RollbarCrashCRS_MAX_PATH_LENGTH]; getCrashReportPathByID(currentID, crashReportPath); int fd = open(crashReportPath, O_WRONLY | O_CREAT, 0644); if(fd < 0) { - KSLOG_ERROR("Could not open file %s: %s", crashReportPath, strerror(errno)); + RollbarCrashLOG_ERROR("Could not open file %s: %s", crashReportPath, strerror(errno)); goto done; } int bytesWritten = (int)write(fd, report, (unsigned)reportLength); if(bytesWritten < 0) { - KSLOG_ERROR("Could not write to file %s: %s", crashReportPath, strerror(errno)); + RollbarCrashLOG_ERROR("Could not write to file %s: %s", crashReportPath, strerror(errno)); goto done; } else if(bytesWritten < reportLength) { - KSLOG_ERROR("Expected to write %d bytes to file %s, but only wrote %d", crashReportPath, reportLength, bytesWritten); + RollbarCrashLOG_ERROR("Expected to write %d bytes to file %s, but only wrote %d", crashReportPath, reportLength, bytesWritten); } done: @@ -265,7 +265,7 @@ void kscrs_deleteAllReports() void kscrs_deleteReportWithID(int64_t reportID) { - char path[KSCRS_MAX_PATH_LENGTH]; + char path[RollbarCrashCRS_MAX_PATH_LENGTH]; getCrashReportPathByID(reportID, path); ksfu_removeFile(path, true); } diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashReportStore.h b/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashReportStore.h index 185c9b22..2dc29bd2 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashReportStore.h +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashReportStore.h @@ -1,5 +1,5 @@ // -// KSCrashReportStore.h +// RollbarCrashReportStore.h // // Created by Karl Stenerud on 2012-02-05. // @@ -24,8 +24,8 @@ // THE SOFTWARE. // -#ifndef HDR_KSCrashReportStore_h -#define HDR_KSCrashReportStore_h +#ifndef HDR_RollbarCrashReportStore_h +#define HDR_RollbarCrashReportStore_h #ifdef __cplusplus extern "C" { @@ -34,7 +34,7 @@ extern "C" { #include -#define KSCRS_MAX_PATH_LENGTH 500 +#define RollbarCrashCRS_MAX_PATH_LENGTH 500 /** Initialize the report store. * @@ -44,7 +44,7 @@ extern "C" { void kscrs_initialize(const char* appName, const char* reportsPath); /** Get the next crash report to be generated. - * Max length for paths is KSCRS_MAX_PATH_LENGTH + * Max length for paths is RollbarCrashCRS_MAX_PATH_LENGTH * * @param crashReportPathBuffer Buffer to store the crash report path. * @@ -103,4 +103,4 @@ void kscrs_deleteReportWithID(int64_t reportID); } #endif -#endif // HDR_KSCrashReportStore_h +#endif // HDR_RollbarCrashReportStore_h diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashReportVersion.h b/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashReportVersion.h index c5729908..da32652a 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashReportVersion.h +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashReportVersion.h @@ -1,5 +1,5 @@ // -// KSCrashReportVersion.h +// RollbarCrashReportVersion.h // // Created by Karl Stenerud on 2016-03-10. // @@ -24,9 +24,9 @@ // THE SOFTWARE. // -#ifndef HDR_KSCrashReportVersion_h -#define HDR_KSCrashReportVersion_h +#ifndef HDR_RollbarCrashReportVersion_h +#define HDR_RollbarCrashReportVersion_h -#define KSCRASH_REPORT_VERSION "3.3.0" +#define RollbarCrashCRASH_REPORT_VERSION "3.3.0" -#endif /* HDR_KSCrashReportVersion_h */ +#endif /* HDR_RollbarCrashReportVersion_h */ diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashSystemCapabilities.h b/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashSystemCapabilities.h index 90ee5337..50c1ee72 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashSystemCapabilities.h +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashSystemCapabilities.h @@ -1,5 +1,5 @@ // -// KSSystemCapabilities.h +// RollbarCrashSystemCapabilities.h // // Copyright (c) 2012 Karl Stenerud. All rights reserved. // @@ -23,132 +23,132 @@ // -#ifndef HDR_KSSystemCapabilities_h -#define HDR_KSSystemCapabilities_h +#ifndef HDR_RollbarCrashSystemCapabilities_h +#define HDR_RollbarCrashSystemCapabilities_h #ifdef __APPLE__ #include -#define KSCRASH_HOST_APPLE 1 +#define RollbarCrashCRASH_HOST_APPLE 1 #endif #ifdef __ANDROID__ -#define KSCRASH_HOST_ANDROID 1 +#define RollbarCrashCRASH_HOST_ANDROID 1 #endif -#define KSCRASH_HOST_IOS (KSCRASH_HOST_APPLE && TARGET_OS_IOS) -#define KSCRASH_HOST_TV (KSCRASH_HOST_APPLE && TARGET_OS_TV) -#define KSCRASH_HOST_WATCH (KSCRASH_HOST_APPLE && TARGET_OS_WATCH) -#define KSCRASH_HOST_MAC (KSCRASH_HOST_APPLE && TARGET_OS_MAC && !(TARGET_OS_IOS || TARGET_OS_TV || TARGET_OS_WATCH)) +#define RollbarCrashCRASH_HOST_IOS (RollbarCrashCRASH_HOST_APPLE && TARGET_OS_IOS) +#define RollbarCrashCRASH_HOST_TV (RollbarCrashCRASH_HOST_APPLE && TARGET_OS_TV) +#define RollbarCrashCRASH_HOST_WATCH (RollbarCrashCRASH_HOST_APPLE && TARGET_OS_WATCH) +#define RollbarCrashCRASH_HOST_MAC (RollbarCrashCRASH_HOST_APPLE && TARGET_OS_MAC && !(TARGET_OS_IOS || TARGET_OS_TV || TARGET_OS_WATCH)) -#if KSCRASH_HOST_APPLE -#define KSCRASH_CAN_GET_MAC_ADDRESS 1 +#if RollbarCrashCRASH_HOST_APPLE +#define RollbarCrashCRASH_CAN_GET_MAC_ADDRESS 1 #else -#define KSCRASH_CAN_GET_MAC_ADDRESS 0 +#define RollbarCrashCRASH_CAN_GET_MAC_ADDRESS 0 #endif -#if KSCRASH_HOST_APPLE -#define KSCRASH_HAS_OBJC 1 -#define KSCRASH_HAS_SWIFT 1 +#if RollbarCrashCRASH_HOST_APPLE +#define RollbarCrashCRASH_HAS_OBJC 1 +#define RollbarCrashCRASH_HAS_SWIFT 1 #else -#define KSCRASH_HAS_OBJC 0 -#define KSCRASH_HAS_SWIFT 0 +#define RollbarCrashCRASH_HAS_OBJC 0 +#define RollbarCrashCRASH_HAS_SWIFT 0 #endif -#if KSCRASH_HOST_APPLE -#define KSCRASH_HAS_KINFO_PROC 1 +#if RollbarCrashCRASH_HOST_APPLE +#define RollbarCrashCRASH_HAS_KINFO_PROC 1 #else -#define KSCRASH_HAS_KINFO_PROC 0 +#define RollbarCrashCRASH_HAS_KINFO_PROC 0 #endif -#if KSCRASH_HOST_APPLE -#define KSCRASH_HAS_STRNSTR 1 +#if RollbarCrashCRASH_HOST_APPLE +#define RollbarCrashCRASH_HAS_STRNSTR 1 #else -#define KSCRASH_HAS_STRNSTR 0 +#define RollbarCrashCRASH_HAS_STRNSTR 0 #endif -#if KSCRASH_HOST_IOS || KSCRASH_HOST_TV || KSCRASH_HOST_WATCH -#define KSCRASH_HAS_UIKIT 1 +#if RollbarCrashCRASH_HOST_IOS || RollbarCrashCRASH_HOST_TV || RollbarCrashCRASH_HOST_WATCH +#define RollbarCrashCRASH_HAS_UIKIT 1 #else -#define KSCRASH_HAS_UIKIT 0 +#define RollbarCrashCRASH_HAS_UIKIT 0 #endif -#if KSCRASH_HOST_IOS || KSCRASH_HOST_TV -#define KSCRASH_HAS_UIAPPLICATION 1 +#if RollbarCrashCRASH_HOST_IOS || RollbarCrashCRASH_HOST_TV +#define RollbarCrashCRASH_HAS_UIAPPLICATION 1 #else -#define KSCRASH_HAS_UIAPPLICATION 0 +#define RollbarCrashCRASH_HAS_UIAPPLICATION 0 #endif -#if KSCRASH_HOST_WATCH -#define KSCRASH_HAS_NSEXTENSION 1 +#if RollbarCrashCRASH_HOST_WATCH +#define RollbarCrashCRASH_HAS_NSEXTENSION 1 #else -#define KSCRASH_HAS_NSEXTENSION 0 +#define RollbarCrashCRASH_HAS_NSEXTENSION 0 #endif -#if KSCRASH_HOST_IOS -#define KSCRASH_HAS_MESSAGEUI 1 +#if RollbarCrashCRASH_HOST_IOS +#define RollbarCrashCRASH_HAS_MESSAGEUI 1 #else -#define KSCRASH_HAS_MESSAGEUI 0 +#define RollbarCrashCRASH_HAS_MESSAGEUI 0 #endif -#if KSCRASH_HOST_IOS || KSCRASH_HOST_TV -#define KSCRASH_HAS_UIDEVICE 1 +#if RollbarCrashCRASH_HOST_IOS || RollbarCrashCRASH_HOST_TV +#define RollbarCrashCRASH_HAS_UIDEVICE 1 #else -#define KSCRASH_HAS_UIDEVICE 0 +#define RollbarCrashCRASH_HAS_UIDEVICE 0 #endif -#if KSCRASH_HOST_IOS || KSCRASH_HOST_MAC || KSCRASH_HOST_TV -#define KSCRASH_HAS_ALERTVIEW 1 +#if RollbarCrashCRASH_HOST_IOS || RollbarCrashCRASH_HOST_MAC || RollbarCrashCRASH_HOST_TV +#define RollbarCrashCRASH_HAS_ALERTVIEW 1 #else -#define KSCRASH_HAS_ALERTVIEW 0 +#define RollbarCrashCRASH_HAS_ALERTVIEW 0 #endif -#if KSCRASH_HOST_IOS -#define KSCRASH_HAS_UIALERTVIEW 1 +#if RollbarCrashCRASH_HOST_IOS +#define RollbarCrashCRASH_HAS_UIALERTVIEW 1 #else -#define KSCRASH_HAS_UIALERTVIEW 0 +#define RollbarCrashCRASH_HAS_UIALERTVIEW 0 #endif -#if KSCRASH_HOST_TV -#define KSCRASH_HAS_UIALERTCONTROLLER 1 +#if RollbarCrashCRASH_HOST_TV +#define RollbarCrashCRASH_HAS_UIALERTCONTROLLER 1 #else -#define KSCRASH_HAS_UIALERTCONTROLLER 0 +#define RollbarCrashCRASH_HAS_UIALERTCONTROLLER 0 #endif -#if KSCRASH_HOST_MAC -#define KSCRASH_HAS_NSALERT 1 +#if RollbarCrashCRASH_HOST_MAC +#define RollbarCrashCRASH_HAS_NSALERT 1 #else -#define KSCRASH_HAS_NSALERT 0 +#define RollbarCrashCRASH_HAS_NSALERT 0 #endif -#if KSCRASH_HOST_IOS || KSCRASH_HOST_MAC -#define KSCRASH_HAS_MACH 1 +#if RollbarCrashCRASH_HOST_IOS || RollbarCrashCRASH_HOST_MAC +#define RollbarCrashCRASH_HAS_MACH 1 #else -#define KSCRASH_HAS_MACH 0 +#define RollbarCrashCRASH_HAS_MACH 0 #endif // WatchOS signal is broken as of 3.1 -#if KSCRASH_HOST_ANDROID || KSCRASH_HOST_IOS || KSCRASH_HOST_MAC || KSCRASH_HOST_TV -#define KSCRASH_HAS_SIGNAL 1 +#if RollbarCrashCRASH_HOST_ANDROID || RollbarCrashCRASH_HOST_IOS || RollbarCrashCRASH_HOST_MAC || RollbarCrashCRASH_HOST_TV +#define RollbarCrashCRASH_HAS_SIGNAL 1 #else -#define KSCRASH_HAS_SIGNAL 0 +#define RollbarCrashCRASH_HAS_SIGNAL 0 #endif -#if KSCRASH_HOST_ANDROID || KSCRASH_HOST_MAC || KSCRASH_HOST_IOS -#define KSCRASH_HAS_SIGNAL_STACK 1 +#if RollbarCrashCRASH_HOST_ANDROID || RollbarCrashCRASH_HOST_MAC || RollbarCrashCRASH_HOST_IOS +#define RollbarCrashCRASH_HAS_SIGNAL_STACK 1 #else -#define KSCRASH_HAS_SIGNAL_STACK 0 +#define RollbarCrashCRASH_HAS_SIGNAL_STACK 0 #endif -#if KSCRASH_HOST_MAC || KSCRASH_HOST_IOS || KSCRASH_HOST_TV -#define KSCRASH_HAS_THREADS_API 1 +#if RollbarCrashCRASH_HOST_MAC || RollbarCrashCRASH_HOST_IOS || RollbarCrashCRASH_HOST_TV +#define RollbarCrashCRASH_HAS_THREADS_API 1 #else -#define KSCRASH_HAS_THREADS_API 0 +#define RollbarCrashCRASH_HAS_THREADS_API 0 #endif -#if KSCRASH_HOST_MAC || KSCRASH_HOST_IOS || KSCRASH_HOST_TV -#define KSCRASH_HAS_REACHABILITY 1 +#if RollbarCrashCRASH_HOST_MAC || RollbarCrashCRASH_HOST_IOS || RollbarCrashCRASH_HOST_TV +#define RollbarCrashCRASH_HAS_REACHABILITY 1 #else -#define KSCRASH_HAS_REACHABILITY 0 +#define RollbarCrashCRASH_HAS_REACHABILITY 0 #endif -#endif // HDR_KSSystemCapabilities_h +#endif // HDR_RollbarCrashSystemCapabilities_h diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU.c index f67c45bb..e4ad2461 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU.c @@ -1,5 +1,5 @@ // -// KSCPU.h +// RollbarCrashCPU.h // // Created by Karl Stenerud on 2012-01-29. // @@ -25,15 +25,15 @@ // -#include "KSCPU.h" +#include "RollbarCrashCPU.h" -#include "KSSystemCapabilities.h" +#include "RollbarCrashSystemCapabilities.h" #include #include -//#define KSLogger_LocalLevel TRACE -#include "KSLogger.h" +//#define RollbarCrashLogger_LocalLevel TRACE +#include "RollbarCrashLogger.h" const char* kscpu_currentArch(void) @@ -42,20 +42,20 @@ const char* kscpu_currentArch(void) return archInfo == NULL ? NULL : archInfo->name; } -#if KSCRASH_HAS_THREADS_API +#if RollbarCrashCRASH_HAS_THREADS_API bool kscpu_i_fillState(const thread_t thread, const thread_state_t state, const thread_state_flavor_t flavor, const mach_msg_type_number_t stateCount) { - KSLOG_TRACE("Filling thread state with flavor %x.", flavor); + RollbarCrashLOG_TRACE("Filling thread state with flavor %x.", flavor); mach_msg_type_number_t stateCountBuff = stateCount; kern_return_t kr; kr = thread_get_state(thread, flavor, state, &stateCountBuff); if(kr != KERN_SUCCESS) { - KSLOG_ERROR("thread_get_state: %s", mach_error_string(kr)); + RollbarCrashLOG_ERROR("thread_get_state: %s", mach_error_string(kr)); return false; } return true; diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU.h index f28269cc..54271d0b 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU.h +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU.h @@ -1,5 +1,5 @@ // -// KSCPU.h +// RollbarCrashCPU.h // // Created by Karl Stenerud on 2012-01-29. // @@ -24,15 +24,15 @@ // THE SOFTWARE. // -#ifndef HDR_KSCPU_h -#define HDR_KSCPU_h +#ifndef HDR_RollbarCrashCPU_h +#define HDR_RollbarCrashCPU_h #ifdef __cplusplus extern "C" { #endif -#include "KSMachineContext.h" +#include "RollbarCrashMachineContext.h" #include #include @@ -50,7 +50,7 @@ const char* kscpu_currentArch(void); * * @return The context's frame pointer. */ -uintptr_t kscpu_framePointer(const struct KSMachineContext* const context); +uintptr_t kscpu_framePointer(const struct RollbarCrashMachineContext* const context); /** Get the current stack pointer for a machine context. * @@ -58,7 +58,7 @@ uintptr_t kscpu_framePointer(const struct KSMachineContext* const context); * * @return The context's stack pointer. */ -uintptr_t kscpu_stackPointer(const struct KSMachineContext* const context); +uintptr_t kscpu_stackPointer(const struct RollbarCrashMachineContext* const context); /** Get the address of the instruction about to be, or being executed by a * machine context. @@ -67,7 +67,7 @@ uintptr_t kscpu_stackPointer(const struct KSMachineContext* const context); * * @return The context's next instruction address. */ -uintptr_t kscpu_instructionAddress(const struct KSMachineContext* const context); +uintptr_t kscpu_instructionAddress(const struct RollbarCrashMachineContext* const context); /** Get the address stored in the link register (arm only). This may * contain the first return address of the stack. @@ -76,7 +76,7 @@ uintptr_t kscpu_instructionAddress(const struct KSMachineContext* const context) * * @return The link register value. */ -uintptr_t kscpu_linkRegister(const struct KSMachineContext* const context); +uintptr_t kscpu_linkRegister(const struct RollbarCrashMachineContext* const context); /** Get the address whose access caused the last fault. * @@ -84,7 +84,7 @@ uintptr_t kscpu_linkRegister(const struct KSMachineContext* const context); * * @return The faulting address. */ -uintptr_t kscpu_faultAddress(const struct KSMachineContext* const context); +uintptr_t kscpu_faultAddress(const struct RollbarCrashMachineContext* const context); /** Get the number of normal (not floating point or exception) registers the * currently running CPU has. @@ -107,7 +107,7 @@ const char* kscpu_registerName(int regNumber); * * @return The register's current value. */ -uint64_t kscpu_registerValue(const struct KSMachineContext* const context, int regNumber); +uint64_t kscpu_registerValue(const struct RollbarCrashMachineContext* const context, int regNumber); /** Get the number of exception registers the currently running CPU has. * @@ -129,7 +129,7 @@ const char* kscpu_exceptionRegisterName(int regNumber); * * @return The register's current value. */ -uint64_t kscpu_exceptionRegisterValue(const struct KSMachineContext* const context, int regNumber); +uint64_t kscpu_exceptionRegisterValue(const struct RollbarCrashMachineContext* const context, int regNumber); /** Get the direction in which the stack grows on the current architecture. * @@ -141,7 +141,7 @@ int kscpu_stackGrowDirection(void); * * @param destinationContext The context to fill. */ -void kscpu_getState(struct KSMachineContext* destinationContext); +void kscpu_getState(struct RollbarCrashMachineContext* destinationContext); /** Strip PAC from an instruction pointer. * @@ -155,4 +155,4 @@ uintptr_t kscpu_normaliseInstructionPointer(uintptr_t ip); } #endif -#endif // HDR_KSCPU_h +#endif // HDR_RollbarCrashCPU_h diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU_Apple.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU_Apple.h index 1b1bbadc..b520fc97 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU_Apple.h +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU_Apple.h @@ -1,5 +1,5 @@ // -// KSCPU_Apple.h +// RollbarCrashCPU_Apple.h // // Created by Karl Stenerud on 2012-01-29. // @@ -24,8 +24,8 @@ // THE SOFTWARE. // -#ifndef HDR_KSCPU_Apple_h -#define HDR_KSCPU_Apple_h +#ifndef HDR_RollbarCrashCPU_Apple_h +#define HDR_RollbarCrashCPU_Apple_h #ifdef __cplusplus extern "C" { @@ -55,4 +55,4 @@ bool kscpu_i_fillState(thread_t thread, } #endif -#endif // HDR_KSCPU_Apple_h +#endif // HDR_RollbarCrashCPU_Apple_h diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU_arm.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU_arm.c index 12411bde..059856f5 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU_arm.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU_arm.c @@ -1,5 +1,5 @@ // -// KSCPU_arm.c +// RollbarCrashCPU_arm.c // // Created by Karl Stenerud on 2012-01-29. // @@ -27,14 +27,14 @@ #if defined (__arm__) -#include "KSCPU.h" -#include "KSCPU_Apple.h" -#include "KSMachineContext.h" -#include "KSMachineContext_Apple.h" +#include "RollbarCrashCPU.h" +#include "RollbarCrashCPU_Apple.h" +#include "RollbarCrashMachineContext.h" +#include "RollbarCrashMachineContext_Apple.h" #include -//#define KSLogger_LocalLevel TRACE -#include "KSLogger.h" +//#define RollbarCrashLogger_LocalLevel TRACE +#include "RollbarCrashLogger.h" static const char* g_registerNames[] = @@ -55,27 +55,27 @@ static const int g_exceptionRegisterNamesCount = sizeof(g_exceptionRegisterNames) / sizeof(*g_exceptionRegisterNames); -uintptr_t kscpu_framePointer(const KSMachineContext* const context) +uintptr_t kscpu_framePointer(const RollbarCrashMachineContext* const context) { return context->machineContext.__ss.__r[7]; } -uintptr_t kscpu_stackPointer(const KSMachineContext* const context) +uintptr_t kscpu_stackPointer(const RollbarCrashMachineContext* const context) { return context->machineContext.__ss.__sp; } -uintptr_t kscpu_instructionAddress(const KSMachineContext* const context) +uintptr_t kscpu_instructionAddress(const RollbarCrashMachineContext* const context) { return context->machineContext.__ss.__pc; } -uintptr_t kscpu_linkRegister(const KSMachineContext* const context) +uintptr_t kscpu_linkRegister(const RollbarCrashMachineContext* const context) { return context->machineContext.__ss.__lr; } -void kscpu_getState(KSMachineContext* context) +void kscpu_getState(RollbarCrashMachineContext* context) { thread_t thread = context->thisThread; STRUCT_MCONTEXT_L* const machineContext = &context->machineContext; @@ -98,7 +98,7 @@ const char* kscpu_registerName(const int regNumber) return NULL; } -uint64_t kscpu_registerValue(const KSMachineContext* const context, const int regNumber) +uint64_t kscpu_registerValue(const RollbarCrashMachineContext* const context, const int regNumber) { if(regNumber <= 12) { @@ -113,7 +113,7 @@ uint64_t kscpu_registerValue(const KSMachineContext* const context, const int re case 16: return context->machineContext.__ss.__cpsr; } - KSLOG_ERROR("Invalid register number: %d", regNumber); + RollbarCrashLOG_ERROR("Invalid register number: %d", regNumber); return 0; } @@ -128,11 +128,11 @@ const char* kscpu_exceptionRegisterName(const int regNumber) { return g_exceptionRegisterNames[regNumber]; } - KSLOG_ERROR("Invalid register number: %d", regNumber); + RollbarCrashLOG_ERROR("Invalid register number: %d", regNumber); return NULL; } -uint64_t kscpu_exceptionRegisterValue(const KSMachineContext* const context, const int regNumber) +uint64_t kscpu_exceptionRegisterValue(const RollbarCrashMachineContext* const context, const int regNumber) { switch(regNumber) { @@ -144,11 +144,11 @@ uint64_t kscpu_exceptionRegisterValue(const KSMachineContext* const context, con return context->machineContext.__es.__far; } - KSLOG_ERROR("Invalid register number: %d", regNumber); + RollbarCrashLOG_ERROR("Invalid register number: %d", regNumber); return 0; } -uintptr_t kscpu_faultAddress(const KSMachineContext* const context) +uintptr_t kscpu_faultAddress(const RollbarCrashMachineContext* const context) { return context->machineContext.__es.__far; } diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU_arm64.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU_arm64.c index e96a9585..71b168b1 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU_arm64.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU_arm64.c @@ -1,5 +1,5 @@ // -// KSCPU_arm64_Apple.c +// RollbarCrashCPU_arm64_Apple.c // // Created by Karl Stenerud on 2013-09-29. // @@ -27,16 +27,16 @@ #if defined (__arm64__) -#include "KSCPU.h" -#include "KSCPU_Apple.h" -#include "KSMachineContext.h" -#include "KSMachineContext_Apple.h" +#include "RollbarCrashCPU.h" +#include "RollbarCrashCPU_Apple.h" +#include "RollbarCrashMachineContext.h" +#include "RollbarCrashMachineContext_Apple.h" #include -//#define KSLogger_LocalLevel TRACE -#include "KSLogger.h" +//#define RollbarCrashLogger_LocalLevel TRACE +#include "RollbarCrashLogger.h" -#define KSPACStrippingMask_ARM64e 0x0000000fffffffff +#define RollbarCrashPACStrippingMask_ARM64e 0x0000000fffffffff static const char* g_registerNames[] = { @@ -58,27 +58,27 @@ static const int g_exceptionRegisterNamesCount = sizeof(g_exceptionRegisterNames) / sizeof(*g_exceptionRegisterNames); -uintptr_t kscpu_framePointer(const KSMachineContext* const context) +uintptr_t kscpu_framePointer(const RollbarCrashMachineContext* const context) { return context->machineContext.__ss.__fp; } -uintptr_t kscpu_stackPointer(const KSMachineContext* const context) +uintptr_t kscpu_stackPointer(const RollbarCrashMachineContext* const context) { return context->machineContext.__ss.__sp; } -uintptr_t kscpu_instructionAddress(const KSMachineContext* const context) +uintptr_t kscpu_instructionAddress(const RollbarCrashMachineContext* const context) { return context->machineContext.__ss.__pc; } -uintptr_t kscpu_linkRegister(const KSMachineContext* const context) +uintptr_t kscpu_linkRegister(const RollbarCrashMachineContext* const context) { return context->machineContext.__ss.__lr; } -void kscpu_getState(KSMachineContext* context) +void kscpu_getState(RollbarCrashMachineContext* context) { thread_t thread = context->thisThread; STRUCT_MCONTEXT_L* const machineContext = &context->machineContext; @@ -101,7 +101,7 @@ const char* kscpu_registerName(const int regNumber) return NULL; } -uint64_t kscpu_registerValue(const KSMachineContext* const context, const int regNumber) +uint64_t kscpu_registerValue(const RollbarCrashMachineContext* const context, const int regNumber) { if(regNumber <= 29) { @@ -117,7 +117,7 @@ uint64_t kscpu_registerValue(const KSMachineContext* const context, const int re case 34: return context->machineContext.__ss.__cpsr; } - KSLOG_ERROR("Invalid register number: %d", regNumber); + RollbarCrashLOG_ERROR("Invalid register number: %d", regNumber); return 0; } @@ -132,11 +132,11 @@ const char* kscpu_exceptionRegisterName(const int regNumber) { return g_exceptionRegisterNames[regNumber]; } - KSLOG_ERROR("Invalid register number: %d", regNumber); + RollbarCrashLOG_ERROR("Invalid register number: %d", regNumber); return NULL; } -uint64_t kscpu_exceptionRegisterValue(const KSMachineContext* const context, const int regNumber) +uint64_t kscpu_exceptionRegisterValue(const RollbarCrashMachineContext* const context, const int regNumber) { switch(regNumber) { @@ -148,11 +148,11 @@ uint64_t kscpu_exceptionRegisterValue(const KSMachineContext* const context, con return context->machineContext.__es.__far; } - KSLOG_ERROR("Invalid register number: %d", regNumber); + RollbarCrashLOG_ERROR("Invalid register number: %d", regNumber); return 0; } -uintptr_t kscpu_faultAddress(const KSMachineContext* const context) +uintptr_t kscpu_faultAddress(const RollbarCrashMachineContext* const context) { return context->machineContext.__es.__far; } @@ -164,7 +164,7 @@ int kscpu_stackGrowDirection(void) uintptr_t kscpu_normaliseInstructionPointer(uintptr_t ip) { - return ip & KSPACStrippingMask_ARM64e; + return ip & RollbarCrashPACStrippingMask_ARM64e; } #endif diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU_x86_32.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU_x86_32.c index b5f29252..d64d38a4 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU_x86_32.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU_x86_32.c @@ -1,5 +1,5 @@ // -// KSCPU_x86_32.c +// RollbarCrashCPU_x86_32.c // // Created by Karl Stenerud on 2012-01-29. // @@ -28,14 +28,14 @@ #if defined (__i386__) -#include "KSCPU.h" -#include "KSCPU_Apple.h" -#include "KSMachineContext.h" -#include "KSMachineContext_Apple.h" +#include "RollbarCrashCPU.h" +#include "RollbarCrashCPU_Apple.h" +#include "RollbarCrashMachineContext.h" +#include "RollbarCrashMachineContext_Apple.h" #include -//#define KSLogger_LocalLevel TRACE -#include "KSLogger.h" +//#define RollbarCrashLogger_LocalLevel TRACE +#include "RollbarCrashLogger.h" static const char* g_registerNames[] = @@ -58,27 +58,27 @@ static const int g_exceptionRegisterNamesCount = sizeof(g_exceptionRegisterNames) / sizeof(*g_exceptionRegisterNames); -uintptr_t kscpu_framePointer(const KSMachineContext* const context) +uintptr_t kscpu_framePointer(const RollbarCrashMachineContext* const context) { return context->machineContext.__ss.__ebp; } -uintptr_t kscpu_stackPointer(const KSMachineContext* const context) +uintptr_t kscpu_stackPointer(const RollbarCrashMachineContext* const context) { return context->machineContext.__ss.__esp; } -uintptr_t kscpu_instructionAddress(const KSMachineContext* const context) +uintptr_t kscpu_instructionAddress(const RollbarCrashMachineContext* const context) { return context->machineContext.__ss.__eip; } -uintptr_t kscpu_linkRegister(__unused const KSMachineContext* const context) +uintptr_t kscpu_linkRegister(__unused const RollbarCrashMachineContext* const context) { return 0; } -void kscpu_getState(KSMachineContext* context) +void kscpu_getState(RollbarCrashMachineContext* context) { thread_t thread = context->thisThread; STRUCT_MCONTEXT_L* const machineContext = &context->machineContext; @@ -101,7 +101,7 @@ const char* kscpu_registerName(const int regNumber) return NULL; } -uint64_t kscpu_registerValue(const KSMachineContext* const context, const int regNumber) +uint64_t kscpu_registerValue(const RollbarCrashMachineContext* const context, const int regNumber) { switch(regNumber) { @@ -139,7 +139,7 @@ uint64_t kscpu_registerValue(const KSMachineContext* const context, const int re return context->machineContext.__ss.__gs; } - KSLOG_ERROR("Invalid register number: %d", regNumber); + RollbarCrashLOG_ERROR("Invalid register number: %d", regNumber); return 0; } @@ -154,11 +154,11 @@ const char* kscpu_exceptionRegisterName(const int regNumber) { return g_exceptionRegisterNames[regNumber]; } - KSLOG_ERROR("Invalid register number: %d", regNumber); + RollbarCrashLOG_ERROR("Invalid register number: %d", regNumber); return NULL; } -uint64_t kscpu_exceptionRegisterValue(const KSMachineContext* const context, const int regNumber) +uint64_t kscpu_exceptionRegisterValue(const RollbarCrashMachineContext* const context, const int regNumber) { switch(regNumber) { @@ -170,11 +170,11 @@ uint64_t kscpu_exceptionRegisterValue(const KSMachineContext* const context, con return context->machineContext.__es.__faultvaddr; } - KSLOG_ERROR("Invalid register number: %d", regNumber); + RollbarCrashLOG_ERROR("Invalid register number: %d", regNumber); return 0; } -uintptr_t kscpu_faultAddress(const KSMachineContext* const context) +uintptr_t kscpu_faultAddress(const RollbarCrashMachineContext* const context) { return context->machineContext.__es.__faultvaddr; } diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU_x86_64.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU_x86_64.c index f731a53d..7d5ffa7d 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU_x86_64.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU_x86_64.c @@ -1,5 +1,5 @@ // -// KSCPU_x86_64.c +// RollbarCrashCPU_x86_64.c // // Created by Karl Stenerud on 2012-01-29. // @@ -28,15 +28,15 @@ #if defined (__x86_64__) -#include "KSCPU.h" -#include "KSCPU_Apple.h" -#include "KSMachineContext.h" -#include "KSMachineContext_Apple.h" +#include "RollbarCrashCPU.h" +#include "RollbarCrashCPU_Apple.h" +#include "RollbarCrashMachineContext.h" +#include "RollbarCrashMachineContext_Apple.h" #include -//#define KSLogger_LocalLevel TRACE -#include "KSLogger.h" +//#define RollbarCrashLogger_LocalLevel TRACE +#include "RollbarCrashLogger.h" static const char* g_registerNames[] = @@ -60,27 +60,27 @@ static const int g_exceptionRegisterNamesCount = sizeof(g_exceptionRegisterNames) / sizeof(*g_exceptionRegisterNames); -uintptr_t kscpu_framePointer(const KSMachineContext* const context) +uintptr_t kscpu_framePointer(const RollbarCrashMachineContext* const context) { return context->machineContext.__ss.__rbp; } -uintptr_t kscpu_stackPointer(const KSMachineContext* const context) +uintptr_t kscpu_stackPointer(const RollbarCrashMachineContext* const context) { return context->machineContext.__ss.__rsp; } -uintptr_t kscpu_instructionAddress(const KSMachineContext* const context) +uintptr_t kscpu_instructionAddress(const RollbarCrashMachineContext* const context) { return context->machineContext.__ss.__rip; } -uintptr_t kscpu_linkRegister(__unused const KSMachineContext* const context) +uintptr_t kscpu_linkRegister(__unused const RollbarCrashMachineContext* const context) { return 0; } -void kscpu_getState(KSMachineContext* context) +void kscpu_getState(RollbarCrashMachineContext* context) { thread_t thread = context->thisThread; STRUCT_MCONTEXT_L* const machineContext = &context->machineContext; @@ -103,7 +103,7 @@ const char* kscpu_registerName(const int regNumber) return NULL; } -uint64_t kscpu_registerValue(const KSMachineContext* const context, const int regNumber) +uint64_t kscpu_registerValue(const RollbarCrashMachineContext* const context, const int regNumber) { switch(regNumber) { @@ -151,7 +151,7 @@ uint64_t kscpu_registerValue(const KSMachineContext* const context, const int re return context->machineContext.__ss.__gs; } - KSLOG_ERROR("Invalid register number: %d", regNumber); + RollbarCrashLOG_ERROR("Invalid register number: %d", regNumber); return 0; } @@ -166,11 +166,11 @@ const char* kscpu_exceptionRegisterName(const int regNumber) { return g_exceptionRegisterNames[regNumber]; } - KSLOG_ERROR("Invalid register number: %d", regNumber); + RollbarCrashLOG_ERROR("Invalid register number: %d", regNumber); return NULL; } -uint64_t kscpu_exceptionRegisterValue(const KSMachineContext* const context, const int regNumber) +uint64_t kscpu_exceptionRegisterValue(const RollbarCrashMachineContext* const context, const int regNumber) { switch(regNumber) { @@ -182,11 +182,11 @@ uint64_t kscpu_exceptionRegisterValue(const KSMachineContext* const context, con return context->machineContext.__es.__faultvaddr; } - KSLOG_ERROR("Invalid register number: %d", regNumber); + RollbarCrashLOG_ERROR("Invalid register number: %d", regNumber); return 0; } -uintptr_t kscpu_faultAddress(const KSMachineContext* const context) +uintptr_t kscpu_faultAddress(const RollbarCrashMachineContext* const context) { return context->machineContext.__es.__faultvaddr; } diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCxaThrowSwapper.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCxaThrowSwapper.c index 647f04af..8c9a9327 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCxaThrowSwapper.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCxaThrowSwapper.c @@ -1,5 +1,5 @@ // -// KSCxaThrowSwapper.cpp +// RollbarCrashCxaThrowSwapper.cpp // // Copyright (c) 2019 YANDEX LLC. All rights reserved. // @@ -48,7 +48,7 @@ // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#include "KSCxaThrowSwapper.h" +#include "RollbarCrashCxaThrowSwapper.h" #include #include @@ -60,8 +60,8 @@ #include #include -#include "KSgetsect.h" -#include "KSPlatformSpecificDefines.h" +#include "RollbarCrashgetsect.h" +#include "RollbarCrashPlatformSpecificDefines.h" #ifndef SEG_DATA_CONST #define SEG_DATA_CONST "__DATA_CONST" @@ -71,23 +71,23 @@ typedef struct { uintptr_t image; uintptr_t function; -} KSAddressPair; +} RollbarCrashAddressPair; static cxa_throw_type g_cxa_throw_handler = NULL; static const char *const g_cxa_throw_name = "__cxa_throw"; -static KSAddressPair *g_cxa_originals = NULL; +static RollbarCrashAddressPair *g_cxa_originals = NULL; static size_t g_cxa_originals_capacity = 0; static size_t g_cxa_originals_count = 0; -static void addPair(KSAddressPair pair) +static void addPair(RollbarCrashAddressPair pair) { if (g_cxa_originals_count == g_cxa_originals_capacity) { g_cxa_originals_capacity *= 2; - g_cxa_originals = (KSAddressPair *) realloc(g_cxa_originals, sizeof(KSAddressPair) * g_cxa_originals_capacity); + g_cxa_originals = (RollbarCrashAddressPair *) realloc(g_cxa_originals, sizeof(RollbarCrashAddressPair) * g_cxa_originals_capacity); } - memcpy(&g_cxa_originals[g_cxa_originals_count++], &pair, sizeof(KSAddressPair)); + memcpy(&g_cxa_originals[g_cxa_originals_count++], &pair, sizeof(RollbarCrashAddressPair)); } static uintptr_t findAddress(void *address) @@ -275,7 +275,7 @@ static void perform_rebinding_with_section(const section_t *section, Dl_info info; if (dladdr(section, &info) != 0) { - KSAddressPair pair = {(uintptr_t) info.dli_fbase, (uintptr_t) indirect_symbol_bindings[i]}; + RollbarCrashAddressPair pair = {(uintptr_t) info.dli_fbase, (uintptr_t) indirect_symbol_bindings[i]}; addPair(pair); } indirect_symbol_bindings[i] = (void *) __cxa_throw_decorator; @@ -355,7 +355,7 @@ int ksct_swap(const cxa_throw_type handler) if (g_cxa_originals == NULL) { g_cxa_originals_capacity = 25; - g_cxa_originals = (KSAddressPair *) malloc(sizeof(KSAddressPair) * g_cxa_originals_capacity); + g_cxa_originals = (RollbarCrashAddressPair *) malloc(sizeof(RollbarCrashAddressPair) * g_cxa_originals_capacity); } g_cxa_originals_count = 0; diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCxaThrowSwapper.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCxaThrowSwapper.h index cb8bea28..b2064f3e 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCxaThrowSwapper.h +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCxaThrowSwapper.h @@ -1,5 +1,5 @@ // -// KSCxaThrowSwapper.h +// RollbarCrashCxaThrowSwapper.h // // Copyright (c) 2019 YANDEX LLC. All rights reserved. // @@ -22,8 +22,8 @@ // THE SOFTWARE. // -#ifndef KSCxaThrowSwapper_h -#define KSCxaThrowSwapper_h +#ifndef RollbarCrashCxaThrowSwapper_h +#define RollbarCrashCxaThrowSwapper_h #ifdef __cplusplus @@ -42,4 +42,4 @@ int ksct_swap(const cxa_throw_type handler); } #endif -#endif /* KSCxaThrowSwapper_h */ +#endif /* RollbarCrashCxaThrowSwapper_h */ diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashDate.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashDate.c index 92643ede..6643f728 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashDate.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashDate.c @@ -1,5 +1,5 @@ // -// KSDate.c +// RollbarCrashDate.c // // Copyright 2016 Karl Stenerud. // @@ -22,7 +22,7 @@ // THE SOFTWARE. // -#include "KSDate.h" +#include "RollbarCrashDate.h" #include #include diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashDate.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashDate.h index bcf06bab..84cb0675 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashDate.h +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashDate.h @@ -1,5 +1,5 @@ // -// KSDate.h +// RollbarCrashDate.h // // Copyright 2016 Karl Stenerud. // @@ -22,8 +22,8 @@ // THE SOFTWARE. // -#ifndef KSDate_h -#define KSDate_h +#ifndef RollbarCrashDate_h +#define RollbarCrashDate_h #ifdef __cplusplus extern "C" { @@ -52,4 +52,4 @@ void ksdate_utcStringFromMicroseconds(int64_t microseconds, char* buffer28Chars) } #endif -#endif /* KSDate_h */ +#endif /* RollbarCrashDate_h */ diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashDebug.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashDebug.c index 390a4b5c..9e983321 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashDebug.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashDebug.c @@ -1,5 +1,5 @@ // -// KSDebug.c +// RollbarCrashDebug.c // // Created by Karl Stenerud on 2012-01-29. // @@ -25,10 +25,10 @@ // -#include "KSDebug.h" +#include "RollbarCrashDebug.h" -//#define KSLogger_LocalLevel TRACE -#include "KSLogger.h" +//#define RollbarCrashLogger_LocalLevel TRACE +#include "RollbarCrashLogger.h" #include #include @@ -48,7 +48,7 @@ bool ksdebug_isBeingTraced(void) if(sysctl(mib, sizeof(mib)/sizeof(*mib), &procInfo, &structSize, NULL, 0) != 0) { - KSLOG_ERROR("sysctl: %s", strerror(errno)); + RollbarCrashLOG_ERROR("sysctl: %s", strerror(errno)); return false; } diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashDebug.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashDebug.h index 16d5a66a..4e83d106 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashDebug.h +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashDebug.h @@ -1,5 +1,5 @@ // -// KSDebug.h +// RollbarCrashDebug.h // // Created by Karl Stenerud on 2012-01-29. // @@ -29,8 +29,8 @@ */ -#ifndef HDR_KSDebug_h -#define HDR_KSDebug_h +#ifndef HDR_RollbarCrashDebug_h +#define HDR_RollbarCrashDebug_h #ifdef __cplusplus extern "C" { @@ -50,4 +50,4 @@ bool ksdebug_isBeingTraced(void); } #endif -#endif // HDR_KSDebug_h +#endif // HDR_RollbarCrashDebug_h diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashDynamicLinker.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashDynamicLinker.c index ae1b4914..7e27f5f4 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashDynamicLinker.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashDynamicLinker.c @@ -1,5 +1,5 @@ // -// KSDynamicLinker.c +// RollbarCrashDynamicLinker.c // // Created by Karl Stenerud on 2013-10-02. // @@ -24,7 +24,7 @@ // THE SOFTWARE. // -#include "KSDynamicLinker.h" +#include "RollbarCrashDynamicLinker.h" #include #include @@ -33,12 +33,12 @@ #include #include -#include "KSLogger.h" -#include "KSMemory.h" -#include "KSPlatformSpecificDefines.h" +#include "RollbarCrashLogger.h" +#include "RollbarCrashMemory.h" +#include "RollbarCrashPlatformSpecificDefines.h" -#ifndef KSDL_MaxCrashInfoStringLength - #define KSDL_MaxCrashInfoStringLength 1024 +#ifndef RollbarCrashDL_MaxCrashInfoStringLength + #define RollbarCrashDL_MaxCrashInfoStringLength 1024 #endif #pragma pack(8) @@ -53,7 +53,7 @@ typedef struct { void* reserved3; // First introduced in version 5 } crash_info_t; #pragma pack() -#define KSDL_SECT_CRASH_INFO "__crash_info" +#define RollbarCrashDL_SECT_CRASH_INFO "__crash_info" /** Get the address of the first command following a header (which will be of @@ -324,7 +324,7 @@ static bool isValidCrashInfoMessage(const char* str) { return false; } - int maxReadableBytes = ksmem_maxReadableBytes(str, KSDL_MaxCrashInfoStringLength + 1); + int maxReadableBytes = ksmem_maxReadableBytes(str, RollbarCrashDL_MaxCrashInfoStringLength + 1); if(maxReadableBytes == 0) { return false; @@ -338,47 +338,47 @@ static bool isValidCrashInfoMessage(const char* str) return false; } -static void getCrashInfo(const struct mach_header* header, KSBinaryImage* buffer) +static void getCrashInfo(const struct mach_header* header, RollbarCrashBinaryImage* buffer) { unsigned long size = 0; crash_info_t* crashInfo = - (crash_info_t*)getsectiondata((mach_header_t*)header, SEG_DATA, KSDL_SECT_CRASH_INFO, &size); + (crash_info_t*)getsectiondata((mach_header_t*)header, SEG_DATA, RollbarCrashDL_SECT_CRASH_INFO, &size); if(crashInfo == NULL) { return; } - KSLOG_TRACE("Found crash info section in binary: %s", buffer->name); + RollbarCrashLOG_TRACE("Found crash info section in binary: %s", buffer->name); const unsigned int minimalSize = offsetof(crash_info_t, reserved); // Include message and message2 if(size < minimalSize) { - KSLOG_TRACE("Skipped reading crash info: section is too small"); + RollbarCrashLOG_TRACE("Skipped reading crash info: section is too small"); return; } if(!ksmem_isMemoryReadable(crashInfo, minimalSize)) { - KSLOG_TRACE("Skipped reading crash info: section memory is not readable"); + RollbarCrashLOG_TRACE("Skipped reading crash info: section memory is not readable"); return; } if(crashInfo->version != 4 && crashInfo->version != 5) { - KSLOG_TRACE("Skipped reading crash info: invalid version '%d'", crashInfo->version); + RollbarCrashLOG_TRACE("Skipped reading crash info: invalid version '%d'", crashInfo->version); return; } if(crashInfo->message == NULL && crashInfo->message2 == NULL) { - KSLOG_TRACE("Skipped reading crash info: both messages are null"); + RollbarCrashLOG_TRACE("Skipped reading crash info: both messages are null"); return; } if(isValidCrashInfoMessage(crashInfo->message)) { - KSLOG_DEBUG("Found first message: %s", crashInfo->message); + RollbarCrashLOG_DEBUG("Found first message: %s", crashInfo->message); buffer->crashInfoMessage = crashInfo->message; } if(isValidCrashInfoMessage(crashInfo->message2)) { - KSLOG_DEBUG("Found second message: %s", crashInfo->message2); + RollbarCrashLOG_DEBUG("Found second message: %s", crashInfo->message2); buffer->crashInfoMessage2 = crashInfo->message2; } } @@ -388,7 +388,7 @@ int ksdl_imageCount() return (int)_dyld_image_count(); } -bool ksdl_getBinaryImage(int index, KSBinaryImage* buffer) +bool ksdl_getBinaryImage(int index, RollbarCrashBinaryImage* buffer) { const struct mach_header* header = _dyld_get_image_header((unsigned)index); if(header == NULL) @@ -399,7 +399,7 @@ bool ksdl_getBinaryImage(int index, KSBinaryImage* buffer) return ksdl_getBinaryImageForHeader((const void*)header, _dyld_get_image_name((unsigned)index), buffer); } -bool ksdl_getBinaryImageForHeader(const void* const header_ptr, const char* const image_name, KSBinaryImage* buffer) +bool ksdl_getBinaryImageForHeader(const void* const header_ptr, const char* const image_name, RollbarCrashBinaryImage* buffer) { const struct mach_header* header = (const struct mach_header*)header_ptr; uintptr_t cmdPtr = firstCmdAfterHeader(header); diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashDynamicLinker.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashDynamicLinker.h index 82efec7e..e202ed8a 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashDynamicLinker.h +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashDynamicLinker.h @@ -1,5 +1,5 @@ // -// KSDynamicLinker.h +// RollbarCrashDynamicLinker.h // // Created by Karl Stenerud on 2013-10-02. // @@ -24,8 +24,8 @@ // THE SOFTWARE. // -#ifndef HDR_KSDynamicLinker_h -#define HDR_KSDynamicLinker_h +#ifndef HDR_RollbarCrashDynamicLinker_h +#define HDR_RollbarCrashDynamicLinker_h #ifdef __cplusplus extern "C" { @@ -50,7 +50,7 @@ typedef struct uint64_t revisionVersion; const char* crashInfoMessage; const char* crashInfoMessage2; -} KSBinaryImage; +} RollbarCrashBinaryImage; /** Get the number of loaded binary images. */ @@ -64,7 +64,7 @@ int ksdl_imageCount(void); * * @return True if the image was successfully queried. */ -bool ksdl_getBinaryImage(int index, KSBinaryImage* buffer); +bool ksdl_getBinaryImage(int index, RollbarCrashBinaryImage* buffer); /** Get information about a binary image based on mach_header. * @@ -76,7 +76,7 @@ bool ksdl_getBinaryImage(int index, KSBinaryImage* buffer); * * @return True if the image was successfully queried. */ -bool ksdl_getBinaryImageForHeader(const void* const header_ptr, const char* const image_name, KSBinaryImage* buffer); +bool ksdl_getBinaryImageForHeader(const void* const header_ptr, const char* const image_name, RollbarCrashBinaryImage* buffer); /** Find a loaded binary image with the specified name. * @@ -120,4 +120,4 @@ bool ksdl_dladdr(const uintptr_t address, Dl_info* const info); } #endif -#endif // HDR_KSDynamicLinker_h +#endif // HDR_RollbarCrashDynamicLinker_h diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashFileUtils.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashFileUtils.c index a44ffde4..b0336ba6 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashFileUtils.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashFileUtils.c @@ -1,5 +1,5 @@ // -// KSFileUtils.c +// RollbarCrashFileUtils.c // // Created by Karl Stenerud on 2012-01-28. // @@ -25,10 +25,10 @@ // -#include "KSFileUtils.h" +#include "RollbarCrashFileUtils.h" -//#define KSLogger_LocalLevel TRACE -#include "KSLogger.h" +//#define RollbarCrashLogger_LocalLevel TRACE +#include "RollbarCrashLogger.h" #include #include @@ -43,8 +43,8 @@ /** Buffer size to use in the "writeFmt" functions. * If the formatted output length would exceed this value, it is truncated. */ -#ifndef KSFU_WriteFmtBufferSize - #define KSFU_WriteFmtBufferSize 1024 +#ifndef RollbarCrashFU_WriteFmtBufferSize + #define RollbarCrashFU_WriteFmtBufferSize 1024 #endif @@ -80,7 +80,7 @@ static int dirContentsCount(const char* path) DIR* dir = opendir(path); if(dir == NULL) { - KSLOG_ERROR("Error reading directory %s: %s", path, strerror(errno)); + RollbarCrashLOG_ERROR("Error reading directory %s: %s", path, strerror(errno)); return 0; } @@ -106,7 +106,7 @@ static void dirContents(const char* path, char*** entries, int* count) dir = opendir(path); if(dir == NULL) { - KSLOG_ERROR("Error reading directory %s: %s", path, strerror(errno)); + RollbarCrashLOG_ERROR("Error reading directory %s: %s", path, strerror(errno)); goto done; } @@ -117,7 +117,7 @@ static void dirContents(const char* path, char*** entries, int* count) { if(index >= entryCount) { - KSLOG_ERROR("Contents of %s have been mutated", path); + RollbarCrashLOG_ERROR("Contents of %s have been mutated", path); goto done; } entryList[index] = strdup(ent->d_name); @@ -158,7 +158,7 @@ static bool deletePathContents(const char* path, bool deleteTopLevelPathAlso) struct stat statStruct = {0}; if(stat(path, &statStruct) != 0) { - KSLOG_ERROR("Could not stat %s: %s", path, strerror(errno)); + RollbarCrashLOG_ERROR("Could not stat %s: %s", path, strerror(errno)); return false; } if(S_ISDIR(statStruct.st_mode)) @@ -167,7 +167,7 @@ static bool deletePathContents(const char* path, bool deleteTopLevelPathAlso) int entryCount = 0; dirContents(path, &entries, &entryCount); - int bufferLength = KSFU_MAX_PATH_LENGTH; + int bufferLength = RollbarCrashFU_MAX_PATH_LENGTH; char* pathBuffer = malloc((unsigned)bufferLength); snprintf(pathBuffer, bufferLength, "%s/", path); char* pathPtr = pathBuffer + strlen(pathBuffer); @@ -196,7 +196,7 @@ static bool deletePathContents(const char* path, bool deleteTopLevelPathAlso) } else { - KSLOG_ERROR("Could not delete %s: Not a regular file.", path); + RollbarCrashLOG_ERROR("Could not delete %s: Not a regular file.", path); return false; } return true; @@ -225,7 +225,7 @@ bool ksfu_writeBytesToFD(const int fd, const char* const bytes, int length) int bytesWritten = (int)write(fd, pos, (unsigned)length); if(bytesWritten == -1) { - KSLOG_ERROR("Could not write to fd %d: %s", fd, strerror(errno)); + RollbarCrashLOG_ERROR("Could not write to fd %d: %s", fd, strerror(errno)); return false; } length -= bytesWritten; @@ -242,7 +242,7 @@ bool ksfu_readBytesFromFD(const int fd, char* const bytes, int length) int bytesRead = (int)read(fd, pos, (unsigned)length); if(bytesRead == -1) { - KSLOG_ERROR("Could not write to fd %d: %s", fd, strerror(errno)); + RollbarCrashLOG_ERROR("Could not write to fd %d: %s", fd, strerror(errno)); return false; } length -= bytesRead; @@ -262,14 +262,14 @@ bool ksfu_readEntireFile(const char* const path, char** data, int* length, int m struct stat st; if(stat(path, &st) < 0) { - KSLOG_ERROR("Could not stat %s: %s", path, strerror(errno)); + RollbarCrashLOG_ERROR("Could not stat %s: %s", path, strerror(errno)); goto done; } fd = open(path, O_RDONLY); if(fd < 0) { - KSLOG_ERROR("Could not open %s: %s", path, strerror(errno)); + RollbarCrashLOG_ERROR("Could not open %s: %s", path, strerror(errno)); goto done; } @@ -281,7 +281,7 @@ bool ksfu_readEntireFile(const char* const path, char** data, int* length, int m { if(lseek(fd, -bytesToRead, SEEK_END) < 0) { - KSLOG_ERROR("Could not seek to %d from end of %s: %s", -bytesToRead, path, strerror(errno)); + RollbarCrashLOG_ERROR("Could not seek to %d from end of %s: %s", -bytesToRead, path, strerror(errno)); goto done; } } @@ -289,7 +289,7 @@ bool ksfu_readEntireFile(const char* const path, char** data, int* length, int m mem = malloc((unsigned)bytesToRead + 1); if(mem == NULL) { - KSLOG_ERROR("Out of memory"); + RollbarCrashLOG_ERROR("Out of memory"); goto done; } @@ -333,7 +333,7 @@ bool ksfu_writeStringToFD(const int fd, const char* const string) int bytesWritten = (int)write(fd, pos, (unsigned)bytesToWrite); if(bytesWritten == -1) { - KSLOG_ERROR("Could not write to fd %d: %s", + RollbarCrashLOG_ERROR("Could not write to fd %d: %s", fd, strerror(errno)); return false; } @@ -364,7 +364,7 @@ bool ksfu_writeFmtArgsToFD(const int fd, { if(*fmt != 0) { - char buffer[KSFU_WriteFmtBufferSize]; + char buffer[RollbarCrashFU_WriteFmtBufferSize]; vsnprintf(buffer, sizeof(buffer), fmt, args); return ksfu_writeStringToFD(fd, buffer); } @@ -381,7 +381,7 @@ int ksfu_readLineFromFD(const int fd, char* const buffer, const int maxLength) int bytesRead = (int)read(fd, ch, 1); if(bytesRead < 0) { - KSLOG_ERROR("Could not read from fd %d: %s", fd, strerror(errno)); + RollbarCrashLOG_ERROR("Could not read from fd %d: %s", fd, strerror(errno)); return -1; } else if(bytesRead == 0 || *ch == '\n') @@ -404,7 +404,7 @@ bool ksfu_makePath(const char* absolutePath) *ptr = '\0'; if(mkdir(pathCopy, S_IRWXU) < 0 && errno != EEXIST) { - KSLOG_ERROR("Could not create directory %s: %s", pathCopy, strerror(errno)); + RollbarCrashLOG_ERROR("Could not create directory %s: %s", pathCopy, strerror(errno)); goto done; } *ptr = '/'; @@ -412,7 +412,7 @@ bool ksfu_makePath(const char* absolutePath) } if(mkdir(pathCopy, S_IRWXU) < 0 && errno != EEXIST) { - KSLOG_ERROR("Could not create directory %s: %s", pathCopy, strerror(errno)); + RollbarCrashLOG_ERROR("Could not create directory %s: %s", pathCopy, strerror(errno)); goto done; } isSuccessful = true; @@ -428,7 +428,7 @@ bool ksfu_removeFile(const char* path, bool mustExist) { if(mustExist || errno != ENOENT) { - KSLOG_ERROR("Could not delete %s: %s", path, strerror(errno)); + RollbarCrashLOG_ERROR("Could not delete %s: %s", path, strerror(errno)); } return false; } @@ -449,7 +449,7 @@ bool ksfu_deleteContentsOfPath(const char* path) return deletePathContents(path, false); } -bool ksfu_openBufferedWriter(KSBufferedWriter* writer, const char* const path, char* writeBuffer, int writeBufferLength) +bool ksfu_openBufferedWriter(RollbarCrashBufferedWriter* writer, const char* const path, char* writeBuffer, int writeBufferLength) { writer->buffer = writeBuffer; writer->bufferLength = writeBufferLength; @@ -457,13 +457,13 @@ bool ksfu_openBufferedWriter(KSBufferedWriter* writer, const char* const path, c writer->fd = open(path, O_RDWR | O_CREAT | O_EXCL, 0644); if(writer->fd < 0) { - KSLOG_ERROR("Could not open crash report file %s: %s", path, strerror(errno)); + RollbarCrashLOG_ERROR("Could not open crash report file %s: %s", path, strerror(errno)); return false; } return true; } -void ksfu_closeBufferedWriter(KSBufferedWriter* writer) +void ksfu_closeBufferedWriter(RollbarCrashBufferedWriter* writer) { if(writer->fd > 0) { @@ -473,7 +473,7 @@ void ksfu_closeBufferedWriter(KSBufferedWriter* writer) } } -bool ksfu_writeBufferedWriter(KSBufferedWriter* writer, const char* restrict const data, const int length) +bool ksfu_writeBufferedWriter(RollbarCrashBufferedWriter* writer, const char* restrict const data, const int length) { if(length > writer->bufferLength - writer->position) { @@ -488,7 +488,7 @@ bool ksfu_writeBufferedWriter(KSBufferedWriter* writer, const char* restrict con return true; } -bool ksfu_flushBufferedWriter(KSBufferedWriter* writer) +bool ksfu_flushBufferedWriter(RollbarCrashBufferedWriter* writer) { if(writer->fd > 0 && writer->position > 0) { @@ -501,12 +501,12 @@ bool ksfu_flushBufferedWriter(KSBufferedWriter* writer) return true; } -static inline bool isReadBufferEmpty(KSBufferedReader* reader) +static inline bool isReadBufferEmpty(RollbarCrashBufferedReader* reader) { return reader->dataEndPos == reader->dataStartPos; } -static bool fillReadBuffer(KSBufferedReader* reader) +static bool fillReadBuffer(RollbarCrashBufferedReader* reader) { if(reader->dataStartPos > 0) { @@ -523,7 +523,7 @@ static bool fillReadBuffer(KSBufferedReader* reader) int bytesRead = (int)read(reader->fd, reader->buffer + reader->dataEndPos, (size_t)bytesToRead); if(bytesRead < 0) { - KSLOG_ERROR("Could not read: %s", strerror(errno)); + RollbarCrashLOG_ERROR("Could not read: %s", strerror(errno)); return false; } else @@ -534,7 +534,7 @@ static bool fillReadBuffer(KSBufferedReader* reader) return true; } -int ksfu_readBufferedReader(KSBufferedReader* reader, char* dstBuffer, int byteCount) +int ksfu_readBufferedReader(RollbarCrashBufferedReader* reader, char* dstBuffer, int byteCount) { int bytesRemaining = byteCount; int bytesConsumed = 0; @@ -566,7 +566,7 @@ int ksfu_readBufferedReader(KSBufferedReader* reader, char* dstBuffer, int byteC return bytesConsumed; } -bool ksfu_readBufferedReaderUntilChar(KSBufferedReader* reader, int ch, char* dstBuffer, int* length) +bool ksfu_readBufferedReaderUntilChar(RollbarCrashBufferedReader* reader, int ch, char* dstBuffer, int* length) { int bytesRemaining = *length; int bytesConsumed = 0; @@ -610,7 +610,7 @@ bool ksfu_readBufferedReaderUntilChar(KSBufferedReader* reader, int ch, char* ds return false; } -bool ksfu_openBufferedReader(KSBufferedReader* reader, const char* const path, char* readBuffer, int readBufferLength) +bool ksfu_openBufferedReader(RollbarCrashBufferedReader* reader, const char* const path, char* readBuffer, int readBufferLength) { readBuffer[0] = '\0'; readBuffer[readBufferLength - 1] = '\0'; @@ -621,14 +621,14 @@ bool ksfu_openBufferedReader(KSBufferedReader* reader, const char* const path, c reader->fd = open(path, O_RDONLY); if(reader->fd < 0) { - KSLOG_ERROR("Could not open file %s: %s", path, strerror(errno)); + RollbarCrashLOG_ERROR("Could not open file %s: %s", path, strerror(errno)); return false; } fillReadBuffer(reader); return true; } -void ksfu_closeBufferedReader(KSBufferedReader* reader) +void ksfu_closeBufferedReader(RollbarCrashBufferedReader* reader) { if(reader->fd > 0) { diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashFileUtils.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashFileUtils.h index 26d4a7f2..0d797083 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashFileUtils.h +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashFileUtils.h @@ -1,5 +1,5 @@ // -// KSFileUtils.h +// RollbarCrashFileUtils.h // // Created by Karl Stenerud on 2012-01-28. // @@ -29,8 +29,8 @@ */ -#ifndef HDR_KSFileUtils_h -#define HDR_KSFileUtils_h +#ifndef HDR_RollbarCrashFileUtils_h +#define HDR_RollbarCrashFileUtils_h #ifdef __cplusplus extern "C" { @@ -41,7 +41,7 @@ extern "C" { #include -#define KSFU_MAX_PATH_LENGTH 500 +#define RollbarCrashFU_MAX_PATH_LENGTH 500 /** Get the last entry in a file path. Assumes UNIX style separators. * @@ -168,7 +168,7 @@ typedef struct int bufferLength; int position; int fd; -} KSBufferedWriter; +} RollbarCrashBufferedWriter; /** Open a file for buffered writing. * @@ -182,13 +182,13 @@ typedef struct * * @return True if the file was successfully opened. */ -bool ksfu_openBufferedWriter(KSBufferedWriter* writer, const char* const path, char* writeBuffer, int writeBufferLength); +bool ksfu_openBufferedWriter(RollbarCrashBufferedWriter* writer, const char* const path, char* writeBuffer, int writeBufferLength); /** Close a buffered writer. * * @param writer The writer to close. */ -void ksfu_closeBufferedWriter(KSBufferedWriter* writer); +void ksfu_closeBufferedWriter(RollbarCrashBufferedWriter* writer); /** Write to a buffered writer. * @@ -200,7 +200,7 @@ void ksfu_closeBufferedWriter(KSBufferedWriter* writer); * * @return True if the data was successfully written. */ -bool ksfu_writeBufferedWriter(KSBufferedWriter* writer, const char* restrict const data, const int length); +bool ksfu_writeBufferedWriter(RollbarCrashBufferedWriter* writer, const char* restrict const data, const int length); /** Flush a buffered writer, writing all uncommitted data to disk. * @@ -208,7 +208,7 @@ bool ksfu_writeBufferedWriter(KSBufferedWriter* writer, const char* restrict con * * @return True if the buffer was successfully flushed. */ -bool ksfu_flushBufferedWriter(KSBufferedWriter* writer); +bool ksfu_flushBufferedWriter(RollbarCrashBufferedWriter* writer); /** Buffered reader structure. Everything inside should be considered internal use only. */ typedef struct @@ -218,7 +218,7 @@ typedef struct int dataStartPos; int dataEndPos; int fd; -} KSBufferedReader; +} RollbarCrashBufferedReader; /** Open a file for buffered reading. * @@ -232,13 +232,13 @@ typedef struct * * @return True if the file was successfully opened. */ -bool ksfu_openBufferedReader(KSBufferedReader* reader, const char* const path, char* readBuffer, int readBufferLength); +bool ksfu_openBufferedReader(RollbarCrashBufferedReader* reader, const char* const path, char* readBuffer, int readBufferLength); /** Close a buffered reader. * * @param reader The reader to close. */ -void ksfu_closeBufferedReader(KSBufferedReader* reader); +void ksfu_closeBufferedReader(RollbarCrashBufferedReader* reader); /** Read from a buffered reader. * @@ -250,7 +250,7 @@ void ksfu_closeBufferedReader(KSBufferedReader* reader); * * @return The number of bytes actually read. */ -int ksfu_readBufferedReader(KSBufferedReader* reader, char* dstBuffer, int byteCount); +int ksfu_readBufferedReader(RollbarCrashBufferedReader* reader, char* dstBuffer, int byteCount); /** Read from a buffered reader until the specified character is encountered. * All bytes up to and including the character will be read. @@ -266,11 +266,11 @@ int ksfu_readBufferedReader(KSBufferedReader* reader, char* dstBuffer, int byteC * * @return True if the character was found before giving up. */ -bool ksfu_readBufferedReaderUntilChar(KSBufferedReader* reader, int ch, char* dstBuffer, int* length); +bool ksfu_readBufferedReaderUntilChar(RollbarCrashBufferedReader* reader, int ch, char* dstBuffer, int* length); #ifdef __cplusplus } #endif -#endif // HDR_KSFileUtils_h +#endif // HDR_RollbarCrashFileUtils_h diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashID.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashID.c index 7d389fee..d66d3c9c 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashID.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashID.c @@ -1,5 +1,5 @@ // -// KSID.c +// RollbarCrashID.c // // Copyright (c) 2016 Karl Stenerud. All rights reserved. // diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashID.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashID.h index 896e72db..b5bf3cab 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashID.h +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashID.h @@ -1,5 +1,5 @@ // -// KSID.h +// RollbarCrashID.h // // Copyright (c) 2016 Karl Stenerud. All rights reserved. // @@ -22,8 +22,8 @@ // THE SOFTWARE. // -#ifndef HDR_KSID_h -#define HDR_KSID_h +#ifndef HDR_RollbarCrashID_h +#define HDR_RollbarCrashID_h #ifdef __cplusplus extern "C" { @@ -41,4 +41,4 @@ void ksid_generate(char* destinationBuffer37Bytes); } #endif -#endif // HDR_KSID_h +#endif // HDR_RollbarCrashID_h diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashJSONCodec.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashJSONCodec.c index 039f3afa..73f043c4 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashJSONCodec.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashJSONCodec.c @@ -1,5 +1,5 @@ // -// KSJSONCodec.c +// RollbarCrashJSONCodec.c // // Created by Karl Stenerud on 2012-01-07. // @@ -25,7 +25,7 @@ // -#include "KSJSONCodec.h" +#include "RollbarCrashJSONCodec.h" #include #include @@ -41,22 +41,22 @@ #pragma mark - Configuration - // ============================================================================ -/** Set to 1 if you're also compiling KSLogger and want to use it here */ -#ifndef KSJSONCODEC_UseKSLogger - #define KSJSONCODEC_UseKSLogger 1 +/** Set to 1 if you're also compiling RollbarCrashLogger and want to use it here */ +#ifndef RollbarCrashJSONCODEC_UseRollbarCrashLogger + #define RollbarCrashJSONCODEC_UseRollbarCrashLogger 1 #endif -#if KSJSONCODEC_UseKSLogger - #include "KSLogger.h" +#if RollbarCrashJSONCODEC_UseRollbarCrashLogger + #include "RollbarCrashLogger.h" #else - #define KSLOG_DEBUG(FMT, ...) + #define RollbarCrashLOG_DEBUG(FMT, ...) #endif /** The work buffer size to use when escaping string values. * There's little reason to change this since nothing ever gets truncated. */ -#ifndef KSJSONCODEC_WorkBufferSize - #define KSJSONCODEC_WorkBufferSize 512 +#ifndef RollbarCrashJSONCODEC_WorkBufferSize + #define RollbarCrashJSONCODEC_WorkBufferSize 512 #endif @@ -79,15 +79,15 @@ const char* ksjson_stringForError(const int error) { switch (error) { - case KSJSON_ERROR_INVALID_CHARACTER: + case RollbarCrashJSON_ERROR_INVALID_CHARACTER: return "Invalid character"; - case KSJSON_ERROR_DATA_TOO_LONG: + case RollbarCrashJSON_ERROR_DATA_TOO_LONG: return "Data too long"; - case KSJSON_ERROR_CANNOT_ADD_DATA: + case RollbarCrashJSON_ERROR_CANNOT_ADD_DATA: return "Cannot add data"; - case KSJSON_ERROR_INCOMPLETE: + case RollbarCrashJSON_ERROR_INCOMPLETE: return "Incomplete data"; - case KSJSON_ERROR_INVALID_DATA: + case RollbarCrashJSON_ERROR_INVALID_DATA: return "Invalid data"; default: return "(unknown error)"; @@ -108,7 +108,7 @@ const char* ksjson_stringForError(const int error) * * @param length The length of the data. * - * @return KSJSON_OK if the data was handled successfully. + * @return RollbarCrashJSON_OK if the data was handled successfully. */ #define addJSONData(CONTEXT,DATA,LENGTH) \ (CONTEXT)->addJSONData(DATA, LENGTH, (CONTEXT)->userData) @@ -121,13 +121,13 @@ const char* ksjson_stringForError(const int error) * * @param length The length of the string. * - * @return KSJSON_OK if the data was handled successfully. + * @return RollbarCrashJSON_OK if the data was handled successfully. */ -static int appendEscapedString(KSJSONEncodeContext* const context, +static int appendEscapedString(RollbarCrashJSONEncodeContext* const context, const char* restrict const string, int length) { - char workBuffer[KSJSONCODEC_WorkBufferSize]; + char workBuffer[RollbarCrashJSONCODEC_WorkBufferSize]; const char* const srcEnd = string + length; const char* restrict src = string; @@ -175,9 +175,9 @@ static int appendEscapedString(KSJSONEncodeContext* const context, default: unlikely_if((unsigned char)*src < ' ') { - KSLOG_DEBUG("Invalid character 0x%02x in string: %s", + RollbarCrashLOG_DEBUG("Invalid character 0x%02x in string: %s", *src, string); - return KSJSON_ERROR_INVALID_CHARACTER; + return RollbarCrashJSON_ERROR_INVALID_CHARACTER; } *dst++ = *src; } @@ -195,25 +195,25 @@ static int appendEscapedString(KSJSONEncodeContext* const context, * * @param length The length of the string. * - * @return KSJSON_OK if the data was handled successfully. + * @return RollbarCrashJSON_OK if the data was handled successfully. */ -static int addEscapedString(KSJSONEncodeContext* const context, +static int addEscapedString(RollbarCrashJSONEncodeContext* const context, const char* restrict const string, int length) { - int result = KSJSON_OK; + int result = RollbarCrashJSON_OK; // Keep adding portions until the whole string has been processed. int offset = 0; while(offset < length) { int toAdd = length - offset; - unlikely_if(toAdd > KSJSONCODEC_WorkBufferSize / 2) + unlikely_if(toAdd > RollbarCrashJSONCODEC_WorkBufferSize / 2) { - toAdd = KSJSONCODEC_WorkBufferSize / 2; + toAdd = RollbarCrashJSONCODEC_WorkBufferSize / 2; } result = appendEscapedString(context, string + offset, toAdd); - unlikely_if(result != KSJSON_OK) + unlikely_if(result != RollbarCrashJSON_OK) { break; } @@ -230,14 +230,14 @@ static int addEscapedString(KSJSONEncodeContext* const context, * * @param length The length of the string. * - * @return KSJSON_OK if the data was handled successfully. + * @return RollbarCrashJSON_OK if the data was handled successfully. */ -static int addQuotedEscapedString(KSJSONEncodeContext* const context, +static int addQuotedEscapedString(RollbarCrashJSONEncodeContext* const context, const char* restrict const string, int length) { int result; - unlikely_if((result = addJSONData(context, "\"", 1)) != KSJSON_OK) + unlikely_if((result = addJSONData(context, "\"", 1)) != RollbarCrashJSON_OK) { return result; } @@ -249,9 +249,9 @@ static int addQuotedEscapedString(KSJSONEncodeContext* const context, return result || closeResult; } -int ksjson_beginElement(KSJSONEncodeContext* const context, const char* const name) +int ksjson_beginElement(RollbarCrashJSONEncodeContext* const context, const char* const name) { - int result = KSJSON_OK; + int result = RollbarCrashJSON_OK; // Decide if a comma is warranted. unlikely_if(context->containerFirstEntry) @@ -260,7 +260,7 @@ int ksjson_beginElement(KSJSONEncodeContext* const context, const char* const na } else { - unlikely_if((result = addJSONData(context, ",", 1)) != KSJSON_OK) + unlikely_if((result = addJSONData(context, ",", 1)) != RollbarCrashJSON_OK) { return result; } @@ -269,13 +269,13 @@ int ksjson_beginElement(KSJSONEncodeContext* const context, const char* const na // Pretty printing unlikely_if(context->prettyPrint && context->containerLevel > 0) { - unlikely_if((result = addJSONData(context, "\n", 1)) != KSJSON_OK) + unlikely_if((result = addJSONData(context, "\n", 1)) != RollbarCrashJSON_OK) { return result; } for(int i = 0; i < context->containerLevel; i++) { - unlikely_if((result = addJSONData(context, " ", 4)) != KSJSON_OK) + unlikely_if((result = addJSONData(context, " ", 4)) != RollbarCrashJSON_OK) { return result; } @@ -287,23 +287,23 @@ int ksjson_beginElement(KSJSONEncodeContext* const context, const char* const na { unlikely_if(name == NULL) { - KSLOG_DEBUG("Name was null inside an object"); - return KSJSON_ERROR_INVALID_DATA; + RollbarCrashLOG_DEBUG("Name was null inside an object"); + return RollbarCrashJSON_ERROR_INVALID_DATA; } - unlikely_if((result = addQuotedEscapedString(context, name, (int)strlen(name))) != KSJSON_OK) + unlikely_if((result = addQuotedEscapedString(context, name, (int)strlen(name))) != RollbarCrashJSON_OK) { return result; } unlikely_if(context->prettyPrint) { - unlikely_if((result = addJSONData(context, ": ", 2)) != KSJSON_OK) + unlikely_if((result = addJSONData(context, ": ", 2)) != RollbarCrashJSON_OK) { return result; } } else { - unlikely_if((result = addJSONData(context, ":", 1)) != KSJSON_OK) + unlikely_if((result = addJSONData(context, ":", 1)) != RollbarCrashJSON_OK) { return result; } @@ -312,19 +312,19 @@ int ksjson_beginElement(KSJSONEncodeContext* const context, const char* const na return result; } -int ksjson_addRawJSONData(KSJSONEncodeContext* const context, +int ksjson_addRawJSONData(RollbarCrashJSONEncodeContext* const context, const char* const data, const int length) { return addJSONData(context, data, length); } -int ksjson_addBooleanElement(KSJSONEncodeContext* const context, +int ksjson_addBooleanElement(RollbarCrashJSONEncodeContext* const context, const char* const name, const bool value) { int result = ksjson_beginElement(context, name); - unlikely_if(result != KSJSON_OK) + unlikely_if(result != RollbarCrashJSON_OK) { return result; } @@ -338,12 +338,12 @@ int ksjson_addBooleanElement(KSJSONEncodeContext* const context, } } -int ksjson_addFloatingPointElement(KSJSONEncodeContext* const context, +int ksjson_addFloatingPointElement(RollbarCrashJSONEncodeContext* const context, const char* const name, double value) { int result = ksjson_beginElement(context, name); - unlikely_if(result != KSJSON_OK) + unlikely_if(result != RollbarCrashJSON_OK) { return result; } @@ -352,12 +352,12 @@ int ksjson_addFloatingPointElement(KSJSONEncodeContext* const context, return addJSONData(context, buff, (int)strlen(buff)); } -int ksjson_addIntegerElement(KSJSONEncodeContext* const context, +int ksjson_addIntegerElement(RollbarCrashJSONEncodeContext* const context, const char* const name, int64_t value) { int result = ksjson_beginElement(context, name); - unlikely_if(result != KSJSON_OK) + unlikely_if(result != RollbarCrashJSON_OK) { return result; } @@ -366,12 +366,12 @@ int ksjson_addIntegerElement(KSJSONEncodeContext* const context, return addJSONData(context, buff, (int)strlen(buff)); } -int ksjson_addUIntegerElement(KSJSONEncodeContext* const context, +int ksjson_addUIntegerElement(RollbarCrashJSONEncodeContext* const context, const char* const name, uint64_t value) { int result = ksjson_beginElement(context, name); - unlikely_if(result != KSJSON_OK) + unlikely_if(result != RollbarCrashJSON_OK) { return result; } @@ -380,18 +380,18 @@ int ksjson_addUIntegerElement(KSJSONEncodeContext* const context, return addJSONData(context, buff, (int)strlen(buff)); } -int ksjson_addNullElement(KSJSONEncodeContext* const context, +int ksjson_addNullElement(RollbarCrashJSONEncodeContext* const context, const char* const name) { int result = ksjson_beginElement(context, name); - unlikely_if(result != KSJSON_OK) + unlikely_if(result != RollbarCrashJSON_OK) { return result; } return addJSONData(context, "null", 4); } -int ksjson_addStringElement(KSJSONEncodeContext* const context, +int ksjson_addStringElement(RollbarCrashJSONEncodeContext* const context, const char* const name, const char* const value, int length) @@ -401,78 +401,78 @@ int ksjson_addStringElement(KSJSONEncodeContext* const context, return ksjson_addNullElement(context, name); } int result = ksjson_beginElement(context, name); - unlikely_if(result != KSJSON_OK) + unlikely_if(result != RollbarCrashJSON_OK) { return result; } - if(length == KSJSON_SIZE_AUTOMATIC) + if(length == RollbarCrashJSON_SIZE_AUTOMATIC) { length = (int)strlen(value); } return addQuotedEscapedString(context, value, length); } -int ksjson_beginStringElement(KSJSONEncodeContext* const context, +int ksjson_beginStringElement(RollbarCrashJSONEncodeContext* const context, const char* const name) { int result = ksjson_beginElement(context, name); - unlikely_if(result != KSJSON_OK) + unlikely_if(result != RollbarCrashJSON_OK) { return result; } return addJSONData(context, "\"", 1); } -int ksjson_appendStringElement(KSJSONEncodeContext* const context, +int ksjson_appendStringElement(RollbarCrashJSONEncodeContext* const context, const char* const value, int length) { return addEscapedString(context, value, length); } -int ksjson_endStringElement(KSJSONEncodeContext* const context) +int ksjson_endStringElement(RollbarCrashJSONEncodeContext* const context) { return addJSONData(context, "\"", 1); } -int ksjson_addDataElement(KSJSONEncodeContext* const context, +int ksjson_addDataElement(RollbarCrashJSONEncodeContext* const context, const char* name, const char* value, int length) { - int result = KSJSON_OK; + int result = RollbarCrashJSON_OK; result = ksjson_beginDataElement(context, name); - if(result == KSJSON_OK) + if(result == RollbarCrashJSON_OK) { result = ksjson_appendDataElement(context, value, length); } - if(result == KSJSON_OK) + if(result == RollbarCrashJSON_OK) { result = ksjson_endDataElement(context); } return result; } -int ksjson_beginDataElement(KSJSONEncodeContext* const context, +int ksjson_beginDataElement(RollbarCrashJSONEncodeContext* const context, const char* const name) { return ksjson_beginStringElement(context, name); } -int ksjson_appendDataElement(KSJSONEncodeContext* const context, +int ksjson_appendDataElement(RollbarCrashJSONEncodeContext* const context, const char* const value, int length) { unsigned char* currentByte = (unsigned char*)value; unsigned char* end = currentByte + length; char chars[2]; - int result = KSJSON_OK; + int result = RollbarCrashJSON_OK; while(currentByte < end) { chars[0] = g_hexNybbles[(*currentByte>>4)&15]; chars[1] = g_hexNybbles[*currentByte&15]; result = addJSONData(context, chars, sizeof(chars)); - if(result != KSJSON_OK) + if(result != RollbarCrashJSON_OK) { break; } @@ -481,18 +481,18 @@ int ksjson_appendDataElement(KSJSONEncodeContext* const context, return result; } -int ksjson_endDataElement(KSJSONEncodeContext* const context) +int ksjson_endDataElement(RollbarCrashJSONEncodeContext* const context) { return ksjson_endStringElement(context); } -int ksjson_beginArray(KSJSONEncodeContext* const context, +int ksjson_beginArray(RollbarCrashJSONEncodeContext* const context, const char* const name) { likely_if(context->containerLevel >= 0) { int result = ksjson_beginElement(context, name); - unlikely_if(result != KSJSON_OK) + unlikely_if(result != RollbarCrashJSON_OK) { return result; } @@ -505,13 +505,13 @@ int ksjson_beginArray(KSJSONEncodeContext* const context, return addJSONData(context, "[", 1); } -int ksjson_beginObject(KSJSONEncodeContext* const context, +int ksjson_beginObject(RollbarCrashJSONEncodeContext* const context, const char* const name) { likely_if(context->containerLevel >= 0) { int result = ksjson_beginElement(context, name); - unlikely_if(result != KSJSON_OK) + unlikely_if(result != RollbarCrashJSON_OK) { return result; } @@ -524,11 +524,11 @@ int ksjson_beginObject(KSJSONEncodeContext* const context, return addJSONData(context, "{", 1); } -int ksjson_endContainer(KSJSONEncodeContext* const context) +int ksjson_endContainer(RollbarCrashJSONEncodeContext* const context) { unlikely_if(context->containerLevel <= 0) { - return KSJSON_OK; + return RollbarCrashJSON_OK; } bool isObject = context->isObject[context->containerLevel]; @@ -538,13 +538,13 @@ int ksjson_endContainer(KSJSONEncodeContext* const context) unlikely_if(context->prettyPrint && !context->containerFirstEntry) { int result; - unlikely_if((result = addJSONData(context, "\n", 1)) != KSJSON_OK) + unlikely_if((result = addJSONData(context, "\n", 1)) != RollbarCrashJSON_OK) { return result; } for(int i = 0; i < context->containerLevel; i++) { - unlikely_if((result = addJSONData(context, " ", 4)) != KSJSON_OK) + unlikely_if((result = addJSONData(context, " ", 4)) != RollbarCrashJSON_OK) { return result; } @@ -554,9 +554,9 @@ int ksjson_endContainer(KSJSONEncodeContext* const context) return addJSONData(context, isObject ? "}" : "]", 1); } -void ksjson_beginEncode(KSJSONEncodeContext* const context, +void ksjson_beginEncode(RollbarCrashJSONEncodeContext* const context, bool prettyPrint, - KSJSONAddDataFunc addJSONDataFunc, + RollbarCrashJSONAddDataFunc addJSONDataFunc, void* const userData) { memset(context, 0, sizeof(*context)); @@ -566,12 +566,12 @@ void ksjson_beginEncode(KSJSONEncodeContext* const context, context->containerFirstEntry = true; } -int ksjson_endEncode(KSJSONEncodeContext* const context) +int ksjson_endEncode(RollbarCrashJSONEncodeContext* const context) { - int result = KSJSON_OK; + int result = RollbarCrashJSON_OK; while(context->containerLevel > 0) { - unlikely_if((result = ksjson_endContainer(context)) != KSJSON_OK) + unlikely_if((result = ksjson_endContainer(context)) != RollbarCrashJSON_OK) { return result; } @@ -601,10 +601,10 @@ typedef struct /** Length of the string buffer. */ int stringBufferLength; /** The callbacks to call while decoding. */ - KSJSONDecodeCallbacks* const callbacks; + RollbarCrashJSONDecodeCallbacks* const callbacks; /** Data that was specified when calling ksjson_decode(). */ void* userData; -} KSJSONDecodeContext; +} RollbarCrashJSONDecodeContext; /** Lookup table for converting hex values to integers. * INV (0x11111) is used to mark invalid characters so that any attempted @@ -638,7 +638,7 @@ static const unsigned int g_hexConversion[] = * * @param dst Where to write the UTF-8 character. * - * @return KSJSON_OK if the encoding was successful. + * @return RollbarCrashJSON_OK if the encoding was successful. */ static int writeUTF8(unsigned int character, char** dst); @@ -650,9 +650,9 @@ static int writeUTF8(unsigned int character, char** dst); * * @param dstBufferLength Length of the destination buffer. * - * @return KSJSON_OK if successful. + * @return RollbarCrashJSON_OK if successful. */ -static int decodeString(KSJSONDecodeContext* context, char* dstBuffer, int dstBufferLength); +static int decodeString(RollbarCrashJSONDecodeContext* context, char* dstBuffer, int dstBufferLength); /** Decode a JSON element. * @@ -660,10 +660,10 @@ static int decodeString(KSJSONDecodeContext* context, char* dstBuffer, int dstBu * * @param context The decoding context. * - * @return KSJSON_OK if successful. + * @return RollbarCrashJSON_OK if successful. */ static int decodeElement(const char* const name, - KSJSONDecodeContext* context); + RollbarCrashJSONDecodeContext* context); /** Skip past any whitespace. @@ -703,14 +703,14 @@ static int writeUTF8(unsigned int character, char** dst) { **dst = (char) character; (*dst)++; - return KSJSON_OK; + return RollbarCrashJSON_OK; } if(character <= 0x7ff) { (*dst)[0] = (char)(0xc0 | (character >> 6)); (*dst)[1] = (char)(0x80 | (character & 0x3f)); *dst += 2; - return KSJSON_OK; + return RollbarCrashJSON_OK; } if(character <= 0xffff) { @@ -718,7 +718,7 @@ static int writeUTF8(unsigned int character, char** dst) (*dst)[1] = (char)(0x80 | ((character >> 6) & 0x3f)); (*dst)[2] = (char)(0x80 | (character & 0x3f)); *dst += 3; - return KSJSON_OK; + return RollbarCrashJSON_OK; } // RFC3629 restricts UTF-8 to end at 0x10ffff. if(character <= 0x10ffff) @@ -728,21 +728,21 @@ static int writeUTF8(unsigned int character, char** dst) (*dst)[2] = (char)(0x80 | ((character >> 6) & 0x3f)); (*dst)[3] = (char)(0x80 | (character & 0x3f)); *dst += 4; - return KSJSON_OK; + return RollbarCrashJSON_OK; } // If we get here, the character cannot be converted to valid UTF-8. - KSLOG_DEBUG("Invalid unicode: 0x%04x", character); - return KSJSON_ERROR_INVALID_CHARACTER; + RollbarCrashLOG_DEBUG("Invalid unicode: 0x%04x", character); + return RollbarCrashJSON_ERROR_INVALID_CHARACTER; } -static int decodeString(KSJSONDecodeContext* context, char* dstBuffer, int dstBufferLength) +static int decodeString(RollbarCrashJSONDecodeContext* context, char* dstBuffer, int dstBufferLength) { *dstBuffer = '\0'; unlikely_if(*context->bufferPtr != '\"') { - KSLOG_DEBUG("Expected '\"' but got '%c'", *context->bufferPtr); - return KSJSON_ERROR_INVALID_CHARACTER; + RollbarCrashLOG_DEBUG("Expected '\"' but got '%c'", *context->bufferPtr); + return RollbarCrashJSON_ERROR_INVALID_CHARACTER; } const char* src = context->bufferPtr + 1; @@ -758,16 +758,16 @@ static int decodeString(KSJSONDecodeContext* context, char* dstBuffer, int dstBu } unlikely_if(src >= context->bufferEnd) { - KSLOG_DEBUG("Premature end of data"); - return KSJSON_ERROR_INCOMPLETE; + RollbarCrashLOG_DEBUG("Premature end of data"); + return RollbarCrashJSON_ERROR_INCOMPLETE; } const char* srcEnd = src; src = context->bufferPtr + 1; int length = (int)(srcEnd - src); if(length >= dstBufferLength) { - KSLOG_DEBUG("String is too long"); - return KSJSON_ERROR_DATA_TOO_LONG; + RollbarCrashLOG_DEBUG("String is too long"); + return RollbarCrashJSON_ERROR_DATA_TOO_LONG; } context->bufferPtr = srcEnd + 1; @@ -777,7 +777,7 @@ static int decodeString(KSJSONDecodeContext* context, char* dstBuffer, int dstBu { memcpy(dstBuffer, src, length); dstBuffer[length] = 0; - return KSJSON_OK; + return RollbarCrashJSON_OK; } char* dst = dstBuffer; @@ -821,8 +821,8 @@ static int decodeString(KSJSONDecodeContext* context, char* dstBuffer, int dstBu { unlikely_if(src + 5 > srcEnd) { - KSLOG_DEBUG("Premature end of data"); - return KSJSON_ERROR_INCOMPLETE; + RollbarCrashLOG_DEBUG("Premature end of data"); + return RollbarCrashJSON_ERROR_INCOMPLETE; } unsigned int accum = g_hexConversion[src[1]] << 12 | @@ -831,17 +831,17 @@ static int decodeString(KSJSONDecodeContext* context, char* dstBuffer, int dstBu g_hexConversion[src[4]]; unlikely_if(accum > 0xffff) { - KSLOG_DEBUG("Invalid unicode sequence: %c%c%c%c", + RollbarCrashLOG_DEBUG("Invalid unicode sequence: %c%c%c%c", src[1], src[2], src[3], src[4]); - return KSJSON_ERROR_INVALID_CHARACTER; + return RollbarCrashJSON_ERROR_INVALID_CHARACTER; } // UTF-16 Trail surrogate on its own. unlikely_if(accum >= 0xdc00 && accum <= 0xdfff) { - KSLOG_DEBUG("Unexpected trail surrogate: 0x%04x", + RollbarCrashLOG_DEBUG("Unexpected trail surrogate: 0x%04x", accum); - return KSJSON_ERROR_INVALID_CHARACTER; + return RollbarCrashJSON_ERROR_INVALID_CHARACTER; } // UTF-16 Lead surrogate. @@ -850,15 +850,15 @@ static int decodeString(KSJSONDecodeContext* context, char* dstBuffer, int dstBu // Fetch trail surrogate. unlikely_if(src + 11 > srcEnd) { - KSLOG_DEBUG("Premature end of data"); - return KSJSON_ERROR_INCOMPLETE; + RollbarCrashLOG_DEBUG("Premature end of data"); + return RollbarCrashJSON_ERROR_INCOMPLETE; } unlikely_if(src[5] != '\\' || src[6] != 'u') { - KSLOG_DEBUG("Expected \"\\u\" but got: \"%c%c\"", + RollbarCrashLOG_DEBUG("Expected \"\\u\" but got: \"%c%c\"", src[5], src[6]); - return KSJSON_ERROR_INVALID_CHARACTER; + return RollbarCrashJSON_ERROR_INVALID_CHARACTER; } src += 6; unsigned int accum2 = @@ -868,16 +868,16 @@ static int decodeString(KSJSONDecodeContext* context, char* dstBuffer, int dstBu g_hexConversion[src[4]]; unlikely_if(accum2 < 0xdc00 || accum2 > 0xdfff) { - KSLOG_DEBUG("Invalid trail surrogate: 0x%04x", + RollbarCrashLOG_DEBUG("Invalid trail surrogate: 0x%04x", accum2); - return KSJSON_ERROR_INVALID_CHARACTER; + return RollbarCrashJSON_ERROR_INVALID_CHARACTER; } // And combine 20 bit result. accum = ((accum - 0xd800) << 10) | (accum2 - 0xdc00); } int result = writeUTF8(accum, &dst); - unlikely_if(result != KSJSON_OK) + unlikely_if(result != RollbarCrashJSON_OK) { return result; } @@ -885,23 +885,23 @@ static int decodeString(KSJSONDecodeContext* context, char* dstBuffer, int dstBu continue; } default: - KSLOG_DEBUG("Invalid control character '%c'", *src); - return KSJSON_ERROR_INVALID_CHARACTER; + RollbarCrashLOG_DEBUG("Invalid control character '%c'", *src); + return RollbarCrashJSON_ERROR_INVALID_CHARACTER; } } } *dst = 0; - return KSJSON_OK; + return RollbarCrashJSON_OK; } -static int decodeElement(const char* const name, KSJSONDecodeContext* context) +static int decodeElement(const char* const name, RollbarCrashJSONDecodeContext* context) { SKIP_WHITESPACE(context); unlikely_if(context->bufferPtr >= context->bufferEnd) { - KSLOG_DEBUG("Premature end of data"); - return KSJSON_ERROR_INCOMPLETE; + RollbarCrashLOG_DEBUG("Premature end of data"); + return RollbarCrashJSON_ERROR_INCOMPLETE; } int sign = 1; @@ -913,7 +913,7 @@ static int decodeElement(const char* const name, KSJSONDecodeContext* context) { context->bufferPtr++; result = context->callbacks->onBeginArray(name, context->userData); - unlikely_if(result != KSJSON_OK) return result; + unlikely_if(result != RollbarCrashJSON_OK) return result; while(context->bufferPtr < context->bufferEnd) { SKIP_WHITESPACE(context); @@ -927,7 +927,7 @@ static int decodeElement(const char* const name, KSJSONDecodeContext* context) return context->callbacks->onEndContainer(context->userData); } result = decodeElement(NULL, context); - unlikely_if(result != KSJSON_OK) return result; + unlikely_if(result != RollbarCrashJSON_OK) return result; SKIP_WHITESPACE(context); unlikely_if(context->bufferPtr >= context->bufferEnd) { @@ -938,14 +938,14 @@ static int decodeElement(const char* const name, KSJSONDecodeContext* context) context->bufferPtr++; } } - KSLOG_DEBUG("Premature end of data"); - return KSJSON_ERROR_INCOMPLETE; + RollbarCrashLOG_DEBUG("Premature end of data"); + return RollbarCrashJSON_ERROR_INCOMPLETE; } case '{': { context->bufferPtr++; result = context->callbacks->onBeginObject(name, context->userData); - unlikely_if(result != KSJSON_OK) return result; + unlikely_if(result != RollbarCrashJSON_OK) return result; while(context->bufferPtr < context->bufferEnd) { SKIP_WHITESPACE(context); @@ -959,7 +959,7 @@ static int decodeElement(const char* const name, KSJSONDecodeContext* context) return context->callbacks->onEndContainer(context->userData); } result = decodeString(context, context->nameBuffer, context->nameBufferLength); - unlikely_if(result != KSJSON_OK) return result; + unlikely_if(result != RollbarCrashJSON_OK) return result; SKIP_WHITESPACE(context); unlikely_if(context->bufferPtr >= context->bufferEnd) { @@ -967,13 +967,13 @@ static int decodeElement(const char* const name, KSJSONDecodeContext* context) } unlikely_if(*context->bufferPtr != ':') { - KSLOG_DEBUG("Expected ':' but got '%c'", *context->bufferPtr); - return KSJSON_ERROR_INVALID_CHARACTER; + RollbarCrashLOG_DEBUG("Expected ':' but got '%c'", *context->bufferPtr); + return RollbarCrashJSON_ERROR_INVALID_CHARACTER; } context->bufferPtr++; SKIP_WHITESPACE(context); result = decodeElement(context->nameBuffer, context); - unlikely_if(result != KSJSON_OK) return result; + unlikely_if(result != RollbarCrashJSON_OK) return result; SKIP_WHITESPACE(context); unlikely_if(context->bufferPtr >= context->bufferEnd) { @@ -984,13 +984,13 @@ static int decodeElement(const char* const name, KSJSONDecodeContext* context) context->bufferPtr++; } } - KSLOG_DEBUG("Premature end of data"); - return KSJSON_ERROR_INCOMPLETE; + RollbarCrashLOG_DEBUG("Premature end of data"); + return RollbarCrashJSON_ERROR_INCOMPLETE; } case '\"': { result = decodeString(context, context->stringBuffer, context->stringBufferLength); - unlikely_if(result != KSJSON_OK) return result; + unlikely_if(result != RollbarCrashJSON_OK) return result; result = context->callbacks->onStringElement(name, context->stringBuffer, context->userData); @@ -1000,17 +1000,17 @@ static int decodeElement(const char* const name, KSJSONDecodeContext* context) { unlikely_if(context->bufferEnd - context->bufferPtr < 5) { - KSLOG_DEBUG("Premature end of data"); - return KSJSON_ERROR_INCOMPLETE; + RollbarCrashLOG_DEBUG("Premature end of data"); + return RollbarCrashJSON_ERROR_INCOMPLETE; } unlikely_if(!(context->bufferPtr[1] == 'a' && context->bufferPtr[2] == 'l' && context->bufferPtr[3] == 's' && context->bufferPtr[4] == 'e')) { - KSLOG_DEBUG("Expected \"false\" but got \"f%c%c%c%c\"", + RollbarCrashLOG_DEBUG("Expected \"false\" but got \"f%c%c%c%c\"", context->bufferPtr[1], context->bufferPtr[2], context->bufferPtr[3], context->bufferPtr[4]); - return KSJSON_ERROR_INVALID_CHARACTER; + return RollbarCrashJSON_ERROR_INVALID_CHARACTER; } context->bufferPtr += 5; return context->callbacks->onBooleanElement(name, false, context->userData); @@ -1019,16 +1019,16 @@ static int decodeElement(const char* const name, KSJSONDecodeContext* context) { unlikely_if(context->bufferEnd - context->bufferPtr < 4) { - KSLOG_DEBUG("Premature end of data"); - return KSJSON_ERROR_INCOMPLETE; + RollbarCrashLOG_DEBUG("Premature end of data"); + return RollbarCrashJSON_ERROR_INCOMPLETE; } unlikely_if(!(context->bufferPtr[1] == 'r' && context->bufferPtr[2] == 'u' && context->bufferPtr[3] == 'e')) { - KSLOG_DEBUG("Expected \"true\" but got \"t%c%c%c\"", + RollbarCrashLOG_DEBUG("Expected \"true\" but got \"t%c%c%c\"", context->bufferPtr[1], context->bufferPtr[2], context->bufferPtr[3]); - return KSJSON_ERROR_INVALID_CHARACTER; + return RollbarCrashJSON_ERROR_INVALID_CHARACTER; } context->bufferPtr += 4; return context->callbacks->onBooleanElement(name, true, context->userData); @@ -1037,16 +1037,16 @@ static int decodeElement(const char* const name, KSJSONDecodeContext* context) { unlikely_if(context->bufferEnd - context->bufferPtr < 4) { - KSLOG_DEBUG("Premature end of data"); - return KSJSON_ERROR_INCOMPLETE; + RollbarCrashLOG_DEBUG("Premature end of data"); + return RollbarCrashJSON_ERROR_INCOMPLETE; } unlikely_if(!(context->bufferPtr[1] == 'u' && context->bufferPtr[2] == 'l' && context->bufferPtr[3] == 'l')) { - KSLOG_DEBUG("Expected \"null\" but got \"n%c%c%c\"", + RollbarCrashLOG_DEBUG("Expected \"null\" but got \"n%c%c%c\"", context->bufferPtr[1], context->bufferPtr[2], context->bufferPtr[3]); - return KSJSON_ERROR_INVALID_CHARACTER; + return RollbarCrashJSON_ERROR_INVALID_CHARACTER; } context->bufferPtr += 4; return context->callbacks->onNullElement(name, context->userData); @@ -1056,8 +1056,8 @@ static int decodeElement(const char* const name, KSJSONDecodeContext* context) context->bufferPtr++; unlikely_if(!isdigit(*context->bufferPtr)) { - KSLOG_DEBUG("Not a digit: '%c'", *context->bufferPtr); - return KSJSON_ERROR_INVALID_CHARACTER; + RollbarCrashLOG_DEBUG("Not a digit: '%c'", *context->bufferPtr); + return RollbarCrashJSON_ERROR_INVALID_CHARACTER; } // Fall through case '0': case '1': case '2': case '3': case '4': @@ -1085,8 +1085,8 @@ static int decodeElement(const char* const name, KSJSONDecodeContext* context) unlikely_if(context->bufferPtr >= context->bufferEnd) { - KSLOG_DEBUG("Premature end of data"); - return KSJSON_ERROR_INCOMPLETE; + RollbarCrashLOG_DEBUG("Premature end of data"); + return RollbarCrashJSON_ERROR_INCOMPLETE; } if(!isFPChar(*context->bufferPtr) && !isOverflow) @@ -1106,8 +1106,8 @@ static int decodeElement(const char* const name, KSJSONDecodeContext* context) unlikely_if(context->bufferPtr >= context->bufferEnd) { - KSLOG_DEBUG("Premature end of data"); - return KSJSON_ERROR_INCOMPLETE; + RollbarCrashLOG_DEBUG("Premature end of data"); + return RollbarCrashJSON_ERROR_INCOMPLETE; } // our buffer is not necessarily NULL-terminated, so @@ -1117,8 +1117,8 @@ static int decodeElement(const char* const name, KSJSONDecodeContext* context) int len = (int)(context->bufferPtr - start); if(len >= context->stringBufferLength) { - KSLOG_DEBUG("Number is too long."); - return KSJSON_ERROR_DATA_TOO_LONG; + RollbarCrashLOG_DEBUG("Number is too long."); + return RollbarCrashJSON_ERROR_DATA_TOO_LONG; } strncpy(context->stringBuffer, start, len); context->stringBuffer[len] = '\0'; @@ -1129,15 +1129,15 @@ static int decodeElement(const char* const name, KSJSONDecodeContext* context) return context->callbacks->onFloatingPointElement(name, value, context->userData); } } - KSLOG_DEBUG("Invalid character '%c'", *context->bufferPtr); - return KSJSON_ERROR_INVALID_CHARACTER; + RollbarCrashLOG_DEBUG("Invalid character '%c'", *context->bufferPtr); + return RollbarCrashJSON_ERROR_INVALID_CHARACTER; } int ksjson_decode(const char* const data, int length, char* stringBuffer, int stringBufferLength, - KSJSONDecodeCallbacks* const callbacks, + RollbarCrashJSONDecodeCallbacks* const callbacks, void* const userData, int* const errorOffset) { @@ -1145,7 +1145,7 @@ int ksjson_decode(const char* const data, int nameBufferLength = stringBufferLength / 4; stringBuffer = nameBuffer + nameBufferLength; stringBufferLength -= nameBufferLength; - KSJSONDecodeContext context = + RollbarCrashJSONDecodeContext context = { .bufferPtr = (char*)data, .bufferEnd = (char*)data + length, @@ -1160,12 +1160,12 @@ int ksjson_decode(const char* const data, const char* ptr = data; int result = decodeElement(NULL, &context); - likely_if(result == KSJSON_OK) + likely_if(result == RollbarCrashJSON_OK) { result = callbacks->onEndData(userData); } - unlikely_if(result != KSJSON_OK && errorOffset != NULL) + unlikely_if(result != RollbarCrashJSON_OK && errorOffset != NULL) { *errorOffset = (int)(ptr - data); } @@ -1177,8 +1177,8 @@ typedef void (*UpdateDecoderCallback)(struct JSONFromFileContext* context); typedef struct JSONFromFileContext { - KSJSONEncodeContext* encodeContext; - KSJSONDecodeContext* decodeContext; + RollbarCrashJSONEncodeContext* encodeContext; + RollbarCrashJSONDecodeContext* decodeContext; char* bufferStart; const char* sourceFilename; int fd; @@ -1211,7 +1211,7 @@ static void updateDecoder_readFile(struct JSONFromFileContext* context) { if(bytesRead < 0) { - KSLOG_ERROR("Error reading file %s: %s", context->sourceFilename, strerror(errno)); + RollbarCrashLOG_ERROR("Error reading file %s: %s", context->sourceFilename, strerror(errno)); } context->isEOF = true; } @@ -1289,7 +1289,7 @@ static int addJSONFromFile_onBeginArray(const char* const name, static int addJSONFromFile_onEndContainer(void* const userData) { JSONFromFileContext* context = (JSONFromFileContext*)userData; - int result = KSJSON_OK; + int result = RollbarCrashJSON_OK; if(context->closeLastContainer || context->encodeContext->containerLevel > 2) { result = ksjson_endContainer(context->encodeContext); @@ -1300,15 +1300,15 @@ static int addJSONFromFile_onEndContainer(void* const userData) static int addJSONFromFile_onEndData(__unused void* const userData) { - return KSJSON_OK; + return RollbarCrashJSON_OK; } -int ksjson_addJSONFromFile(KSJSONEncodeContext* const encodeContext, +int ksjson_addJSONFromFile(RollbarCrashJSONEncodeContext* const encodeContext, const char* restrict const name, const char* restrict const filename, const bool closeLastContainer) { - KSJSONDecodeCallbacks callbacks = + RollbarCrashJSONDecodeCallbacks callbacks = { .onBeginArray = addJSONFromFile_onBeginArray, .onBeginObject = addJSONFromFile_onBeginObject, @@ -1323,7 +1323,7 @@ int ksjson_addJSONFromFile(KSJSONEncodeContext* const encodeContext, char nameBuffer[100] = {0}; char stringBuffer[500] = {0}; char fileBuffer[1000] = {0}; - KSJSONDecodeContext decodeContext = + RollbarCrashJSONDecodeContext decodeContext = { .bufferPtr = fileBuffer, .bufferEnd = fileBuffer + sizeof(fileBuffer), @@ -1364,13 +1364,13 @@ int ksjson_addJSONFromFile(KSJSONEncodeContext* const encodeContext, return result; } -int ksjson_addJSONElement(KSJSONEncodeContext* const encodeContext, +int ksjson_addJSONElement(RollbarCrashJSONEncodeContext* const encodeContext, const char* restrict const name, const char* restrict const jsonData, const int jsonDataLength, const bool closeLastContainer) { - KSJSONDecodeCallbacks callbacks = + RollbarCrashJSONDecodeCallbacks callbacks = { .onBeginArray = addJSONFromFile_onBeginArray, .onBeginObject = addJSONFromFile_onBeginObject, @@ -1384,7 +1384,7 @@ int ksjson_addJSONElement(KSJSONEncodeContext* const encodeContext, }; char nameBuffer[100] = {0}; char stringBuffer[5000] = {0}; - KSJSONDecodeContext decodeContext = + RollbarCrashJSONDecodeContext decodeContext = { .bufferPtr = jsonData, .bufferEnd = jsonData + jsonDataLength, diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashJSONCodec.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashJSONCodec.h index d56bb7ca..c6277700 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashJSONCodec.h +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashJSONCodec.h @@ -1,5 +1,5 @@ // -// KSJSONCodec.h +// RollbarCrashJSONCodec.h // // Created by Karl Stenerud on 2012-01-07. // @@ -29,8 +29,8 @@ */ -#ifndef HDR_KSJSONCodec_h -#define HDR_KSJSONCodec_h +#ifndef HDR_RollbarCrashJSONCodec_h +#define HDR_RollbarCrashJSONCodec_h #ifdef __cplusplus extern "C" { @@ -43,34 +43,34 @@ extern "C" { /* Tells the encoder to automatically determine the length of a field value. * Currently, this is done using strlen(). */ -#define KSJSON_SIZE_AUTOMATIC -1 +#define RollbarCrashJSON_SIZE_AUTOMATIC -1 enum { /** Encoding or decoding: Everything completed without error */ - KSJSON_OK = 0, + RollbarCrashJSON_OK = 0, /** Encoding or decoding: Encountered an unexpected or invalid character */ - KSJSON_ERROR_INVALID_CHARACTER = 1, + RollbarCrashJSON_ERROR_INVALID_CHARACTER = 1, /** Decoding: Source data was too long. */ - KSJSON_ERROR_DATA_TOO_LONG = 2, + RollbarCrashJSON_ERROR_DATA_TOO_LONG = 2, /** Encoding: addJSONData could not handle the data. * This code is not used by the decoder, but is meant to be returned by * the addJSONData callback method if it couldn't handle the data. */ - KSJSON_ERROR_CANNOT_ADD_DATA = 3, + RollbarCrashJSON_ERROR_CANNOT_ADD_DATA = 3, /** Decoding: Source data appears to be truncated. */ - KSJSON_ERROR_INCOMPLETE = 4, + RollbarCrashJSON_ERROR_INCOMPLETE = 4, /** Decoding: Parsing failed due to bad data structure/type/contents. * This code is not used by the decoder, but is meant to be returned * by the user callback methods if the decoded data is incorrect for * semantic or structural reasons. */ - KSJSON_ERROR_INVALID_DATA = 5, + RollbarCrashJSON_ERROR_INVALID_DATA = 5, }; /** Get a description for an error code. @@ -94,15 +94,15 @@ const char* ksjson_stringForError(const int error); * * @param userData user-specified contextual data. * - * @return KSJSON_OK if the data was handled. - * otherwise KSJSON_ERROR_CANNOT_ADD_DATA. + * @return RollbarCrashJSON_OK if the data was handled. + * otherwise RollbarCrashJSON_ERROR_CANNOT_ADD_DATA. */ -typedef int (*KSJSONAddDataFunc)(const char* data, int length, void* userData); +typedef int (*RollbarCrashJSONAddDataFunc)(const char* data, int length, void* userData); typedef struct { /** Function to call to add more encoded JSON data. */ - KSJSONAddDataFunc addJSONData; + RollbarCrashJSONAddDataFunc addJSONData; /** User-specified data */ void* userData; @@ -118,7 +118,7 @@ typedef struct bool prettyPrint; -} KSJSONEncodeContext; +} RollbarCrashJSONEncodeContext; /** Begin a new encoding process. @@ -131,16 +131,16 @@ typedef struct * * @param userData User-specified data which gets passed to addJSONData. */ -void ksjson_beginEncode(KSJSONEncodeContext* context, +void ksjson_beginEncode(RollbarCrashJSONEncodeContext* context, bool prettyPrint, - KSJSONAddDataFunc addJSONData, + RollbarCrashJSONAddDataFunc addJSONData, void* userData); /** End the encoding process, ending any remaining open containers. * - * @return KSJSON_OK if the process was successful. + * @return RollbarCrashJSON_OK if the process was successful. */ -int ksjson_endEncode(KSJSONEncodeContext* context); +int ksjson_endEncode(RollbarCrashJSONEncodeContext* context); /** Add a boolean element. * @@ -150,9 +150,9 @@ int ksjson_endEncode(KSJSONEncodeContext* context); * * @param value The element's value. * - * @return KSJSON_OK if the process was successful. + * @return RollbarCrashJSON_OK if the process was successful. */ -int ksjson_addBooleanElement(KSJSONEncodeContext* context, +int ksjson_addBooleanElement(RollbarCrashJSONEncodeContext* context, const char* name, bool value); @@ -164,9 +164,9 @@ int ksjson_addBooleanElement(KSJSONEncodeContext* context, * * @param value The element's value. * - * @return KSJSON_OK if the process was successful. + * @return RollbarCrashJSON_OK if the process was successful. */ -int ksjson_addIntegerElement(KSJSONEncodeContext* context, +int ksjson_addIntegerElement(RollbarCrashJSONEncodeContext* context, const char* name, int64_t value); @@ -178,9 +178,9 @@ int ksjson_addIntegerElement(KSJSONEncodeContext* context, * * @param value The element's value. * - * @return KSJSON_OK if the process was successful. + * @return RollbarCrashJSON_OK if the process was successful. */ -int ksjson_addUIntegerElement(KSJSONEncodeContext* const context, +int ksjson_addUIntegerElement(RollbarCrashJSONEncodeContext* const context, const char* const name, uint64_t value); @@ -192,9 +192,9 @@ int ksjson_addUIntegerElement(KSJSONEncodeContext* const context, * * @param value The element's value. * - * @return KSJSON_OK if the process was successful. + * @return RollbarCrashJSON_OK if the process was successful. */ -int ksjson_addFloatingPointElement(KSJSONEncodeContext* context, +int ksjson_addFloatingPointElement(RollbarCrashJSONEncodeContext* context, const char* name, double value); @@ -204,9 +204,9 @@ int ksjson_addFloatingPointElement(KSJSONEncodeContext* context, * * @param name The element's name. * - * @return KSJSON_OK if the process was successful. + * @return RollbarCrashJSON_OK if the process was successful. */ -int ksjson_addNullElement(KSJSONEncodeContext* context, +int ksjson_addNullElement(RollbarCrashJSONEncodeContext* context, const char* name); /** Add a string element. @@ -217,11 +217,11 @@ int ksjson_addNullElement(KSJSONEncodeContext* context, * * @param value The element's value. * - * @param length the length of the string, or KSJSON_SIZE_AUTOMATIC. + * @param length the length of the string, or RollbarCrashJSON_SIZE_AUTOMATIC. * - * @return KSJSON_OK if the process was successful. + * @return RollbarCrashJSON_OK if the process was successful. */ -int ksjson_addStringElement(KSJSONEncodeContext* context, +int ksjson_addStringElement(RollbarCrashJSONEncodeContext* context, const char* name, const char* value, int length); @@ -234,9 +234,9 @@ int ksjson_addStringElement(KSJSONEncodeContext* context, * * @param name The element's name. * - * @return KSJSON_OK if the process was successful. + * @return RollbarCrashJSON_OK if the process was successful. */ -int ksjson_beginStringElement(KSJSONEncodeContext* context, +int ksjson_beginStringElement(RollbarCrashJSONEncodeContext* context, const char* name); /** Add a string fragment to an incrementally-built string element. @@ -247,9 +247,9 @@ int ksjson_beginStringElement(KSJSONEncodeContext* context, * * @param length the length of the string fragment. * - * @return KSJSON_OK if the process was successful. + * @return RollbarCrashJSON_OK if the process was successful. */ -int ksjson_appendStringElement(KSJSONEncodeContext* context, +int ksjson_appendStringElement(RollbarCrashJSONEncodeContext* context, const char* value, int length); @@ -257,9 +257,9 @@ int ksjson_appendStringElement(KSJSONEncodeContext* context, * * @param context The encoding context. * - * @return KSJSON_OK if the process was successful. + * @return RollbarCrashJSON_OK if the process was successful. */ -int ksjson_endStringElement(KSJSONEncodeContext* context); +int ksjson_endStringElement(RollbarCrashJSONEncodeContext* context); /** Add a string element. The element will be converted to string-coded hex. * @@ -271,9 +271,9 @@ int ksjson_endStringElement(KSJSONEncodeContext* context); * * @param length The length of the data. * - * @return KSJSON_OK if the process was successful. + * @return RollbarCrashJSON_OK if the process was successful. */ -int ksjson_addDataElement(KSJSONEncodeContext* const context, +int ksjson_addDataElement(RollbarCrashJSONEncodeContext* const context, const char* name, const char* value, int length); @@ -287,9 +287,9 @@ int ksjson_addDataElement(KSJSONEncodeContext* const context, * * @param name The element's name. * - * @return KSJSON_OK if the process was successful. + * @return RollbarCrashJSON_OK if the process was successful. */ -int ksjson_beginDataElement(KSJSONEncodeContext* const context, +int ksjson_beginDataElement(RollbarCrashJSONEncodeContext* const context, const char* const name); /** Add a data fragment to an incrementally-built data element. @@ -300,9 +300,9 @@ int ksjson_beginDataElement(KSJSONEncodeContext* const context, * * @param length the length of the data fragment. * - * @return KSJSON_OK if the process was successful. + * @return RollbarCrashJSON_OK if the process was successful. */ -int ksjson_appendDataElement(KSJSONEncodeContext* const context, +int ksjson_appendDataElement(RollbarCrashJSONEncodeContext* const context, const char* const value, int length); @@ -310,9 +310,9 @@ int ksjson_appendDataElement(KSJSONEncodeContext* const context, * * @param context The encoding context. * - * @return KSJSON_OK if the process was successful. + * @return RollbarCrashJSON_OK if the process was successful. */ -int ksjson_endDataElement(KSJSONEncodeContext* const context); +int ksjson_endDataElement(RollbarCrashJSONEncodeContext* const context); /** Add a pre-formatted JSON element. * @@ -326,9 +326,9 @@ int ksjson_endDataElement(KSJSONEncodeContext* const context); * * @param closeLastContainer If false, do not close the last container. * - * @return KSJSON_OK if the process was successful. + * @return RollbarCrashJSON_OK if the process was successful. */ -int ksjson_addJSONElement(KSJSONEncodeContext* const encodeContext, +int ksjson_addJSONElement(RollbarCrashJSONEncodeContext* const encodeContext, const char* restrict const name, const char* restrict const jsonData, const int jsonDataLength, @@ -340,9 +340,9 @@ int ksjson_addJSONElement(KSJSONEncodeContext* const encodeContext, * * @param name The object's name. * - * @return KSJSON_OK if the process was successful. + * @return RollbarCrashJSON_OK if the process was successful. */ -int ksjson_beginObject(KSJSONEncodeContext* context, +int ksjson_beginObject(RollbarCrashJSONEncodeContext* context, const char* name); /** Begin a new array container. @@ -351,9 +351,9 @@ int ksjson_beginObject(KSJSONEncodeContext* context, * * @param name The array's name. * - * @return KSJSON_OK if the process was successful. + * @return RollbarCrashJSON_OK if the process was successful. */ -int ksjson_beginArray(KSJSONEncodeContext* context, +int ksjson_beginArray(RollbarCrashJSONEncodeContext* context, const char* name); /** Begin a generic JSON element, adding any necessary JSON preamble text, @@ -364,7 +364,7 @@ int ksjson_beginArray(KSJSONEncodeContext* context, * * @param name The name of the next element (only needed if parent is a dictionary). */ -int ksjson_beginElement(KSJSONEncodeContext* const context, +int ksjson_beginElement(RollbarCrashJSONEncodeContext* const context, const char* const name); /** Add JSON data manually. @@ -376,9 +376,9 @@ int ksjson_beginElement(KSJSONEncodeContext* const context, * * @param length The length of the data. * - * @return KSJSON_OK if the process was successful. + * @return RollbarCrashJSON_OK if the process was successful. */ -int ksjson_addRawJSONData(KSJSONEncodeContext* const context, +int ksjson_addRawJSONData(RollbarCrashJSONEncodeContext* const context, const char* const data, const int length); @@ -386,9 +386,9 @@ int ksjson_addRawJSONData(KSJSONEncodeContext* const context, * * @param context The encoding context. * - * @return KSJSON_OK if the process was successful. + * @return RollbarCrashJSON_OK if the process was successful. */ -int ksjson_endContainer(KSJSONEncodeContext* context); +int ksjson_endContainer(RollbarCrashJSONEncodeContext* context); /** Decode and add JSON data from a file. * @@ -400,7 +400,7 @@ int ksjson_endContainer(KSJSONEncodeContext* context); * * @param closeLastContainer If false, do not close the last container. */ -int ksjson_addJSONFromFile(KSJSONEncodeContext* const context, +int ksjson_addJSONFromFile(RollbarCrashJSONEncodeContext* const context, const char* restrict const name, const char* restrict const filename, const bool closeLastContainer); @@ -415,7 +415,7 @@ int ksjson_addJSONFromFile(KSJSONEncodeContext* const context, * Callbacks called during a JSON decode process. * All function pointers must point to valid functions. */ -typedef struct KSJSONDecodeCallbacks +typedef struct RollbarCrashJSONDecodeCallbacks { /** Called when a boolean element is decoded. * @@ -425,7 +425,7 @@ typedef struct KSJSONDecodeCallbacks * * @param userData Data that was specified when calling ksjson_decode(). * - * @return KSJSON_OK if decoding should continue. + * @return RollbarCrashJSON_OK if decoding should continue. */ int (*onBooleanElement)(const char* name, bool value, @@ -439,7 +439,7 @@ typedef struct KSJSONDecodeCallbacks * * @param userData Data that was specified when calling ksjson_decode(). * - * @return KSJSON_OK if decoding should continue. + * @return RollbarCrashJSON_OK if decoding should continue. */ int (*onFloatingPointElement)(const char* name, double value, @@ -453,7 +453,7 @@ typedef struct KSJSONDecodeCallbacks * * @param userData Data that was specified when calling ksjson_decode(). * - * @return KSJSON_OK if decoding should continue. + * @return RollbarCrashJSON_OK if decoding should continue. */ int (*onIntegerElement)(const char* name, int64_t value, @@ -465,7 +465,7 @@ typedef struct KSJSONDecodeCallbacks * * @param userData Data that was specified when calling ksjson_decode(). * - * @return KSJSON_OK if decoding should continue. + * @return RollbarCrashJSON_OK if decoding should continue. */ int (*onNullElement)(const char* name, void* userData); @@ -478,7 +478,7 @@ typedef struct KSJSONDecodeCallbacks * * @param userData Data that was specified when calling ksjson_decode(). * - * @return KSJSON_OK if decoding should continue. + * @return RollbarCrashJSON_OK if decoding should continue. */ int (*onStringElement)(const char* name, const char* value, @@ -490,7 +490,7 @@ typedef struct KSJSONDecodeCallbacks * * @param userData Data that was specified when calling ksjson_decode(). * - * @return KSJSON_OK if decoding should continue. + * @return RollbarCrashJSON_OK if decoding should continue. */ int (*onBeginObject)(const char* name, void* userData); @@ -501,7 +501,7 @@ typedef struct KSJSONDecodeCallbacks * * @param userData Data that was specified when calling ksjson_decode(). * - * @return KSJSON_OK if decoding should continue. + * @return RollbarCrashJSON_OK if decoding should continue. */ int (*onBeginArray)(const char* name, void* userData); @@ -511,7 +511,7 @@ typedef struct KSJSONDecodeCallbacks * * @param userData Data that was specified when calling ksjson_decode(). * - * @return KSJSON_OK if decoding should continue. + * @return RollbarCrashJSON_OK if decoding should continue. */ int (*onEndContainer)(void* userData); @@ -519,11 +519,11 @@ typedef struct KSJSONDecodeCallbacks * * @param userData Data that was specified when calling ksjson_decode(). * - * @return KSJSON_OK if decoding should continue. + * @return RollbarCrashJSON_OK if decoding should continue. */ int (*onEndData)(void* userData); -} KSJSONDecodeCallbacks; +} RollbarCrashJSONDecodeCallbacks; /** Read a JSON encoded file from the specified FD. @@ -544,13 +544,13 @@ typedef struct KSJSONDecodeCallbacks * @oaram errorOffset If not null, will contain the offset into the data * where the error (if any) occurred. * - * @return KSJSON_OK if succesful. An error code otherwise. + * @return RollbarCrashJSON_OK if succesful. An error code otherwise. */ int ksjson_decode(const char* data, int length, char* stringBuffer, int stringBufferLength, - KSJSONDecodeCallbacks* callbacks, + RollbarCrashJSONDecodeCallbacks* callbacks, void* userData, int* errorOffset); @@ -559,4 +559,4 @@ int ksjson_decode(const char* data, } #endif -#endif // HDR_KSJSONCodec_h +#endif // HDR_RollbarCrashJSONCodec_h diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashJSONCodecObjC.m b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashJSONCodecObjC.m index 0e93d0eb..603c9c78 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashJSONCodecObjC.m +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashJSONCodecObjC.m @@ -1,5 +1,5 @@ // -// KSJSONCodecObjC.m +// RollbarCrashJSONCodecObjC.m // // Created by Karl Stenerud on 2012-01-08. // @@ -25,19 +25,19 @@ // -#import "KSJSONCodecObjC.h" +#import "RollbarCrashJSONCodecObjC.h" -#import "KSJSONCodec.h" +#import "RollbarCrashJSONCodec.h" #import "NSError+SimpleConstructor.h" -#import "KSDate.h" +#import "RollbarCrashDate.h" -@interface KSJSONCodec () +@interface RollbarCrashJSONCodec () #pragma mark Properties /** Callbacks from the C library */ -@property(nonatomic,readwrite,assign) KSJSONDecodeCallbacks* callbacks; +@property(nonatomic,readwrite,assign) RollbarCrashJSONDecodeCallbacks* callbacks; /** Stack of arrays/objects as the decoded content is built */ @property(nonatomic,readwrite,retain) NSMutableArray* containerStack; @@ -77,8 +77,8 @@ @interface KSJSONCodec () * * @return A new codec. */ -+ (KSJSONCodec*) codecWithEncodeOptions:(KSJSONEncodeOption) encodeOptions - decodeOptions:(KSJSONDecodeOption) decodeOptions; ++ (RollbarCrashJSONCodec*) codecWithEncodeOptions:(RollbarCrashJSONEncodeOption) encodeOptions + decodeOptions:(RollbarCrashJSONDecodeOption) decodeOptions; /** Initializer. * @@ -88,8 +88,8 @@ + (KSJSONCodec*) codecWithEncodeOptions:(KSJSONEncodeOption) encodeOptions * * @return The initialized codec. */ -- (id) initWithEncodeOptions:(KSJSONEncodeOption) encodeOptions - decodeOptions:(KSJSONDecodeOption) decodeOptions; +- (id) initWithEncodeOptions:(RollbarCrashJSONEncodeOption) encodeOptions + decodeOptions:(RollbarCrashJSONDecodeOption) decodeOptions; @end @@ -98,7 +98,7 @@ - (id) initWithEncodeOptions:(KSJSONEncodeOption) encodeOptions #pragma mark - -@implementation KSJSONCodec +@implementation RollbarCrashJSONCodec #pragma mark Properties @@ -115,14 +115,14 @@ @implementation KSJSONCodec #pragma mark Constructors/Destructor -+ (KSJSONCodec*) codecWithEncodeOptions:(KSJSONEncodeOption) encodeOptions - decodeOptions:(KSJSONDecodeOption) decodeOptions ++ (RollbarCrashJSONCodec*) codecWithEncodeOptions:(RollbarCrashJSONEncodeOption) encodeOptions + decodeOptions:(RollbarCrashJSONDecodeOption) decodeOptions { return [[self alloc] initWithEncodeOptions:encodeOptions decodeOptions:decodeOptions]; } -- (id) initWithEncodeOptions:(KSJSONEncodeOption) encodeOptions - decodeOptions:(KSJSONDecodeOption) decodeOptions +- (id) initWithEncodeOptions:(RollbarCrashJSONEncodeOption) encodeOptions + decodeOptions:(RollbarCrashJSONDecodeOption) decodeOptions { if((self = [super init])) { @@ -137,10 +137,10 @@ - (id) initWithEncodeOptions:(KSJSONEncodeOption) encodeOptions self.callbacks->onIntegerElement = onIntegerElement; self.callbacks->onNullElement = onNullElement; self.callbacks->onStringElement = onStringElement; - self.prettyPrint = (encodeOptions & KSJSONEncodeOptionPretty) != 0; - self.sorted = (encodeOptions & KSJSONEncodeOptionSorted) != 0; - self.ignoreNullsInArrays = (decodeOptions & KSJSONDecodeOptionIgnoreNullInArray) != 0; - self.ignoreNullsInObjects = (decodeOptions & KSJSONDecodeOptionIgnoreNullInObject) != 0; + self.prettyPrint = (encodeOptions & RollbarCrashJSONEncodeOptionPretty) != 0; + self.sorted = (encodeOptions & RollbarCrashJSONEncodeOptionSorted) != 0; + self.ignoreNullsInArrays = (decodeOptions & RollbarCrashJSONDecodeOptionIgnoreNullInArray) != 0; + self.ignoreNullsInObjects = (decodeOptions & RollbarCrashJSONDecodeOptionIgnoreNullInObject) != 0; } return self; } @@ -163,15 +163,15 @@ - (void) dealloc #pragma mark Callbacks -static int onElement(KSJSONCodec* codec, NSString* name, id element) +static int onElement(RollbarCrashJSONCodec* codec, NSString* name, id element) { if(codec->_currentContainer == nil) { - codec.error = [NSError errorWithDomain:@"KSJSONCodecObjC" + codec.error = [NSError errorWithDomain:@"RollbarCrashJSONCodecObjC" code:0 description:@"Type %@ not allowed as top level container", [element class]]; - return KSJSON_ERROR_INVALID_DATA; + return RollbarCrashJSON_ERROR_INVALID_DATA; } if([codec->_currentContainer isKindOfClass:[NSMutableDictionary class]]) @@ -183,10 +183,10 @@ static int onElement(KSJSONCodec* codec, NSString* name, id element) { [(NSMutableArray*)codec->_currentContainer addObject:element]; } - return KSJSON_OK; + return RollbarCrashJSON_OK; } -static int onBeginContainer(KSJSONCodec* codec, NSString* name, id container) +static int onBeginContainer(RollbarCrashJSONCodec* codec, NSString* name, id container) { if(codec->_topLevelContainer == nil) { @@ -195,21 +195,21 @@ static int onBeginContainer(KSJSONCodec* codec, NSString* name, id container) else { int result = onElement(codec, name, container); - if(result != KSJSON_OK) + if(result != RollbarCrashJSON_OK) { return result; } } codec->_currentContainer = container; [codec->_containerStack addObject:container]; - return KSJSON_OK; + return RollbarCrashJSON_OK; } static int onBooleanElement(const char* const cName, const bool value, void* const userData) { NSString* name = stringFromCString(cName); id element = [NSNumber numberWithBool:value]; - KSJSONCodec* codec = (__bridge KSJSONCodec*)userData; + RollbarCrashJSONCodec* codec = (__bridge RollbarCrashJSONCodec*)userData; return onElement(codec, name, element); } @@ -217,7 +217,7 @@ static int onFloatingPointElement(const char* const cName, const double value, v { NSString* name = stringFromCString(cName); id element = [NSNumber numberWithDouble:value]; - KSJSONCodec* codec = (__bridge KSJSONCodec*)userData; + RollbarCrashJSONCodec* codec = (__bridge RollbarCrashJSONCodec*)userData; return onElement(codec, name, element); } @@ -227,21 +227,21 @@ static int onIntegerElement(const char* const cName, { NSString* name = stringFromCString(cName); id element = [NSNumber numberWithLongLong:value]; - KSJSONCodec* codec = (__bridge KSJSONCodec*)userData; + RollbarCrashJSONCodec* codec = (__bridge RollbarCrashJSONCodec*)userData; return onElement(codec, name, element); } static int onNullElement(const char* const cName, void* const userData) { NSString* name = stringFromCString(cName); - KSJSONCodec* codec = (__bridge KSJSONCodec*)userData; + RollbarCrashJSONCodec* codec = (__bridge RollbarCrashJSONCodec*)userData; if((codec->_ignoreNullsInArrays && [codec->_currentContainer isKindOfClass:[NSArray class]]) || (codec->_ignoreNullsInObjects && [codec->_currentContainer isKindOfClass:[NSDictionary class]])) { - return KSJSON_OK; + return RollbarCrashJSON_OK; } return onElement(codec, name, [NSNull null]); @@ -252,7 +252,7 @@ static int onStringElement(const char* const cName, const char* const value, voi NSString* name = stringFromCString(cName); id element = [NSString stringWithCString:value encoding:NSUTF8StringEncoding]; - KSJSONCodec* codec = (__bridge KSJSONCodec*)userData; + RollbarCrashJSONCodec* codec = (__bridge RollbarCrashJSONCodec*)userData; return onElement(codec, name, element); } @@ -260,7 +260,7 @@ static int onBeginObject(const char* const cName, void* const userData) { NSString* name = stringFromCString(cName); id container = [NSMutableDictionary dictionary]; - KSJSONCodec* codec = (__bridge KSJSONCodec*)userData; + RollbarCrashJSONCodec* codec = (__bridge RollbarCrashJSONCodec*)userData; return onBeginContainer(codec, name, container); } @@ -268,20 +268,20 @@ static int onBeginArray(const char* const cName, void* const userData) { NSString* name = stringFromCString(cName); id container = [NSMutableArray array]; - KSJSONCodec* codec = (__bridge KSJSONCodec*)userData; + RollbarCrashJSONCodec* codec = (__bridge RollbarCrashJSONCodec*)userData; return onBeginContainer(codec, name, container); } static int onEndContainer(void* const userData) { - KSJSONCodec* codec = (__bridge KSJSONCodec*)userData; + RollbarCrashJSONCodec* codec = (__bridge RollbarCrashJSONCodec*)userData; if([codec->_containerStack count] == 0) { - codec.error = [NSError errorWithDomain:@"KSJSONCodecObjC" + codec.error = [NSError errorWithDomain:@"RollbarCrashJSONCodecObjC" code:0 description:@"Already at the top level; no container left to end"]; - return KSJSON_ERROR_INVALID_DATA; + return RollbarCrashJSON_ERROR_INVALID_DATA; } [codec->_containerStack removeLastObject]; NSUInteger count = [codec->_containerStack count]; @@ -293,22 +293,22 @@ static int onEndContainer(void* const userData) { codec->_currentContainer = nil; } - return KSJSON_OK; + return RollbarCrashJSON_OK; } static int onEndData(__unused void* const userData) { - return KSJSON_OK; + return RollbarCrashJSON_OK; } static int addJSONData(const char* const bytes, const int length, void* const userData) { NSMutableData* data = (__bridge NSMutableData*)userData; [data appendBytes:bytes length:(unsigned)length]; - return KSJSON_OK; + return RollbarCrashJSON_OK; } -static int encodeObject(KSJSONCodec* codec, id object, NSString* name, KSJSONEncodeContext* context) +static int encodeObject(RollbarCrashJSONCodec* codec, id object, NSString* name, RollbarCrashJSONEncodeContext* context) { int result; const char* cName = [name UTF8String]; @@ -316,9 +316,9 @@ static int encodeObject(KSJSONCodec* codec, id object, NSString* name, KSJSONEnc { NSData* data = [object dataUsingEncoding:NSUTF8StringEncoding]; result = ksjson_addStringElement(context, cName, data.bytes, (int)data.length); - if(result == KSJSON_ERROR_INVALID_CHARACTER) + if(result == RollbarCrashJSON_ERROR_INVALID_CHARACTER) { - codec.error = [NSError errorWithDomain:@"KSJSONCodecObjC" + codec.error = [NSError errorWithDomain:@"RollbarCrashJSONCodecObjC" code:0 description:@"Invalid character in %@", object]; } @@ -344,13 +344,13 @@ static int encodeObject(KSJSONCodec* codec, id object, NSString* name, KSJSONEnc if([object isKindOfClass:[NSArray class]]) { - if((result = ksjson_beginArray(context, cName)) != KSJSON_OK) + if((result = ksjson_beginArray(context, cName)) != RollbarCrashJSON_OK) { return result; } for(id subObject in object) { - if((result = encodeObject(codec, subObject, NULL, context)) != KSJSON_OK) + if((result = encodeObject(codec, subObject, NULL, context)) != RollbarCrashJSON_OK) { return result; } @@ -360,7 +360,7 @@ static int encodeObject(KSJSONCodec* codec, id object, NSString* name, KSJSONEnc if([object isKindOfClass:[NSDictionary class]]) { - if((result = ksjson_beginObject(context, cName)) != KSJSON_OK) + if((result = ksjson_beginObject(context, cName)) != RollbarCrashJSON_OK) { return result; } @@ -371,7 +371,7 @@ static int encodeObject(KSJSONCodec* codec, id object, NSString* name, KSJSONEnc } for(id key in keys) { - if((result = encodeObject(codec, [object valueForKey:key], key, context)) != KSJSON_OK) + if((result = encodeObject(codec, [object valueForKey:key], key, context)) != RollbarCrashJSON_OK) { return result; } @@ -399,41 +399,41 @@ static int encodeObject(KSJSONCodec* codec, id object, NSString* name, KSJSONEnc return ksjson_addDataElement(context, cName, data.bytes, (int)data.length); } - codec.error = [NSError errorWithDomain:@"KSJSONCodecObjC" + codec.error = [NSError errorWithDomain:@"RollbarCrashJSONCodecObjC" code:0 description:@"Could not determine type of %@", [object class]]; - return KSJSON_ERROR_INVALID_DATA; + return RollbarCrashJSON_ERROR_INVALID_DATA; } #pragma mark Public API + (NSData*) encode:(id) object - options:(KSJSONEncodeOption) encodeOptions + options:(RollbarCrashJSONEncodeOption) encodeOptions error:(NSError* __autoreleasing *) error { NSMutableData* data = [NSMutableData data]; - KSJSONEncodeContext JSONContext; + RollbarCrashJSONEncodeContext JSONContext; ksjson_beginEncode(&JSONContext, - encodeOptions & KSJSONEncodeOptionPretty, + encodeOptions & RollbarCrashJSONEncodeOptionPretty, addJSONData, (__bridge void*)data); - KSJSONCodec* codec = [self codecWithEncodeOptions:encodeOptions - decodeOptions:KSJSONDecodeOptionNone]; + RollbarCrashJSONCodec* codec = [self codecWithEncodeOptions:encodeOptions + decodeOptions:RollbarCrashJSONDecodeOptionNone]; int result = encodeObject(codec, object, NULL, &JSONContext); if(error != nil) { *error = codec.error; } - return result == KSJSON_OK ? data : nil; + return result == RollbarCrashJSON_OK ? data : nil; } + (id) decode:(NSData*) JSONData - options:(KSJSONDecodeOption) decodeOptions + options:(RollbarCrashJSONDecodeOption) decodeOptions error:(NSError* __autoreleasing *) error { - KSJSONCodec* codec = [self codecWithEncodeOptions:0 + RollbarCrashJSONCodec* codec = [self codecWithEncodeOptions:0 decodeOptions:decodeOptions]; NSMutableData* stringData = [NSMutableData dataWithLength:10001]; int errorOffset; @@ -443,9 +443,9 @@ + (id) decode:(NSData*) JSONData (int)stringData.length, codec.callbacks, (__bridge void*)codec, &errorOffset); - if(result != KSJSON_OK && codec.error == nil) + if(result != RollbarCrashJSON_OK && codec.error == nil) { - codec.error = [NSError errorWithDomain:@"KSJSONCodecObjC" + codec.error = [NSError errorWithDomain:@"RollbarCrashJSONCodecObjC" code:0 description:@"%s (offset %d)", ksjson_stringForError(result), @@ -456,7 +456,7 @@ + (id) decode:(NSData*) JSONData *error = codec.error; } - if(result != KSJSON_OK && !(decodeOptions & KSJSONDecodeOptionKeepPartialObject)) + if(result != RollbarCrashJSON_OK && !(decodeOptions & RollbarCrashJSONDecodeOptionKeepPartialObject)) { return nil; } diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashLogger.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashLogger.c index f3935ee6..8e7631ae 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashLogger.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashLogger.c @@ -1,5 +1,5 @@ // -// KSLogger.c +// RollbarCrashLogger.c // // Created by Karl Stenerud on 11-06-25. // @@ -25,8 +25,8 @@ // -#include "KSLogger.h" -#include "KSSystemCapabilities.h" +#include "RollbarCrashLogger.h" +#include "RollbarCrashSystemCapabilities.h" // =========================================================================== #pragma mark - Common - @@ -54,8 +54,8 @@ * * Unless you're logging from within signal handlers, it's safe to set it to 0. */ -#ifndef KSLOGGER_CBufferSize -#define KSLOGGER_CBufferSize 1024 +#ifndef RollbarCrashLOGGER_CBufferSize +#define RollbarCrashLOGGER_CBufferSize 1024 #endif /** Where console logs will be written */ @@ -94,7 +94,7 @@ static inline void writeFmtToLog(const char* fmt, ...) va_end(args); } -#if KSLOGGER_CBufferSize > 0 +#if RollbarCrashLOGGER_CBufferSize > 0 /** The file descriptor where log entries get written. */ static int g_fd = -1; @@ -128,7 +128,7 @@ static inline void writeFmtArgsToLog(const char* fmt, va_list args) } else { - char buffer[KSLOGGER_CBufferSize]; + char buffer[RollbarCrashLOGGER_CBufferSize]; vsnprintf(buffer, sizeof(buffer), fmt, args); writeToLog(buffer); } @@ -161,7 +161,7 @@ bool kslog_setLogFilename(const char* filename, bool overwrite) fd = open(filename, openMask, 0644); unlikely_if(fd < 0) { - writeFmtToLog("KSLogger: Could not open %s: %s", filename, strerror(errno)); + writeFmtToLog("RollbarCrashLogger: Could not open %s: %s", filename, strerror(errno)); return false; } if(filename != g_logFilename) @@ -174,7 +174,7 @@ bool kslog_setLogFilename(const char* filename, bool overwrite) return true; } -#else // if KSLogger_CBufferSize <= 0 +#else // if RollbarCrashLogger_CBufferSize <= 0 static FILE* g_file = NULL; @@ -227,7 +227,7 @@ bool kslog_setLogFilename(const char* filename, bool overwrite) file = fopen(filename, overwrite ? "wb" : "ab"); unlikely_if(file == NULL) { - writeFmtToLog("KSLogger: Could not open %s: %s", filename, strerror(errno)); + writeFmtToLog("RollbarCrashLogger: Could not open %s: %s", filename, strerror(errno)); return false; } } @@ -287,7 +287,7 @@ void i_kslog_logC(const char* const level, #pragma mark - Objective-C - // =========================================================================== -#if KSCRASH_HAS_OBJC +#if RollbarCrashCRASH_HAS_OBJC #include void i_kslog_logObjCBasic(CFStringRef fmt, ...) @@ -345,4 +345,4 @@ void i_kslog_logObjC(const char* const level, } CFRelease(logFmt); } -#endif // KSCRASH_HAS_OBJC +#endif // RollbarCrashCRASH_HAS_OBJC diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashLogger.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashLogger.h index 7b7b55d7..335901bc 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashLogger.h +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashLogger.h @@ -1,5 +1,5 @@ // -// KSLogger.h +// RollbarCrashLogger.h // // Created by Karl Stenerud on 11-06-25. // @@ -26,7 +26,7 @@ /** - * KSLogger + * RollbarCrashLogger * ======== * * Prints log entries to the console consisting of: @@ -48,38 +48,38 @@ * Set the log level in your "Preprocessor Macros" build setting. You may choose * TRACE, DEBUG, INFO, WARN, ERROR. If nothing is set, it defaults to ERROR. * - * Example: KSLogger_Level=WARN + * Example: RollbarCrashLogger_Level=WARN * - * Anything below the level specified for KSLogger_Level will not be compiled + * Anything below the level specified for RollbarCrashLogger_Level will not be compiled * or printed. * * * Next, include the header file: * - * #include "KSLogger.h" + * #include "RollbarCrashLogger.h" * * * Next, call the logger functions from your code (using objective-c strings * in objective-C files and regular strings in regular C files): * * Code: - * KSLOG_ERROR(@"Some error message"); + * RollbarCrashLOG_ERROR(@"Some error message"); * * Prints: * 2011-07-16 05:41:01.379 TestApp[4439:f803] ERROR: SomeClass.m (21): -[SomeFunction]: Some error message * * Code: - * KSLOG_INFO(@"Info about %@", someObject); + * RollbarCrashLOG_INFO(@"Info about %@", someObject); * * Prints: * 2011-07-16 05:44:05.239 TestApp[4473:f803] INFO : SomeClass.m (20): -[SomeFunction]: Info about * * * The "BASIC" versions of the macros behave exactly like NSLog() or printf(), - * except they respect the KSLogger_Level setting: + * except they respect the RollbarCrashLogger_Level setting: * * Code: - * KSLOGBASIC_ERROR(@"A basic log entry"); + * RollbarCrashLOGBASIC_ERROR(@"A basic log entry"); * * Prints: * 2011-07-16 05:44:05.916 TestApp[4473:f803] A basic log entry @@ -89,12 +89,12 @@ * in C files do not print the NSLog preamble: * * Objective-C version: - * KSLOG_ERROR(@"Some error message"); + * RollbarCrashLOG_ERROR(@"Some error message"); * * 2011-07-16 05:41:01.379 TestApp[4439:f803] ERROR: SomeClass.m (21): -[SomeFunction]: Some error message * * C version: - * KSLOG_ERROR("Some error message"); + * RollbarCrashLOG_ERROR("Some error message"); * * ERROR: SomeClass.c (21): SomeFunction(): Some error message * @@ -104,20 +104,20 @@ * ============= * * You can control logging messages at the local file level using the - * "KSLogger_LocalLevel" define. Note that it must be defined BEFORE - * including KSLogger.h + * "RollbarCrashLogger_LocalLevel" define. Note that it must be defined BEFORE + * including RollbarCrashLogger.h * - * The KSLOG_XX() and KSLOGBASIC_XX() macros will print out based on the LOWER - * of KSLogger_Level and KSLogger_LocalLevel, so if KSLogger_Level is DEBUG - * and KSLogger_LocalLevel is TRACE, it will print all the way down to the trace - * level for the local file where KSLogger_LocalLevel was defined, and to the + * The RollbarCrashLOG_XX() and RollbarCrashLOGBASIC_XX() macros will print out based on the LOWER + * of RollbarCrashLogger_Level and RollbarCrashLogger_LocalLevel, so if RollbarCrashLogger_Level is DEBUG + * and RollbarCrashLogger_LocalLevel is TRACE, it will print all the way down to the trace + * level for the local file where RollbarCrashLogger_LocalLevel was defined, and to the * debug level everywhere else. * * Example: * - * // KSLogger_LocalLevel, if defined, MUST come BEFORE including KSLogger.h - * #define KSLogger_LocalLevel TRACE - * #import "KSLogger.h" + * // RollbarCrashLogger_LocalLevel, if defined, MUST come BEFORE including RollbarCrashLogger.h + * #define RollbarCrashLogger_LocalLevel TRACE + * #import "RollbarCrashLogger.h" * * * =============== @@ -125,16 +125,16 @@ * =============== * * The C logger changes its behavior depending on the value of the preprocessor - * define KSLogger_CBufferSize. + * define RollbarCrashLogger_CBufferSize. * - * If KSLogger_CBufferSize is > 0, the C logger will behave in an async-safe + * If RollbarCrashLogger_CBufferSize is > 0, the C logger will behave in an async-safe * manner, calling write() instead of printf(). Any log messages that exceed the - * length specified by KSLogger_CBufferSize will be truncated. + * length specified by RollbarCrashLogger_CBufferSize will be truncated. * - * If KSLogger_CBufferSize == 0, the C logger will use printf(), and there will + * If RollbarCrashLogger_CBufferSize == 0, the C logger will use printf(), and there will * be no limit on the log message length. * - * KSLogger_CBufferSize can only be set as a preprocessor define, and will + * RollbarCrashLogger_CBufferSize can only be set as a preprocessor define, and will * default to 1024 if not specified during compilation. */ @@ -144,8 +144,8 @@ // ============================================================================ -#ifndef HDR_KSLogger_h -#define HDR_KSLogger_h +#ifndef HDR_RollbarCrashLogger_h +#define HDR_RollbarCrashLogger_h #ifdef __cplusplus extern "C" { @@ -167,8 +167,8 @@ void i_kslog_logObjC(const char* level, void i_kslog_logObjCBasic(CFStringRef fmt, ...); -#define i_KSLOG_FULL(LEVEL,FILE,LINE,FUNCTION,FMT,...) i_kslog_logObjC(LEVEL,FILE,LINE,FUNCTION,(__bridge CFStringRef)FMT,##__VA_ARGS__) -#define i_KSLOG_BASIC(FMT, ...) i_kslog_logObjCBasic((__bridge CFStringRef)FMT,##__VA_ARGS__) +#define i_RollbarCrashLOG_FULL(LEVEL,FILE,LINE,FUNCTION,FMT,...) i_kslog_logObjC(LEVEL,FILE,LINE,FUNCTION,(__bridge CFStringRef)FMT,##__VA_ARGS__) +#define i_RollbarCrashLOG_BASIC(FMT, ...) i_kslog_logObjCBasic((__bridge CFStringRef)FMT,##__VA_ARGS__) #else // __OBJC__ @@ -180,64 +180,64 @@ void i_kslog_logC(const char* level, void i_kslog_logCBasic(const char* fmt, ...); -#define i_KSLOG_FULL i_kslog_logC -#define i_KSLOG_BASIC i_kslog_logCBasic +#define i_RollbarCrashLOG_FULL i_kslog_logC +#define i_RollbarCrashLOG_BASIC i_kslog_logCBasic #endif // __OBJC__ /* Back up any existing defines by the same name */ -#ifdef KS_NONE - #define KSLOG_BAK_NONE KS_NONE - #undef KS_NONE +#ifdef RollbarCrash_NONE + #define RollbarCrashLOG_BAK_NONE RollbarCrash_NONE + #undef RollbarCrash_NONE #endif #ifdef ERROR - #define KSLOG_BAK_ERROR ERROR + #define RollbarCrashLOG_BAK_ERROR ERROR #undef ERROR #endif #ifdef WARN - #define KSLOG_BAK_WARN WARN + #define RollbarCrashLOG_BAK_WARN WARN #undef WARN #endif #ifdef INFO - #define KSLOG_BAK_INFO INFO + #define RollbarCrashLOG_BAK_INFO INFO #undef INFO #endif #ifdef DEBUG - #define KSLOG_BAK_DEBUG DEBUG + #define RollbarCrashLOG_BAK_DEBUG DEBUG #undef DEBUG #endif #ifdef TRACE - #define KSLOG_BAK_TRACE TRACE + #define RollbarCrashLOG_BAK_TRACE TRACE #undef TRACE #endif -#define KSLogger_Level_None 0 -#define KSLogger_Level_Error 10 -#define KSLogger_Level_Warn 20 -#define KSLogger_Level_Info 30 -#define KSLogger_Level_Debug 40 -#define KSLogger_Level_Trace 50 +#define RollbarCrashLogger_Level_None 0 +#define RollbarCrashLogger_Level_Error 10 +#define RollbarCrashLogger_Level_Warn 20 +#define RollbarCrashLogger_Level_Info 30 +#define RollbarCrashLogger_Level_Debug 40 +#define RollbarCrashLogger_Level_Trace 50 -#define KS_NONE KSLogger_Level_None -#define ERROR KSLogger_Level_Error -#define WARN KSLogger_Level_Warn -#define INFO KSLogger_Level_Info -#define DEBUG KSLogger_Level_Debug -#define TRACE KSLogger_Level_Trace +#define RollbarCrash_NONE RollbarCrashLogger_Level_None +#define ERROR RollbarCrashLogger_Level_Error +#define WARN RollbarCrashLogger_Level_Warn +#define INFO RollbarCrashLogger_Level_Info +#define DEBUG RollbarCrashLogger_Level_Debug +#define TRACE RollbarCrashLogger_Level_Trace -#ifndef KSLogger_Level - #define KSLogger_Level KSLogger_Level_Error +#ifndef RollbarCrashLogger_Level + #define RollbarCrashLogger_Level RollbarCrashLogger_Level_Error #endif -#ifndef KSLogger_LocalLevel - #define KSLogger_LocalLevel KSLogger_Level_None +#ifndef RollbarCrashLogger_LocalLevel + #define RollbarCrashLogger_LocalLevel RollbarCrashLogger_Level_None #endif -#define a_KSLOG_FULL(LEVEL, FMT, ...) \ - i_KSLOG_FULL(LEVEL, \ +#define a_RollbarCrashLOG_FULL(LEVEL, FMT, ...) \ + i_RollbarCrashLOG_FULL(LEVEL, \ __FILE__, \ __LINE__, \ __PRETTY_FUNCTION__, \ @@ -264,24 +264,24 @@ bool kslog_clearLogFile(void); /** Tests if the logger would print at the specified level. * * @param LEVEL The level to test for. One of: - * KSLogger_Level_Error, - * KSLogger_Level_Warn, - * KSLogger_Level_Info, - * KSLogger_Level_Debug, - * KSLogger_Level_Trace, + * RollbarCrashLogger_Level_Error, + * RollbarCrashLogger_Level_Warn, + * RollbarCrashLogger_Level_Info, + * RollbarCrashLogger_Level_Debug, + * RollbarCrashLogger_Level_Trace, * * @return TRUE if the logger would print at the specified level. */ -#define KSLOG_PRINTS_AT_LEVEL(LEVEL) \ - (KSLogger_Level >= LEVEL || KSLogger_LocalLevel >= LEVEL) +#define RollbarCrashLOG_PRINTS_AT_LEVEL(LEVEL) \ + (RollbarCrashLogger_Level >= LEVEL || RollbarCrashLogger_LocalLevel >= LEVEL) /** Log a message regardless of the log settings. * Normal version prints out full context. Basic version prints directly. * * @param FMT The format specifier, followed by its arguments. */ -#define KSLOG_ALWAYS(FMT, ...) a_KSLOG_FULL("FORCE", FMT, ##__VA_ARGS__) -#define KSLOGBASIC_ALWAYS(FMT, ...) i_KSLOG_BASIC(FMT, ##__VA_ARGS__) +#define RollbarCrashLOG_ALWAYS(FMT, ...) a_RollbarCrashLOG_FULL("FORCE", FMT, ##__VA_ARGS__) +#define RollbarCrashLOGBASIC_ALWAYS(FMT, ...) i_RollbarCrashLOG_BASIC(FMT, ##__VA_ARGS__) /** Log an error. @@ -289,12 +289,12 @@ bool kslog_clearLogFile(void); * * @param FMT The format specifier, followed by its arguments. */ -#if KSLOG_PRINTS_AT_LEVEL(KSLogger_Level_Error) - #define KSLOG_ERROR(FMT, ...) a_KSLOG_FULL("ERROR", FMT, ##__VA_ARGS__) - #define KSLOGBASIC_ERROR(FMT, ...) i_KSLOG_BASIC(FMT, ##__VA_ARGS__) +#if RollbarCrashLOG_PRINTS_AT_LEVEL(RollbarCrashLogger_Level_Error) + #define RollbarCrashLOG_ERROR(FMT, ...) a_RollbarCrashLOG_FULL("ERROR", FMT, ##__VA_ARGS__) + #define RollbarCrashLOGBASIC_ERROR(FMT, ...) i_RollbarCrashLOG_BASIC(FMT, ##__VA_ARGS__) #else - #define KSLOG_ERROR(FMT, ...) - #define KSLOGBASIC_ERROR(FMT, ...) + #define RollbarCrashLOG_ERROR(FMT, ...) + #define RollbarCrashLOGBASIC_ERROR(FMT, ...) #endif /** Log a warning. @@ -302,12 +302,12 @@ bool kslog_clearLogFile(void); * * @param FMT The format specifier, followed by its arguments. */ -#if KSLOG_PRINTS_AT_LEVEL(KSLogger_Level_Warn) - #define KSLOG_WARN(FMT, ...) a_KSLOG_FULL("WARN ", FMT, ##__VA_ARGS__) - #define KSLOGBASIC_WARN(FMT, ...) i_KSLOG_BASIC(FMT, ##__VA_ARGS__) +#if RollbarCrashLOG_PRINTS_AT_LEVEL(RollbarCrashLogger_Level_Warn) + #define RollbarCrashLOG_WARN(FMT, ...) a_RollbarCrashLOG_FULL("WARN ", FMT, ##__VA_ARGS__) + #define RollbarCrashLOGBASIC_WARN(FMT, ...) i_RollbarCrashLOG_BASIC(FMT, ##__VA_ARGS__) #else - #define KSLOG_WARN(FMT, ...) - #define KSLOGBASIC_WARN(FMT, ...) + #define RollbarCrashLOG_WARN(FMT, ...) + #define RollbarCrashLOGBASIC_WARN(FMT, ...) #endif /** Log an info message. @@ -315,12 +315,12 @@ bool kslog_clearLogFile(void); * * @param FMT The format specifier, followed by its arguments. */ -#if KSLOG_PRINTS_AT_LEVEL(KSLogger_Level_Info) - #define KSLOG_INFO(FMT, ...) a_KSLOG_FULL("INFO ", FMT, ##__VA_ARGS__) - #define KSLOGBASIC_INFO(FMT, ...) i_KSLOG_BASIC(FMT, ##__VA_ARGS__) +#if RollbarCrashLOG_PRINTS_AT_LEVEL(RollbarCrashLogger_Level_Info) + #define RollbarCrashLOG_INFO(FMT, ...) a_RollbarCrashLOG_FULL("INFO ", FMT, ##__VA_ARGS__) + #define RollbarCrashLOGBASIC_INFO(FMT, ...) i_RollbarCrashLOG_BASIC(FMT, ##__VA_ARGS__) #else - #define KSLOG_INFO(FMT, ...) - #define KSLOGBASIC_INFO(FMT, ...) + #define RollbarCrashLOG_INFO(FMT, ...) + #define RollbarCrashLOGBASIC_INFO(FMT, ...) #endif /** Log a debug message. @@ -328,12 +328,12 @@ bool kslog_clearLogFile(void); * * @param FMT The format specifier, followed by its arguments. */ -#if KSLOG_PRINTS_AT_LEVEL(KSLogger_Level_Debug) - #define KSLOG_DEBUG(FMT, ...) a_KSLOG_FULL("DEBUG", FMT, ##__VA_ARGS__) - #define KSLOGBASIC_DEBUG(FMT, ...) i_KSLOG_BASIC(FMT, ##__VA_ARGS__) +#if RollbarCrashLOG_PRINTS_AT_LEVEL(RollbarCrashLogger_Level_Debug) + #define RollbarCrashLOG_DEBUG(FMT, ...) a_RollbarCrashLOG_FULL("DEBUG", FMT, ##__VA_ARGS__) + #define RollbarCrashLOGBASIC_DEBUG(FMT, ...) i_RollbarCrashLOG_BASIC(FMT, ##__VA_ARGS__) #else - #define KSLOG_DEBUG(FMT, ...) - #define KSLOGBASIC_DEBUG(FMT, ...) + #define RollbarCrashLOG_DEBUG(FMT, ...) + #define RollbarCrashLOGBASIC_DEBUG(FMT, ...) #endif /** Log a trace message. @@ -341,12 +341,12 @@ bool kslog_clearLogFile(void); * * @param FMT The format specifier, followed by its arguments. */ -#if KSLOG_PRINTS_AT_LEVEL(KSLogger_Level_Trace) - #define KSLOG_TRACE(FMT, ...) a_KSLOG_FULL("TRACE", FMT, ##__VA_ARGS__) - #define KSLOGBASIC_TRACE(FMT, ...) i_KSLOG_BASIC(FMT, ##__VA_ARGS__) +#if RollbarCrashLOG_PRINTS_AT_LEVEL(RollbarCrashLogger_Level_Trace) + #define RollbarCrashLOG_TRACE(FMT, ...) a_RollbarCrashLOG_FULL("TRACE", FMT, ##__VA_ARGS__) + #define RollbarCrashLOGBASIC_TRACE(FMT, ...) i_RollbarCrashLOG_BASIC(FMT, ##__VA_ARGS__) #else - #define KSLOG_TRACE(FMT, ...) - #define KSLOGBASIC_TRACE(FMT, ...) + #define RollbarCrashLOG_TRACE(FMT, ...) + #define RollbarCrashLOGBASIC_TRACE(FMT, ...) #endif @@ -357,29 +357,29 @@ bool kslog_clearLogFile(void); /* Put everything back to the way we found it. */ #undef ERROR -#ifdef KSLOG_BAK_ERROR - #define ERROR KSLOG_BAK_ERROR - #undef KSLOG_BAK_ERROR +#ifdef RollbarCrashLOG_BAK_ERROR + #define ERROR RollbarCrashLOG_BAK_ERROR + #undef RollbarCrashLOG_BAK_ERROR #endif #undef WARNING -#ifdef KSLOG_BAK_WARN - #define WARNING KSLOG_BAK_WARN - #undef KSLOG_BAK_WARN +#ifdef RollbarCrashLOG_BAK_WARN + #define WARNING RollbarCrashLOG_BAK_WARN + #undef RollbarCrashLOG_BAK_WARN #endif #undef INFO -#ifdef KSLOG_BAK_INFO - #define INFO KSLOG_BAK_INFO - #undef KSLOG_BAK_INFO +#ifdef RollbarCrashLOG_BAK_INFO + #define INFO RollbarCrashLOG_BAK_INFO + #undef RollbarCrashLOG_BAK_INFO #endif #undef DEBUG -#ifdef KSLOG_BAK_DEBUG - #define DEBUG KSLOG_BAK_DEBUG - #undef KSLOG_BAK_DEBUG +#ifdef RollbarCrashLOG_BAK_DEBUG + #define DEBUG RollbarCrashLOG_BAK_DEBUG + #undef RollbarCrashLOG_BAK_DEBUG #endif #undef TRACE -#ifdef KSLOG_BAK_TRACE - #define TRACE KSLOG_BAK_TRACE - #undef KSLOG_BAK_TRACE +#ifdef RollbarCrashLOG_BAK_TRACE + #define TRACE RollbarCrashLOG_BAK_TRACE + #undef RollbarCrashLOG_BAK_TRACE #endif @@ -387,4 +387,4 @@ bool kslog_clearLogFile(void); } #endif -#endif // HDR_KSLogger_h +#endif // HDR_RollbarCrashLogger_h diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashMach.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashMach.c index 6ac60722..81ff081b 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashMach.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashMach.c @@ -1,5 +1,5 @@ // -// KSMach.c +// RollbarCrashMach.c // // Copyright 2016 Karl Stenerud. // @@ -22,7 +22,7 @@ // THE SOFTWARE. // -#include "KSMach.h" +#include "RollbarCrashMach.h" #include #include diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashMach.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashMach.h index 34c0e566..770b2b11 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashMach.h +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashMach.h @@ -1,5 +1,5 @@ // -// KSMach.h +// RollbarCrashMach.h // // Copyright 2016 Karl Stenerud. // @@ -22,8 +22,8 @@ // THE SOFTWARE. // -#ifndef HDR_KSMach_h -#define HDR_KSMach_h +#ifndef HDR_RollbarCrashMach_h +#define HDR_RollbarCrashMach_h #ifdef __cplusplus extern "C" { @@ -71,4 +71,4 @@ int ksmach_machExceptionForSignal(int signal); } #endif -#endif // HDR_KSMach_h +#endif // HDR_RollbarCrashMach_h diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashMachineContext.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashMachineContext.c index ba25ad27..9b2e5236 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashMachineContext.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashMachineContext.c @@ -1,5 +1,5 @@ // -// KSMachineContext.c +// RollbarCrashMachineContext.c // // Created by Karl Stenerud on 2016-12-02. // @@ -24,17 +24,17 @@ // THE SOFTWARE. // -#include "KSMachineContext_Apple.h" -#include "KSMachineContext.h" -#include "KSSystemCapabilities.h" -#include "KSCPU.h" -#include "KSCPU_Apple.h" -#include "KSStackCursor_MachineContext.h" +#include "RollbarCrashMachineContext_Apple.h" +#include "RollbarCrashMachineContext.h" +#include "RollbarCrashSystemCapabilities.h" +#include "RollbarCrashCPU.h" +#include "RollbarCrashCPU_Apple.h" +#include "RollbarCrashStackCursor_MachineContext.h" #include -//#define KSLogger_LocalLevel TRACE -#include "KSLogger.h" +//#define RollbarCrashLogger_LocalLevel TRACE +#include "RollbarCrashLogger.h" #ifdef __arm64__ #define UC_MCONTEXT uc_mcontext64 @@ -45,40 +45,40 @@ typedef ucontext64_t SignalUserContext; typedef ucontext_t SignalUserContext; #endif -static KSThread g_reservedThreads[10]; +static RollbarCrashThread g_reservedThreads[10]; static int g_reservedThreadsMaxIndex = sizeof(g_reservedThreads) / sizeof(g_reservedThreads[0]) - 1; static int g_reservedThreadsCount = 0; -static inline bool isStackOverflow(const KSMachineContext* const context) +static inline bool isStackOverflow(const RollbarCrashMachineContext* const context) { - KSStackCursor stackCursor; - kssc_initWithMachineContext(&stackCursor, KSSC_STACK_OVERFLOW_THRESHOLD, context); + RollbarCrashStackCursor stackCursor; + kssc_initWithMachineContext(&stackCursor, RollbarCrashSC_STACK_OVERFLOW_THRESHOLD, context); while(stackCursor.advanceCursor(&stackCursor)) { } return stackCursor.state.hasGivenUp; } -static inline bool getThreadList(KSMachineContext* context) +static inline bool getThreadList(RollbarCrashMachineContext* context) { const task_t thisTask = mach_task_self(); - KSLOG_DEBUG("Getting thread list"); + RollbarCrashLOG_DEBUG("Getting thread list"); kern_return_t kr; thread_act_array_t threads; mach_msg_type_number_t actualThreadCount; if((kr = task_threads(thisTask, &threads, &actualThreadCount)) != KERN_SUCCESS) { - KSLOG_ERROR("task_threads: %s", mach_error_string(kr)); + RollbarCrashLOG_ERROR("task_threads: %s", mach_error_string(kr)); return false; } - KSLOG_TRACE("Got %d threads", context->threadCount); + RollbarCrashLOG_TRACE("Got %d threads", context->threadCount); int threadCount = (int)actualThreadCount; int maxThreadCount = sizeof(context->allThreads) / sizeof(context->allThreads[0]); if(threadCount > maxThreadCount) { - KSLOG_ERROR("Thread count %d is higher than maximum of %d", threadCount, maxThreadCount); + RollbarCrashLOG_ERROR("Thread count %d is higher than maximum of %d", threadCount, maxThreadCount); threadCount = maxThreadCount; } for(int i = 0; i < threadCount; i++) @@ -98,17 +98,17 @@ static inline bool getThreadList(KSMachineContext* context) int ksmc_contextSize() { - return sizeof(KSMachineContext); + return sizeof(RollbarCrashMachineContext); } -KSThread ksmc_getThreadFromContext(const KSMachineContext* const context) +RollbarCrashThread ksmc_getThreadFromContext(const RollbarCrashMachineContext* const context) { return context->thisThread; } -bool ksmc_getContextForThread(KSThread thread, KSMachineContext* destinationContext, bool isCrashedContext) +bool ksmc_getContextForThread(RollbarCrashThread thread, RollbarCrashMachineContext* destinationContext, bool isCrashedContext) { - KSLOG_DEBUG("Fill thread 0x%x context into %p. is crashed = %d", thread, destinationContext, isCrashedContext); + RollbarCrashLOG_DEBUG("Fill thread 0x%x context into %p. is crashed = %d", thread, destinationContext, isCrashedContext); memset(destinationContext, 0, sizeof(*destinationContext)); destinationContext->thisThread = (thread_t)thread; destinationContext->isCurrentThread = thread == ksthread_self(); @@ -123,13 +123,13 @@ bool ksmc_getContextForThread(KSThread thread, KSMachineContext* destinationCont destinationContext->isStackOverflow = isStackOverflow(destinationContext); getThreadList(destinationContext); } - KSLOG_TRACE("Context retrieved."); + RollbarCrashLOG_TRACE("Context retrieved."); return true; } -bool ksmc_getContextForSignal(void* signalUserContext, KSMachineContext* destinationContext) +bool ksmc_getContextForSignal(void* signalUserContext, RollbarCrashMachineContext* destinationContext) { - KSLOG_DEBUG("Get context from signal user context and put into %p.", destinationContext); + RollbarCrashLOG_DEBUG("Get context from signal user context and put into %p.", destinationContext); _STRUCT_MCONTEXT* sourceContext = ((SignalUserContext*)signalUserContext)->UC_MCONTEXT; memcpy(&destinationContext->machineContext, sourceContext, sizeof(destinationContext->machineContext)); destinationContext->thisThread = (thread_t)ksthread_self(); @@ -137,27 +137,27 @@ bool ksmc_getContextForSignal(void* signalUserContext, KSMachineContext* destina destinationContext->isSignalContext = true; destinationContext->isStackOverflow = isStackOverflow(destinationContext); getThreadList(destinationContext); - KSLOG_TRACE("Context retrieved."); + RollbarCrashLOG_TRACE("Context retrieved."); return true; } -void ksmc_addReservedThread(KSThread thread) +void ksmc_addReservedThread(RollbarCrashThread thread) { int nextIndex = g_reservedThreadsCount; if(nextIndex > g_reservedThreadsMaxIndex) { - KSLOG_ERROR("Too many reserved threads (%d). Max is %d", nextIndex, g_reservedThreadsMaxIndex); + RollbarCrashLOG_ERROR("Too many reserved threads (%d). Max is %d", nextIndex, g_reservedThreadsMaxIndex); return; } g_reservedThreads[g_reservedThreadsCount++] = thread; } -#if KSCRASH_HAS_THREADS_API -static inline bool isThreadInList(thread_t thread, KSThread* list, int listCount) +#if RollbarCrashCRASH_HAS_THREADS_API +static inline bool isThreadInList(thread_t thread, RollbarCrashThread* list, int listCount) { for(int i = 0; i < listCount; i++) { - if(list[i] == (KSThread)thread) + if(list[i] == (RollbarCrashThread)thread) { return true; } @@ -168,15 +168,15 @@ static inline bool isThreadInList(thread_t thread, KSThread* list, int listCount void ksmc_suspendEnvironment(__unused thread_act_array_t *suspendedThreads, __unused mach_msg_type_number_t *numSuspendedThreads) { -#if KSCRASH_HAS_THREADS_API - KSLOG_DEBUG("Suspending environment."); +#if RollbarCrashCRASH_HAS_THREADS_API + RollbarCrashLOG_DEBUG("Suspending environment."); kern_return_t kr; const task_t thisTask = mach_task_self(); const thread_t thisThread = (thread_t)ksthread_self(); if((kr = task_threads(thisTask, suspendedThreads, numSuspendedThreads)) != KERN_SUCCESS) { - KSLOG_ERROR("task_threads: %s", mach_error_string(kr)); + RollbarCrashLOG_ERROR("task_threads: %s", mach_error_string(kr)); return; } @@ -188,26 +188,26 @@ void ksmc_suspendEnvironment(__unused thread_act_array_t *suspendedThreads, __un if((kr = thread_suspend(thread)) != KERN_SUCCESS) { // Record the error and keep going. - KSLOG_ERROR("thread_suspend (%08x): %s", thread, mach_error_string(kr)); + RollbarCrashLOG_ERROR("thread_suspend (%08x): %s", thread, mach_error_string(kr)); } } } - KSLOG_DEBUG("Suspend complete."); + RollbarCrashLOG_DEBUG("Suspend complete."); #endif } void ksmc_resumeEnvironment(__unused thread_act_array_t threads, __unused mach_msg_type_number_t numThreads) { -#if KSCRASH_HAS_THREADS_API - KSLOG_DEBUG("Resuming environment."); +#if RollbarCrashCRASH_HAS_THREADS_API + RollbarCrashLOG_DEBUG("Resuming environment."); kern_return_t kr; const task_t thisTask = mach_task_self(); const thread_t thisThread = (thread_t)ksthread_self(); if(threads == NULL || numThreads == 0) { - KSLOG_ERROR("we should call ksmc_suspendEnvironment() first"); + RollbarCrashLOG_ERROR("we should call ksmc_suspendEnvironment() first"); return; } @@ -219,7 +219,7 @@ void ksmc_resumeEnvironment(__unused thread_act_array_t threads, __unused mach_m if((kr = thread_resume(thread)) != KERN_SUCCESS) { // Record the error and keep going. - KSLOG_ERROR("thread_resume (%08x): %s", thread, mach_error_string(kr)); + RollbarCrashLOG_ERROR("thread_resume (%08x): %s", thread, mach_error_string(kr)); } } } @@ -230,27 +230,27 @@ void ksmc_resumeEnvironment(__unused thread_act_array_t threads, __unused mach_m } vm_deallocate(thisTask, (vm_address_t)threads, sizeof(thread_t) * numThreads); - KSLOG_DEBUG("Resume complete."); + RollbarCrashLOG_DEBUG("Resume complete."); #endif } -int ksmc_getThreadCount(const KSMachineContext* const context) +int ksmc_getThreadCount(const RollbarCrashMachineContext* const context) { return context->threadCount; } -KSThread ksmc_getThreadAtIndex(const KSMachineContext* const context, int index) +RollbarCrashThread ksmc_getThreadAtIndex(const RollbarCrashMachineContext* const context, int index) { return context->allThreads[index]; } -int ksmc_indexOfThread(const KSMachineContext* const context, KSThread thread) +int ksmc_indexOfThread(const RollbarCrashMachineContext* const context, RollbarCrashThread thread) { - KSLOG_TRACE("check thread vs %d threads", context->threadCount); + RollbarCrashLOG_TRACE("check thread vs %d threads", context->threadCount); for(int i = 0; i < (int)context->threadCount; i++) { - KSLOG_TRACE("%d: %x vs %x", i, thread, context->allThreads[i]); + RollbarCrashLOG_TRACE("%d: %x vs %x", i, thread, context->allThreads[i]); if(context->allThreads[i] == thread) { return i; @@ -259,27 +259,27 @@ int ksmc_indexOfThread(const KSMachineContext* const context, KSThread thread) return -1; } -bool ksmc_isCrashedContext(const KSMachineContext* const context) +bool ksmc_isCrashedContext(const RollbarCrashMachineContext* const context) { return context->isCrashedContext; } -static inline bool isContextForCurrentThread(const KSMachineContext* const context) +static inline bool isContextForCurrentThread(const RollbarCrashMachineContext* const context) { return context->isCurrentThread; } -static inline bool isSignalContext(const KSMachineContext* const context) +static inline bool isSignalContext(const RollbarCrashMachineContext* const context) { return context->isSignalContext; } -bool ksmc_canHaveCPUState(const KSMachineContext* const context) +bool ksmc_canHaveCPUState(const RollbarCrashMachineContext* const context) { return !isContextForCurrentThread(context) || isSignalContext(context); } -bool ksmc_hasValidExceptionRegisters(const KSMachineContext* const context) +bool ksmc_hasValidExceptionRegisters(const RollbarCrashMachineContext* const context) { return ksmc_canHaveCPUState(context) && ksmc_isCrashedContext(context); } diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashMachineContext_Apple.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashMachineContext_Apple.h index 76a1bb76..3c7812f6 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashMachineContext_Apple.h +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashMachineContext_Apple.h @@ -1,5 +1,5 @@ // -// KSMachineContext_Apple.h +// RollbarCrashMachineContext_Apple.h // // Created by Karl Stenerud on 2016-12-02. // @@ -25,8 +25,8 @@ // -#ifndef HDR_KSMachineContext_Apple_h -#define HDR_KSMachineContext_Apple_h +#ifndef HDR_RollbarCrashMachineContext_Apple_h +#define HDR_RollbarCrashMachineContext_Apple_h #ifdef __cplusplus extern "C" { @@ -42,7 +42,7 @@ extern "C" { #define STRUCT_MCONTEXT_L _STRUCT_MCONTEXT #endif -typedef struct KSMachineContext +typedef struct RollbarCrashMachineContext { thread_t thisThread; thread_t allThreads[100]; @@ -52,11 +52,11 @@ typedef struct KSMachineContext bool isStackOverflow; bool isSignalContext; STRUCT_MCONTEXT_L machineContext; -} KSMachineContext; +} RollbarCrashMachineContext; #ifdef __cplusplus } #endif -#endif // HDR_KSMachineContext_Apple_h +#endif // HDR_RollbarCrashMachineContext_Apple_h diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashMemory.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashMemory.c index ba0f806b..bfdd1ae8 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashMemory.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashMemory.c @@ -1,5 +1,5 @@ // -// KSMemory.c +// RollbarCrashMemory.c // // Created by Karl Stenerud on 2012-01-29. // @@ -25,10 +25,10 @@ // -#include "KSMemory.h" +#include "RollbarCrashMemory.h" -//#define KSLogger_LocalLevel TRACE -#include "KSLogger.h" +//#define RollbarCrashLogger_LocalLevel TRACE +#include "RollbarCrashLogger.h" #include diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashMemory.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashMemory.h index ae4e9e2e..0174935e 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashMemory.h +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashMemory.h @@ -1,5 +1,5 @@ // -// KSMemory.h +// RollbarCrashMemory.h // // Created by Karl Stenerud on 2012-01-29. // diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashObjC.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashObjC.c index 8e1f545c..cec4796f 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashObjC.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashObjC.c @@ -1,5 +1,5 @@ // -// KSObjC.c +// RollbarCrashObjC.c // // Created by Karl Stenerud on 2012-08-30. // @@ -25,13 +25,13 @@ // -#include "KSObjC.h" -#include "KSObjCApple.h" +#include "RollbarCrashObjC.h" +#include "RollbarCrashObjCApple.h" -#include "KSMemory.h" -#include "KSString.h" +#include "RollbarCrashMemory.h" +#include "RollbarCrashString.h" -#include "KSLogger.h" +#include "RollbarCrashLogger.h" #if __IPHONE_OS_VERSION_MAX_ALLOWED > 70000 #include @@ -79,7 +79,7 @@ typedef enum typedef struct { const char* name; - KSObjCClassType type; + RollbarCrashObjCClassType type; ClassSubtype subtype; bool isMutable; bool (*isValidObject)(const void* object); @@ -118,34 +118,34 @@ static int taggedStringDescription(const void* object, char* buffer, int bufferL static ClassData g_classData[] = { - {"__NSCFString", KSObjCClassTypeString, ClassSubtypeNone, true, stringIsValid, stringDescription}, - {"NSCFString", KSObjCClassTypeString, ClassSubtypeNone, true, stringIsValid, stringDescription}, - {"__NSCFConstantString", KSObjCClassTypeString, ClassSubtypeNone, true, stringIsValid, stringDescription}, - {"NSCFConstantString", KSObjCClassTypeString, ClassSubtypeNone, true, stringIsValid, stringDescription}, - {"__NSArray0", KSObjCClassTypeArray, ClassSubtypeNSArrayImmutable, false, arrayIsValid, arrayDescription}, - {"__NSArrayI", KSObjCClassTypeArray, ClassSubtypeNSArrayImmutable, false, arrayIsValid, arrayDescription}, - {"__NSArrayM", KSObjCClassTypeArray, ClassSubtypeNSArrayMutable, true, arrayIsValid, arrayDescription}, - {"__NSCFArray", KSObjCClassTypeArray, ClassSubtypeCFArray, false, arrayIsValid, arrayDescription}, - {"NSCFArray", KSObjCClassTypeArray, ClassSubtypeCFArray, false, arrayIsValid, arrayDescription}, - {"__NSDate", KSObjCClassTypeDate, ClassSubtypeNone, false, dateIsValid, dateDescription}, - {"NSDate", KSObjCClassTypeDate, ClassSubtypeNone, false, dateIsValid, dateDescription}, - {"__NSCFNumber", KSObjCClassTypeNumber, ClassSubtypeNone, false, numberIsValid, numberDescription}, - {"NSCFNumber", KSObjCClassTypeNumber, ClassSubtypeNone, false, numberIsValid, numberDescription}, - {"NSNumber", KSObjCClassTypeNumber, ClassSubtypeNone, false, numberIsValid, numberDescription}, - {"NSURL", KSObjCClassTypeURL, ClassSubtypeNone, false, urlIsValid, urlDescription}, - {NULL, KSObjCClassTypeUnknown, ClassSubtypeNone, false, objectIsValid, objectDescription}, + {"__NSCFString", RollbarCrashObjCClassTypeString, ClassSubtypeNone, true, stringIsValid, stringDescription}, + {"NSCFString", RollbarCrashObjCClassTypeString, ClassSubtypeNone, true, stringIsValid, stringDescription}, + {"__NSCFConstantString", RollbarCrashObjCClassTypeString, ClassSubtypeNone, true, stringIsValid, stringDescription}, + {"NSCFConstantString", RollbarCrashObjCClassTypeString, ClassSubtypeNone, true, stringIsValid, stringDescription}, + {"__NSArray0", RollbarCrashObjCClassTypeArray, ClassSubtypeNSArrayImmutable, false, arrayIsValid, arrayDescription}, + {"__NSArrayI", RollbarCrashObjCClassTypeArray, ClassSubtypeNSArrayImmutable, false, arrayIsValid, arrayDescription}, + {"__NSArrayM", RollbarCrashObjCClassTypeArray, ClassSubtypeNSArrayMutable, true, arrayIsValid, arrayDescription}, + {"__NSCFArray", RollbarCrashObjCClassTypeArray, ClassSubtypeCFArray, false, arrayIsValid, arrayDescription}, + {"NSCFArray", RollbarCrashObjCClassTypeArray, ClassSubtypeCFArray, false, arrayIsValid, arrayDescription}, + {"__NSDate", RollbarCrashObjCClassTypeDate, ClassSubtypeNone, false, dateIsValid, dateDescription}, + {"NSDate", RollbarCrashObjCClassTypeDate, ClassSubtypeNone, false, dateIsValid, dateDescription}, + {"__NSCFNumber", RollbarCrashObjCClassTypeNumber, ClassSubtypeNone, false, numberIsValid, numberDescription}, + {"NSCFNumber", RollbarCrashObjCClassTypeNumber, ClassSubtypeNone, false, numberIsValid, numberDescription}, + {"NSNumber", RollbarCrashObjCClassTypeNumber, ClassSubtypeNone, false, numberIsValid, numberDescription}, + {"NSURL", RollbarCrashObjCClassTypeURL, ClassSubtypeNone, false, urlIsValid, urlDescription}, + {NULL, RollbarCrashObjCClassTypeUnknown, ClassSubtypeNone, false, objectIsValid, objectDescription}, }; static ClassData g_taggedClassData[] = { - {"NSAtom", KSObjCClassTypeUnknown, ClassSubtypeNone, false, taggedObjectIsValid, taggedObjectDescription}, - {NULL, KSObjCClassTypeUnknown, ClassSubtypeNone, false, taggedObjectIsValid, taggedObjectDescription}, - {"NSString", KSObjCClassTypeString, ClassSubtypeNone, false, taggedStringIsValid, taggedStringDescription}, - {"NSNumber", KSObjCClassTypeNumber, ClassSubtypeNone, false, taggedNumberIsValid, taggedNumberDescription}, - {"NSIndexPath", KSObjCClassTypeUnknown, ClassSubtypeNone, false, taggedObjectIsValid, taggedObjectDescription}, - {"NSManagedObjectID", KSObjCClassTypeUnknown, ClassSubtypeNone, false, taggedObjectIsValid, taggedObjectDescription}, - {"NSDate", KSObjCClassTypeDate, ClassSubtypeNone, false, taggedDateIsValid, taggedDateDescription}, - {NULL, KSObjCClassTypeUnknown, ClassSubtypeNone, false, taggedObjectIsValid, taggedObjectDescription}, + {"NSAtom", RollbarCrashObjCClassTypeUnknown, ClassSubtypeNone, false, taggedObjectIsValid, taggedObjectDescription}, + {NULL, RollbarCrashObjCClassTypeUnknown, ClassSubtypeNone, false, taggedObjectIsValid, taggedObjectDescription}, + {"NSString", RollbarCrashObjCClassTypeString, ClassSubtypeNone, false, taggedStringIsValid, taggedStringDescription}, + {"NSNumber", RollbarCrashObjCClassTypeNumber, ClassSubtypeNone, false, taggedNumberIsValid, taggedNumberDescription}, + {"NSIndexPath", RollbarCrashObjCClassTypeUnknown, ClassSubtypeNone, false, taggedObjectIsValid, taggedObjectDescription}, + {"NSManagedObjectID", RollbarCrashObjCClassTypeUnknown, ClassSubtypeNone, false, taggedObjectIsValid, taggedObjectDescription}, + {"NSDate", RollbarCrashObjCClassTypeDate, ClassSubtypeNone, false, taggedDateIsValid, taggedDateDescription}, + {NULL, RollbarCrashObjCClassTypeUnknown, ClassSubtypeNone, false, taggedObjectIsValid, taggedObjectDescription}, }; static int g_taggedClassDataCount = sizeof(g_taggedClassData) / sizeof(*g_taggedClassData); @@ -184,7 +184,7 @@ static bool isValidTaggedPointer(const void* object) if(getTaggedSlot(object) <= g_taggedClassDataCount) { const ClassData* classData = getClassDataFromTaggedPointer(object); - return classData->type != KSObjCClassTypeUnknown; + return classData->type != RollbarCrashObjCClassTypeUnknown; } } return false; @@ -797,7 +797,7 @@ int ksobjc_ivarCount(const void* const classPtr) return (int)ivars->count; } -int ksobjc_ivarList(const void* const classPtr, KSObjCIvar* dstIvars, int ivarsCount) +int ksobjc_ivarList(const void* const classPtr, RollbarCrashObjCIvar* dstIvars, int ivarsCount) { // TODO: Check this for a possible bad access. if(dstIvars == NULL) @@ -820,7 +820,7 @@ int ksobjc_ivarList(const void* const classPtr, KSObjCIvar* dstIvars, int ivarsC const struct ivar_t* src = (void*)srcPtr; for(int i = 0; i < count; i++) { - KSObjCIvar* dst = &dstIvars[i]; + RollbarCrashObjCIvar* dst = &dstIvars[i]; dst->name = src->name; dst->type = src->type; dst->index = i; @@ -830,7 +830,7 @@ int ksobjc_ivarList(const void* const classPtr, KSObjCIvar* dstIvars, int ivarsC return count; } -bool ksobjc_ivarNamed(const void* const classPtr, const char* name, KSObjCIvar* dst) +bool ksobjc_ivarNamed(const void* const classPtr, const char* name, RollbarCrashObjCIvar* dst) { if(name == NULL) { @@ -912,40 +912,40 @@ static inline bool isBlockClass(const void* class) return strcmp(name, g_blockBaseClassName) == 0; } -KSObjCType ksobjc_objectType(const void* objectOrClassPtr) +RollbarCrashObjCType ksobjc_objectType(const void* objectOrClassPtr) { if(objectOrClassPtr == NULL) { - return KSObjCTypeUnknown; + return RollbarCrashObjCTypeUnknown; } if(isTaggedPointer(objectOrClassPtr)) { - return KSObjCTypeObject; + return RollbarCrashObjCTypeObject; } if(!isValidObject(objectOrClassPtr)) { - return KSObjCTypeUnknown; + return RollbarCrashObjCTypeUnknown; } if(!isValidClass(objectOrClassPtr)) { - return KSObjCTypeUnknown; + return RollbarCrashObjCTypeUnknown; } const struct class_t* isa = getIsaPointer(objectOrClassPtr); if(isBlockClass(isa)) { - return KSObjCTypeBlock; + return RollbarCrashObjCTypeBlock; } if(!isMetaClass(isa)) { - return KSObjCTypeObject; + return RollbarCrashObjCTypeObject; } - return KSObjCTypeClass; + return RollbarCrashObjCTypeClass; } @@ -1704,7 +1704,7 @@ bool ksobjc_isValidObject(const void* object) return data->isValidObject(object); } -KSObjCClassType ksobjc_objectClassType(const void* object) +RollbarCrashObjCClassType ksobjc_objectClassType(const void* object) { const ClassData* data = getClassDataFromObject(object); return data->type; diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashObjC.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashObjC.h index 18255ff4..bd4d83be 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashObjC.h +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashObjC.h @@ -1,5 +1,5 @@ // -// KSObjC.h +// RollbarCrashObjC.h // // Created by Karl Stenerud on 2012-08-30. // @@ -25,8 +25,8 @@ // -#ifndef HDR_KSObjC_h -#define HDR_KSObjC_h +#ifndef HDR_RollbarCrashObjC_h +#define HDR_RollbarCrashObjC_h #ifdef __cplusplus extern "C" { @@ -39,30 +39,30 @@ extern "C" { typedef enum { - KSObjCTypeUnknown = 0, - KSObjCTypeClass, - KSObjCTypeObject, - KSObjCTypeBlock, -} KSObjCType; + RollbarCrashObjCTypeUnknown = 0, + RollbarCrashObjCTypeClass, + RollbarCrashObjCTypeObject, + RollbarCrashObjCTypeBlock, +} RollbarCrashObjCType; typedef enum { - KSObjCClassTypeUnknown = 0, - KSObjCClassTypeString, - KSObjCClassTypeDate, - KSObjCClassTypeURL, - KSObjCClassTypeArray, - KSObjCClassTypeDictionary, - KSObjCClassTypeNumber, - KSObjCClassTypeException, -} KSObjCClassType; + RollbarCrashObjCClassTypeUnknown = 0, + RollbarCrashObjCClassTypeString, + RollbarCrashObjCClassTypeDate, + RollbarCrashObjCClassTypeURL, + RollbarCrashObjCClassTypeArray, + RollbarCrashObjCClassTypeDictionary, + RollbarCrashObjCClassTypeNumber, + RollbarCrashObjCClassTypeException, +} RollbarCrashObjCClassType; typedef struct { const char* name; const char* type; int index; -} KSObjCIvar; +} RollbarCrashObjCIvar; //====================================================================== @@ -97,10 +97,10 @@ bool ksobjc_isValidTaggedPointer(const void* const pointer); * * @param objectOrClassPtr Pointer to something that may be an object or class. * - * @return The type of object, or KSObjCTypeNone if it was not an object or + * @return The type of object, or RollbarCrashObjCTypeNone if it was not an object or * was inaccessible. */ -KSObjCType ksobjc_objectType(const void* objectOrClassPtr); +RollbarCrashObjCType ksobjc_objectType(const void* objectOrClassPtr); /** Check that an object contains valid data. * If the object is of a recognized type (string, date, array, etc), @@ -213,7 +213,7 @@ int ksobjc_ivarCount(const void* classPtr); * * @return The number of ivars copied. */ -int ksobjc_ivarList(const void* classPtr, KSObjCIvar* dstIvars, int ivarsCount); +int ksobjc_ivarList(const void* classPtr, RollbarCrashObjCIvar* dstIvars, int ivarsCount); /** Get ivar information by name/ * @@ -225,7 +225,7 @@ int ksobjc_ivarList(const void* classPtr, KSObjCIvar* dstIvars, int ivarsCount); * * @return true if the operation was successful. */ -bool ksobjc_ivarNamed(const void* const classPtr, const char* name, KSObjCIvar* dst); +bool ksobjc_ivarNamed(const void* const classPtr, const char* name, RollbarCrashObjCIvar* dst); /** Get the value of an ivar in an object. * @@ -268,14 +268,14 @@ uintptr_t ksobjc_taggedPointerPayload(const void* taggedObjectPtr); int ksobjc_getDescription(void* object, char* buffer, int bufferLength); /** Get the class type of an object. - * There are a number of common class types that KSObjC understamds, - * listed in KSObjCClassType. + * There are a number of common class types that RollbarCrashObjC understamds, + * listed in RollbarCrashObjCClassType. * * @param object The object to query. * - * @return The class type, or KSObjCClassTypeUnknown if it couldn't be determined. + * @return The class type, or RollbarCrashObjCClassTypeUnknown if it couldn't be determined. */ -KSObjCClassType ksobjc_objectClassType(const void* object); +RollbarCrashObjCClassType ksobjc_objectClassType(const void* object); //====================================================================== @@ -399,4 +399,4 @@ int ksobjc_dictionaryCount(const void* dict); } #endif -#endif // HDR_KSObjC_h +#endif // HDR_RollbarCrashObjC_h diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashObjCApple.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashObjCApple.h index 4e99c3fe..60349172 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashObjCApple.h +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashObjCApple.h @@ -1,5 +1,5 @@ // -// KSObjCApple.h +// RollbarCrashObjCApple.h // // Created by Karl Stenerud on 2012-08-30. // @@ -14,10 +14,10 @@ // // This file contains structures and constants copied from Apple header -// files, arranged for use in KSObjC. +// files, arranged for use in RollbarCrashObjC. -#ifndef HDR_KSObjCApple_h -#define HDR_KSObjCApple_h +#ifndef HDR_RollbarCrashObjCApple_h +#define HDR_RollbarCrashObjCApple_h #ifdef __cplusplus extern "C" { @@ -88,7 +88,7 @@ NAME { \ #if SUPPORT_TAGGED_POINTERS -// KS: The original values wouldn't have worked. The slot shift and mask +// RollbarCrash: The original values wouldn't have worked. The slot shift and mask // were incorrect. #define TAG_COUNT 8 //#define TAG_SLOT_MASK 0xf @@ -668,4 +668,4 @@ CF_INLINE uintptr_t __CFBasicHashGetSlotCount(CFConstBasicHashRef ht, CFIndex id } #endif -#endif // HDR_KSObjCApple_h +#endif // HDR_RollbarCrashObjCApple_h diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashPlatformSpecificDefines.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashPlatformSpecificDefines.h index 57fbd431..27af12fc 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashPlatformSpecificDefines.h +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashPlatformSpecificDefines.h @@ -1,5 +1,5 @@ // -// KSPlatformSpecificDefines.h +// RollbarCrashPlatformSpecificDefines.h // // Copyright (c) 2019 YANDEX LLC. All rights reserved. // @@ -22,8 +22,8 @@ // THE SOFTWARE. // -#ifndef KSPlatformSpecificDefines_h -#define KSPlatformSpecificDefines_h +#ifndef RollbarCrashPlatformSpecificDefines_h +#define RollbarCrashPlatformSpecificDefines_h #include #include @@ -42,4 +42,4 @@ typedef struct nlist nlist_t; #define LC_SEGMENT_ARCH_DEPENDENT LC_SEGMENT #endif /* __LP64__ */ -#endif /* KSPlatformSpecificDefines_h */ +#endif /* RollbarCrashPlatformSpecificDefines_h */ diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashSignalInfo.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashSignalInfo.c index 343a0d72..00b3187b 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashSignalInfo.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashSignalInfo.c @@ -1,5 +1,5 @@ // -// KSSignalInfo.c +// RollbarCrashSignalInfo.c // // Created by Karl Stenerud on 2012-02-03. // @@ -25,7 +25,7 @@ // -#include "KSSignalInfo.h" +#include "RollbarCrashSignalInfo.h" #include #include @@ -35,19 +35,19 @@ typedef struct { const int code; const char* const name; -} KSSignalCodeInfo; +} RollbarCrashSignalCodeInfo; typedef struct { const int sigNum; const char* const name; - const KSSignalCodeInfo* const codes; + const RollbarCrashSignalCodeInfo* const codes; const int numCodes; -} KSSignalInfo; +} RollbarCrashSignalInfo; #define ENUM_NAME_MAPPING(A) {A, #A} -static const KSSignalCodeInfo g_sigIllCodes[] = +static const RollbarCrashSignalCodeInfo g_sigIllCodes[] = { #ifdef ILL_NOOP ENUM_NAME_MAPPING(ILL_NOOP), @@ -62,14 +62,14 @@ static const KSSignalCodeInfo g_sigIllCodes[] = ENUM_NAME_MAPPING(ILL_BADSTK), }; -static const KSSignalCodeInfo g_sigTrapCodes[] = +static const RollbarCrashSignalCodeInfo g_sigTrapCodes[] = { ENUM_NAME_MAPPING(0), ENUM_NAME_MAPPING(TRAP_BRKPT), ENUM_NAME_MAPPING(TRAP_TRACE), }; -static const KSSignalCodeInfo g_sigFPECodes[] = +static const RollbarCrashSignalCodeInfo g_sigFPECodes[] = { #ifdef FPE_NOOP ENUM_NAME_MAPPING(FPE_NOOP), @@ -84,7 +84,7 @@ static const KSSignalCodeInfo g_sigFPECodes[] = ENUM_NAME_MAPPING(FPE_INTOVF), }; -static const KSSignalCodeInfo g_sigBusCodes[] = +static const RollbarCrashSignalCodeInfo g_sigBusCodes[] = { #ifdef BUS_NOOP ENUM_NAME_MAPPING(BUS_NOOP), @@ -94,7 +94,7 @@ static const KSSignalCodeInfo g_sigBusCodes[] = ENUM_NAME_MAPPING(BUS_OBJERR), }; -static const KSSignalCodeInfo g_sigSegVCodes[] = +static const RollbarCrashSignalCodeInfo g_sigSegVCodes[] = { #ifdef SEGV_NOOP ENUM_NAME_MAPPING(SEGV_NOOP), @@ -106,7 +106,7 @@ static const KSSignalCodeInfo g_sigSegVCodes[] = #define SIGNAL_INFO(SIGNAL, CODES) {SIGNAL, #SIGNAL, CODES, sizeof(CODES) / sizeof(*CODES)} #define SIGNAL_INFO_NOCODES(SIGNAL) {SIGNAL, #SIGNAL, 0, 0} -static const KSSignalInfo g_fatalSignalData[] = +static const RollbarCrashSignalInfo g_fatalSignalData[] = { SIGNAL_INFO_NOCODES(SIGABRT), SIGNAL_INFO(SIGBUS, g_sigBusCodes), diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashSignalInfo.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashSignalInfo.h index 8a98fe4f..0d6643bb 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashSignalInfo.h +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashSignalInfo.h @@ -1,5 +1,5 @@ // -// KSSignalInfo.h +// RollbarCrashSignalInfo.h // // Created by Karl Stenerud on 2012-02-03. // @@ -29,8 +29,8 @@ */ -#ifndef HDR_KSSignalInfo_h -#define HDR_KSSignalInfo_h +#ifndef HDR_RollbarCrashSignalInfo_h +#define HDR_RollbarCrashSignalInfo_h #ifdef __cplusplus extern "C" { @@ -75,4 +75,4 @@ int kssignal_numFatalSignals(void); } #endif -#endif // HDR_KSSignalInfo_h +#endif // HDR_RollbarCrashSignalInfo_h diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor.c index b85c654f..d35bc98d 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor.c @@ -1,5 +1,5 @@ // -// KSStackCursor.h +// RollbarCrashStackCursor.h // // Copyright (c) 2016 Karl Stenerud. All rights reserved. // @@ -23,20 +23,20 @@ // -#include "KSStackCursor.h" -#include "KSSymbolicator.h" +#include "RollbarCrashStackCursor.h" +#include "RollbarCrashSymbolicator.h" #include -//#define KSLogger_LocalLevel TRACE -#include "KSLogger.h" +//#define RollbarCrashLogger_LocalLevel TRACE +#include "RollbarCrashLogger.h" -static bool g_advanceCursor(__unused KSStackCursor *cursor) +static bool g_advanceCursor(__unused RollbarCrashStackCursor *cursor) { - KSLOG_WARN("No stack cursor has been set. For C++, this means that hooking __cxa_throw() failed for some reason. Embedded frameworks can cause this: https://github.com/kstenerud/KSCrash/issues/205"); + RollbarCrashLOG_WARN("No stack cursor has been set. For C++, this means that hooking __cxa_throw() failed for some reason. Embedded frameworks can cause this: https://github.com/kstenerud/RollbarCrash/issues/205"); return false; } -void kssc_resetCursor(KSStackCursor *cursor) +void kssc_resetCursor(RollbarCrashStackCursor *cursor) { cursor->state.currentDepth = 0; cursor->state.hasGivenUp = false; @@ -47,9 +47,9 @@ void kssc_resetCursor(KSStackCursor *cursor) cursor->stackEntry.symbolName = NULL; } -void kssc_initCursor(KSStackCursor *cursor, - void (*resetCursor)(KSStackCursor*), - bool (*advanceCursor)(KSStackCursor*)) +void kssc_initCursor(RollbarCrashStackCursor *cursor, + void (*resetCursor)(RollbarCrashStackCursor*), + bool (*advanceCursor)(RollbarCrashStackCursor*)) { cursor->symbolicate = kssymbolicator_symbolicate; cursor->advanceCursor = advanceCursor != NULL ? advanceCursor : g_advanceCursor; diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor.h index d9602808..17908124 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor.h +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor.h @@ -1,5 +1,5 @@ // -// KSStackCursor.h +// RollbarCrashStackCursor.h // // Copyright (c) 2016 Karl Stenerud. All rights reserved. // @@ -23,28 +23,28 @@ // -#ifndef KSStackCursor_h -#define KSStackCursor_h +#ifndef RollbarCrashStackCursor_h +#define RollbarCrashStackCursor_h #ifdef __cplusplus extern "C" { #endif -#include "KSMachineContext.h" +#include "RollbarCrashMachineContext.h" #include #include -#define KSSC_CONTEXT_SIZE 100 +#define RollbarCrashSC_CONTEXT_SIZE 100 /** Point at which to give up walking a stack and consider it a stack overflow. */ -#define KSSC_STACK_OVERFLOW_THRESHOLD 150 +#define RollbarCrashSC_STACK_OVERFLOW_THRESHOLD 150 /** The max depth to search before giving up. */ -#define KSSC_MAX_STACK_DEPTH 500 +#define RollbarCrashSC_MAX_STACK_DEPTH 500 -typedef struct KSStackCursor +typedef struct RollbarCrashStackCursor { struct { @@ -73,17 +73,17 @@ typedef struct KSStackCursor } state; /** Reset the cursor back to the beginning. */ - void (*resetCursor)(struct KSStackCursor*); + void (*resetCursor)(struct RollbarCrashStackCursor*); /** Advance the cursor to the next stack entry. */ - bool (*advanceCursor)(struct KSStackCursor*); + bool (*advanceCursor)(struct RollbarCrashStackCursor*); /** Attempt to symbolicate the current address, filling in the fields in stackEntry. */ - bool (*symbolicate)(struct KSStackCursor*); + bool (*symbolicate)(struct RollbarCrashStackCursor*); /** Internal context-specific information. */ - void* context[KSSC_CONTEXT_SIZE]; -} KSStackCursor; + void* context[RollbarCrashSC_CONTEXT_SIZE]; +} RollbarCrashStackCursor; /** Common initialization routine for a stack cursor. @@ -95,20 +95,20 @@ typedef struct KSStackCursor * * @param advanceCursor Function to advance the cursor (NULL = default: Do nothing and return false). */ -void kssc_initCursor(KSStackCursor *cursor, - void (*resetCursor)(KSStackCursor*), - bool (*advanceCursor)(KSStackCursor*)); +void kssc_initCursor(RollbarCrashStackCursor *cursor, + void (*resetCursor)(RollbarCrashStackCursor*), + bool (*advanceCursor)(RollbarCrashStackCursor*)); /** Reset a cursor. * INTERNAL METHOD. Do not call! * * @param cursor The cursor to reset. */ -void kssc_resetCursor(KSStackCursor *cursor); +void kssc_resetCursor(RollbarCrashStackCursor *cursor); #ifdef __cplusplus } #endif -#endif // KSStackCursor_h +#endif // RollbarCrashStackCursor_h diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor_Backtrace.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor_Backtrace.c index 9005cf13..859e4117 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor_Backtrace.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor_Backtrace.c @@ -1,5 +1,5 @@ // -// KSStackCursor_Backtrace.c +// RollbarCrashStackCursor_Backtrace.c // // Copyright (c) 2016 Karl Stenerud. All rights reserved. // @@ -23,15 +23,15 @@ // -#include "KSStackCursor_Backtrace.h" -#include "KSCPU.h" +#include "RollbarCrashStackCursor_Backtrace.h" +#include "RollbarCrashCPU.h" -//#define KSLogger_LocalLevel TRACE -#include "KSLogger.h" +//#define RollbarCrashLogger_LocalLevel TRACE +#include "RollbarCrashLogger.h" -static bool advanceCursor(KSStackCursor *cursor) +static bool advanceCursor(RollbarCrashStackCursor *cursor) { - KSStackCursor_Backtrace_Context* context = (KSStackCursor_Backtrace_Context*)cursor->context; + RollbarCrashStackCursor_Backtrace_Context* context = (RollbarCrashStackCursor_Backtrace_Context*)cursor->context; int endDepth = context->backtraceLength - context->skippedEntries; if(cursor->state.currentDepth < endDepth) { @@ -48,10 +48,10 @@ static bool advanceCursor(KSStackCursor *cursor) return false; } -void kssc_initWithBacktrace(KSStackCursor *cursor, const uintptr_t* backtrace, int backtraceLength, int skipEntries) +void kssc_initWithBacktrace(RollbarCrashStackCursor *cursor, const uintptr_t* backtrace, int backtraceLength, int skipEntries) { kssc_initCursor(cursor, kssc_resetCursor, advanceCursor); - KSStackCursor_Backtrace_Context* context = (KSStackCursor_Backtrace_Context*)cursor->context; + RollbarCrashStackCursor_Backtrace_Context* context = (RollbarCrashStackCursor_Backtrace_Context*)cursor->context; context->skippedEntries = skipEntries; context->backtraceLength = backtraceLength; context->backtrace = backtrace; diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor_Backtrace.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor_Backtrace.h index 32436e64..9ae212d3 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor_Backtrace.h +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor_Backtrace.h @@ -1,5 +1,5 @@ // -// KSStackCursor_Backtrace.h +// RollbarCrashStackCursor_Backtrace.h // // Copyright (c) 2016 Karl Stenerud. All rights reserved. // @@ -23,15 +23,15 @@ // -#ifndef KSStackCursor_Backtrace_h -#define KSStackCursor_Backtrace_h +#ifndef RollbarCrashStackCursor_Backtrace_h +#define RollbarCrashStackCursor_Backtrace_h #ifdef __cplusplus extern "C" { #endif -#include "KSStackCursor.h" +#include "RollbarCrashStackCursor.h" /** Exposed for other internal systems to use. */ @@ -40,7 +40,7 @@ typedef struct int skippedEntries; int backtraceLength; const uintptr_t* backtrace; -} KSStackCursor_Backtrace_Context; +} RollbarCrashStackCursor_Backtrace_Context; /** Initialize a stack cursor for an existing backtrace (array of addresses). @@ -53,11 +53,11 @@ typedef struct * * @param skipEntries The number of stack entries to skip. */ -void kssc_initWithBacktrace(KSStackCursor *cursor, const uintptr_t* backtrace, int backtraceLength, int skipEntries); +void kssc_initWithBacktrace(RollbarCrashStackCursor *cursor, const uintptr_t* backtrace, int backtraceLength, int skipEntries); #ifdef __cplusplus } #endif -#endif // KSStackCursor_Backtrace_h +#endif // RollbarCrashStackCursor_Backtrace_h diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor_MachineContext.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor_MachineContext.c index 0dfa0575..eb5b15b7 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor_MachineContext.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor_MachineContext.c @@ -1,5 +1,5 @@ // -// KSStackCursor_MachineContext.c +// RollbarCrashStackCursor_MachineContext.c // // Copyright (c) 2016 Karl Stenerud. All rights reserved. // @@ -23,15 +23,15 @@ // -#include "KSStackCursor_MachineContext.h" +#include "RollbarCrashStackCursor_MachineContext.h" -#include "KSCPU.h" -#include "KSMemory.h" +#include "RollbarCrashCPU.h" +#include "RollbarCrashMemory.h" #include -#define KSLogger_LocalLevel TRACE -#include "KSLogger.h" +#define RollbarCrashLogger_LocalLevel TRACE +#include "RollbarCrashLogger.h" /** Represents an entry in a frame list. @@ -90,7 +90,7 @@ typedef struct FrameEntry typedef struct { - const struct KSMachineContext* machineContext; + const struct RollbarCrashMachineContext* machineContext; int maxStackDepth; FrameEntry currentFrame; uintptr_t instructionAddress; @@ -98,7 +98,7 @@ typedef struct bool isPastFramePointer; } MachineContextCursor; -static bool advanceCursor(KSStackCursor *cursor) +static bool advanceCursor(RollbarCrashStackCursor *cursor) { MachineContextCursor* context = (MachineContextCursor*)cursor->context; uintptr_t nextAddress = 0; @@ -154,7 +154,7 @@ static bool advanceCursor(KSStackCursor *cursor) return true; } -static void resetCursor(KSStackCursor* cursor) +static void resetCursor(RollbarCrashStackCursor* cursor) { kssc_resetCursor(cursor); MachineContextCursor* context = (MachineContextCursor*)cursor->context; @@ -165,7 +165,7 @@ static void resetCursor(KSStackCursor* cursor) context->isPastFramePointer = 0; } -void kssc_initWithMachineContext(KSStackCursor *cursor, int maxStackDepth, const struct KSMachineContext* machineContext) +void kssc_initWithMachineContext(RollbarCrashStackCursor *cursor, int maxStackDepth, const struct RollbarCrashMachineContext* machineContext) { kssc_initCursor(cursor, resetCursor, advanceCursor); MachineContextCursor* context = (MachineContextCursor*)cursor->context; diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor_MachineContext.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor_MachineContext.h index db2dc06e..50fb48ea 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor_MachineContext.h +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor_MachineContext.h @@ -1,5 +1,5 @@ // -// KSStackCursor_MachineContext.h +// RollbarCrashStackCursor_MachineContext.h // // Copyright (c) 2016 Karl Stenerud. All rights reserved. // @@ -23,15 +23,15 @@ // -#ifndef KSStackCursor_MachineContext_h -#define KSStackCursor_MachineContext_h +#ifndef RollbarCrashStackCursor_MachineContext_h +#define RollbarCrashStackCursor_MachineContext_h #ifdef __cplusplus extern "C" { #endif -#include "KSStackCursor.h" +#include "RollbarCrashStackCursor.h" /** Initialize a stack cursor for a machine context. * @@ -41,11 +41,11 @@ extern "C" { * * @param machineContext The machine context whose stack to walk. */ -void kssc_initWithMachineContext(KSStackCursor *cursor, int maxStackDepth, const struct KSMachineContext* machineContext); +void kssc_initWithMachineContext(RollbarCrashStackCursor *cursor, int maxStackDepth, const struct RollbarCrashMachineContext* machineContext); #ifdef __cplusplus } #endif -#endif // KSStackCursor_MachineContext_h +#endif // RollbarCrashStackCursor_MachineContext_h diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor_SelfThread.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor_SelfThread.c index 99970a7e..13477860 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor_SelfThread.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor_SelfThread.c @@ -1,5 +1,5 @@ // -// KSStackCursor_SelfThread.c +// RollbarCrashStackCursor_SelfThread.c // // Copyright (c) 2016 Karl Stenerud. All rights reserved. // @@ -23,22 +23,22 @@ // -#include "KSStackCursor_SelfThread.h" -#include "KSStackCursor_Backtrace.h" +#include "RollbarCrashStackCursor_SelfThread.h" +#include "RollbarCrashStackCursor_Backtrace.h" #include -//#define KSLogger_LocalLevel TRACE -#include "KSLogger.h" +//#define RollbarCrashLogger_LocalLevel TRACE +#include "RollbarCrashLogger.h" -#define MAX_BACKTRACE_LENGTH (KSSC_CONTEXT_SIZE - sizeof(KSStackCursor_Backtrace_Context) / sizeof(void*) - 1) +#define MAX_BACKTRACE_LENGTH (RollbarCrashSC_CONTEXT_SIZE - sizeof(RollbarCrashStackCursor_Backtrace_Context) / sizeof(void*) - 1) typedef struct { - KSStackCursor_Backtrace_Context SelfThreadContextSpacer; + RollbarCrashStackCursor_Backtrace_Context SelfThreadContextSpacer; uintptr_t backtrace[0]; } SelfThreadContext; -void kssc_initSelfThread(KSStackCursor *cursor, int skipEntries) +void kssc_initSelfThread(RollbarCrashStackCursor *cursor, int skipEntries) { SelfThreadContext* context = (SelfThreadContext*)cursor->context; int backtraceLength = backtrace((void**)context->backtrace, MAX_BACKTRACE_LENGTH); diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor_SelfThread.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor_SelfThread.h index 99e31314..2ff73917 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor_SelfThread.h +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor_SelfThread.h @@ -1,5 +1,5 @@ // -// KSStackCursor_SelfThread.h +// RollbarCrashStackCursor_SelfThread.h // // Copyright (c) 2016 Karl Stenerud. All rights reserved. // @@ -23,15 +23,15 @@ // -#ifndef KSStackCursor_SelfThread_h -#define KSStackCursor_SelfThread_h +#ifndef RollbarCrashStackCursor_SelfThread_h +#define RollbarCrashStackCursor_SelfThread_h #ifdef __cplusplus extern "C" { #endif -#include "KSStackCursor.h" +#include "RollbarCrashStackCursor.h" /** Initialize a stack cursor for the current thread. * You may want to skip some entries to account for the trace immediately leading @@ -41,11 +41,11 @@ extern "C" { * * @param skipEntries The number of stack entries to skip. */ -void kssc_initSelfThread(KSStackCursor *cursor, int skipEntries); +void kssc_initSelfThread(RollbarCrashStackCursor *cursor, int skipEntries); #ifdef __cplusplus } #endif -#endif // KSStackCursor_SelfThread_h +#endif // RollbarCrashStackCursor_SelfThread_h diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashString.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashString.c index 5258af8d..f933c642 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashString.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashString.c @@ -1,5 +1,5 @@ // -// KSString.m +// RollbarCrashString.m // // Created by Karl Stenerud on 2012-09-15. // @@ -25,10 +25,10 @@ // -#include "KSString.h" +#include "RollbarCrashString.h" #include #include -#include "KSSystemCapabilities.h" +#include "RollbarCrashSystemCapabilities.h" // Compiler hints for "if" statements @@ -136,7 +136,7 @@ bool ksstring_extractHexValue(const char* string, int stringLength, uint64_t* co const unsigned char* const end = current + stringLength; for(;;) { -#if KSCRASH_HAS_STRNSTR +#if RollbarCrashCRASH_HAS_STRNSTR current = (const unsigned char*)strnstr((const char*)current, "0x", (unsigned)(end - current)); #else current = (const unsigned char*)strstr((const char*)current, "0x"); diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashString.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashString.h index f0c2b839..e5146bf6 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashString.h +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashString.h @@ -1,5 +1,5 @@ // -// KSString.h +// RollbarCrashString.h // // Created by Karl Stenerud on 2012-09-15. // @@ -24,8 +24,8 @@ // THE SOFTWARE. // -#ifndef HDR_KSString_h -#define HDR_KSString_h +#ifndef HDR_RollbarCrashString_h +#define HDR_RollbarCrashString_h #ifdef __cplusplus extern "C" { @@ -63,4 +63,4 @@ bool ksstring_extractHexValue(const char* string, int stringLength, uint64_t* re } #endif -#endif // HDR_KSString_h +#endif // HDR_RollbarCrashString_h diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashSymbolicator.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashSymbolicator.c index b74c848d..b2eefb6e 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashSymbolicator.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashSymbolicator.c @@ -1,5 +1,5 @@ // -// KSSymbolicator.c +// RollbarCrashSymbolicator.c // // Copyright (c) 2016 Karl Stenerud. All rights reserved. // @@ -23,8 +23,8 @@ // -#include "KSSymbolicator.h" -#include "KSDynamicLinker.h" +#include "RollbarCrashSymbolicator.h" +#include "RollbarCrashDynamicLinker.h" /** Remove any pointer tagging from an instruction address @@ -57,7 +57,7 @@ uintptr_t kssymbolicator_callInstructionAddress(const uintptr_t returnAddress) return CALL_INSTRUCTION_FROM_RETURN_ADDRESS(returnAddress); } -bool kssymbolicator_symbolicate(KSStackCursor *cursor) +bool kssymbolicator_symbolicate(RollbarCrashStackCursor *cursor) { Dl_info symbolsBuffer; if(ksdl_dladdr(CALL_INSTRUCTION_FROM_RETURN_ADDRESS(cursor->stackEntry.address), &symbolsBuffer)) diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashSymbolicator.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashSymbolicator.h index db83f235..a3445ee1 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashSymbolicator.h +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashSymbolicator.h @@ -1,5 +1,5 @@ // -// KSSymbolicator.h +// RollbarCrashSymbolicator.h // // Copyright (c) 2016 Karl Stenerud. All rights reserved. // @@ -23,15 +23,15 @@ // -#ifndef KSSymbolicator_h -#define KSSymbolicator_h +#ifndef RollbarCrashSymbolicator_h +#define RollbarCrashSymbolicator_h #ifdef __cplusplus extern "C" { #endif -#include "KSStackCursor.h" +#include "RollbarCrashStackCursor.h" #include /** Call instruction address is different from return address. @@ -48,11 +48,11 @@ uintptr_t kssymbolicator_callInstructionAddress(const uintptr_t returnAddress); * * @return True if successful. */ -bool kssymbolicator_symbolicate(KSStackCursor *cursor); +bool kssymbolicator_symbolicate(RollbarCrashStackCursor *cursor); #ifdef __cplusplus } #endif -#endif // KSSymbolicator_h +#endif // RollbarCrashSymbolicator_h diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashSysCtl.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashSysCtl.c index a9464568..0ecdc542 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashSysCtl.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashSysCtl.c @@ -1,5 +1,5 @@ // -// KSSysCtl.m +// RollbarCrashSysCtl.m // // Created by Karl Stenerud on 2012-02-19. // @@ -25,10 +25,10 @@ // -#include "KSSysCtl.h" +#include "RollbarCrashSysCtl.h" -//#define KSLogger_LocalLevel TRACE -#include "KSLogger.h" +//#define RollbarCrashLogger_LocalLevel TRACE +#include "RollbarCrashLogger.h" #include #include @@ -40,7 +40,7 @@ #define CHECK_SYSCTL_NAME(TYPE, CALL) \ if(0 != (CALL)) \ { \ - KSLOG_ERROR("Could not get %s value for %s: %s", \ + RollbarCrashLOG_ERROR("Could not get %s value for %s: %s", \ #CALL, name, strerror(errno)); \ return 0; \ } @@ -48,7 +48,7 @@ if(0 != (CALL)) \ #define CHECK_SYSCTL_CMD(TYPE, CALL) \ if(0 != (CALL)) \ { \ - KSLOG_ERROR("Could not get %s value for %d,%d: %s", \ + RollbarCrashLOG_ERROR("Could not get %s value for %d,%d: %s", \ #CALL, major_cmd, minor_cmd, strerror(errno)); \ return 0; \ } @@ -194,7 +194,7 @@ struct timeval kssysctl_timeval(const int major_cmd, const int minor_cmd) if(0 != sysctl(cmd, sizeof(cmd)/sizeof(*cmd), &value, &size, NULL, 0)) { - KSLOG_ERROR("Could not get timeval value for %d,%d: %s", + RollbarCrashLOG_ERROR("Could not get timeval value for %d,%d: %s", major_cmd, minor_cmd, strerror(errno)); } @@ -208,7 +208,7 @@ struct timeval kssysctl_timevalForName(const char* const name) if(0 != sysctlbyname(name, &value, &size, NULL, 0)) { - KSLOG_ERROR("Could not get timeval value for %s: %s", + RollbarCrashLOG_ERROR("Could not get timeval value for %s: %s", name, strerror(errno)); } @@ -223,7 +223,7 @@ bool kssysctl_getProcessInfo(const int pid, if(0 != sysctl(cmd, sizeof(cmd)/sizeof(*cmd), procInfo, &size, NULL, 0)) { - KSLOG_ERROR("Could not get the name for process %d: %s", + RollbarCrashLOG_ERROR("Could not get the name for process %d: %s", pid, strerror(errno)); return false; } @@ -246,7 +246,7 @@ bool kssysctl_getMacAddress(const char* const name, }; if(mib[5] == 0) { - KSLOG_ERROR("Could not get interface index for %s: %s", + RollbarCrashLOG_ERROR("Could not get interface index for %s: %s", name, strerror(errno)); return false; } @@ -254,7 +254,7 @@ bool kssysctl_getMacAddress(const char* const name, size_t length; if(sysctl(mib, 6, NULL, &length, NULL, 0) != 0) { - KSLOG_ERROR("Could not get interface data for %s: %s", + RollbarCrashLOG_ERROR("Could not get interface data for %s: %s", name, strerror(errno)); return false; } @@ -262,13 +262,13 @@ bool kssysctl_getMacAddress(const char* const name, void* ifBuffer = malloc(length); if(ifBuffer == NULL) { - KSLOG_ERROR("Out of memory"); + RollbarCrashLOG_ERROR("Out of memory"); return false; } if(sysctl(mib, 6, ifBuffer, &length, NULL, 0) != 0) { - KSLOG_ERROR("Could not get interface data for %s: %s", + RollbarCrashLOG_ERROR("Could not get interface data for %s: %s", name, strerror(errno)); free(ifBuffer); return false; diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashSysCtl.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashSysCtl.h index 1d56321a..60b7d637 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashSysCtl.h +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashSysCtl.h @@ -1,5 +1,5 @@ // -// KSSysCtl.h +// RollbarCrashSysCtl.h // // Created by Karl Stenerud on 2012-02-19. // @@ -29,8 +29,8 @@ */ -#ifndef HDR_KSSysCtl_h -#define HDR_KSSysCtl_h +#ifndef HDR_RollbarCrashSysCtl_h +#define HDR_RollbarCrashSysCtl_h #ifdef __cplusplus extern "C" { @@ -188,4 +188,4 @@ bool kssysctl_getMacAddress(const char* name, char* macAddressBuffer); } #endif -#endif // HDR_KSSysCtl_h +#endif // HDR_RollbarCrashSysCtl_h diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashThread.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashThread.c index 74615c58..87dcafdf 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashThread.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashThread.c @@ -1,5 +1,5 @@ // -// KSThread.c +// RollbarCrashThread.c // // Created by Karl Stenerud on 2012-01-29. // @@ -25,13 +25,13 @@ // -#include "KSThread.h" +#include "RollbarCrashThread.h" -#include "KSSystemCapabilities.h" -#include "KSMemory.h" +#include "RollbarCrashSystemCapabilities.h" +#include "RollbarCrashMemory.h" -//#define KSLogger_LocalLevel TRACE -#include "KSLogger.h" +//#define RollbarCrashLogger_LocalLevel TRACE +#include "RollbarCrashLogger.h" #include #include @@ -39,14 +39,14 @@ #include -KSThread ksthread_self() +RollbarCrashThread ksthread_self() { thread_t thread_self = mach_thread_self(); mach_port_deallocate(mach_task_self(), thread_self); - return (KSThread)thread_self; + return (RollbarCrashThread)thread_self; } -bool ksthread_getThreadName(const KSThread thread, char* const buffer, int bufLength) +bool ksthread_getThreadName(const RollbarCrashThread thread, char* const buffer, int bufLength) { // WARNING: This implementation is no longer async-safe! @@ -54,7 +54,7 @@ bool ksthread_getThreadName(const KSThread thread, char* const buffer, int bufLe return pthread_getname_np(pthread, buffer, (unsigned)bufLength) == 0; } -bool ksthread_getQueueName(const KSThread thread, char* const buffer, int bufLength) +bool ksthread_getQueueName(const RollbarCrashThread thread, char* const buffer, int bufLength) { // WARNING: This implementation is no longer async-safe! @@ -66,27 +66,27 @@ bool ksthread_getQueueName(const KSThread thread, char* const buffer, int bufLen kr = thread_info((thread_t)thread, THREAD_IDENTIFIER_INFO, info, &inOutSize); if(kr != KERN_SUCCESS) { - KSLOG_TRACE("Error getting thread_info with flavor THREAD_IDENTIFIER_INFO from mach thread : %s", mach_error_string(kr)); + RollbarCrashLOG_TRACE("Error getting thread_info with flavor THREAD_IDENTIFIER_INFO from mach thread : %s", mach_error_string(kr)); return false; } thread_identifier_info_t idInfo = (thread_identifier_info_t)info; if(!ksmem_isMemoryReadable(idInfo, sizeof(*idInfo))) { - KSLOG_DEBUG("Thread %p has an invalid thread identifier info %p", thread, idInfo); + RollbarCrashLOG_DEBUG("Thread %p has an invalid thread identifier info %p", thread, idInfo); return false; } dispatch_queue_t* dispatch_queue_ptr = (dispatch_queue_t*)idInfo->dispatch_qaddr; if(!ksmem_isMemoryReadable(dispatch_queue_ptr, sizeof(*dispatch_queue_ptr))) { - KSLOG_DEBUG("Thread %p has an invalid dispatch queue pointer %p", thread, dispatch_queue_ptr); + RollbarCrashLOG_DEBUG("Thread %p has an invalid dispatch queue pointer %p", thread, dispatch_queue_ptr); return false; } //thread_handle shouldn't be 0 also, because //identifier_info->dispatch_qaddr = identifier_info->thread_handle + get_dispatchqueue_offset_from_proc(thread->task->bsd_info); if(dispatch_queue_ptr == NULL || idInfo->thread_handle == 0 || *dispatch_queue_ptr == NULL) { - KSLOG_TRACE("This thread doesn't have a dispatch queue attached : %p", thread); + RollbarCrashLOG_TRACE("This thread doesn't have a dispatch queue attached : %p", thread); return false; } @@ -94,10 +94,10 @@ bool ksthread_getQueueName(const KSThread thread, char* const buffer, int bufLen const char* queue_name = dispatch_queue_get_label(dispatch_queue); if(queue_name == NULL) { - KSLOG_TRACE("Error while getting dispatch queue name : %p", dispatch_queue); + RollbarCrashLOG_TRACE("Error while getting dispatch queue name : %p", dispatch_queue); return false; } - KSLOG_TRACE("Dispatch queue name: %s", queue_name); + RollbarCrashLOG_TRACE("Dispatch queue name: %s", queue_name); int length = (int)strlen(queue_name); // Queue label must be a null terminated string. @@ -112,12 +112,12 @@ bool ksthread_getQueueName(const KSThread thread, char* const buffer, int bufLen if(queue_name[iLabel] != 0) { // Found a non-null, invalid char. - KSLOG_TRACE("Queue label contains invalid chars"); + RollbarCrashLOG_TRACE("Queue label contains invalid chars"); return false; } bufLength = MIN(length, bufLength - 1);//just strlen, without null-terminator strncpy(buffer, queue_name, bufLength); buffer[bufLength] = 0;//terminate string - KSLOG_TRACE("Queue label = %s", buffer); + RollbarCrashLOG_TRACE("Queue label = %s", buffer); return true; } diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashgetsect.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashgetsect.c index ebce2605..6c91f8fe 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashgetsect.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashgetsect.c @@ -1,5 +1,5 @@ // -// KSgetsect.c +// RollbarCrashgetsect.c // // Copyright (c) 2019 YANDEX LLC. All rights reserved. // @@ -45,7 +45,7 @@ // @APPLE_LICENSE_HEADER_END@ // -#include "KSgetsect.h" +#include "RollbarCrashgetsect.h" #include const segment_command_t *ksgs_getsegbynamefromheader(const mach_header_t *header, const char *seg_name) diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashgetsect.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashgetsect.h index 6140e0d5..b7be00da 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashgetsect.h +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashgetsect.h @@ -1,5 +1,5 @@ // -// KSgetsect.h +// RollbarCrashgetsect.h // // Copyright (c) 2019 YANDEX LLC. All rights reserved. // @@ -22,15 +22,15 @@ // THE SOFTWARE. // -#ifndef KSgetsect_h -#define KSgetsect_h +#ifndef RollbarCrashgetsect_h +#define RollbarCrashgetsect_h #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #include -#include "KSPlatformSpecificDefines.h" +#include "RollbarCrashPlatformSpecificDefines.h" /** * This routine returns the segment_command structure for the named segment @@ -44,4 +44,4 @@ const segment_command_t *ksgs_getsegbynamefromheader(const mach_header_t *header } #endif /* __cplusplus */ -#endif /* KSgetsect_h */ +#endif /* RollbarCrashgetsect_h */ diff --git a/RollbarNotifier/Sources/RollbarCrash/Reporting/Filters/RollbarCrashReportFilterBasic.m b/RollbarNotifier/Sources/RollbarCrash/Reporting/Filters/RollbarCrashReportFilterBasic.m index 75637e62..2053ba89 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Reporting/Filters/RollbarCrashReportFilterBasic.m +++ b/RollbarNotifier/Sources/RollbarCrash/Reporting/Filters/RollbarCrashReportFilterBasic.m @@ -1,5 +1,5 @@ // -// KSCrashReportFilterBasic.m +// RollbarCrashReportFilterBasic.m // // Created by Karl Stenerud on 2012-05-11. // @@ -25,24 +25,24 @@ // -#import "KSCrashReportFilterBasic.h" +#import "RollbarCrashReportFilterBasic.h" #import "NSError+SimpleConstructor.h" #import "Container+DeepSearch.h" -#import "KSVarArgs.h" +#import "RollbarCrashVarArgs.h" -//#define KSLogger_LocalLevel TRACE -#import "KSLogger.h" +//#define RollbarCrashLogger_LocalLevel TRACE +#import "RollbarCrashLogger.h" -@implementation KSCrashReportFilterPassthrough +@implementation RollbarCrashReportFilterPassthrough -+ (KSCrashReportFilterPassthrough*) filter ++ (RollbarCrashReportFilterPassthrough*) filter { return [[self alloc] init]; } - (void) filterReports:(NSArray*) reports - onCompletion:(KSCrashReportFilterCompletion) onCompletion + onCompletion:(RollbarCrashReportFilterCompletion) onCompletion { kscrash_callCompletion(onCompletion, reports, YES, nil); } @@ -50,7 +50,7 @@ - (void) filterReports:(NSArray*) reports @end -@interface KSCrashReportFilterCombine () +@interface RollbarCrashReportFilterCombine () @property(nonatomic,readwrite,retain) NSArray* filters; @property(nonatomic,readwrite,retain) NSArray* keys; @@ -60,7 +60,7 @@ - (id) initWithFilters:(NSArray*) filters keys:(NSArray*) keys; @end -@implementation KSCrashReportFilterCombine +@implementation RollbarCrashReportFilterCombine @synthesize filters = _filters; @synthesize keys = _keys; @@ -75,16 +75,16 @@ - (id) initWithFilters:(NSArray*) filters keys:(NSArray*) keys return self; } -+ (KSVA_Block) argBlockWithFilters:(NSMutableArray*) filters andKeys:(NSMutableArray*) keys ++ (RollbarCrashVA_Block) argBlockWithFilters:(NSMutableArray*) filters andKeys:(NSMutableArray*) keys { __block BOOL isKey = FALSE; - KSVA_Block block = ^(id entry) + RollbarCrashVA_Block block = ^(id entry) { if(isKey) { if(entry == nil) { - KSLOG_ERROR(@"key entry was nil"); + RollbarCrashLOG_ERROR(@"key entry was nil"); } else { @@ -95,11 +95,11 @@ + (KSVA_Block) argBlockWithFilters:(NSMutableArray*) filters andKeys:(NSMutableA { if([entry isKindOfClass:[NSArray class]]) { - entry = [KSCrashReportFilterPipeline filterWithFilters:entry, nil]; + entry = [RollbarCrashReportFilterPipeline filterWithFilters:entry, nil]; } - if(![entry conformsToProtocol:@protocol(KSCrashReportFilter)]) + if(![entry conformsToProtocol:@protocol(RollbarCrashReportFilter)]) { - KSLOG_ERROR(@"Not a filter: %@", entry); + RollbarCrashLOG_ERROR(@"Not a filter: %@", entry); // Cause next key entry to fail as well. return; } @@ -113,7 +113,7 @@ + (KSVA_Block) argBlockWithFilters:(NSMutableArray*) filters andKeys:(NSMutableA return [block copy]; } -+ (KSCrashReportFilterCombine*) filterWithFiltersAndKeys:(id) firstFilter, ... ++ (RollbarCrashReportFilterCombine*) filterWithFiltersAndKeys:(id) firstFilter, ... { NSMutableArray* filters = [NSMutableArray array]; NSMutableArray* keys = [NSMutableArray array]; @@ -130,7 +130,7 @@ - (id) initWithFiltersAndKeys:(id) firstFilter, ... } - (void) filterReports:(NSArray*) reports - onCompletion:(KSCrashReportFilterCompletion) onCompletion + onCompletion:(RollbarCrashReportFilterCompletion) onCompletion { NSArray* filters = self.filters; NSArray* keys = self.keys; @@ -155,8 +155,8 @@ - (void) filterReports:(NSArray*) reports NSMutableArray* reportSets = [NSMutableArray arrayWithCapacity:filterCount]; __block NSUInteger iFilter = 0; - __block KSCrashReportFilterCompletion filterCompletion = nil; - __block __weak KSCrashReportFilterCompletion weakFilterCompletion = nil; + __block RollbarCrashReportFilterCompletion filterCompletion = nil; + __block __weak RollbarCrashReportFilterCompletion weakFilterCompletion = nil; dispatch_block_t disposeOfCompletion = [^ { // Release self-reference on the main thread. @@ -193,7 +193,7 @@ - (void) filterReports:(NSArray*) reports [reportSets addObject:filteredReports]; if(++iFilter < filterCount) { - id filter = [filters objectAtIndex:iFilter]; + id filter = [filters objectAtIndex:iFilter]; [filter filterReports:reports onCompletion:weakFilterCompletion]; return; } @@ -223,7 +223,7 @@ - (void) filterReports:(NSArray*) reports weakFilterCompletion = filterCompletion; // Initial call with first filter to start everything going. - id filter = [filters objectAtIndex:iFilter]; + id filter = [filters objectAtIndex:iFilter]; [filter filterReports:reports onCompletion:filterCompletion]; } @@ -231,18 +231,18 @@ - (void) filterReports:(NSArray*) reports @end -@interface KSCrashReportFilterPipeline () +@interface RollbarCrashReportFilterPipeline () @property(nonatomic,readwrite,retain) NSArray* filters; @end -@implementation KSCrashReportFilterPipeline +@implementation RollbarCrashReportFilterPipeline @synthesize filters = _filters; -+ (KSCrashReportFilterPipeline*) filterWithFilters:(id) firstFilter, ... ++ (RollbarCrashReportFilterPipeline*) filterWithFilters:(id) firstFilter, ... { ksva_list_to_nsarray(firstFilter, filters); return [[self alloc] initWithFiltersArray:filters]; @@ -259,7 +259,7 @@ - (id) initWithFiltersArray:(NSArray*) filters if((self = [super init])) { NSMutableArray* expandedFilters = [NSMutableArray array]; - for(id filter in filters) + for(id filter in filters) { if([filter isKindOfClass:[NSArray class]]) { @@ -275,14 +275,14 @@ - (id) initWithFiltersArray:(NSArray*) filters return self; } -- (void) addFilter:(id) filter +- (void) addFilter:(id) filter { NSMutableArray* mutableFilters = (NSMutableArray*)self.filters; // Shh! Don't tell anyone! [mutableFilters insertObject:filter atIndex:0]; } - (void) filterReports:(NSArray*) reports - onCompletion:(KSCrashReportFilterCompletion) onCompletion + onCompletion:(RollbarCrashReportFilterCompletion) onCompletion { NSArray* filters = self.filters; NSUInteger filterCount = [filters count]; @@ -294,8 +294,8 @@ - (void) filterReports:(NSArray*) reports } __block NSUInteger iFilter = 0; - __block KSCrashReportFilterCompletion filterCompletion; - __block __weak KSCrashReportFilterCompletion weakFilterCompletion = nil; + __block RollbarCrashReportFilterCompletion filterCompletion; + __block __weak RollbarCrashReportFilterCompletion weakFilterCompletion = nil; dispatch_block_t disposeOfCompletion = [^ { // Release self-reference on the main thread. @@ -332,7 +332,7 @@ - (void) filterReports:(NSArray*) reports // filter fails to complete. if(++iFilter < filterCount) { - id filter = [filters objectAtIndex:iFilter]; + id filter = [filters objectAtIndex:iFilter]; [filter filterReports:filteredReports onCompletion:weakFilterCompletion]; return; } @@ -344,26 +344,26 @@ - (void) filterReports:(NSArray*) reports weakFilterCompletion = filterCompletion; // Initial call with first filter to start everything going. - id filter = [filters objectAtIndex:iFilter]; + id filter = [filters objectAtIndex:iFilter]; [filter filterReports:reports onCompletion:filterCompletion]; } @end -@interface KSCrashReportFilterObjectForKey () +@interface RollbarCrashReportFilterObjectForKey () @property(nonatomic, readwrite, retain) id key; @property(nonatomic, readwrite, assign) BOOL allowNotFound; @end -@implementation KSCrashReportFilterObjectForKey +@implementation RollbarCrashReportFilterObjectForKey @synthesize key = _key; @synthesize allowNotFound = _allowNotFound; -+ (KSCrashReportFilterObjectForKey*) filterWithKey:(id)key ++ (RollbarCrashReportFilterObjectForKey*) filterWithKey:(id)key allowNotFound:(BOOL) allowNotFound { return [[self alloc] initWithKey:key allowNotFound:allowNotFound]; @@ -381,7 +381,7 @@ - (id) initWithKey:(id)key } - (void) filterReports:(NSArray*) reports - onCompletion:(KSCrashReportFilterCompletion) onCompletion + onCompletion:(RollbarCrashReportFilterCompletion) onCompletion { NSMutableArray* filteredReports = [NSMutableArray arrayWithCapacity:[reports count]]; for(NSDictionary* report in reports) @@ -418,19 +418,19 @@ - (void) filterReports:(NSArray*) reports @end -@interface KSCrashReportFilterConcatenate () +@interface RollbarCrashReportFilterConcatenate () @property(nonatomic, readwrite, retain) NSString* separatorFmt; @property(nonatomic, readwrite, retain) NSArray* keys; @end -@implementation KSCrashReportFilterConcatenate +@implementation RollbarCrashReportFilterConcatenate @synthesize separatorFmt = _separatorFmt; @synthesize keys = _keys; -+ (KSCrashReportFilterConcatenate*) filterWithSeparatorFmt:(NSString*) separatorFmt keys:(id) firstKey, ... ++ (RollbarCrashReportFilterConcatenate*) filterWithSeparatorFmt:(NSString*) separatorFmt keys:(id) firstKey, ... { ksva_list_to_nsarray(firstKey, keys); return [[self alloc] initWithSeparatorFmt:separatorFmt keysArray:keys]; @@ -466,7 +466,7 @@ - (id) initWithSeparatorFmt:(NSString*) separatorFmt keysArray:(NSArray*) keys } - (void) filterReports:(NSArray*) reports - onCompletion:(KSCrashReportFilterCompletion) onCompletion + onCompletion:(RollbarCrashReportFilterCompletion) onCompletion { NSMutableArray* filteredReports = [NSMutableArray arrayWithCapacity:[reports count]]; for(NSDictionary* report in reports) @@ -494,17 +494,17 @@ - (void) filterReports:(NSArray*) reports @end -@interface KSCrashReportFilterSubset () +@interface RollbarCrashReportFilterSubset () @property(nonatomic, readwrite, retain) NSArray* keyPaths; @end -@implementation KSCrashReportFilterSubset +@implementation RollbarCrashReportFilterSubset @synthesize keyPaths = _keyPaths; -+ (KSCrashReportFilterSubset*) filterWithKeys:(id) firstKeyPath, ... ++ (RollbarCrashReportFilterSubset*) filterWithKeys:(id) firstKeyPath, ... { ksva_list_to_nsarray(firstKeyPath, keyPaths); return [[self alloc] initWithKeysArray:keyPaths]; @@ -539,7 +539,7 @@ - (id) initWithKeysArray:(NSArray*) keyPaths } - (void) filterReports:(NSArray*) reports - onCompletion:(KSCrashReportFilterCompletion) onCompletion + onCompletion:(RollbarCrashReportFilterCompletion) onCompletion { NSMutableArray* filteredReports = [NSMutableArray arrayWithCapacity:[reports count]]; for(NSDictionary* report in reports) @@ -566,15 +566,15 @@ - (void) filterReports:(NSArray*) reports @end -@implementation KSCrashReportFilterDataToString +@implementation RollbarCrashReportFilterDataToString -+ (KSCrashReportFilterDataToString*) filter ++ (RollbarCrashReportFilterDataToString*) filter { return [[self alloc] init]; } - (void) filterReports:(NSArray*) reports - onCompletion:(KSCrashReportFilterCompletion)onCompletion + onCompletion:(RollbarCrashReportFilterCompletion)onCompletion { NSMutableArray* filteredReports = [NSMutableArray arrayWithCapacity:[reports count]]; for(NSData* report in reports) @@ -589,15 +589,15 @@ - (void) filterReports:(NSArray*) reports @end -@implementation KSCrashReportFilterStringToData +@implementation RollbarCrashReportFilterStringToData -+ (KSCrashReportFilterStringToData*) filter ++ (RollbarCrashReportFilterStringToData*) filter { return [[self alloc] init]; } - (void) filterReports:(NSArray*) reports - onCompletion:(KSCrashReportFilterCompletion)onCompletion + onCompletion:(RollbarCrashReportFilterCompletion)onCompletion { NSMutableArray* filteredReports = [NSMutableArray arrayWithCapacity:[reports count]]; for(NSString* report in reports) diff --git a/RollbarNotifier/Sources/RollbarCrash/Reporting/Filters/Tools/RollbarCrashVarArgs.h b/RollbarNotifier/Sources/RollbarCrash/Reporting/Filters/Tools/RollbarCrashVarArgs.h index f871fddc..cb5b7f6e 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Reporting/Filters/Tools/RollbarCrashVarArgs.h +++ b/RollbarNotifier/Sources/RollbarCrash/Reporting/Filters/Tools/RollbarCrashVarArgs.h @@ -1,5 +1,5 @@ // -// KSVarArgs.h +// RollbarCrashVarArgs.h // // Created by Karl Stenerud on 2012-08-19. // @@ -25,7 +25,7 @@ // -/* KSVarArgs is a set of macros designed to make dealing with variable arguments +/* RollbarCrashVarArgs is a set of macros designed to make dealing with variable arguments * easier in Objective-C. All macros assume that the varargs list contains only * objective-c objects or object-like structures (assignable to type id). * @@ -40,18 +40,18 @@ * * @param entry The current argument in the vararg list. */ -typedef void (^KSVA_Block)(id entry); +typedef void (^RollbarCrashVA_Block)(id entry); /** * Iterate over a va_list, executing the specified code block for each entry. * * @param FIRST_ARG_NAME The name of the first argument in the vararg list. - * @param BLOCK A code block of type KSVA_Block. + * @param BLOCK A code block of type RollbarCrashVA_Block. */ #define ksva_iterate_list(FIRST_ARG_NAME, BLOCK) \ { \ - KSVA_Block ksva_block = BLOCK; \ + RollbarCrashVA_Block ksva_block = BLOCK; \ va_list ksva_args; \ va_start(ksva_args,FIRST_ARG_NAME); \ for(id ksva_arg = FIRST_ARG_NAME; ksva_arg != nil; ksva_arg = va_arg(ksva_args, id)) \ diff --git a/RollbarNotifier/Sources/RollbarCrash/Reporting/Tools/RollbarCrashCString.h b/RollbarNotifier/Sources/RollbarCrash/Reporting/Tools/RollbarCrashCString.h index 73975280..108c8a32 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Reporting/Tools/RollbarCrashCString.h +++ b/RollbarNotifier/Sources/RollbarCrash/Reporting/Tools/RollbarCrashCString.h @@ -1,5 +1,5 @@ // -// KSCString.h +// RollbarCrashCString.h // // Created by Karl Stenerud on 2013-02-23. // @@ -29,7 +29,7 @@ /** * A string, stored C style with null termination. */ -@interface KSCString : NSObject +@interface RollbarCrashCString : NSObject /** Length of the string in bytes (not characters!). Length does not include null terminator. */ @property(nonatomic,readonly,assign) NSUInteger length; @@ -38,16 +38,16 @@ @property(nonatomic,readonly,assign) const char* bytes; /** Constructor for NSString */ -+ (KSCString*) stringWithString:(NSString*) string; ++ (RollbarCrashCString*) stringWithString:(NSString*) string; /** Constructor for null-terminated C string (assumes UTF-8 encoding). */ -+ (KSCString*) stringWithCString:(const char*) string; ++ (RollbarCrashCString*) stringWithCString:(const char*) string; /** Constructor for string contained in NSData (assumes UTF-8 encoding). */ -+ (KSCString*) stringWithData:(NSData*) data; ++ (RollbarCrashCString*) stringWithData:(NSData*) data; /** Constructor for non-terminated string (assumes UTF-8 encoding). */ -+ (KSCString*) stringWithData:(const char*) data length:(NSUInteger) length; ++ (RollbarCrashCString*) stringWithData:(const char*) data length:(NSUInteger) length; - (id) initWithString:(NSString*) string; - (id) initWithCString:(const char*) string; diff --git a/RollbarNotifier/Sources/RollbarCrash/Reporting/Tools/RollbarCrashCString.m b/RollbarNotifier/Sources/RollbarCrash/Reporting/Tools/RollbarCrashCString.m index a37f138d..12a9f70a 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Reporting/Tools/RollbarCrashCString.m +++ b/RollbarNotifier/Sources/RollbarCrash/Reporting/Tools/RollbarCrashCString.m @@ -1,5 +1,5 @@ // -// KSCString.m +// RollbarCrashCString.m // // Created by Karl Stenerud on 2013-02-23. // @@ -24,29 +24,29 @@ // THE SOFTWARE. // -#import "KSCString.h" +#import "RollbarCrashCString.h" -@implementation KSCString +@implementation RollbarCrashCString @synthesize length = _length; @synthesize bytes = _bytes; -+ (KSCString*) stringWithString:(NSString*) string ++ (RollbarCrashCString*) stringWithString:(NSString*) string { return [[self alloc] initWithString:string]; } -+ (KSCString*) stringWithCString:(const char*) string ++ (RollbarCrashCString*) stringWithCString:(const char*) string { return [[self alloc] initWithCString:string]; } -+ (KSCString*) stringWithData:(NSData*) data ++ (RollbarCrashCString*) stringWithData:(NSData*) data { return [[self alloc] initWithData:data]; } -+ (KSCString*) stringWithData:(const char*) data length:(NSUInteger) length ++ (RollbarCrashCString*) stringWithData:(const char*) data length:(NSUInteger) length { return [[self alloc] initWithData:data length:length]; } diff --git a/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrash.h b/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrash.h index 7191a5f2..d46e0461 100644 --- a/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrash.h +++ b/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrash.h @@ -1,5 +1,5 @@ // -// KSCrash.h +// RollbarCrash.h // // Created by Karl Stenerud on 2012-01-28. // @@ -27,27 +27,27 @@ #import -#import "KSCrashReportWriter.h" -#import "KSCrashReportFilter.h" -#import "KSCrashMonitorType.h" +#import "RollbarCrashReportWriter.h" +#import "RollbarCrashReportFilter.h" +#import "RollbarCrashMonitorType.h" typedef enum { - KSCDeleteNever, - KSCDeleteOnSucess, - KSCDeleteAlways -} KSCDeleteBehavior; + RollbarCrashDeleteNever, + RollbarCrashDeleteOnSucess, + RollbarCrashDeleteAlways +} RollbarCrashDeleteBehavior; /** * Reports any crashes that occur in the application. * - * The crash reports will be located in $APP_HOME/Library/Caches/KSCrashReports + * The crash reports will be located in $APP_HOME/Library/Caches/RollbarCrashReports */ -@interface KSCrash : NSObject +@interface RollbarCrash : NSObject #pragma mark - Configuration - -/** Init KSCrash instance with custom base path. */ +/** Init RollbarCrash instance with custom base path. */ - (id) initWithBasePath:(NSString *)basePath; /** A dictionary containing any info you'd like to appear in crash reports. Must @@ -60,29 +60,29 @@ typedef enum /** What to do after sending reports via sendAllReportsWithCompletion: * - * - Use KSCDeleteNever if you will manually manage the reports. - * - Use KSCDeleteAlways if you will be using an alert confirmation (otherwise it + * - Use RollbarCrashCDeleteNever if you will manually manage the reports. + * - Use RollbarCrashCDeleteAlways if you will be using an alert confirmation (otherwise it * will nag the user incessantly until he selects "yes"). - * - Use KSCDeleteOnSuccess for all other situations. + * - Use RollbarCrashCDeleteOnSuccess for all other situations. * - * Default: KSCDeleteAlways + * Default: RollbarCrashCDeleteAlways */ -@property(nonatomic,readwrite,assign) KSCDeleteBehavior deleteBehaviorAfterSendAll; +@property(nonatomic,readwrite,assign) RollbarCrashDeleteBehavior deleteBehaviorAfterSendAll; /** The monitors that will or have been installed. - * Note: This value may change once KSCrash is installed if some monitors + * Note: This value may change once RollbarCrash is installed if some monitors * fail to install. * - * Default: KSCrashMonitorTypeProductionSafeMinimal + * Default: RollbarCrashMonitorTypeProductionSafeMinimal */ -@property(nonatomic,readwrite,assign) KSCrashMonitorType monitoring; +@property(nonatomic,readwrite,assign) RollbarCrashMonitorType monitoring; /** Maximum time to allow the main thread to run without returning. * If a task occupies the main thread for longer than this interval, the * watchdog will consider the queue deadlocked and shut down the app and write a * crash report. * - * Note: You must have added KSCrashMonitorTypeMainThreadDeadlock to the monitoring + * Note: You must have added RollbarCrashMonitorTypeMainThreadDeadlock to the monitoring * property in order for this to have any effect. * * Warning: Make SURE that nothing in your app that runs on the main thread takes @@ -146,7 +146,7 @@ typedef enum * Note: If you use an installation, it will automatically set this property. * Do not modify it in such a case. */ -@property(nonatomic,readwrite,retain) id sink; +@property(nonatomic,readwrite,retain) id sink; /** C Function to call during a crash report to give the callee an opportunity to * add to the report. NULL = ignore. @@ -157,21 +157,21 @@ typedef enum * Note: If you use an installation, it will automatically set this property. * Do not modify it in such a case. */ -@property(nonatomic,readwrite,assign) KSReportWriteCallback onCrash; +@property(nonatomic,readwrite,assign) RollbarCrashReportWriteCallback onCrash; -/** Add a copy of KSCrash's console log messages to the crash report. +/** Add a copy of RollbarCrash's console log messages to the crash report. */ @property(nonatomic,readwrite,assign) BOOL addConsoleLogToReport; -/** Print the previous app run log to the console when installing KSCrash. +/** Print the previous app run log to the console when installing RollbarCrash. * This is primarily for debugging purposes. */ @property(nonatomic,readwrite,assign) BOOL printPreviousLog; -/** Exposes the uncaughtExceptionHandler if set from KSCrash. Is nil if debugger is running. **/ +/** Exposes the uncaughtExceptionHandler if set from RollbarCrash. Is nil if debugger is running. **/ @property (nonatomic, assign) NSUncaughtExceptionHandler *uncaughtExceptionHandler; -/** Exposes the currentSnapshotUserReportedExceptionHandler if set from KSCrash. Is nil if debugger is running. **/ +/** Exposes the currentSnapshotUserReportedExceptionHandler if set from RollbarCrash. Is nil if debugger is running. **/ @property (nonatomic, assign) NSUncaughtExceptionHandler *currentSnapshotUserReportedExceptionHandler; #pragma mark - Information - @@ -210,7 +210,7 @@ typedef enum /** Get the singleton instance of the crash reporter. */ -+ (KSCrash*) sharedInstance; ++ (RollbarCrash*) sharedInstance; /** Install the crash reporter. * The reporter will record crashes, but will not send any crash reports unless @@ -230,7 +230,7 @@ typedef enum * * @param onCompletion Called when sending is complete (nil = ignore). */ -- (void) sendAllReportsWithCompletion:(KSCrashReportFilterCompletion) onCompletion; +- (void) sendAllReportsWithCompletion:(RollbarCrashReportFilterCompletion) onCompletion; /** Get all unsent report IDs. * @@ -242,7 +242,7 @@ typedef enum * * @param reportID An ID of report. * - * @return A dictionary with report fields. See KSCrashReportFields.h for available fields. + * @return A dictionary with report fields. See RollbarCrashReportFields.h for available fields. */ - (NSDictionary*) reportWithID:(NSNumber*) reportID; @@ -295,8 +295,8 @@ typedef enum @end -//! Project version number for KSCrashFramework. -FOUNDATION_EXPORT const double KSCrashFrameworkVersionNumber; +//! Project version number for RollbarCrashFramework. +FOUNDATION_EXPORT const double RollbarCrashFrameworkVersionNumber; -//! Project version string for KSCrashFramework. -FOUNDATION_EXPORT const unsigned char KSCrashFrameworkVersionString[]; +//! Project version string for RollbarCrashFramework. +FOUNDATION_EXPORT const unsigned char RollbarCrashFrameworkVersionString[]; diff --git a/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashC.h b/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashC.h index f09fb32f..e3ef4e74 100644 --- a/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashC.h +++ b/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashC.h @@ -1,5 +1,5 @@ // -// KSCrashC.h +// RollbarCrashC.h // // Created by Karl Stenerud on 2012-01-28. // @@ -29,16 +29,16 @@ */ -#ifndef HDR_KSCrashC_h -#define HDR_KSCrashC_h +#ifndef HDR_RollbarCrashC_h +#define HDR_RollbarCrashC_h #ifdef __cplusplus extern "C" { #endif -#include "KSCrashMonitorType.h" -#include "KSCrashReportWriter.h" +#include "RollbarCrashMonitorType.h" +#include "RollbarCrashReportWriter.h" #include @@ -50,7 +50,7 @@ extern "C" { * * @return The crash types that are being handled. */ -KSCrashMonitorType kscrash_install(const char* appName, const char* const installPath); +RollbarCrashMonitorType kscrash_install(const char* appName, const char* const installPath); /** Set the crash types that will be handled. * Some crash types may not be enabled depending on circumstances (e.g. running @@ -58,12 +58,12 @@ KSCrashMonitorType kscrash_install(const char* appName, const char* const instal * * @param monitors The monitors to install. * - * @return The monitors that were installed. If KSCrash has been + * @return The monitors that were installed. If RollbarCrash has been * installed, the return value represents the monitors that were * successfully installed. Otherwise it represents which monitors it - * will attempt to activate when KSCrash installs. + * will attempt to activate when RollbarCrash installs. */ -KSCrashMonitorType kscrash_setMonitoring(KSCrashMonitorType monitors); +RollbarCrashMonitorType kscrash_setMonitoring(RollbarCrashMonitorType monitors); /** Set the user-supplied data in JSON format. * @@ -127,9 +127,9 @@ void kscrash_setDoNotIntrospectClasses(const char** doNotIntrospectClasses, int * * Default: NULL */ -void kscrash_setCrashNotifyCallback(const KSReportWriteCallback onCrashNotify); +void kscrash_setCrashNotifyCallback(const RollbarCrashReportWriteCallback onCrashNotify); -typedef void (*KSReportWrittenCallback)(int64_t reportID); +typedef void (*RollbarCrashReportWrittenCallback)(int64_t reportID); /** Set the callback to invoke upon finishing writing a crash report. Default is @c NULL . * @@ -140,15 +140,15 @@ typedef void (*KSReportWrittenCallback)(int64_t reportID); * give the callee an opportunity to react to the report. * NULL = ignore. */ -void kscrash_setReportWrittenCallback(const KSReportWrittenCallback onReportWrittenNotify); +void kscrash_setReportWrittenCallback(const RollbarCrashReportWrittenCallback onReportWrittenNotify); -/** Set if KSLOG console messages should be appended to the report. +/** Set if RollbarCrashLOG console messages should be appended to the report. * * @param shouldAddConsoleLogToReport If true, add the log to the report. */ void kscrash_setAddConsoleLogToReport(bool shouldAddConsoleLogToReport); -/** Set if KSCrash should print the previous log to the console on startup. +/** Set if RollbarCrash should print the previous log to the console on startup. * This is for debugging purposes. */ void kscrash_setPrintPreviousLog(bool shouldPrintPreviousLog); @@ -198,7 +198,7 @@ void enableSwapCxaThrow(void); #pragma mark -- Notifications -- -/** Notify the crash reporter of KSCrash being added to Objective-C runtime system. +/** Notify the crash reporter of RollbarCrash being added to Objective-C runtime system. */ void kscrash_notifyObjCLoad(void); @@ -272,4 +272,4 @@ void kscrash_deleteReportWithID(int64_t reportID); } #endif -#endif // HDR_KSCrashC_h +#endif // HDR_RollbarCrashC_h diff --git a/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashInstallation+Private.h b/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashInstallation+Private.h index 5a642927..e15e8eed 100644 --- a/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashInstallation+Private.h +++ b/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashInstallation+Private.h @@ -1,5 +1,5 @@ // -// KSCrashReportFieldProperties.h +// RollbarCrashReportFieldProperties.h // // Created by Karl Stenerud on 2013-02-10. // @@ -25,7 +25,7 @@ // -#import "KSCrashInstallation.h" +#import "RollbarCrashInstallation.h" /** Implement a property to be used as a "key". */ @@ -54,7 +54,7 @@ IMPLEMENT_REPORT_VALUE_PROPERTY(NAME, NAMEUPPER, TYPE) \ IMPLEMENT_REPORT_KEY_PROPERTY(NAME, NAMEUPPER) -@interface KSCrashInstallation () +@interface RollbarCrashInstallation () /** Initializer. * @@ -78,7 +78,7 @@ IMPLEMENT_REPORT_KEY_PROPERTY(NAME, NAMEUPPER) /** Create a new sink. Subclasses must implement this. */ -- (id) sink; +- (id) sink; /** Make an absolute key path if the specified path is not already absolute. */ - (NSString*) makeKeyPath:(NSString*) keyPath; diff --git a/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashInstallation.h b/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashInstallation.h index 2a6e97d8..9444867f 100644 --- a/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashInstallation.h +++ b/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashInstallation.h @@ -1,5 +1,5 @@ // -// KSCrashInstallation.h +// RollbarCrashInstallation.h // // Created by Karl Stenerud on 2013-02-10. // @@ -26,8 +26,8 @@ #import -#import "KSCrashReportFilter.h" -#import "KSCrashReportWriter.h" +#import "RollbarCrashReportFilter.h" +#import "RollbarCrashReportWriter.h" /** @@ -37,7 +37,7 @@ * * This is an abstract class. */ -@interface KSCrashInstallation : NSObject +@interface RollbarCrashInstallation : NSObject /** C Function to call during a crash report to give the callee an opportunity to * add to the report. NULL = ignore. @@ -45,27 +45,27 @@ * WARNING: Only call async-safe functions from this function! DO NOT call * Objective-C methods!!! */ -@property(atomic,readwrite,assign) KSReportWriteCallback onCrash; +@property(atomic,readwrite,assign) RollbarCrashReportWriteCallback onCrash; -/** Install this installation. Call this instead of -[KSCrash install] to install +/** Install this installation. Call this instead of -[RollbarCrash install] to install * with everything needed for your particular backend. */ - (void) install; -/** Convenience method to call -[KSCrash sendAllReportsWithCompletion:]. - * This method will set the KSCrash sink and then send all outstanding reports. +/** Convenience method to call -[RollbarCrash sendAllReportsWithCompletion:]. + * This method will set the RollbarCrash sink and then send all outstanding reports. * - * Note: Pay special attention to KSCrash's "deleteBehaviorAfterSendAll" property. + * Note: Pay special attention to RollbarCrash's "deleteBehaviorAfterSendAll" property. * * @param onCompletion Called when sending is complete (nil = ignore). */ -- (void) sendAllReportsWithCompletion:(KSCrashReportFilterCompletion) onCompletion; +- (void) sendAllReportsWithCompletion:(RollbarCrashReportFilterCompletion) onCompletion; /** Add a filter that gets executed before all normal filters. * Prepended filters will be executed in the order in which they were added. * * @param filter the filter to prepend. */ -- (void) addPreFilter:(id) filter; +- (void) addPreFilter:(id) filter; @end diff --git a/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashJSONCodecObjC.h b/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashJSONCodecObjC.h index fb71c37c..a6b24abe 100644 --- a/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashJSONCodecObjC.h +++ b/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashJSONCodecObjC.h @@ -1,5 +1,5 @@ // -// KSJSONCodecObjC.h +// RollbarCrashJSONCodecObjC.h // // Created by Karl Stenerud on 2012-01-08. // @@ -31,45 +31,45 @@ /** Optional behavior when encoding JSON data */ typedef enum { - KSJSONEncodeOptionNone = 0, + RollbarCrashJSONEncodeOptionNone = 0, /** Indent 4 spaces per object/array level */ - KSJSONEncodeOptionPretty = 1, + RollbarCrashJSONEncodeOptionPretty = 1, /** Sort object contents by key name */ - KSJSONEncodeOptionSorted = 2, -} KSJSONEncodeOption; + RollbarCrashJSONEncodeOptionSorted = 2, +} RollbarCrashJSONEncodeOption; /** Optional behavior when decoding JSON data */ typedef enum { - KSJSONDecodeOptionNone = 0, + RollbarCrashJSONDecodeOptionNone = 0, /** Normally, null elements get stored as [NSNull null]. * If this option is set, do not store anything when a null element is * encountered inside an array. */ - KSJSONDecodeOptionIgnoreNullInArray = 1, + RollbarCrashJSONDecodeOptionIgnoreNullInArray = 1, /** Normally, null elements get stored as [NSNull null]. * If this option is set, do not store anything when a null element is * encountered inside an object. */ - KSJSONDecodeOptionIgnoreNullInObject = 2, + RollbarCrashJSONDecodeOptionIgnoreNullInObject = 2, /** Convenience enum to ignore nulls in arrays and objects. */ - KSJSONDecodeOptionIgnoreAllNulls = 3, + RollbarCrashJSONDecodeOptionIgnoreAllNulls = 3, /** If an error is encountered, return the partially decoded object. */ - KSJSONDecodeOptionKeepPartialObject = 4, -} KSJSONDecodeOption; + RollbarCrashJSONDecodeOptionKeepPartialObject = 4, +} RollbarCrashJSONDecodeOption; /** * Encodes and decodes UTF-8 JSON data. */ -@interface KSJSONCodec : NSObject +@interface RollbarCrashJSONCodec : NSObject /** Encode an object to JSON data. * @@ -83,7 +83,7 @@ typedef enum * @return The encoded UTF-8 JSON data or nil if an error occurred. */ + (NSData*) encode:(id) object - options:(KSJSONEncodeOption) options + options:(RollbarCrashJSONEncodeOption) options error:(NSError**) error; /** Decode JSON data to an object. @@ -95,11 +95,11 @@ typedef enum * @param error Place to store any error that occurs (nil = ignore). Will be * set to nil on success. * - * @return The decoded object or, if the KSJSONDecodeOptionKeepPartialFile + * @return The decoded object or, if the RollbarCrashJSONDecodeOptionKeepPartialFile * option is not set, nil when an error occurs. */ + (id) decode:(NSData*) JSONData - options:(KSJSONDecodeOption) options + options:(RollbarCrashJSONDecodeOption) options error:(NSError**) error; @end diff --git a/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashMachineContext.h b/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashMachineContext.h index 35208c04..a4029a12 100644 --- a/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashMachineContext.h +++ b/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashMachineContext.h @@ -1,5 +1,5 @@ // -// KSMachineContext.h +// RollbarCrashMachineContext.h // // Created by Karl Stenerud on 2016-12-02. // @@ -25,14 +25,14 @@ // -#ifndef HDR_KSMachineContext_h -#define HDR_KSMachineContext_h +#ifndef HDR_RollbarCrashMachineContext_h +#define HDR_RollbarCrashMachineContext_h #ifdef __cplusplus extern "C" { #endif -#include "KSThread.h" +#include "RollbarCrashThread.h" #include #include @@ -46,19 +46,19 @@ void ksmc_resumeEnvironment(thread_act_array_t threads, mach_msg_type_number_t n /** Create a new machine context on the stack. * This macro creates a storage object on the stack, as well as a pointer of type - * struct KSMachineContext* in the current scope, which points to the storage object. + * struct RollbarCrashMachineContext* in the current scope, which points to the storage object. * - * Example usage: KSMC_NEW_CONTEXT(a_context); + * Example usage: RollbarCrashMC_NEW_CONTEXT(a_context); * This creates a new pointer at the current scope that behaves as if: - * struct KSMachineContext* a_context = some_storage_location; + * struct RollbarCrashMachineContext* a_context = some_storage_location; * * @param NAME The C identifier to give the pointer. */ -#define KSMC_NEW_CONTEXT(NAME) \ +#define RollbarCrashMC_NEW_CONTEXT(NAME) \ char ksmc_##NAME##_storage[ksmc_contextSize()]; \ - struct KSMachineContext* NAME = (struct KSMachineContext*)ksmc_##NAME##_storage + struct RollbarCrashMachineContext* NAME = (struct RollbarCrashMachineContext*)ksmc_##NAME##_storage -struct KSMachineContext; +struct RollbarCrashMachineContext; /** Get the internal size of a machine context. */ @@ -72,7 +72,7 @@ int ksmc_contextSize(void); * * @return true if successful. */ -bool ksmc_getContextForThread(KSThread thread, struct KSMachineContext* destinationContext, bool isCrashedContext); +bool ksmc_getContextForThread(RollbarCrashThread thread, struct RollbarCrashMachineContext* destinationContext, bool isCrashedContext); /** Fill in a machine context from a signal handler. * A signal handler context is always assumed to be a crashed context. @@ -82,7 +82,7 @@ bool ksmc_getContextForThread(KSThread thread, struct KSMachineContext* destinat * * @return true if successful. */ -bool ksmc_getContextForSignal(void* signalUserContext, struct KSMachineContext* destinationContext); +bool ksmc_getContextForSignal(void* signalUserContext, struct RollbarCrashMachineContext* destinationContext); /** Get the thread associated with a machine context. * @@ -90,7 +90,7 @@ bool ksmc_getContextForSignal(void* signalUserContext, struct KSMachineContext* * * @return The associated thread. */ -KSThread ksmc_getThreadFromContext(const struct KSMachineContext* const context); +RollbarCrashThread ksmc_getThreadFromContext(const struct RollbarCrashMachineContext* const context); /** Get the number of threads stored in a machine context. * @@ -98,7 +98,7 @@ KSThread ksmc_getThreadFromContext(const struct KSMachineContext* const context) * * @return The number of threads. */ -int ksmc_getThreadCount(const struct KSMachineContext* const context); +int ksmc_getThreadCount(const struct RollbarCrashMachineContext* const context); /** Get a thread from a machine context. * @@ -107,7 +107,7 @@ int ksmc_getThreadCount(const struct KSMachineContext* const context); * * @return The thread. */ -KSThread ksmc_getThreadAtIndex(const struct KSMachineContext* const context, int index); +RollbarCrashThread ksmc_getThreadAtIndex(const struct RollbarCrashMachineContext* const context, int index); /** Get the index of a thread. * @@ -116,29 +116,29 @@ KSThread ksmc_getThreadAtIndex(const struct KSMachineContext* const context, int * * @return The thread's index, or -1 if it couldn't be determined. */ -int ksmc_indexOfThread(const struct KSMachineContext* const context, KSThread thread); +int ksmc_indexOfThread(const struct RollbarCrashMachineContext* const context, RollbarCrashThread thread); /** Check if this is a crashed context. */ -bool ksmc_isCrashedContext(const struct KSMachineContext* const context); +bool ksmc_isCrashedContext(const struct RollbarCrashMachineContext* const context); /** Check if this context can have stored CPU state. */ -bool ksmc_canHaveCPUState(const struct KSMachineContext* const context); +bool ksmc_canHaveCPUState(const struct RollbarCrashMachineContext* const context); /** Check if this context has valid exception registers. */ -bool ksmc_hasValidExceptionRegisters(const struct KSMachineContext* const context); +bool ksmc_hasValidExceptionRegisters(const struct RollbarCrashMachineContext* const context); /** Add a thread to the reserved threads list. * * @param thread The thread to add to the list. */ -void ksmc_addReservedThread(KSThread thread); +void ksmc_addReservedThread(RollbarCrashThread thread); #ifdef __cplusplus } #endif -#endif // HDR_KSMachineContext_h +#endif // HDR_RollbarCrashMachineContext_h diff --git a/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashMonitor.h b/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashMonitor.h index 9ff07368..de118f46 100644 --- a/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashMonitor.h +++ b/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashMonitor.h @@ -1,5 +1,5 @@ // -// KSCrashMonitor.h +// RollbarCrashMonitor.h // // Created by Karl Stenerud on 2012-02-12. // @@ -29,20 +29,20 @@ */ -#ifndef HDR_KSCrashMonitor_h -#define HDR_KSCrashMonitor_h +#ifndef HDR_RollbarCrashMonitor_h +#define HDR_RollbarCrashMonitor_h #ifdef __cplusplus extern "C" { #endif -#include "KSCrashMonitorType.h" -#include "KSThread.h" +#include "RollbarCrashMonitorType.h" +#include "RollbarCrashThread.h" #include -struct KSCrash_MonitorContext; +struct RollbarCrash_MonitorContext; // ============================================================================ @@ -53,17 +53,17 @@ struct KSCrash_MonitorContext; * * @param monitorTypes Which monitors should be active. */ -void kscm_setActiveMonitors(KSCrashMonitorType monitorTypes); +void kscm_setActiveMonitors(RollbarCrashMonitorType monitorTypes); /** Get the currently active monitors. */ -KSCrashMonitorType kscm_getActiveMonitors(void); +RollbarCrashMonitorType kscm_getActiveMonitors(void); /** Set the callback to call when an event is captured. * * @param onEvent Called whenever an event is captured. */ -void kscm_setEventCallback(void (*onEvent)(struct KSCrash_MonitorContext* monitorContext)); +void kscm_setEventCallback(void (*onEvent)(struct RollbarCrash_MonitorContext* monitorContext)); // ============================================================================ @@ -74,8 +74,8 @@ typedef struct { void (*setEnabled)(bool isEnabled); bool (*isEnabled)(void); - void (*addContextualInfoToEvent)(struct KSCrash_MonitorContext* eventContext); -} KSCrashMonitorAPI; + void (*addContextualInfoToEvent)(struct RollbarCrash_MonitorContext* eventContext); +} RollbarCrashMonitorAPI; /** Notify that a fatal exception has been captured. * This allows the system to take appropriate steps in preparation. @@ -88,11 +88,11 @@ bool kscm_notifyFatalExceptionCaptured(bool isAsyncSafeEnvironment); * * @oaram context Contextual information about the exception. */ -void kscm_handleException(struct KSCrash_MonitorContext* context); +void kscm_handleException(struct RollbarCrash_MonitorContext* context); #ifdef __cplusplus } #endif -#endif // HDR_KSCrashMonitor_h +#endif // HDR_RollbarCrashMonitor_h diff --git a/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashMonitorContext.h b/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashMonitorContext.h index 4dc6ce2c..b49564f5 100644 --- a/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashMonitorContext.h +++ b/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashMonitorContext.h @@ -1,5 +1,5 @@ // -// KSCrashMonitorContext.h +// RollbarCrashMonitorContext.h // // Created by Karl Stenerud on 2012-02-12. // @@ -25,20 +25,20 @@ // -#ifndef HDR_KSCrashMonitorContext_h -#define HDR_KSCrashMonitorContext_h +#ifndef HDR_RollbarCrashMonitorContext_h +#define HDR_RollbarCrashMonitorContext_h #ifdef __cplusplus extern "C" { #endif -#include "KSCrashMonitorType.h" -#include "KSMachineContext.h" +#include "RollbarCrashMonitorType.h" +#include "RollbarCrashMachineContext.h" #include #include -typedef struct KSCrash_MonitorContext +typedef struct RollbarCrash_MonitorContext { /** Unique identifier for this event. */ const char* eventID; @@ -67,14 +67,14 @@ typedef struct KSCrash_MonitorContext bool isStackOverflow; /** The machine context that generated the event. */ - struct KSMachineContext* offendingMachineContext; + struct RollbarCrashMachineContext* offendingMachineContext; /** Address that caused the fault. */ uintptr_t faultAddress; /** The type of crash that occurred. * This determines which other fields are valid. */ - KSCrashMonitorType crashType; + RollbarCrashMonitorType crashType; /** The name of the exception that caused the crash, if any. */ const char* exceptionName; @@ -83,7 +83,7 @@ typedef struct KSCrash_MonitorContext const char* crashReason; /** The stack cursor for the trace leading up to the crash. - * Note: Actual type is KSStackCursor* + * Note: Actual type is RollbarCrashStackCursor* */ void* stackCursor; @@ -230,11 +230,11 @@ typedef struct KSCrash_MonitorContext /** Full path to the console log, if any. */ const char* consoleLogPath; -} KSCrash_MonitorContext; +} RollbarCrash_MonitorContext; #ifdef __cplusplus } #endif -#endif // HDR_KSCrashMonitorContext_h +#endif // HDR_RollbarCrashMonitorContext_h diff --git a/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashMonitorType.h b/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashMonitorType.h index 75764617..7275fc26 100644 --- a/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashMonitorType.h +++ b/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashMonitorType.h @@ -1,5 +1,5 @@ // -// KSCrashMonitorType.h +// RollbarCrashMonitorType.h // // Copyright (c) 2012 Karl Stenerud. All rights reserved. // @@ -23,8 +23,8 @@ // -#ifndef HDR_KSCrashMonitorType_h -#define HDR_KSCrashMonitorType_h +#ifndef HDR_RollbarCrashMonitorType_h +#define HDR_RollbarCrashMonitorType_h #ifdef __cplusplus extern "C" { @@ -42,102 +42,102 @@ extern "C" { typedef enum { /* Captures and reports Mach exceptions. */ - KSCrashMonitorTypeMachException = 0x01, + RollbarCrashMonitorTypeMachException = 0x01, /* Captures and reports POSIX signals. */ - KSCrashMonitorTypeSignal = 0x02, + RollbarCrashMonitorTypeSignal = 0x02, /* Captures and reports C++ exceptions. * Note: This will slightly slow down exception processing. */ - KSCrashMonitorTypeCPPException = 0x04, + RollbarCrashMonitorTypeCPPException = 0x04, /* Captures and reports NSExceptions. */ - KSCrashMonitorTypeNSException = 0x08, + RollbarCrashMonitorTypeNSException = 0x08, /* Detects and reports a deadlock in the main thread. */ - KSCrashMonitorTypeMainThreadDeadlock = 0x10, + RollbarCrashMonitorTypeMainThreadDeadlock = 0x10, /* Accepts and reports user-generated exceptions. */ - KSCrashMonitorTypeUserReported = 0x20, + RollbarCrashMonitorTypeUserReported = 0x20, /* Keeps track of and injects system information. */ - KSCrashMonitorTypeSystem = 0x40, + RollbarCrashMonitorTypeSystem = 0x40, /* Keeps track of and injects application state. */ - KSCrashMonitorTypeApplicationState = 0x80, + RollbarCrashMonitorTypeApplicationState = 0x80, /* Keeps track of zombies, and injects the last zombie NSException. */ - KSCrashMonitorTypeZombie = 0x100, -} KSCrashMonitorType; + RollbarCrashMonitorTypeZombie = 0x100, +} RollbarCrashMonitorType; -#define KSCrashMonitorTypeAll \ +#define RollbarCrashMonitorTypeAll \ ( \ - KSCrashMonitorTypeMachException | \ - KSCrashMonitorTypeSignal | \ - KSCrashMonitorTypeCPPException | \ - KSCrashMonitorTypeNSException | \ - KSCrashMonitorTypeMainThreadDeadlock | \ - KSCrashMonitorTypeUserReported | \ - KSCrashMonitorTypeSystem | \ - KSCrashMonitorTypeApplicationState | \ - KSCrashMonitorTypeZombie \ + RollbarCrashMonitorTypeMachException | \ + RollbarCrashMonitorTypeSignal | \ + RollbarCrashMonitorTypeCPPException | \ + RollbarCrashMonitorTypeNSException | \ + RollbarCrashMonitorTypeMainThreadDeadlock | \ + RollbarCrashMonitorTypeUserReported | \ + RollbarCrashMonitorTypeSystem | \ + RollbarCrashMonitorTypeApplicationState | \ + RollbarCrashMonitorTypeZombie \ ) -#define KSCrashMonitorTypeExperimental \ +#define RollbarCrashMonitorTypeExperimental \ ( \ - KSCrashMonitorTypeMainThreadDeadlock \ + RollbarCrashMonitorTypeMainThreadDeadlock \ ) -#define KSCrashMonitorTypeDebuggerUnsafe \ +#define RollbarCrashMonitorTypeDebuggerUnsafe \ ( \ - KSCrashMonitorTypeMachException | \ - KSCrashMonitorTypeSignal | \ - KSCrashMonitorTypeCPPException | \ - KSCrashMonitorTypeNSException \ + RollbarCrashMonitorTypeMachException | \ + RollbarCrashMonitorTypeSignal | \ + RollbarCrashMonitorTypeCPPException | \ + RollbarCrashMonitorTypeNSException \ ) -#define KSCrashMonitorTypeAsyncSafe \ +#define RollbarCrashMonitorTypeAsyncSafe \ ( \ - KSCrashMonitorTypeMachException | \ - KSCrashMonitorTypeSignal \ + RollbarCrashMonitorTypeMachException | \ + RollbarCrashMonitorTypeSignal \ ) -#define KSCrashMonitorTypeOptional \ +#define RollbarCrashMonitorTypeOptional \ ( \ - KSCrashMonitorTypeZombie \ + RollbarCrashMonitorTypeZombie \ ) -#define KSCrashMonitorTypeAsyncUnsafe (KSCrashMonitorTypeAll & (~KSCrashMonitorTypeAsyncSafe)) +#define RollbarCrashMonitorTypeAsyncUnsafe (RollbarCrashMonitorTypeAll & (~RollbarCrashMonitorTypeAsyncSafe)) /** Monitors that are safe to enable in a debugger. */ -#define KSCrashMonitorTypeDebuggerSafe (KSCrashMonitorTypeAll & (~KSCrashMonitorTypeDebuggerUnsafe)) +#define RollbarCrashMonitorTypeDebuggerSafe (RollbarCrashMonitorTypeAll & (~RollbarCrashMonitorTypeDebuggerUnsafe)) /** Monitors that are safe to use in a production environment. * All other monitors should be considered experimental. */ -#define KSCrashMonitorTypeProductionSafe (KSCrashMonitorTypeAll & (~KSCrashMonitorTypeExperimental)) +#define RollbarCrashMonitorTypeProductionSafe (RollbarCrashMonitorTypeAll & (~RollbarCrashMonitorTypeExperimental)) /** Production safe monitors, minus the optional ones. */ -#define KSCrashMonitorTypeProductionSafeMinimal (KSCrashMonitorTypeProductionSafe & (~KSCrashMonitorTypeOptional)) +#define RollbarCrashMonitorTypeProductionSafeMinimal (RollbarCrashMonitorTypeProductionSafe & (~RollbarCrashMonitorTypeOptional)) /** Monitors that are required for proper operation. * These add essential information to the reports, but do not trigger reporting. */ -#define KSCrashMonitorTypeRequired (KSCrashMonitorTypeSystem | KSCrashMonitorTypeApplicationState) +#define RollbarCrashMonitorTypeRequired (RollbarCrashMonitorTypeSystem | RollbarCrashMonitorTypeApplicationState) /** Effectively disables automatica reporting. The only way to generate a report * in this mode is by manually calling kscrash_reportUserException(). */ -#define KSCrashMonitorTypeManual (KSCrashMonitorTypeRequired | KSCrashMonitorTypeUserReported) +#define RollbarCrashMonitorTypeManual (RollbarCrashMonitorTypeRequired | RollbarCrashMonitorTypeUserReported) -#define KSCrashMonitorTypeNone 0 +#define RollbarCrashMonitorTypeNone 0 -const char* kscrashmonitortype_name(KSCrashMonitorType monitorType); +const char* kscrashmonitortype_name(RollbarCrashMonitorType monitorType); #ifdef __cplusplus } #endif -#endif // HDR_KSCrashMonitorType_h +#endif // HDR_RollbarCrashMonitorType_h diff --git a/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashMonitor_System.h b/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashMonitor_System.h index 54407f96..9e2dcc33 100644 --- a/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashMonitor_System.h +++ b/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashMonitor_System.h @@ -1,5 +1,5 @@ // -// KSCrashMonitor_System.h +// RollbarCrashMonitor_System.h // // Created by Karl Stenerud on 2012-02-05. // @@ -24,20 +24,20 @@ // THE SOFTWARE. // -#ifndef KSCrashMonitor_System_h -#define KSCrashMonitor_System_h +#ifndef RollbarCrashMonitor_System_h +#define RollbarCrashMonitor_System_h #ifdef __cplusplus extern "C" { #endif -#include "KSCrashMonitor.h" +#include "RollbarCrashMonitor.h" /** Access the Monitor API. */ - KSCrashMonitorAPI* kscm_system_getAPI(void); + RollbarCrashMonitorAPI* kscm_system_getAPI(void); #ifdef __cplusplus diff --git a/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashReportFields.h b/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashReportFields.h index ba7dd88e..b3b77dde 100644 --- a/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashReportFields.h +++ b/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashReportFields.h @@ -1,5 +1,5 @@ // -// KSCrashReportFields.h +// RollbarCrashReportFields.h // // Created by Karl Stenerud on 2012-10-07. // @@ -25,205 +25,205 @@ // -#ifndef HDR_KSCrashReportFields_h -#define HDR_KSCrashReportFields_h +#ifndef HDR_RollbarCrashReportFields_h +#define HDR_RollbarCrashReportFields_h #pragma mark - Report Types - -#define KSCrashReportType_Minimal "minimal" -#define KSCrashReportType_Standard "standard" -#define KSCrashReportType_Custom "custom" +#define RollbarCrashReportType_Minimal "minimal" +#define RollbarCrashReportType_Standard "standard" +#define RollbarCrashReportType_Custom "custom" #pragma mark - Memory Types - -#define KSCrashMemType_Block "objc_block" -#define KSCrashMemType_Class "objc_class" -#define KSCrashMemType_NullPointer "null_pointer" -#define KSCrashMemType_Object "objc_object" -#define KSCrashMemType_String "string" -#define KSCrashMemType_Unknown "unknown" +#define RollbarCrashMemType_Block "objc_block" +#define RollbarCrashMemType_Class "objc_class" +#define RollbarCrashMemType_NullPointer "null_pointer" +#define RollbarCrashMemType_Object "objc_object" +#define RollbarCrashMemType_String "string" +#define RollbarCrashMemType_Unknown "unknown" #pragma mark - Exception Types - -#define KSCrashExcType_CPPException "cpp_exception" -#define KSCrashExcType_Deadlock "deadlock" -#define KSCrashExcType_Mach "mach" -#define KSCrashExcType_NSException "nsexception" -#define KSCrashExcType_Signal "signal" -#define KSCrashExcType_User "user" +#define RollbarCrashExcType_CPPException "cpp_exception" +#define RollbarCrashExcType_Deadlock "deadlock" +#define RollbarCrashExcType_Mach "mach" +#define RollbarCrashExcType_NSException "nsexception" +#define RollbarCrashExcType_Signal "signal" +#define RollbarCrashExcType_User "user" #pragma mark - Common - -#define KSCrashField_Address "address" -#define KSCrashField_Contents "contents" -#define KSCrashField_Exception "exception" -#define KSCrashField_FirstObject "first_object" -#define KSCrashField_Index "index" -#define KSCrashField_Ivars "ivars" -#define KSCrashField_Language "language" -#define KSCrashField_Name "name" -#define KSCrashField_UserInfo "userInfo" -#define KSCrashField_ReferencedObject "referenced_object" -#define KSCrashField_Type "type" -#define KSCrashField_UUID "uuid" -#define KSCrashField_Value "value" +#define RollbarCrashField_Address "address" +#define RollbarCrashField_Contents "contents" +#define RollbarCrashField_Exception "exception" +#define RollbarCrashField_FirstObject "first_object" +#define RollbarCrashField_Index "index" +#define RollbarCrashField_Ivars "ivars" +#define RollbarCrashField_Language "language" +#define RollbarCrashField_Name "name" +#define RollbarCrashField_UserInfo "userInfo" +#define RollbarCrashField_ReferencedObject "referenced_object" +#define RollbarCrashField_Type "type" +#define RollbarCrashField_UUID "uuid" +#define RollbarCrashField_Value "value" -#define KSCrashField_Error "error" -#define KSCrashField_JSONData "json_data" +#define RollbarCrashField_Error "error" +#define RollbarCrashField_JSONData "json_data" #pragma mark - Notable Address - -#define KSCrashField_Class "class" -#define KSCrashField_LastDeallocObject "last_deallocated_obj" +#define RollbarCrashField_Class "class" +#define RollbarCrashField_LastDeallocObject "last_deallocated_obj" #pragma mark - Backtrace - -#define KSCrashField_InstructionAddr "instruction_addr" -#define KSCrashField_LineOfCode "line_of_code" -#define KSCrashField_ObjectAddr "object_addr" -#define KSCrashField_ObjectName "object_name" -#define KSCrashField_SymbolAddr "symbol_addr" -#define KSCrashField_SymbolName "symbol_name" +#define RollbarCrashField_InstructionAddr "instruction_addr" +#define RollbarCrashField_LineOfCode "line_of_code" +#define RollbarCrashField_ObjectAddr "object_addr" +#define RollbarCrashField_ObjectName "object_name" +#define RollbarCrashField_SymbolAddr "symbol_addr" +#define RollbarCrashField_SymbolName "symbol_name" #pragma mark - Stack Dump - -#define KSCrashField_DumpEnd "dump_end" -#define KSCrashField_DumpStart "dump_start" -#define KSCrashField_GrowDirection "grow_direction" -#define KSCrashField_Overflow "overflow" -#define KSCrashField_StackPtr "stack_pointer" +#define RollbarCrashField_DumpEnd "dump_end" +#define RollbarCrashField_DumpStart "dump_start" +#define RollbarCrashField_GrowDirection "grow_direction" +#define RollbarCrashField_Overflow "overflow" +#define RollbarCrashField_StackPtr "stack_pointer" #pragma mark - Thread Dump - -#define KSCrashField_Backtrace "backtrace" -#define KSCrashField_Basic "basic" -#define KSCrashField_Crashed "crashed" -#define KSCrashField_CurrentThread "current_thread" -#define KSCrashField_DispatchQueue "dispatch_queue" -#define KSCrashField_NotableAddresses "notable_addresses" -#define KSCrashField_Registers "registers" -#define KSCrashField_Skipped "skipped" -#define KSCrashField_Stack "stack" +#define RollbarCrashField_Backtrace "backtrace" +#define RollbarCrashField_Basic "basic" +#define RollbarCrashField_Crashed "crashed" +#define RollbarCrashField_CurrentThread "current_thread" +#define RollbarCrashField_DispatchQueue "dispatch_queue" +#define RollbarCrashField_NotableAddresses "notable_addresses" +#define RollbarCrashField_Registers "registers" +#define RollbarCrashField_Skipped "skipped" +#define RollbarCrashField_Stack "stack" #pragma mark - Binary Image - -#define KSCrashField_CPUSubType "cpu_subtype" -#define KSCrashField_CPUType "cpu_type" -#define KSCrashField_ImageAddress "image_addr" -#define KSCrashField_ImageVmAddress "image_vmaddr" -#define KSCrashField_ImageSize "image_size" -#define KSCrashField_ImageMajorVersion "major_version" -#define KSCrashField_ImageMinorVersion "minor_version" -#define KSCrashField_ImageRevisionVersion "revision_version" -#define KSCrashField_ImageCrashInfoMessage "crash_info_message" -#define KSCrashField_ImageCrashInfoMessage2 "crash_info_message2" +#define RollbarCrashField_CPUSubType "cpu_subtype" +#define RollbarCrashField_CPUType "cpu_type" +#define RollbarCrashField_ImageAddress "image_addr" +#define RollbarCrashField_ImageVmAddress "image_vmaddr" +#define RollbarCrashField_ImageSize "image_size" +#define RollbarCrashField_ImageMajorVersion "major_version" +#define RollbarCrashField_ImageMinorVersion "minor_version" +#define RollbarCrashField_ImageRevisionVersion "revision_version" +#define RollbarCrashField_ImageCrashInfoMessage "crash_info_message" +#define RollbarCrashField_ImageCrashInfoMessage2 "crash_info_message2" #pragma mark - Memory - -#define KSCrashField_Free "free" -#define KSCrashField_Usable "usable" +#define RollbarCrashField_Free "free" +#define RollbarCrashField_Usable "usable" #pragma mark - Error - -#define KSCrashField_Backtrace "backtrace" -#define KSCrashField_Code "code" -#define KSCrashField_CodeName "code_name" -#define KSCrashField_CPPException "cpp_exception" -#define KSCrashField_ExceptionName "exception_name" -#define KSCrashField_Mach "mach" -#define KSCrashField_NSException "nsexception" -#define KSCrashField_Reason "reason" -#define KSCrashField_Signal "signal" -#define KSCrashField_Subcode "subcode" -#define KSCrashField_UserReported "user_reported" +#define RollbarCrashField_Backtrace "backtrace" +#define RollbarCrashField_Code "code" +#define RollbarCrashField_CodeName "code_name" +#define RollbarCrashField_CPPException "cpp_exception" +#define RollbarCrashField_ExceptionName "exception_name" +#define RollbarCrashField_Mach "mach" +#define RollbarCrashField_NSException "nsexception" +#define RollbarCrashField_Reason "reason" +#define RollbarCrashField_Signal "signal" +#define RollbarCrashField_Subcode "subcode" +#define RollbarCrashField_UserReported "user_reported" #pragma mark - Process State - -#define KSCrashField_LastDeallocedNSException "last_dealloced_nsexception" -#define KSCrashField_ProcessState "process" +#define RollbarCrashField_LastDeallocedNSException "last_dealloced_nsexception" +#define RollbarCrashField_ProcessState "process" #pragma mark - App Stats - -#define KSCrashField_ActiveTimeSinceCrash "active_time_since_last_crash" -#define KSCrashField_ActiveTimeSinceLaunch "active_time_since_launch" -#define KSCrashField_AppActive "application_active" -#define KSCrashField_AppInFG "application_in_foreground" -#define KSCrashField_BGTimeSinceCrash "background_time_since_last_crash" -#define KSCrashField_BGTimeSinceLaunch "background_time_since_launch" -#define KSCrashField_LaunchesSinceCrash "launches_since_last_crash" -#define KSCrashField_SessionsSinceCrash "sessions_since_last_crash" -#define KSCrashField_SessionsSinceLaunch "sessions_since_launch" +#define RollbarCrashField_ActiveTimeSinceCrash "active_time_since_last_crash" +#define RollbarCrashField_ActiveTimeSinceLaunch "active_time_since_launch" +#define RollbarCrashField_AppActive "application_active" +#define RollbarCrashField_AppInFG "application_in_foreground" +#define RollbarCrashField_BGTimeSinceCrash "background_time_since_last_crash" +#define RollbarCrashField_BGTimeSinceLaunch "background_time_since_launch" +#define RollbarCrashField_LaunchesSinceCrash "launches_since_last_crash" +#define RollbarCrashField_SessionsSinceCrash "sessions_since_last_crash" +#define RollbarCrashField_SessionsSinceLaunch "sessions_since_launch" #pragma mark - Report - -#define KSCrashField_Crash "crash" -#define KSCrashField_Debug "debug" -#define KSCrashField_Diagnosis "diagnosis" -#define KSCrashField_ID "id" -#define KSCrashField_ProcessName "process_name" -#define KSCrashField_Report "report" -#define KSCrashField_Timestamp "timestamp" -#define KSCrashField_Version "version" +#define RollbarCrashField_Crash "crash" +#define RollbarCrashField_Debug "debug" +#define RollbarCrashField_Diagnosis "diagnosis" +#define RollbarCrashField_ID "id" +#define RollbarCrashField_ProcessName "process_name" +#define RollbarCrashField_Report "report" +#define RollbarCrashField_Timestamp "timestamp" +#define RollbarCrashField_Version "version" #pragma mark Minimal -#define KSCrashField_CrashedThread "crashed_thread" +#define RollbarCrashField_CrashedThread "crashed_thread" #pragma mark Standard -#define KSCrashField_AppStats "application_stats" -#define KSCrashField_BinaryImages "binary_images" -#define KSCrashField_System "system" -#define KSCrashField_Memory "memory" -#define KSCrashField_Threads "threads" -#define KSCrashField_User "user" -#define KSCrashField_ConsoleLog "console_log" +#define RollbarCrashField_AppStats "application_stats" +#define RollbarCrashField_BinaryImages "binary_images" +#define RollbarCrashField_System "system" +#define RollbarCrashField_Memory "memory" +#define RollbarCrashField_Threads "threads" +#define RollbarCrashField_User "user" +#define RollbarCrashField_ConsoleLog "console_log" #pragma mark Incomplete -#define KSCrashField_Incomplete "incomplete" -#define KSCrashField_RecrashReport "recrash_report" +#define RollbarCrashField_Incomplete "incomplete" +#define RollbarCrashField_RecrashReport "recrash_report" #pragma mark System -#define KSCrashField_AppStartTime "app_start_time" -#define KSCrashField_AppUUID "app_uuid" -#define KSCrashField_BootTime "boot_time" -#define KSCrashField_BundleID "CFBundleIdentifier" -#define KSCrashField_BundleName "CFBundleName" -#define KSCrashField_BundleShortVersion "CFBundleShortVersionString" -#define KSCrashField_BundleVersion "CFBundleVersion" -#define KSCrashField_CPUArch "cpu_arch" -#define KSCrashField_CPUType "cpu_type" -#define KSCrashField_CPUSubType "cpu_subtype" -#define KSCrashField_BinaryCPUType "binary_cpu_type" -#define KSCrashField_BinaryCPUSubType "binary_cpu_subtype" -#define KSCrashField_DeviceAppHash "device_app_hash" -#define KSCrashField_Executable "CFBundleExecutable" -#define KSCrashField_ExecutablePath "CFBundleExecutablePath" -#define KSCrashField_Jailbroken "jailbroken" -#define KSCrashField_KernelVersion "kernel_version" -#define KSCrashField_Machine "machine" -#define KSCrashField_Model "model" -#define KSCrashField_OSVersion "os_version" -#define KSCrashField_ParentProcessID "parent_process_id" -#define KSCrashField_ProcessID "process_id" -#define KSCrashField_ProcessName "process_name" -#define KSCrashField_Size "size" -#define KSCrashField_Storage "storage" -#define KSCrashField_SystemName "system_name" -#define KSCrashField_SystemVersion "system_version" -#define KSCrashField_TimeZone "time_zone" -#define KSCrashField_BuildType "build_type" +#define RollbarCrashField_AppStartTime "app_start_time" +#define RollbarCrashField_AppUUID "app_uuid" +#define RollbarCrashField_BootTime "boot_time" +#define RollbarCrashField_BundleID "CFBundleIdentifier" +#define RollbarCrashField_BundleName "CFBundleName" +#define RollbarCrashField_BundleShortVersion "CFBundleShortVersionString" +#define RollbarCrashField_BundleVersion "CFBundleVersion" +#define RollbarCrashField_CPUArch "cpu_arch" +#define RollbarCrashField_CPUType "cpu_type" +#define RollbarCrashField_CPUSubType "cpu_subtype" +#define RollbarCrashField_BinaryCPUType "binary_cpu_type" +#define RollbarCrashField_BinaryCPUSubType "binary_cpu_subtype" +#define RollbarCrashField_DeviceAppHash "device_app_hash" +#define RollbarCrashField_Executable "CFBundleExecutable" +#define RollbarCrashField_ExecutablePath "CFBundleExecutablePath" +#define RollbarCrashField_Jailbroken "jailbroken" +#define RollbarCrashField_KernelVersion "kernel_version" +#define RollbarCrashField_Machine "machine" +#define RollbarCrashField_Model "model" +#define RollbarCrashField_OSVersion "os_version" +#define RollbarCrashField_ParentProcessID "parent_process_id" +#define RollbarCrashField_ProcessID "process_id" +#define RollbarCrashField_ProcessName "process_name" +#define RollbarCrashField_Size "size" +#define RollbarCrashField_Storage "storage" +#define RollbarCrashField_SystemName "system_name" +#define RollbarCrashField_SystemVersion "system_version" +#define RollbarCrashField_TimeZone "time_zone" +#define RollbarCrashField_BuildType "build_type" #endif diff --git a/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashReportFilter.h b/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashReportFilter.h index b92fce3a..09cbda7e 100644 --- a/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashReportFilter.h +++ b/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashReportFilter.h @@ -1,5 +1,5 @@ // -// KSCrashReportFilter.h +// RollbarCrashReportFilter.h // // Created by Karl Stenerud on 2012-02-18. // @@ -35,14 +35,14 @@ * user cancelling the operation). * @param error Non-nil if an error occurred. */ -typedef void(^KSCrashReportFilterCompletion)(NSArray* filteredReports, BOOL completed, NSError* error); +typedef void(^RollbarCrashReportFilterCompletion)(NSArray* filteredReports, BOOL completed, NSError* error); /** * A filter receives a set of reports, possibly transforms them, and then * calls a completion method. */ -@protocol KSCrashReportFilter +@protocol RollbarCrashReportFilter /** Filter the specified reports. * @@ -50,7 +50,7 @@ typedef void(^KSCrashReportFilterCompletion)(NSArray* filteredReports, BOOL comp * @param onCompletion Block to call when processing is complete. */ - (void) filterReports:(NSArray*) reports - onCompletion:(KSCrashReportFilterCompletion) onCompletion; + onCompletion:(RollbarCrashReportFilterCompletion) onCompletion; @end @@ -62,7 +62,7 @@ typedef void(^KSCrashReportFilterCompletion)(NSArray* filteredReports, BOOL comp * @param completed The parameter to send as "completed". * @param error The parameter to send as "error". */ -static inline void kscrash_callCompletion(KSCrashReportFilterCompletion onCompletion, +static inline void kscrash_callCompletion(RollbarCrashReportFilterCompletion onCompletion, NSArray* filteredReports, BOOL completed, NSError* error) diff --git a/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashReportFilterBasic.h b/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashReportFilterBasic.h index 188ebe01..371966b1 100644 --- a/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashReportFilterBasic.h +++ b/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashReportFilterBasic.h @@ -1,5 +1,5 @@ // -// KSCrashReportFilterBasic.h +// RollbarCrashReportFilterBasic.h // // Created by Karl Stenerud on 2012-05-11. // @@ -25,7 +25,7 @@ // -#import "KSCrashReportFilter.h" +#import "RollbarCrashReportFilter.h" /** @@ -34,9 +34,9 @@ * Input: Anything. * Output: Same as input (passthrough). */ -@interface KSCrashReportFilterPassthrough : NSObject +@interface RollbarCrashReportFilterPassthrough : NSObject -+ (KSCrashReportFilterPassthrough*) filter; ++ (RollbarCrashReportFilterPassthrough*) filter; @end @@ -48,20 +48,20 @@ * Input: Anything * Output: NSDictionary */ -@interface KSCrashReportFilterCombine : NSObject +@interface RollbarCrashReportFilterCombine : NSObject /** Constructor. * * @param firstFilter The first filter, followed by key, filter, key, ... - * Each "filter" can be id or an NSArray + * Each "filter" can be id or an NSArray * of filters (which gets wrapped in a pipeline filter). */ -+ (KSCrashReportFilterCombine*) filterWithFiltersAndKeys:(id) firstFilter, ... NS_REQUIRES_NIL_TERMINATION; ++ (RollbarCrashReportFilterCombine*) filterWithFiltersAndKeys:(id) firstFilter, ... NS_REQUIRES_NIL_TERMINATION; /** Initializer. * * @param firstFilter The first filter, followed by key, filter, key, ... - * Each "filter" can be id or an NSArray + * Each "filter" can be id or an NSArray * of filters (which gets wrapped in a pipeline filter). */ - (id) initWithFiltersAndKeys:(id)firstFilter, ... NS_REQUIRES_NIL_TERMINATION; @@ -75,7 +75,7 @@ * Input: Depends on what's in the pipeline. * Output: Depends on what's in the pipeline. */ -@interface KSCrashReportFilterPipeline : NSObject +@interface RollbarCrashReportFilterPipeline : NSObject /** The filters in this pipeline. */ @property(nonatomic,readonly,retain) NSArray* filters; @@ -84,7 +84,7 @@ * * @param firstFilter The first filter, followed by filter, filter, ... */ -+ (KSCrashReportFilterPipeline*) filterWithFilters:(id) firstFilter, ... NS_REQUIRES_NIL_TERMINATION; ++ (RollbarCrashReportFilterPipeline*) filterWithFilters:(id) firstFilter, ... NS_REQUIRES_NIL_TERMINATION; /** Initializer. * @@ -92,7 +92,7 @@ */ - (id) initWithFilters:(id) firstFilter, ... NS_REQUIRES_NIL_TERMINATION; -- (void) addFilter:(id) filter; +- (void) addFilter:(id) filter; @end @@ -100,7 +100,7 @@ /** * Extracts data associated with a key from each report. */ -@interface KSCrashReportFilterObjectForKey : NSObject +@interface RollbarCrashReportFilterObjectForKey : NSObject /** Constructor. * @@ -109,7 +109,7 @@ * @param allowNotFound If NO, filtering will stop with an error if the key * was not found in a report. */ -+ (KSCrashReportFilterObjectForKey*) filterWithKey:(id) key ++ (RollbarCrashReportFilterObjectForKey*) filterWithKey:(id) key allowNotFound:(BOOL) allowNotFound; /** Initializer. @@ -131,7 +131,7 @@ * Input: NSDictionary * Output: NSString */ -@interface KSCrashReportFilterConcatenate : NSObject +@interface RollbarCrashReportFilterConcatenate : NSObject /** Constructor. * @@ -139,7 +139,7 @@ * %@ in the formatting text to include the key name as well. * @param firstKey Series of keys to extract from the source report. */ -+ (KSCrashReportFilterConcatenate*) filterWithSeparatorFmt:(NSString*) separatorFmt ++ (RollbarCrashReportFilterConcatenate*) filterWithSeparatorFmt:(NSString*) separatorFmt keys:(id) firstKey, ... NS_REQUIRES_NIL_TERMINATION; /** Constructor. @@ -160,13 +160,13 @@ * Input: NSDictionary * Output: NSDictionary */ -@interface KSCrashReportFilterSubset : NSObject +@interface RollbarCrashReportFilterSubset : NSObject /** Constructor. * * @param firstKeyPath Series of key paths to search in the source reports. */ -+ (KSCrashReportFilterSubset*) filterWithKeys:(id) firstKeyPath, ... NS_REQUIRES_NIL_TERMINATION; ++ (RollbarCrashReportFilterSubset*) filterWithKeys:(id) firstKeyPath, ... NS_REQUIRES_NIL_TERMINATION; /** Initializer. * @@ -183,9 +183,9 @@ * Input: NSData * Output: NSString */ -@interface KSCrashReportFilterDataToString : NSObject +@interface RollbarCrashReportFilterDataToString : NSObject -+ (KSCrashReportFilterDataToString*) filter; ++ (RollbarCrashReportFilterDataToString*) filter; @end @@ -196,8 +196,8 @@ * Input: NSString * Output: NSData */ -@interface KSCrashReportFilterStringToData : NSObject +@interface RollbarCrashReportFilterStringToData : NSObject -+ (KSCrashReportFilterStringToData*) filter; ++ (RollbarCrashReportFilterStringToData*) filter; @end diff --git a/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashReportWriter.h b/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashReportWriter.h index 8f11a957..6790432f 100644 --- a/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashReportWriter.h +++ b/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashReportWriter.h @@ -1,5 +1,5 @@ // -// KSCrashReportWriter.h +// RollbarCrashReportWriter.h // // Created by Karl Stenerud on 2012-01-28. // @@ -30,8 +30,8 @@ */ -#ifndef HDR_KSCrashReportWriter_h -#define HDR_KSCrashReportWriter_h +#ifndef HDR_RollbarCrashReportWriter_h +#define HDR_RollbarCrashReportWriter_h #ifdef __cplusplus extern "C" { @@ -45,7 +45,7 @@ extern "C" { /** * Encapsulates report writing functionality. */ -typedef struct KSCrashReportWriter +typedef struct RollbarCrashReportWriter { /** Add a boolean element to the report. * @@ -55,7 +55,7 @@ typedef struct KSCrashReportWriter * * @param value The value to add. */ - void (*addBooleanElement)(const struct KSCrashReportWriter* writer, + void (*addBooleanElement)(const struct RollbarCrashReportWriter* writer, const char* name, bool value); @@ -67,7 +67,7 @@ typedef struct KSCrashReportWriter * * @param value The value to add. */ - void (*addFloatingPointElement)(const struct KSCrashReportWriter* writer, + void (*addFloatingPointElement)(const struct RollbarCrashReportWriter* writer, const char* name, double value); @@ -79,7 +79,7 @@ typedef struct KSCrashReportWriter * * @param value The value to add. */ - void (*addIntegerElement)(const struct KSCrashReportWriter* writer, + void (*addIntegerElement)(const struct RollbarCrashReportWriter* writer, const char* name, int64_t value); @@ -91,7 +91,7 @@ typedef struct KSCrashReportWriter * * @param value The value to add. */ - void (*addUIntegerElement)(const struct KSCrashReportWriter* writer, + void (*addUIntegerElement)(const struct RollbarCrashReportWriter* writer, const char* name, uint64_t value); @@ -103,7 +103,7 @@ typedef struct KSCrashReportWriter * * @param value The value to add. */ - void (*addStringElement)(const struct KSCrashReportWriter* writer, + void (*addStringElement)(const struct RollbarCrashReportWriter* writer, const char* name, const char* value); @@ -115,7 +115,7 @@ typedef struct KSCrashReportWriter * * @param filePath The path to the file containing the value to add. */ - void (*addTextFileElement)(const struct KSCrashReportWriter* writer, + void (*addTextFileElement)(const struct RollbarCrashReportWriter* writer, const char* name, const char* filePath); @@ -127,7 +127,7 @@ typedef struct KSCrashReportWriter * * @param filePath The path to the file containing the value to add. */ - void (*addTextFileLinesElement)(const struct KSCrashReportWriter* writer, + void (*addTextFileLinesElement)(const struct RollbarCrashReportWriter* writer, const char* name, const char* filePath); @@ -141,7 +141,7 @@ typedef struct KSCrashReportWriter * * @param closeLastContainer If false, do not close the last container. */ - void (*addJSONFileElement)(const struct KSCrashReportWriter* writer, + void (*addJSONFileElement)(const struct RollbarCrashReportWriter* writer, const char* name, const char* filePath, const bool closeLastContainer); @@ -156,7 +156,7 @@ typedef struct KSCrashReportWriter * * @paramn length The length of the data. */ - void (*addDataElement)(const struct KSCrashReportWriter* writer, + void (*addDataElement)(const struct RollbarCrashReportWriter* writer, const char* name, const char* value, const int length); @@ -167,7 +167,7 @@ typedef struct KSCrashReportWriter * * @param name The name to give this element. */ - void (*beginDataElement)(const struct KSCrashReportWriter* writer, + void (*beginDataElement)(const struct RollbarCrashReportWriter* writer, const char* name); /** Append hex encoded data to the current data element in the report. @@ -178,7 +178,7 @@ typedef struct KSCrashReportWriter * * @paramn length The length of the data. */ - void (*appendDataElement)(const struct KSCrashReportWriter* writer, + void (*appendDataElement)(const struct RollbarCrashReportWriter* writer, const char* value, const int length); @@ -186,7 +186,7 @@ typedef struct KSCrashReportWriter * * @param writer This writer. */ - void (*endDataElement)(const struct KSCrashReportWriter* writer); + void (*endDataElement)(const struct RollbarCrashReportWriter* writer); /** Add a UUID element to the report. * @@ -196,7 +196,7 @@ typedef struct KSCrashReportWriter * * @param value A pointer to the binary UUID data. */ - void (*addUUIDElement)(const struct KSCrashReportWriter* writer, + void (*addUUIDElement)(const struct RollbarCrashReportWriter* writer, const char* name, const unsigned char* value); @@ -208,7 +208,7 @@ typedef struct KSCrashReportWriter * * @param value A pointer to the JSON data. */ - void (*addJSONElement)(const struct KSCrashReportWriter* writer, + void (*addJSONElement)(const struct RollbarCrashReportWriter* writer, const char* name, const char* jsonElement, bool closeLastContainer); @@ -219,7 +219,7 @@ typedef struct KSCrashReportWriter * * @param name The name to give this element. */ - void (*beginObject)(const struct KSCrashReportWriter* writer, + void (*beginObject)(const struct RollbarCrashReportWriter* writer, const char* name); /** Begin a new array container. @@ -228,7 +228,7 @@ typedef struct KSCrashReportWriter * * @param name The name to give this element. */ - void (*beginArray)(const struct KSCrashReportWriter* writer, + void (*beginArray)(const struct RollbarCrashReportWriter* writer, const char* name); /** Leave the current container, returning to the next higher level @@ -236,19 +236,19 @@ typedef struct KSCrashReportWriter * * @param writer This writer. */ - void (*endContainer)(const struct KSCrashReportWriter* writer); + void (*endContainer)(const struct RollbarCrashReportWriter* writer); /** Internal contextual data for the writer */ void* context; -} KSCrashReportWriter; +} RollbarCrashReportWriter; -typedef void (*KSReportWriteCallback)(const KSCrashReportWriter* writer); +typedef void (*RollbarCrashReportWriteCallback)(const RollbarCrashReportWriter* writer); #ifdef __cplusplus } #endif -#endif // HDR_KSCrashReportWriter_h +#endif // HDR_RollbarCrashReportWriter_h diff --git a/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashThread.h b/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashThread.h index 74225fea..f5515f52 100644 --- a/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashThread.h +++ b/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashThread.h @@ -1,5 +1,5 @@ // -// KSThread.h +// RollbarCrashThread.h // // Created by Karl Stenerud on 2012-01-29. // @@ -24,8 +24,8 @@ // THE SOFTWARE. // -#ifndef HDR_KSThread_h -#define HDR_KSThread_h +#ifndef HDR_RollbarCrashThread_h +#define HDR_RollbarCrashThread_h #ifdef __cplusplus extern "C" { @@ -36,7 +36,7 @@ extern "C" { #include -typedef uintptr_t KSThread; +typedef uintptr_t RollbarCrashThread; /** Get a thread's name. Internally, a thread name will * never be more than 64 characters long. @@ -49,7 +49,7 @@ typedef uintptr_t KSThread; * * @return true if a name was found. */ -bool ksthread_getThreadName(const KSThread thread, char* const buffer, int bufLength); +bool ksthread_getThreadName(const RollbarCrashThread thread, char* const buffer, int bufLength); /** Get the name of a thread's dispatch queue. Internally, a queue name will * never be more than 64 characters long. @@ -62,7 +62,7 @@ bool ksthread_getThreadName(const KSThread thread, char* const buffer, int bufLe * * @return true if a name or label was found. */ -bool ksthread_getQueueName(KSThread thread, char* buffer, int bufLength); +bool ksthread_getQueueName(RollbarCrashThread thread, char* buffer, int bufLength); /* Get the current mach thread ID. * mach_thread_self() receives a send right for the thread port which needs to @@ -71,11 +71,11 @@ bool ksthread_getQueueName(KSThread thread, char* buffer, int bufLength); * * @return The current thread ID. */ -KSThread ksthread_self(void); +RollbarCrashThread ksthread_self(void); #ifdef __cplusplus } #endif -#endif // HDR_KSThread_h +#endif // HDR_RollbarCrashThread_h diff --git a/RollbarNotifier/Sources/RollbarCrashReport/Diagnostic/RollbarCrashDiagnosticFilter.swift b/RollbarNotifier/Sources/RollbarCrashReport/Diagnostic/RollbarCrashDiagnosticFilter.swift index 503f8241..77049a25 100644 --- a/RollbarNotifier/Sources/RollbarCrashReport/Diagnostic/RollbarCrashDiagnosticFilter.swift +++ b/RollbarNotifier/Sources/RollbarCrashReport/Diagnostic/RollbarCrashDiagnosticFilter.swift @@ -1,26 +1,26 @@ import Foundation import RollbarCrash -/// A `KSCrash` filter that produces richer diagnostic information by extracting data from a raw +/// A `RollbarCrash` filter that produces richer diagnostic information by extracting data from a raw /// crash hashmap that's not usually made available in Apple crash reports. /// -/// `KSCrash` filters receive a set of reports, possibly transforms them, and then +/// `RollbarCrash` filters receive a set of reports, possibly transforms them, and then /// calls a completion method. @objcMembers -public class RollbarCrashDiagnosticFilter: NSObject, KSCrashReportFilter { +public class RollbarCrashDiagnosticFilter: NSObject, RollbarCrashReportFilter { /// This is the filter entry point. /// /// Since this is called from Obj-C, type information is poor, which is why the set of /// reports sent is `[Any]?`. Reports are reified as part of the validation process. /// - /// `KSCrashReportFilterCompletion` is an ObjC function with three parameters: + /// `RollbarCrashReportFilterCompletion` is an ObjC function with three parameters: /// - An array of `Dictionary`, which are "filtered" reports. /// - A boolean value stating whether all the reports were able to be processed. /// - An `NSError` object with error information, or `nil` if no error. public func filterReports( _ reports: [Any]?, - onCompletion complete: KSCrashReportFilterCompletion? + onCompletion complete: RollbarCrashReportFilterCompletion? ) { let diagnosedResults = (reports ?? []).map { report in validated(report).flatMap(diagnose) @@ -36,7 +36,7 @@ public class RollbarCrashDiagnosticFilter: NSObject, KSCrashReportFilter { /// /// Diagnostics are extracted from three sources: /// - /// - The original `KSCrash` diagnosis, this is usually available for most + /// - The original `RollbarCrash` diagnosis, this is usually available for most /// Objective-C, C and C++ crashes. /// - Dynamically linked libraries: Certain libraries like the Swift /// runtime, and Cocoa framework report specialized diagnostic information diff --git a/RollbarNotifier/Sources/RollbarCrashReport/Formatter/RollbarCrashFormattingFilter.swift b/RollbarNotifier/Sources/RollbarCrashReport/Formatter/RollbarCrashFormattingFilter.swift index beea545c..84717354 100644 --- a/RollbarNotifier/Sources/RollbarCrashReport/Formatter/RollbarCrashFormattingFilter.swift +++ b/RollbarNotifier/Sources/RollbarCrashReport/Formatter/RollbarCrashFormattingFilter.swift @@ -1,26 +1,26 @@ import Foundation import RollbarCrash -/// A `KSCrash` filter that produces a proper Apple crash report with rich diagnostic +/// A `RollbarCrash` filter that produces a proper Apple crash report with rich diagnostic /// information by parsing data from a raw crash hashmap. /// -/// `KSCrash` filters receive a set of reports, possibly transforms them, and then +/// `RollbarCrash` filters receive a set of reports, possibly transforms them, and then /// calls a completion method. @objcMembers -public class RollbarCrashFormattingFilter: NSObject, KSCrashReportFilter { +public class RollbarCrashFormattingFilter: NSObject, RollbarCrashReportFilter { /// This is the filter entry point. /// /// Since this is called from Obj-C, type information is poor, which is why the set of /// reports sent is `[Any]?`. Reports are reified as part of the validation process. /// - /// `KSCrashReportFilterCompletion` is an ObjC function with three parameters: + /// `RollbarCrashReportFilterCompletion` is an ObjC function with three parameters: /// - An array of `Dictionary`, which are "filtered" reports. /// - A boolean value stating whether all the reports were able to be processed. /// - An `NSError` object with error information, or `nil` if no error. public func filterReports( _ reports: [Any]?, - onCompletion complete: KSCrashReportFilterCompletion? + onCompletion complete: RollbarCrashReportFilterCompletion? ) -> () { let formattedResults = (reports ?? []).map { report in validated(report).map(format) diff --git a/RollbarNotifier/Sources/RollbarNotifier/RollbarCrashCollector.h b/RollbarNotifier/Sources/RollbarNotifier/RollbarCrashCollector.h index 6621d1ee..6307a6e6 100644 --- a/RollbarNotifier/Sources/RollbarNotifier/RollbarCrashCollector.h +++ b/RollbarNotifier/Sources/RollbarNotifier/RollbarCrashCollector.h @@ -8,7 +8,7 @@ NS_ASSUME_NONNULL_BEGIN /// Rollbar crash report collector -@interface RollbarCrashCollector: KSCrashInstallation +@interface RollbarCrashCollector: RollbarCrashInstallation - (void)sendAllReports; diff --git a/RollbarNotifier/Sources/RollbarNotifier/RollbarCrashCollector.m b/RollbarNotifier/Sources/RollbarNotifier/RollbarCrashCollector.m index 470b322f..4d767c6a 100644 --- a/RollbarNotifier/Sources/RollbarNotifier/RollbarCrashCollector.m +++ b/RollbarNotifier/Sources/RollbarNotifier/RollbarCrashCollector.m @@ -30,13 +30,13 @@ static bool isDebuggerAttached() { NS_ASSUME_NONNULL_BEGIN -@interface RollbarCrashLoggingFilter : NSObject +@interface RollbarCrashLoggingFilter : NSObject @end @implementation RollbarCrashLoggingFilter - (void)filterReports:(NSArray *)reports - onCompletion:(KSCrashReportFilterCompletion)completion + onCompletion:(RollbarCrashReportFilterCompletion)completion { for (NSString *report in reports) { [Rollbar logCrashReport:report]; @@ -58,21 +58,21 @@ - (instancetype)init { - (void)install { [super install]; - KSCrashMonitorType monitoring = isDebuggerAttached() - ? KSCrashMonitorTypeDebuggerSafe - & ~(KSCrashMonitorTypeOptional - | KSCrashMonitorTypeExperimental - | KSCrashMonitorTypeUserReported) - : KSCrashMonitorTypeProductionSafe - & ~(KSCrashMonitorTypeOptional - | KSCrashMonitorTypeUserReported); - - [KSCrash.sharedInstance setDeleteBehaviorAfterSendAll:KSCDeleteOnSucess]; - [KSCrash.sharedInstance setMonitoring:monitoring]; - [KSCrash.sharedInstance setAddConsoleLogToReport:NO]; - [KSCrash.sharedInstance setCatchZombies:NO]; - [KSCrash.sharedInstance setIntrospectMemory:YES]; - [KSCrash.sharedInstance setSearchQueueNames:NO]; + RollbarCrashMonitorType monitoring = isDebuggerAttached() + ? RollbarCrashMonitorTypeDebuggerSafe + & ~(RollbarCrashMonitorTypeOptional + | RollbarCrashMonitorTypeExperimental + | RollbarCrashMonitorTypeUserReported) + : RollbarCrashMonitorTypeProductionSafe + & ~(RollbarCrashMonitorTypeOptional + | RollbarCrashMonitorTypeUserReported); + + [RollbarCrash.sharedInstance setDeleteBehaviorAfterSendAll:RollbarCrashDeleteOnSucess]; + [RollbarCrash.sharedInstance setMonitoring:monitoring]; + [RollbarCrash.sharedInstance setAddConsoleLogToReport:NO]; + [RollbarCrash.sharedInstance setCatchZombies:NO]; + [RollbarCrash.sharedInstance setIntrospectMemory:YES]; + [RollbarCrash.sharedInstance setSearchQueueNames:NO]; } - (void)sendAllReports { @@ -83,11 +83,11 @@ - (void)sendAllReports { }]; } -- (id)sink { +- (id)sink { id diagnose = [[RollbarCrashDiagnosticFilter alloc] init]; id format = [[RollbarCrashFormattingFilter alloc] init]; id log = [[RollbarCrashLoggingFilter alloc] init]; - return [KSCrashReportFilterPipeline filterWithFilters:diagnose, format, log, nil]; + return [RollbarCrashReportFilterPipeline filterWithFilters:diagnose, format, log, nil]; } @end From 72a5b304d440407741c9f708e2be05a51b5233ec Mon Sep 17 00:00:00 2001 From: Matias Pequeno Date: Tue, 4 Jul 2023 12:35:53 -0300 Subject: [PATCH 3/4] Renamed free functions and C types from ks to rc to avoid name coll --- .../Recording/Monitors/RollbarCrashMonitor.c | 34 +-- .../Monitors/RollbarCrashMonitorType.c | 2 +- .../Monitors/RollbarCrashMonitor_AppState.c | 48 ++-- .../Monitors/RollbarCrashMonitor_AppState.h | 18 +- .../RollbarCrashMonitor_CPPException.cpp | 22 +- .../RollbarCrashMonitor_CPPException.h | 4 +- .../Monitors/RollbarCrashMonitor_Deadlock.h | 4 +- .../Monitors/RollbarCrashMonitor_Deadlock.m | 20 +- .../RollbarCrashMonitor_MachException.c | 36 +-- .../RollbarCrashMonitor_MachException.h | 2 +- .../RollbarCrashMonitor_NSException.h | 2 +- .../RollbarCrashMonitor_NSException.m | 16 +- .../Monitors/RollbarCrashMonitor_Signal.c | 26 +- .../Monitors/RollbarCrashMonitor_Signal.h | 2 +- .../Monitors/RollbarCrashMonitor_System.m | 34 +-- .../Monitors/RollbarCrashMonitor_User.c | 18 +- .../Monitors/RollbarCrashMonitor_User.h | 4 +- .../Monitors/RollbarCrashMonitor_Zombie.c | 20 +- .../Monitors/RollbarCrashMonitor_Zombie.h | 4 +- .../RollbarCrash/Recording/RollbarCrash.m | 68 ++--- .../RollbarCrash/Recording/RollbarCrashC.c | 132 ++++----- .../Recording/RollbarCrashCachedData.c | 16 +- .../Recording/RollbarCrashCachedData.h | 14 +- .../Recording/RollbarCrashReport.c | 272 +++++++++--------- .../Recording/RollbarCrashReport.h | 12 +- .../Recording/RollbarCrashReportFixer.c | 32 +-- .../Recording/RollbarCrashReportFixer.h | 2 +- .../Recording/RollbarCrashReportStore.c | 28 +- .../Recording/RollbarCrashReportStore.h | 18 +- .../Recording/Tools/RollbarCrashCPU.c | 6 +- .../Recording/Tools/RollbarCrashCPU.h | 30 +- .../Recording/Tools/RollbarCrashCPU_Apple.h | 2 +- .../Recording/Tools/RollbarCrashCPU_arm.c | 36 +-- .../Recording/Tools/RollbarCrashCPU_arm64.c | 36 +-- .../Recording/Tools/RollbarCrashCPU_x86_32.c | 36 +-- .../Recording/Tools/RollbarCrashCPU_x86_64.c | 36 +-- .../Tools/RollbarCrashCxaThrowSwapper.c | 8 +- .../Tools/RollbarCrashCxaThrowSwapper.h | 2 +- .../Recording/Tools/RollbarCrashDate.c | 4 +- .../Recording/Tools/RollbarCrashDate.h | 4 +- .../Recording/Tools/RollbarCrashDebug.c | 2 +- .../Recording/Tools/RollbarCrashDebug.h | 2 +- .../Tools/RollbarCrashDynamicLinker.c | 20 +- .../Tools/RollbarCrashDynamicLinker.h | 12 +- .../Recording/Tools/RollbarCrashFileUtils.c | 56 ++-- .../Recording/Tools/RollbarCrashFileUtils.h | 38 +-- .../Recording/Tools/RollbarCrashID.c | 2 +- .../Recording/Tools/RollbarCrashID.h | 2 +- .../Recording/Tools/RollbarCrashJSONCodec.c | 102 +++---- .../Recording/Tools/RollbarCrashJSONCodec.h | 66 ++--- .../Tools/RollbarCrashJSONCodecObjC.m | 30 +- .../Recording/Tools/RollbarCrashLogger.c | 20 +- .../Recording/Tools/RollbarCrashLogger.h | 20 +- .../Recording/Tools/RollbarCrashMach.c | 8 +- .../Recording/Tools/RollbarCrashMach.h | 8 +- .../Tools/RollbarCrashMachineContext.c | 46 +-- .../Recording/Tools/RollbarCrashMemory.c | 8 +- .../Recording/Tools/RollbarCrashMemory.h | 14 +- .../Recording/Tools/RollbarCrashObjC.c | 170 +++++------ .../Recording/Tools/RollbarCrashObjC.h | 66 ++--- .../Recording/Tools/RollbarCrashSignalInfo.c | 8 +- .../Recording/Tools/RollbarCrashSignalInfo.h | 8 +- .../Recording/Tools/RollbarCrashStackCursor.c | 8 +- .../Recording/Tools/RollbarCrashStackCursor.h | 4 +- .../Tools/RollbarCrashStackCursor_Backtrace.c | 6 +- .../Tools/RollbarCrashStackCursor_Backtrace.h | 2 +- .../RollbarCrashStackCursor_MachineContext.c | 16 +- .../RollbarCrashStackCursor_MachineContext.h | 2 +- .../RollbarCrashStackCursor_SelfThread.c | 4 +- .../RollbarCrashStackCursor_SelfThread.h | 2 +- .../Recording/Tools/RollbarCrashString.c | 4 +- .../Recording/Tools/RollbarCrashString.h | 4 +- .../Tools/RollbarCrashSymbolicator.c | 6 +- .../Tools/RollbarCrashSymbolicator.h | 4 +- .../Recording/Tools/RollbarCrashSysCtl.c | 28 +- .../Recording/Tools/RollbarCrashSysCtl.h | 28 +- .../Recording/Tools/RollbarCrashThread.c | 10 +- .../Recording/Tools/RollbarCrashgetsect.c | 2 +- .../Recording/Tools/RollbarCrashgetsect.h | 2 +- .../Filters/RollbarCrashReportFilterBasic.m | 52 ++-- .../Filters/Tools/RollbarCrashVarArgs.h | 36 +-- .../RollbarCrash/include/RollbarCrash.h | 2 +- .../RollbarCrash/include/RollbarCrashC.h | 50 ++-- .../include/RollbarCrashMachineContext.h | 30 +- .../include/RollbarCrashMonitor.h | 10 +- .../include/RollbarCrashMonitorType.h | 4 +- .../include/RollbarCrashMonitor_System.h | 2 +- .../include/RollbarCrashReportFilter.h | 2 +- .../RollbarCrash/include/RollbarCrashThread.h | 6 +- .../RollbarCrashDiagnosticFilter.swift | 6 +- .../RollbarNotifier/RollbarCrashCollector.m | 2 +- 91 files changed, 1076 insertions(+), 1076 deletions(-) diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor.c index 78d4421b..0a50468b 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor.c @@ -63,44 +63,44 @@ static Monitor g_monitors[] = #if RollbarCrashCRASH_HAS_MACH { .monitorType = RollbarCrashMonitorTypeMachException, - .getAPI = kscm_machexception_getAPI, + .getAPI = rcm_machexception_getAPI, }, #endif #if RollbarCrashCRASH_HAS_SIGNAL { .monitorType = RollbarCrashMonitorTypeSignal, - .getAPI = kscm_signal_getAPI, + .getAPI = rcm_signal_getAPI, }, #endif #if RollbarCrashCRASH_HAS_OBJC { .monitorType = RollbarCrashMonitorTypeNSException, - .getAPI = kscm_nsexception_getAPI, + .getAPI = rcm_nsexception_getAPI, }, { .monitorType = RollbarCrashMonitorTypeMainThreadDeadlock, - .getAPI = kscm_deadlock_getAPI, + .getAPI = rcm_deadlock_getAPI, }, { .monitorType = RollbarCrashMonitorTypeZombie, - .getAPI = kscm_zombie_getAPI, + .getAPI = rcm_zombie_getAPI, }, #endif { .monitorType = RollbarCrashMonitorTypeCPPException, - .getAPI = kscm_cppexception_getAPI, + .getAPI = rcm_cppexception_getAPI, }, { .monitorType = RollbarCrashMonitorTypeUserReported, - .getAPI = kscm_user_getAPI, + .getAPI = rcm_user_getAPI, }, { .monitorType = RollbarCrashMonitorTypeSystem, - .getAPI = kscm_system_getAPI, + .getAPI = rcm_system_getAPI, }, { .monitorType = RollbarCrashMonitorTypeApplicationState, - .getAPI = kscm_appstate_getAPI, + .getAPI = rcm_appstate_getAPI, }, }; static int g_monitorsCount = sizeof(g_monitors) / sizeof(*g_monitors); @@ -154,14 +154,14 @@ static inline void addContextualInfoToEvent(Monitor* monitor, struct RollbarCras } } -void kscm_setEventCallback(void (*onEvent)(struct RollbarCrash_MonitorContext* monitorContext)) +void rcm_setEventCallback(void (*onEvent)(struct RollbarCrash_MonitorContext* monitorContext)) { g_onExceptionEvent = onEvent; } -void kscm_setActiveMonitors(RollbarCrashMonitorType monitorTypes) +void rcm_setActiveMonitors(RollbarCrashMonitorType monitorTypes) { - if(ksdebug_isBeingTraced() && (monitorTypes & RollbarCrashMonitorTypeDebuggerUnsafe)) + if(rcdebug_isBeingTraced() && (monitorTypes & RollbarCrashMonitorTypeDebuggerUnsafe)) { static bool hasWarned = false; if(!hasWarned) @@ -202,7 +202,7 @@ void kscm_setActiveMonitors(RollbarCrashMonitorType monitorTypes) g_activeMonitors = activeMonitors; } -RollbarCrashMonitorType kscm_getActiveMonitors() +RollbarCrashMonitorType rcm_getActiveMonitors() { return g_activeMonitors; } @@ -212,7 +212,7 @@ RollbarCrashMonitorType kscm_getActiveMonitors() #pragma mark - Private API - // ============================================================================ -bool kscm_notifyFatalExceptionCaptured(bool isAsyncSafeEnvironment) +bool rcm_notifyFatalExceptionCaptured(bool isAsyncSafeEnvironment) { g_requiresAsyncSafety |= isAsyncSafeEnvironment; // Don't let it be unset. if(g_handlingFatalException) @@ -223,12 +223,12 @@ bool kscm_notifyFatalExceptionCaptured(bool isAsyncSafeEnvironment) if(g_crashedDuringExceptionHandling) { RollbarCrashLOG_INFO("Detected crash in the crash reporter. Uninstalling RollbarCrash."); - kscm_setActiveMonitors(RollbarCrashMonitorTypeNone); + rcm_setActiveMonitors(RollbarCrashMonitorTypeNone); } return g_crashedDuringExceptionHandling; } -void kscm_handleException(struct RollbarCrash_MonitorContext* context) +void rcm_handleException(struct RollbarCrash_MonitorContext* context) { context->requiresAsyncSafety = g_requiresAsyncSafety; if(g_crashedDuringExceptionHandling) @@ -251,7 +251,7 @@ void kscm_handleException(struct RollbarCrash_MonitorContext* context) } else { if(g_handlingFatalException && !g_crashedDuringExceptionHandling) { RollbarCrashLOG_DEBUG("Exception is fatal. Restoring original handlers."); - kscm_setActiveMonitors(RollbarCrashMonitorTypeNone); + rcm_setActiveMonitors(RollbarCrashMonitorTypeNone); } } } diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitorType.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitorType.c index 24abc4b5..58d4ac1b 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitorType.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitorType.c @@ -48,7 +48,7 @@ static const struct static const int g_monitorTypesCount = sizeof(g_monitorTypes) / sizeof(*g_monitorTypes); -const char* kscrashmonitortype_name(const RollbarCrashMonitorType monitorType) +const char* rcmonitortype_name(const RollbarCrashMonitorType monitorType) { for(int i = 0; i < g_monitorTypesCount; i++) { diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_AppState.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_AppState.c index 535eb177..6190d66a 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_AppState.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_AppState.c @@ -166,7 +166,7 @@ static int onEndData(__unused void* const userData) static int addJSONData(const char* const data, const int length, void* const userData) { const int fd = *((int*)userData); - const bool success = ksfu_writeBytesToFD(fd, data, length); + const bool success = rcfu_writeBytesToFD(fd, data, length); return success ? RollbarCrashJSON_OK : RollbarCrashJSON_ERROR_CANNOT_ADD_DATA; } @@ -206,7 +206,7 @@ static bool loadState(const char* const path) char* data; int length; - if(!ksfu_readEntireFile(path, &data, &length, 50000)) + if(!rcfu_readEntireFile(path, &data, &length, 50000)) { RollbarCrashLOG_ERROR("%s: Could not load file", path); return false; @@ -226,7 +226,7 @@ static bool loadState(const char* const path) int errorOffset = 0; char stringBuffer[1000]; - const int result = ksjson_decode(data, + const int result = rcjson_decode(data, (int)length, stringBuffer, sizeof(stringBuffer), @@ -237,7 +237,7 @@ static bool loadState(const char* const path) if(result != RollbarCrashJSON_OK) { RollbarCrashLOG_ERROR("%s, offset %d: %s", - path, errorOffset, ksjson_stringForError(result)); + path, errorOffset, rcjson_stringForError(result)); return false; } return true; @@ -261,61 +261,61 @@ static bool saveState(const char* const path) } RollbarCrashJSONEncodeContext JSONContext; - ksjson_beginEncode(&JSONContext, + rcjson_beginEncode(&JSONContext, true, addJSONData, &fd); int result; - if((result = ksjson_beginObject(&JSONContext, NULL)) != RollbarCrashJSON_OK) + if((result = rcjson_beginObject(&JSONContext, NULL)) != RollbarCrashJSON_OK) { goto done; } - if((result = ksjson_addIntegerElement(&JSONContext, + if((result = rcjson_addIntegerElement(&JSONContext, kKeyFormatVersion, kFormatVersion)) != RollbarCrashJSON_OK) { goto done; } // Record this launch crashed state into "crashed last launch" field. - if((result = ksjson_addBooleanElement(&JSONContext, + if((result = rcjson_addBooleanElement(&JSONContext, kKeyCrashedLastLaunch, g_state.crashedThisLaunch)) != RollbarCrashJSON_OK) { goto done; } - if((result = ksjson_addFloatingPointElement(&JSONContext, + if((result = rcjson_addFloatingPointElement(&JSONContext, kKeyActiveDurationSinceLastCrash, g_state.activeDurationSinceLastCrash)) != RollbarCrashJSON_OK) { goto done; } - if((result = ksjson_addFloatingPointElement(&JSONContext, + if((result = rcjson_addFloatingPointElement(&JSONContext, kKeyBackgroundDurationSinceLastCrash, g_state.backgroundDurationSinceLastCrash)) != RollbarCrashJSON_OK) { goto done; } - if((result = ksjson_addIntegerElement(&JSONContext, + if((result = rcjson_addIntegerElement(&JSONContext, kKeyLaunchesSinceLastCrash, g_state.launchesSinceLastCrash)) != RollbarCrashJSON_OK) { goto done; } - if((result = ksjson_addIntegerElement(&JSONContext, + if((result = rcjson_addIntegerElement(&JSONContext, kKeySessionsSinceLastCrash, g_state.sessionsSinceLastCrash)) != RollbarCrashJSON_OK) { goto done; } - result = ksjson_endEncode(&JSONContext); + result = rcjson_endEncode(&JSONContext); done: close(fd); if(result != RollbarCrashJSON_OK) { RollbarCrashLOG_ERROR("%s: %s", - path, ksjson_stringForError(result)); + path, rcjson_stringForError(result)); return false; } return true; @@ -346,13 +346,13 @@ static void updateAppState(void) #pragma mark - API - // ============================================================================ -void kscrashstate_initialize(const char* const stateFilePath) +void rcstate_initialize(const char* const stateFilePath) { g_stateFilePath = strdup(stateFilePath); loadState(g_stateFilePath); } -bool kscrashstate_reset() +bool rcstate_reset() { if(g_isEnabled) { @@ -378,7 +378,7 @@ bool kscrashstate_reset() return false; } -void kscrashstate_notifyObjCLoad(void) +void rcstate_notifyObjCLoad(void) { RollbarCrashLOG_TRACE("RollbarCrash has been loaded!"); memset(&g_state, 0, sizeof(g_state)); @@ -387,7 +387,7 @@ void kscrashstate_notifyObjCLoad(void) g_state.appStateTransitionTime = getCurrentTime(); } -void kscrashstate_notifyAppActive(const bool isActive) +void rcstate_notifyAppActive(const bool isActive) { if(g_isEnabled) { @@ -408,7 +408,7 @@ void kscrashstate_notifyAppActive(const bool isActive) } } -void kscrashstate_notifyAppInForeground(const bool isInForeground) +void rcstate_notifyAppInForeground(const bool isInForeground) { if(g_isEnabled) { @@ -433,7 +433,7 @@ void kscrashstate_notifyAppInForeground(const bool isInForeground) } } -void kscrashstate_notifyAppTerminate(void) +void rcstate_notifyAppTerminate(void) { if(g_isEnabled) { @@ -443,7 +443,7 @@ void kscrashstate_notifyAppTerminate(void) } } -void kscrashstate_notifyAppCrash(void) +void rcstate_notifyAppCrash(void) { RollbarCrashLOG_TRACE("Trying to update AppState. g_isEnabled: %d", g_isEnabled); if(g_isEnabled) @@ -455,7 +455,7 @@ void kscrashstate_notifyAppCrash(void) } } -const RollbarCrash_AppState* const kscrashstate_currentState(void) +const RollbarCrash_AppState* const rcstate_currentState(void) { return &g_state; } @@ -467,7 +467,7 @@ static void setEnabled(bool isEnabled) g_isEnabled = isEnabled; if(isEnabled) { - kscrashstate_reset(); + rcstate_reset(); } } } @@ -498,7 +498,7 @@ static void addContextualInfoToEvent(RollbarCrash_MonitorContext* eventContext) } } -RollbarCrashMonitorAPI* kscm_appstate_getAPI() +RollbarCrashMonitorAPI* rcm_appstate_getAPI() { static RollbarCrashMonitorAPI api = { diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_AppState.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_AppState.h index 17d2635d..f1b8ec4b 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_AppState.h +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_AppState.h @@ -92,44 +92,44 @@ typedef struct * * @param stateFilePath Where to store on-disk representation of state. */ -void kscrashstate_initialize(const char* stateFilePath); +void rcstate_initialize(const char* stateFilePath); /** Reset the crash state. */ -bool kscrashstate_reset(void); +bool rcstate_reset(void); /** Notify the crash reporter of RollbarCrash being added to Objective-C runtime system. */ -void kscrashstate_notifyObjCLoad(void); +void rcstate_notifyObjCLoad(void); /** Notify the crash reporter of the application active state. * * @param isActive true if the application is active, otherwise false. */ -void kscrashstate_notifyAppActive(bool isActive); +void rcstate_notifyAppActive(bool isActive); /** Notify the crash reporter of the application foreground/background state. * * @param isInForeground true if the application is in the foreground, false if * it is in the background. */ -void kscrashstate_notifyAppInForeground(bool isInForeground); +void rcstate_notifyAppInForeground(bool isInForeground); /** Notify the crash reporter that the application is terminating. */ -void kscrashstate_notifyAppTerminate(void); +void rcstate_notifyAppTerminate(void); /** Notify the crash reporter that the application has crashed. */ -void kscrashstate_notifyAppCrash(void); +void rcstate_notifyAppCrash(void); /** Read-only access into the current state. */ -const RollbarCrash_AppState* const kscrashstate_currentState(void); +const RollbarCrash_AppState* const rcstate_currentState(void); /** Access the Monitor API. */ -RollbarCrashMonitorAPI* kscm_appstate_getAPI(void); +RollbarCrashMonitorAPI* rcm_appstate_getAPI(void); #ifdef __cplusplus diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_CPPException.cpp b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_CPPException.cpp index f4d560ec..d7a4b811 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_CPPException.cpp +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_CPPException.cpp @@ -81,7 +81,7 @@ static void captureStackTrace(void*, std::type_info*, void (*)(void*)) { if(g_captureNextStackTrace) { - kssc_initSelfThread(&g_stackCursor, 2); + rcsc_initSelfThread(&g_stackCursor, 2); } } @@ -111,7 +111,7 @@ static void CPPExceptionTerminate(void) { thread_act_array_t threads = NULL; mach_msg_type_number_t numThreads = 0; - ksmc_suspendEnvironment(&threads, &numThreads); + rcmc_suspendEnvironment(&threads, &numThreads); RollbarCrashLOG_DEBUG("Trapped c++ exception"); const char* name = NULL; std::type_info* tinfo = __cxxabiv1::__cxa_current_exception_type(); @@ -122,7 +122,7 @@ static void CPPExceptionTerminate(void) if(name == NULL || strcmp(name, "NSException") != 0) { - kscm_notifyFatalExceptionCaptured(false); + rcm_notifyFatalExceptionCaptured(false); RollbarCrash_MonitorContext* crashContext = &g_monitorContext; memset(crashContext, 0, sizeof(*crashContext)); @@ -167,7 +167,7 @@ catch(TYPE value)\ // TODO: Should this be done here? Maybe better in the exception handler? RollbarCrashMC_NEW_CONTEXT(machineContext); - ksmc_getContextForThread(ksthread_self(), machineContext, true); + rcmc_getContextForThread(rcthread_self(), machineContext, true); RollbarCrashLOG_DEBUG("Filling out context."); crashContext->crashType = RollbarCrashMonitorTypeCPPException; @@ -179,13 +179,13 @@ catch(TYPE value)\ crashContext->crashReason = description; crashContext->offendingMachineContext = machineContext; - kscm_handleException(crashContext); + rcm_handleException(crashContext); } else { RollbarCrashLOG_DEBUG("Detected NSException. Letting the current NSException handler deal with it."); } - ksmc_resumeEnvironment(threads, numThreads); + rcmc_resumeEnvironment(threads, numThreads); RollbarCrashLOG_DEBUG("Calling original terminate handler."); g_originalTerminateHandler(); @@ -202,7 +202,7 @@ static void initialize() if(!isInitialized) { isInitialized = true; - kssc_initCursor(&g_stackCursor, NULL, NULL); + rcsc_initCursor(&g_stackCursor, NULL, NULL); } } @@ -215,7 +215,7 @@ static void setEnabled(bool isEnabled) { initialize(); - ksid_generate(g_eventID); + rcid_generate(g_eventID); g_originalTerminateHandler = std::set_terminate(CPPExceptionTerminate); } else @@ -231,16 +231,16 @@ static bool isEnabled() return g_isEnabled; } -extern "C" void kscm_enableSwapCxaThrow(void) +extern "C" void rcm_enableSwapCxaThrow(void) { if (g_cxaSwapEnabled != true) { - ksct_swap(captureStackTrace); + rcct_swap(captureStackTrace); g_cxaSwapEnabled = true; } } -extern "C" RollbarCrashMonitorAPI* kscm_cppexception_getAPI() +extern "C" RollbarCrashMonitorAPI* rcm_cppexception_getAPI() { static RollbarCrashMonitorAPI api = { diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_CPPException.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_CPPException.h index 92177661..9ee48a66 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_CPPException.h +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_CPPException.h @@ -33,11 +33,11 @@ extern "C" { /** Enable swapping of __cxa_trow symbol with lazy symbols table */ -void kscm_enableSwapCxaThrow(void); +void rcm_enableSwapCxaThrow(void); /** Access the Monitor API. */ -RollbarCrashMonitorAPI* kscm_cppexception_getAPI(void); +RollbarCrashMonitorAPI* rcm_cppexception_getAPI(void); #ifdef __cplusplus diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_Deadlock.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_Deadlock.h index f70babd9..9e9570a2 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_Deadlock.h +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_Deadlock.h @@ -46,11 +46,11 @@ extern "C" { * * @param value The number of seconds between checks (0 = disabled). */ -void kscm_setDeadlockHandlerWatchdogInterval(double value); +void rcm_setDeadlockHandlerWatchdogInterval(double value); /** Access the Monitor API. */ -RollbarCrashMonitorAPI* kscm_deadlock_getAPI(void); +RollbarCrashMonitorAPI* rcm_deadlock_getAPI(void); #ifdef __cplusplus diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_Deadlock.m b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_Deadlock.m index 6e3147fb..531d994a 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_Deadlock.m +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_Deadlock.m @@ -109,15 +109,15 @@ - (void) handleDeadlock { thread_act_array_t threads = NULL; mach_msg_type_number_t numThreads = 0; - ksmc_suspendEnvironment(&threads, &numThreads); - kscm_notifyFatalExceptionCaptured(false); + rcmc_suspendEnvironment(&threads, &numThreads); + rcm_notifyFatalExceptionCaptured(false); RollbarCrashMC_NEW_CONTEXT(machineContext); - ksmc_getContextForThread(g_mainQueueThread, machineContext, false); + rcmc_getContextForThread(g_mainQueueThread, machineContext, false); RollbarCrashStackCursor stackCursor; - kssc_initWithMachineContext(&stackCursor, RollbarCrashSC_MAX_STACK_DEPTH, machineContext); + rcsc_initWithMachineContext(&stackCursor, RollbarCrashSC_MAX_STACK_DEPTH, machineContext); char eventID[37]; - ksid_generate(eventID); + rcid_generate(eventID); RollbarCrashLOG_DEBUG(@"Filling out context."); RollbarCrash_MonitorContext* crashContext = &g_monitorContext; @@ -128,8 +128,8 @@ - (void) handleDeadlock crashContext->offendingMachineContext = machineContext; crashContext->stackCursor = &stackCursor; - kscm_handleException(crashContext); - ksmc_resumeEnvironment(threads, numThreads); + rcm_handleException(crashContext); + rcmc_resumeEnvironment(threads, numThreads); RollbarCrashLOG_DEBUG(@"Calling abort()"); abort(); @@ -178,7 +178,7 @@ static void initialize() if(!isInitialized) { isInitialized = true; - dispatch_async(dispatch_get_main_queue(), ^{g_mainQueueThread = ksthread_self();}); + dispatch_async(dispatch_get_main_queue(), ^{g_mainQueueThread = rcthread_self();}); } } @@ -207,7 +207,7 @@ static bool isEnabled() return g_isEnabled; } -RollbarCrashMonitorAPI* kscm_deadlock_getAPI() +RollbarCrashMonitorAPI* rcm_deadlock_getAPI() { static RollbarCrashMonitorAPI api = { @@ -217,7 +217,7 @@ static bool isEnabled() return &api; } -void kscm_setDeadlockHandlerWatchdogInterval(double value) +void rcm_setDeadlockHandlerWatchdogInterval(double value) { g_watchdogInterval = value; } diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_MachException.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_MachException.c index cef15a61..65b2617c 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_MachException.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_MachException.c @@ -277,7 +277,7 @@ static void* handleExceptions(void* const userData) if(threadName == kThreadSecondary) { RollbarCrashLOG_DEBUG("This is the secondary thread. Suspending."); - thread_suspend((thread_t)ksthread_self()); + thread_suspend((thread_t)rcthread_self()); eventID = g_secondaryEventID; } @@ -308,16 +308,16 @@ static void* handleExceptions(void* const userData) { thread_act_array_t threads = NULL; mach_msg_type_number_t numThreads = 0; - ksmc_suspendEnvironment(&threads, &numThreads); + rcmc_suspendEnvironment(&threads, &numThreads); g_isHandlingCrash = true; - kscm_notifyFatalExceptionCaptured(true); + rcm_notifyFatalExceptionCaptured(true); RollbarCrashLOG_DEBUG("Exception handler is installed. Continuing exception handling."); // Switch to the secondary thread if necessary, or uninstall the handler // to avoid a death loop. - if(ksthread_self() == g_primaryMachThread) + if(rcthread_self() == g_primaryMachThread) { RollbarCrashLOG_DEBUG("This is the primary exception thread. Activating secondary thread."); // TODO: This was put here to avoid a freeze. Does secondary thread ever fire? @@ -338,19 +338,19 @@ static void* handleExceptions(void* const userData) RollbarCrashMC_NEW_CONTEXT(machineContext); RollbarCrash_MonitorContext* crashContext = &g_monitorContext; crashContext->offendingMachineContext = machineContext; - kssc_initCursor(&g_stackCursor, NULL, NULL); - if(ksmc_getContextForThread(exceptionMessage.thread.name, machineContext, true)) + rcsc_initCursor(&g_stackCursor, NULL, NULL); + if(rcmc_getContextForThread(exceptionMessage.thread.name, machineContext, true)) { - kssc_initWithMachineContext(&g_stackCursor, RollbarCrashSC_MAX_STACK_DEPTH, machineContext); + rcsc_initWithMachineContext(&g_stackCursor, RollbarCrashSC_MAX_STACK_DEPTH, machineContext); RollbarCrashLOG_TRACE("Fault address %p, instruction address %p", - kscpu_faultAddress(machineContext), kscpu_instructionAddress(machineContext)); + rccpu_faultAddress(machineContext), rccpu_instructionAddress(machineContext)); if(exceptionMessage.exception == EXC_BAD_ACCESS) { - crashContext->faultAddress = kscpu_faultAddress(machineContext); + crashContext->faultAddress = rccpu_faultAddress(machineContext); } else { - crashContext->faultAddress = kscpu_instructionAddress(machineContext); + crashContext->faultAddress = rccpu_instructionAddress(machineContext); } } @@ -371,11 +371,11 @@ static void* handleExceptions(void* const userData) crashContext->signal.signum = signalForMachException(crashContext->mach.type, crashContext->mach.code); crashContext->stackCursor = &g_stackCursor; - kscm_handleException(crashContext); + rcm_handleException(crashContext); RollbarCrashLOG_DEBUG("Crash handling complete. Restoring original handlers."); g_isHandlingCrash = false; - ksmc_resumeEnvironment(threads, numThreads); + rcmc_resumeEnvironment(threads, numThreads); } RollbarCrashLOG_DEBUG("Replying to mach exception message."); @@ -409,7 +409,7 @@ static void uninstallExceptionHandler() restoreExceptionPorts(); - thread_t thread_self = (thread_t)ksthread_self(); + thread_t thread_self = (thread_t)rcthread_self(); if(g_primaryPThread != 0 && g_primaryMachThread != thread_self) { @@ -525,7 +525,7 @@ static bool installExceptionHandler() goto failed; } g_secondaryMachThread = pthread_mach_thread_np(g_secondaryPThread); - ksmc_addReservedThread(g_secondaryMachThread); + rcmc_addReservedThread(g_secondaryMachThread); RollbarCrashLOG_DEBUG("Creating primary exception thread."); error = pthread_create(&g_primaryPThread, @@ -539,7 +539,7 @@ static bool installExceptionHandler() } pthread_attr_destroy(&attr); g_primaryMachThread = pthread_mach_thread_np(g_primaryPThread); - ksmc_addReservedThread(g_primaryMachThread); + rcmc_addReservedThread(g_primaryMachThread); RollbarCrashLOG_DEBUG("Mach exception handler installed."); return true; @@ -562,8 +562,8 @@ static void setEnabled(bool isEnabled) g_isEnabled = isEnabled; if(isEnabled) { - ksid_generate(g_primaryEventID); - ksid_generate(g_secondaryEventID); + rcid_generate(g_primaryEventID); + rcid_generate(g_secondaryEventID); if(!installExceptionHandler()) { return; @@ -595,7 +595,7 @@ static void addContextualInfoToEvent(struct RollbarCrash_MonitorContext* eventCo #endif -RollbarCrashMonitorAPI* kscm_machexception_getAPI() +RollbarCrashMonitorAPI* rcm_machexception_getAPI() { static RollbarCrashMonitorAPI api = { diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_MachException.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_MachException.h index 1db8e74d..5a297dfd 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_MachException.h +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_MachException.h @@ -42,7 +42,7 @@ extern "C" { /** Access the Monitor API. */ -RollbarCrashMonitorAPI* kscm_machexception_getAPI(void); +RollbarCrashMonitorAPI* rcm_machexception_getAPI(void); #ifdef __cplusplus diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_NSException.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_NSException.h index f3ddba25..fc5bc87f 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_NSException.h +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_NSException.h @@ -42,7 +42,7 @@ extern "C" { /** Access the Monitor API. */ -RollbarCrashMonitorAPI* kscm_nsexception_getAPI(void); +RollbarCrashMonitorAPI* rcm_nsexception_getAPI(void); #ifdef __cplusplus diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_NSException.m b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_NSException.m index e963c67c..9c70fd92 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_NSException.m +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_NSException.m @@ -64,8 +64,8 @@ static void handleException(NSException* exception, BOOL currentSnapshotUserRepo { thread_act_array_t threads = NULL; mach_msg_type_number_t numThreads = 0; - ksmc_suspendEnvironment(&threads, &numThreads); - kscm_notifyFatalExceptionCaptured(false); + rcmc_suspendEnvironment(&threads, &numThreads); + rcm_notifyFatalExceptionCaptured(false); RollbarCrashLOG_DEBUG(@"Filling out context."); NSArray* addresses = [exception callStackReturnAddresses]; @@ -77,11 +77,11 @@ static void handleException(NSException* exception, BOOL currentSnapshotUserRepo } char eventID[37]; - ksid_generate(eventID); + rcid_generate(eventID); RollbarCrashMC_NEW_CONTEXT(machineContext); - ksmc_getContextForThread(ksthread_self(), machineContext, true); + rcmc_getContextForThread(rcthread_self(), machineContext, true); RollbarCrashStackCursor cursor; - kssc_initWithBacktrace(&cursor, callstack, (int)numFrames, 0); + rcsc_initWithBacktrace(&cursor, callstack, (int)numFrames, 0); RollbarCrash_MonitorContext* crashContext = &g_monitorContext; memset(crashContext, 0, sizeof(*crashContext)); @@ -97,11 +97,11 @@ static void handleException(NSException* exception, BOOL currentSnapshotUserRepo crashContext->currentSnapshotUserReported = currentSnapshotUserReported; RollbarCrashLOG_DEBUG(@"Calling main crash handler."); - kscm_handleException(crashContext); + rcm_handleException(crashContext); free(callstack); if (currentSnapshotUserReported) { - ksmc_resumeEnvironment(threads, numThreads); + rcmc_resumeEnvironment(threads, numThreads); } if (g_previousUncaughtExceptionHandler != NULL) { @@ -151,7 +151,7 @@ static bool isEnabled() return g_isEnabled; } -RollbarCrashMonitorAPI* kscm_nsexception_getAPI() +RollbarCrashMonitorAPI* rcm_nsexception_getAPI() { static RollbarCrashMonitorAPI api = { diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_Signal.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_Signal.c index d0f1d685..35b4e410 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_Signal.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_Signal.c @@ -86,13 +86,13 @@ static void handleSignal(int sigNum, siginfo_t* signalInfo, void* userContext) { thread_act_array_t threads = NULL; mach_msg_type_number_t numThreads = 0; - ksmc_suspendEnvironment(&threads, &numThreads); - kscm_notifyFatalExceptionCaptured(false); + rcmc_suspendEnvironment(&threads, &numThreads); + rcm_notifyFatalExceptionCaptured(false); RollbarCrashLOG_DEBUG("Filling out context."); RollbarCrashMC_NEW_CONTEXT(machineContext); - ksmc_getContextForSignal(userContext, machineContext); - kssc_initWithMachineContext(&g_stackCursor, RollbarCrashSC_MAX_STACK_DEPTH, machineContext); + rcmc_getContextForSignal(userContext, machineContext); + rcsc_initWithMachineContext(&g_stackCursor, RollbarCrashSC_MAX_STACK_DEPTH, machineContext); RollbarCrash_MonitorContext* crashContext = &g_monitorContext; memset(crashContext, 0, sizeof(*crashContext)); @@ -106,8 +106,8 @@ static void handleSignal(int sigNum, siginfo_t* signalInfo, void* userContext) crashContext->signal.sigcode = signalInfo->si_code; crashContext->stackCursor = &g_stackCursor; - kscm_handleException(crashContext); - ksmc_resumeEnvironment(threads, numThreads); + rcm_handleException(crashContext); + rcmc_resumeEnvironment(threads, numThreads); } RollbarCrashLOG_DEBUG("Re-raising signal for regular handlers to catch."); @@ -140,8 +140,8 @@ static bool installSignalHandler() } #endif - const int* fatalSignals = kssignal_fatalSignals(); - int fatalSignalsCount = kssignal_numFatalSignals(); + const int* fatalSignals = rcsignal_fatalSignals(); + int fatalSignalsCount = rcsignal_numFatalSignals(); if(g_previousSignalHandlers == NULL) { @@ -164,7 +164,7 @@ static bool installSignalHandler() if(sigaction(fatalSignals[i], &action, &g_previousSignalHandlers[i]) != 0) { char sigNameBuff[30]; - const char* sigName = kssignal_signalName(fatalSignals[i]); + const char* sigName = rcsignal_signalName(fatalSignals[i]); if(sigName == NULL) { snprintf(sigNameBuff, sizeof(sigNameBuff), "%d", fatalSignals[i]); @@ -191,8 +191,8 @@ static void uninstallSignalHandler(void) { RollbarCrashLOG_DEBUG("Uninstalling signal handlers."); - const int* fatalSignals = kssignal_fatalSignals(); - int fatalSignalsCount = kssignal_numFatalSignals(); + const int* fatalSignals = rcsignal_fatalSignals(); + int fatalSignalsCount = rcsignal_numFatalSignals(); for(int i = 0; i < fatalSignalsCount; i++) { @@ -213,7 +213,7 @@ static void setEnabled(bool isEnabled) g_isEnabled = isEnabled; if(isEnabled) { - ksid_generate(g_eventID); + rcid_generate(g_eventID); if(!installSignalHandler()) { return; @@ -241,7 +241,7 @@ static void addContextualInfoToEvent(struct RollbarCrash_MonitorContext* eventCo #endif -RollbarCrashMonitorAPI* kscm_signal_getAPI() +RollbarCrashMonitorAPI* rcm_signal_getAPI() { static RollbarCrashMonitorAPI api = { diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_Signal.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_Signal.h index 88adf9ba..b48070bf 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_Signal.h +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_Signal.h @@ -42,7 +42,7 @@ extern "C" { /** Access the Monitor API. */ -RollbarCrashMonitorAPI* kscm_signal_getAPI(void); +RollbarCrashMonitorAPI* rcm_signal_getAPI(void); #ifdef __cplusplus diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_System.m b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_System.m index 1930238e..36f0d9cd 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_System.m +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_System.m @@ -96,7 +96,7 @@ static NSString* nsstringSysctl(NSString* name) { NSString* str = nil; - int size = (int)kssysctl_stringForName(name.UTF8String, NULL, 0); + int size = (int)rcsysctl_stringForName(name.UTF8String, NULL, 0); if(size <= 0) { @@ -105,7 +105,7 @@ NSMutableData* value = [NSMutableData dataWithLength:(unsigned)size]; - if(kssysctl_stringForName(name.UTF8String, value.mutableBytes, size) != 0) + if(rcsysctl_stringForName(name.UTF8String, value.mutableBytes, size) != 0) { str = [NSString stringWithCString:value.mutableBytes encoding:NSUTF8StringEncoding]; } @@ -121,14 +121,14 @@ */ static const char* stringSysctl(const char* name) { - int size = (int)kssysctl_stringForName(name, NULL, 0); + int size = (int)rcsysctl_stringForName(name, NULL, 0); if(size <= 0) { return NULL; } char* value = malloc((size_t)size); - if(kssysctl_stringForName(name, value, size) <= 0) + if(rcsysctl_stringForName(name, value, size) <= 0) { free(value); return NULL; @@ -140,7 +140,7 @@ static const char* dateString(time_t date) { char* buffer = malloc(21); - ksdate_utcStringFromTimestamp(date, buffer); + rcdate_utcStringFromTimestamp(date, buffer); return buffer; } @@ -152,7 +152,7 @@ */ static const char* dateSysctl(const char* name) { - struct timeval value = kssysctl_timevalForName(name); + struct timeval value = rcsysctl_timevalForName(name); return dateString(value.tv_sec); } @@ -254,11 +254,11 @@ static uint64_t usableMemory(void) if(exePath != nil) { - const uint8_t* uuidBytes = ksdl_imageUUID(exePath.UTF8String, true); + const uint8_t* uuidBytes = rcdl_imageUUID(exePath.UTF8String, true); if(uuidBytes == NULL) { // OSX app image path is a lie. - uuidBytes = ksdl_imageUUID(exePath.lastPathComponent.UTF8String, false); + uuidBytes = rcdl_imageUUID(exePath.lastPathComponent.UTF8String, false); } if(uuidBytes != NULL) { @@ -320,12 +320,12 @@ static uint64_t usableMemory(void) static const char* getCurrentCPUArch() { - const char* result = getCPUArchForCPUType(kssysctl_int32ForName("hw.cputype"), - kssysctl_int32ForName("hw.cpusubtype")); + const char* result = getCPUArchForCPUType(rcsysctl_int32ForName("hw.cputype"), + rcsysctl_int32ForName("hw.cpusubtype")); if(result == NULL) { - result = kscpu_currentArch(); + result = rccpu_currentArch(); } return result; } @@ -336,7 +336,7 @@ static uint64_t usableMemory(void) */ static bool isJailbroken() { - return ksdl_imageNamed("MobileSubstrate", false) != UINT32_MAX; + return rcdl_imageNamed("MobileSubstrate", false) != UINT32_MAX; } /** Check if the current build is a debug build. @@ -407,7 +407,7 @@ static bool isSimulatorBuild() #endif { data = [NSMutableData dataWithLength:6]; - kssysctl_getMacAddress("en0", [data mutableBytes]); + rcsysctl_getMacAddress("en0", [data mutableBytes]); } // Append some device-specific data. @@ -561,8 +561,8 @@ static void initialize() g_systemData.bundleShortVersion = cString(infoDict[@"CFBundleShortVersionString"]); g_systemData.appID = getAppUUID(); g_systemData.cpuArchitecture = getCurrentCPUArch(); - g_systemData.cpuType = kssysctl_int32ForName("hw.cputype"); - g_systemData.cpuSubType = kssysctl_int32ForName("hw.cpusubtype"); + g_systemData.cpuType = rcsysctl_int32ForName("hw.cputype"); + g_systemData.cpuSubType = rcsysctl_int32ForName("hw.cpusubtype"); g_systemData.binaryCPUType = header->cputype; g_systemData.binaryCPUSubType = header->cpusubtype; g_systemData.timezone = cString([NSTimeZone localTimeZone].abbreviation); @@ -572,7 +572,7 @@ static void initialize() g_systemData.deviceAppHash = getDeviceAndAppHash(); g_systemData.buildType = getBuildType(); g_systemData.storageSize = getStorageSize(); - g_systemData.memorySize = kssysctl_uint64ForName("hw.memsize"); + g_systemData.memorySize = rcsysctl_uint64ForName("hw.memsize"); } } @@ -632,7 +632,7 @@ static void addContextualInfoToEvent(RollbarCrash_MonitorContext* eventContext) } } -RollbarCrashMonitorAPI* kscm_system_getAPI() +RollbarCrashMonitorAPI* rcm_system_getAPI() { static RollbarCrashMonitorAPI api = { diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_User.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_User.c index ca80f0b1..4a0d292f 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_User.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_User.c @@ -40,7 +40,7 @@ static volatile bool g_isEnabled = false; -void kscm_reportUserException(const char* name, +void rcm_reportUserException(const char* name, const char* reason, const char* language, const char* lineOfCode, @@ -58,19 +58,19 @@ void kscm_reportUserException(const char* name, mach_msg_type_number_t numThreads = 0; if(logAllThreads) { - ksmc_suspendEnvironment(&threads, &numThreads); + rcmc_suspendEnvironment(&threads, &numThreads); } if(terminateProgram) { - kscm_notifyFatalExceptionCaptured(false); + rcm_notifyFatalExceptionCaptured(false); } char eventID[37]; - ksid_generate(eventID); + rcid_generate(eventID); RollbarCrashMC_NEW_CONTEXT(machineContext); - ksmc_getContextForThread(ksthread_self(), machineContext, true); + rcmc_getContextForThread(rcthread_self(), machineContext, true); RollbarCrashStackCursor stackCursor; - kssc_initSelfThread(&stackCursor, 0); + rcsc_initSelfThread(&stackCursor, 0); RollbarCrashLOG_DEBUG("Filling out context."); @@ -87,11 +87,11 @@ void kscm_reportUserException(const char* name, context.userException.customStackTrace = stackTrace; context.stackCursor = &stackCursor; - kscm_handleException(&context); + rcm_handleException(&context); if(logAllThreads) { - ksmc_resumeEnvironment(threads, numThreads); + rcmc_resumeEnvironment(threads, numThreads); } if(terminateProgram) { @@ -110,7 +110,7 @@ static bool isEnabled() return g_isEnabled; } -RollbarCrashMonitorAPI* kscm_user_getAPI() +RollbarCrashMonitorAPI* rcm_user_getAPI() { static RollbarCrashMonitorAPI api = { diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_User.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_User.h index ff9e2a3b..4cfebea9 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_User.h +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_User.h @@ -55,7 +55,7 @@ extern "C" { * * @param terminateProgram If true, do not return from this function call. Terminate the program instead. */ -void kscm_reportUserException(const char* name, +void rcm_reportUserException(const char* name, const char* reason, const char* language, const char* lineOfCode, @@ -65,7 +65,7 @@ void kscm_reportUserException(const char* name, /** Access the Monitor API. */ -RollbarCrashMonitorAPI* kscm_user_getAPI(void); +RollbarCrashMonitorAPI* rcm_user_getAPI(void); #ifdef __cplusplus diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_Zombie.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_Zombie.c index dd19ec55..aa36d269 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_Zombie.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_Zombie.c @@ -71,35 +71,35 @@ static bool copyStringIvar(const void* self, const char* ivarName, char* buffer, { Class class = object_getClass((id)self); RollbarCrashObjCIvar ivar = {0}; - likely_if(ksobjc_ivarNamed(class, ivarName, &ivar)) + likely_if(rcobjc_ivarNamed(class, ivarName, &ivar)) { void* pointer; - likely_if(ksobjc_ivarValue(self, ivar.index, &pointer)) + likely_if(rcobjc_ivarValue(self, ivar.index, &pointer)) { - likely_if(ksobjc_isValidObject(pointer)) + likely_if(rcobjc_isValidObject(pointer)) { - likely_if(ksobjc_copyStringContents(pointer, buffer, bufferLength) > 0) + likely_if(rcobjc_copyStringContents(pointer, buffer, bufferLength) > 0) { return true; } else { - RollbarCrashLOG_DEBUG("ksobjc_copyStringContents %s failed", ivarName); + RollbarCrashLOG_DEBUG("rcobjc_copyStringContents %s failed", ivarName); } } else { - RollbarCrashLOG_DEBUG("ksobjc_isValidObject %s failed", ivarName); + RollbarCrashLOG_DEBUG("rcobjc_isValidObject %s failed", ivarName); } } else { - RollbarCrashLOG_DEBUG("ksobjc_ivarValue %s failed", ivarName); + RollbarCrashLOG_DEBUG("rcobjc_ivarValue %s failed", ivarName); } } else { - RollbarCrashLOG_DEBUG("ksobjc_ivarNamed %s failed", ivarName); + RollbarCrashLOG_DEBUG("rcobjc_ivarNamed %s failed", ivarName); } return false; } @@ -190,7 +190,7 @@ static void install() // }); //} -const char* kszombie_className(const void* object) +const char* rczombie_className(const void* object) { volatile Zombie* cache = g_zombieCache; if(cache == NULL || object == NULL) @@ -239,7 +239,7 @@ static void addContextualInfoToEvent(RollbarCrash_MonitorContext* eventContext) } } -RollbarCrashMonitorAPI* kscm_zombie_getAPI() +RollbarCrashMonitorAPI* rcm_zombie_getAPI() { static RollbarCrashMonitorAPI api = { diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_Zombie.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_Zombie.h index 22b3b501..7e4818cf 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_Zombie.h +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_Zombie.h @@ -55,11 +55,11 @@ extern "C" { * * @return The object's class name, or NULL if it wasn't found. */ -const char* kszombie_className(const void* object); +const char* rczombie_className(const void* object); /** Access the Monitor API. */ -RollbarCrashMonitorAPI* kscm_zombie_getAPI(void); +RollbarCrashMonitorAPI* rcm_zombie_getAPI(void); #ifdef __cplusplus diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrash.m b/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrash.m index e0e8b6c1..6d6ef6f7 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrash.m +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrash.m @@ -194,37 +194,37 @@ - (void) setUserInfo:(NSDictionary*) userInfo } _userInfo = userInfo; - kscrash_setUserInfoJSON([userInfoJSON bytes]); + rc_setUserInfoJSON([userInfoJSON bytes]); } } - (void) setMonitoring:(RollbarCrashMonitorType)monitoring { - _monitoring = kscrash_setMonitoring(monitoring); + _monitoring = rc_setMonitoring(monitoring); } - (void) setDeadlockWatchdogInterval:(double) deadlockWatchdogInterval { _deadlockWatchdogInterval = deadlockWatchdogInterval; - kscrash_setDeadlockWatchdogInterval(deadlockWatchdogInterval); + rc_setDeadlockWatchdogInterval(deadlockWatchdogInterval); } - (void) setSearchQueueNames:(BOOL) searchQueueNames { _searchQueueNames = searchQueueNames; - kscrash_setSearchQueueNames(searchQueueNames); + rc_setSearchQueueNames(searchQueueNames); } - (void) setOnCrash:(RollbarCrashReportWriteCallback) onCrash { _onCrash = onCrash; - kscrash_setCrashNotifyCallback(onCrash); + rc_setCrashNotifyCallback(onCrash); } - (void) setIntrospectMemory:(BOOL) introspectMemory { _introspectMemory = introspectMemory; - kscrash_setIntrospectMemory(introspectMemory); + rc_setIntrospectMemory(introspectMemory); } - (BOOL) catchZombies @@ -250,7 +250,7 @@ - (void) setDoNotIntrospectClasses:(NSArray *)doNotIntrospectClasses NSUInteger count = [doNotIntrospectClasses count]; if(count == 0) { - kscrash_setDoNotIntrospectClasses(nil, 0); + rc_setDoNotIntrospectClasses(nil, 0); } else { @@ -260,20 +260,20 @@ - (void) setDoNotIntrospectClasses:(NSArray *)doNotIntrospectClasses { classes[i] = [[doNotIntrospectClasses objectAtIndex:i] cStringUsingEncoding:NSUTF8StringEncoding]; } - kscrash_setDoNotIntrospectClasses(classes, (int)count); + rc_setDoNotIntrospectClasses(classes, (int)count); } } - (void) setMaxReportCount:(int)maxReportCount { _maxReportCount = maxReportCount; - kscrash_setMaxReportCount(maxReportCount); + rc_setMaxReportCount(maxReportCount); } - (NSDictionary*) systemInfo { RollbarCrash_MonitorContext fakeEvent = {0}; - kscm_system_getAPI()->addContextualInfoToEvent(&fakeEvent); + rcm_system_getAPI()->addContextualInfoToEvent(&fakeEvent); NSMutableDictionary* dict = [NSMutableDictionary new]; #define COPY_STRING(A) if (fakeEvent.System.A) dict[@#A] = [NSString stringWithUTF8String:fakeEvent.System.A] @@ -315,7 +315,7 @@ - (NSDictionary*) systemInfo - (BOOL) install { - _monitoring = kscrash_install(self.bundleName.UTF8String, + _monitoring = rc_install(self.bundleName.UTF8String, self.basePath.UTF8String); if(self.monitoring == 0) { @@ -342,20 +342,20 @@ - (void) sendAllReportsWithCompletion:(RollbarCrashReportFilterCompletion) onCom if((self.deleteBehaviorAfterSendAll == RollbarCrashDeleteOnSucess && completed) || self.deleteBehaviorAfterSendAll == RollbarCrashDeleteAlways) { - kscrash_deleteAllReports(); + rc_deleteAllReports(); } - kscrash_callCompletion(onCompletion, filteredReports, completed, error); + rc_callCompletion(onCompletion, filteredReports, completed, error); }]; } - (void) deleteAllReports { - kscrash_deleteAllReports(); + rc_deleteAllReports(); } - (void) deleteReportWithID:(NSNumber*) reportID { - kscrash_deleteReportWithID([reportID longLongValue]); + rc_deleteReportWithID([reportID longLongValue]); } - (void) reportUserException:(NSString*) name @@ -385,7 +385,7 @@ - (void) reportUserException:(NSString*) name cStackTrace = [jsonString cStringUsingEncoding:NSUTF8StringEncoding]; } - kscrash_reportUserException(cName, + rc_reportUserException(cName, cReason, cLanguage, cLineOfCode, @@ -406,7 +406,7 @@ - (void) enableSwapOfCxaThrow #define SYNTHESIZE_CRASH_STATE_PROPERTY(TYPE, NAME) \ - (TYPE) NAME \ { \ - return kscrashstate_currentState()->NAME; \ + return rcstate_currentState()->NAME; \ } SYNTHESIZE_CRASH_STATE_PROPERTY(NSTimeInterval, activeDurationSinceLastCrash) @@ -420,20 +420,20 @@ - (TYPE) NAME \ - (int) reportCount { - return kscrash_getReportCount(); + return rc_getReportCount(); } - (void) sendReports:(NSArray*) reports onCompletion:(RollbarCrashReportFilterCompletion) onCompletion { if([reports count] == 0) { - kscrash_callCompletion(onCompletion, reports, YES, nil); + rc_callCompletion(onCompletion, reports, YES, nil); return; } if(self.sink == nil) { - kscrash_callCompletion(onCompletion, reports, NO, + rc_callCompletion(onCompletion, reports, NO, [NSError errorWithDomain:[[self class] description] code:0 description:@"No sink set. Crash reports not sent."]); @@ -443,13 +443,13 @@ - (void) sendReports:(NSArray*) reports onCompletion:(RollbarCrashReportFilterCo [self.sink filterReports:reports onCompletion:^(NSArray* filteredReports, BOOL completed, NSError* error) { - kscrash_callCompletion(onCompletion, filteredReports, completed, error); + rc_callCompletion(onCompletion, filteredReports, completed, error); }]; } - (NSData*) loadCrashReportJSONWithID:(int64_t) reportID { - char* report = kscrash_readReport(reportID); + char* report = rc_readReport(reportID); if(report != NULL) { return [NSData dataWithBytesNoCopy:report length:strlen(report) freeWhenDone:YES]; @@ -473,9 +473,9 @@ - (void) doctorReport:(NSMutableDictionary*) report - (NSArray*)reportIDs { - int reportCount = kscrash_getReportCount(); + int reportCount = rc_getReportCount(); int64_t reportIDsC[reportCount]; - reportCount = kscrash_getReportIDs(reportIDsC, reportCount); + reportCount = rc_getReportIDs(reportIDsC, reportCount); NSMutableArray* reportIDs = [NSMutableArray arrayWithCapacity:(NSUInteger)reportCount]; for(int i = 0; i < reportCount; i++) { @@ -519,9 +519,9 @@ - (NSDictionary*) reportWithIntID:(int64_t) reportID - (NSArray*) allReports { - int reportCount = kscrash_getReportCount(); + int reportCount = rc_getReportCount(); int64_t reportIDs[reportCount]; - reportCount = kscrash_getReportIDs(reportIDs, reportCount); + reportCount = rc_getReportIDs(reportIDs, reportCount); NSMutableArray* reports = [NSMutableArray arrayWithCapacity:(NSUInteger)reportCount]; for(int i = 0; i < reportCount; i++) { @@ -538,13 +538,13 @@ - (NSArray*) allReports - (void) setAddConsoleLogToReport:(BOOL) shouldAddConsoleLogToReport { _addConsoleLogToReport = shouldAddConsoleLogToReport; - kscrash_setAddConsoleLogToReport(shouldAddConsoleLogToReport); + rc_setAddConsoleLogToReport(shouldAddConsoleLogToReport); } - (void) setPrintPreviousLog:(BOOL) shouldPrintPreviousLog { _printPreviousLog = shouldPrintPreviousLog; - kscrash_setPrintPreviousLog(shouldPrintPreviousLog); + rc_setPrintPreviousLog(shouldPrintPreviousLog); } @@ -616,32 +616,32 @@ + (void) subscribeToNotifications + (void) classDidBecomeLoaded { - kscrash_notifyObjCLoad(); + rc_notifyObjCLoad(); } + (void) applicationDidBecomeActive { - kscrash_notifyAppActive(true); + rc_notifyAppActive(true); } + (void) applicationWillResignActive { - kscrash_notifyAppActive(false); + rc_notifyAppActive(false); } + (void) applicationDidEnterBackground { - kscrash_notifyAppInForeground(false); + rc_notifyAppInForeground(false); } + (void) applicationWillEnterForeground { - kscrash_notifyAppInForeground(true); + rc_notifyAppInForeground(true); } + (void) applicationWillTerminate { - kscrash_notifyAppTerminate(); + rc_notifyAppTerminate(); } @end diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashC.c b/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashC.c index 476be01c..1c58d63a 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashC.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashC.c @@ -84,7 +84,7 @@ static void printPreviousLog(const char* filePath) { char* data; int length; - if(ksfu_readEntireFile(filePath, &data, &length, 0)) + if(rcfu_readEntireFile(filePath, &data, &length, 0)) { printf("\nvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv Previous Log vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv\n\n"); printf("%s\n", data); @@ -100,15 +100,15 @@ static void notifyOfBeforeInstallationState(void) switch (g_lastApplicationState) { case RollbarCrashApplicationStateDidBecomeActive: - return kscrash_notifyAppActive(true); + return rc_notifyAppActive(true); case RollbarCrashApplicationStateWillResignActiveActive: - return kscrash_notifyAppActive(false); + return rc_notifyAppActive(false); case RollbarCrashApplicationStateDidEnterBackground: - return kscrash_notifyAppInForeground(false); + return rc_notifyAppInForeground(false); case RollbarCrashApplicationStateWillEnterForeground: - return kscrash_notifyAppInForeground(true); + return rc_notifyAppInForeground(true); case RollbarCrashApplicationStateWillTerminate: - return kscrash_notifyAppTerminate(); + return rc_notifyAppTerminate(); default: return; } @@ -126,20 +126,20 @@ static void onCrash(struct RollbarCrash_MonitorContext* monitorContext) { if (monitorContext->currentSnapshotUserReported == false) { RollbarCrashLOG_DEBUG("Updating application state to note crash."); - kscrashstate_notifyAppCrash(); + rcstate_notifyAppCrash(); } monitorContext->consoleLogPath = g_shouldAddConsoleLogToReport ? g_consoleLogPath : NULL; if(monitorContext->crashedDuringCrashHandling) { - kscrashreport_writeRecrashReport(monitorContext, g_lastCrashReportFilePath); + rcreport_writeRecrashReport(monitorContext, g_lastCrashReportFilePath); } else { char crashReportFilePath[RollbarCrashFU_MAX_PATH_LENGTH]; - int64_t reportID = kscrs_getNextCrashReport(crashReportFilePath); + int64_t reportID = rccrs_getNextCrashReport(crashReportFilePath); strncpy(g_lastCrashReportFilePath, crashReportFilePath, sizeof(g_lastCrashReportFilePath)); - kscrashreport_writeStandardReport(monitorContext, crashReportFilePath); + rcreport_writeStandardReport(monitorContext, crashReportFilePath); if(g_reportWrittenCallback) { @@ -153,7 +153,7 @@ static void onCrash(struct RollbarCrash_MonitorContext* monitorContext) #pragma mark - API - // ============================================================================ -RollbarCrashMonitorType kscrash_install(const char* appName, const char* const installPath) +RollbarCrashMonitorType rc_install(const char* appName, const char* const installPath) { RollbarCrashLOG_DEBUG("Installing crash reporter."); @@ -166,25 +166,25 @@ RollbarCrashMonitorType kscrash_install(const char* appName, const char* const i char path[RollbarCrashFU_MAX_PATH_LENGTH]; snprintf(path, sizeof(path), "%s/Reports", installPath); - ksfu_makePath(path); - kscrs_initialize(appName, path); + rcfu_makePath(path); + rccrs_initialize(appName, path); snprintf(path, sizeof(path), "%s/Data", installPath); - ksfu_makePath(path); + rcfu_makePath(path); snprintf(path, sizeof(path), "%s/Data/CrashState.json", installPath); - kscrashstate_initialize(path); + rcstate_initialize(path); snprintf(g_consoleLogPath, sizeof(g_consoleLogPath), "%s/Data/ConsoleLog.txt", installPath); if(g_shouldPrintPreviousLog) { printPreviousLog(g_consoleLogPath); } - kslog_setLogFilename(g_consoleLogPath, true); + rclog_setLogFilename(g_consoleLogPath, true); - ksccd_init(60); + rcccd_init(60); - kscm_setEventCallback(onCrash); - RollbarCrashMonitorType monitors = kscrash_setMonitoring(g_monitoring); + rcm_setEventCallback(onCrash); + RollbarCrashMonitorType monitors = rc_setMonitoring(g_monitoring); RollbarCrashLOG_DEBUG("Installation complete."); @@ -193,72 +193,72 @@ RollbarCrashMonitorType kscrash_install(const char* appName, const char* const i return monitors; } -RollbarCrashMonitorType kscrash_setMonitoring(RollbarCrashMonitorType monitors) +RollbarCrashMonitorType rc_setMonitoring(RollbarCrashMonitorType monitors) { g_monitoring = monitors; if(g_installed) { - kscm_setActiveMonitors(monitors); - return kscm_getActiveMonitors(); + rcm_setActiveMonitors(monitors); + return rcm_getActiveMonitors(); } // Return what we will be monitoring in future. return g_monitoring; } -void kscrash_setUserInfoJSON(const char* const userInfoJSON) +void rc_setUserInfoJSON(const char* const userInfoJSON) { - kscrashreport_setUserInfoJSON(userInfoJSON); + rcreport_setUserInfoJSON(userInfoJSON); } -void kscrash_setDeadlockWatchdogInterval(double deadlockWatchdogInterval) +void rc_setDeadlockWatchdogInterval(double deadlockWatchdogInterval) { #if RollbarCrashCRASH_HAS_OBJC - kscm_setDeadlockHandlerWatchdogInterval(deadlockWatchdogInterval); + rcm_setDeadlockHandlerWatchdogInterval(deadlockWatchdogInterval); #endif } -void kscrash_setSearchQueueNames(bool searchQueueNames) +void rc_setSearchQueueNames(bool searchQueueNames) { - ksccd_setSearchQueueNames(searchQueueNames); + rcccd_setSearchQueueNames(searchQueueNames); } -void kscrash_setIntrospectMemory(bool introspectMemory) +void rc_setIntrospectMemory(bool introspectMemory) { - kscrashreport_setIntrospectMemory(introspectMemory); + rcreport_setIntrospectMemory(introspectMemory); } -void kscrash_setDoNotIntrospectClasses(const char** doNotIntrospectClasses, int length) +void rc_setDoNotIntrospectClasses(const char** doNotIntrospectClasses, int length) { - kscrashreport_setDoNotIntrospectClasses(doNotIntrospectClasses, length); + rcreport_setDoNotIntrospectClasses(doNotIntrospectClasses, length); } -void kscrash_setCrashNotifyCallback(const RollbarCrashReportWriteCallback onCrashNotify) +void rc_setCrashNotifyCallback(const RollbarCrashReportWriteCallback onCrashNotify) { - kscrashreport_setUserSectionWriteCallback(onCrashNotify); + rcreport_setUserSectionWriteCallback(onCrashNotify); } -void kscrash_setReportWrittenCallback(const RollbarCrashReportWrittenCallback onReportWrittenNotify) +void rc_setReportWrittenCallback(const RollbarCrashReportWrittenCallback onReportWrittenNotify) { g_reportWrittenCallback = onReportWrittenNotify; } -void kscrash_setAddConsoleLogToReport(bool shouldAddConsoleLogToReport) +void rc_setAddConsoleLogToReport(bool shouldAddConsoleLogToReport) { g_shouldAddConsoleLogToReport = shouldAddConsoleLogToReport; } -void kscrash_setPrintPreviousLog(bool shouldPrintPreviousLog) +void rc_setPrintPreviousLog(bool shouldPrintPreviousLog) { g_shouldPrintPreviousLog = shouldPrintPreviousLog; } -void kscrash_setMaxReportCount(int maxReportCount) +void rc_setMaxReportCount(int maxReportCount) { - kscrs_setMaxReportCount(maxReportCount); + rccrs_setMaxReportCount(maxReportCount); } -void kscrash_reportUserException(const char* name, +void rc_reportUserException(const char* name, const char* reason, const char* language, const char* lineOfCode, @@ -266,7 +266,7 @@ void kscrash_reportUserException(const char* name, bool logAllThreads, bool terminateProgram) { - kscm_reportUserException(name, + rcm_reportUserException(name, reason, language, lineOfCode, @@ -275,67 +275,67 @@ void kscrash_reportUserException(const char* name, terminateProgram); if(g_shouldAddConsoleLogToReport) { - kslog_clearLogFile(); + rclog_clearLogFile(); } } void enableSwapCxaThrow(void) { - kscm_enableSwapCxaThrow(); + rcm_enableSwapCxaThrow(); } -void kscrash_notifyObjCLoad(void) +void rc_notifyObjCLoad(void) { - kscrashstate_notifyObjCLoad(); + rcstate_notifyObjCLoad(); } -void kscrash_notifyAppActive(bool isActive) +void rc_notifyAppActive(bool isActive) { if (g_installed) { - kscrashstate_notifyAppActive(isActive); + rcstate_notifyAppActive(isActive); } g_lastApplicationState = isActive ? RollbarCrashApplicationStateDidBecomeActive : RollbarCrashApplicationStateWillResignActiveActive; } -void kscrash_notifyAppInForeground(bool isInForeground) +void rc_notifyAppInForeground(bool isInForeground) { if (g_installed) { - kscrashstate_notifyAppInForeground(isInForeground); + rcstate_notifyAppInForeground(isInForeground); } g_lastApplicationState = isInForeground ? RollbarCrashApplicationStateWillEnterForeground : RollbarCrashApplicationStateDidEnterBackground; } -void kscrash_notifyAppTerminate(void) +void rc_notifyAppTerminate(void) { if (g_installed) { - kscrashstate_notifyAppTerminate(); + rcstate_notifyAppTerminate(); } g_lastApplicationState = RollbarCrashApplicationStateWillTerminate; } -void kscrash_notifyAppCrash(void) +void rc_notifyAppCrash(void) { - kscrashstate_notifyAppCrash(); + rcstate_notifyAppCrash(); } -int kscrash_getReportCount() +int rc_getReportCount() { - return kscrs_getReportCount(); + return rccrs_getReportCount(); } -int kscrash_getReportIDs(int64_t* reportIDs, int count) +int rc_getReportIDs(int64_t* reportIDs, int count) { - return kscrs_getReportIDs(reportIDs, count); + return rccrs_getReportIDs(reportIDs, count); } -char* kscrash_readReport(int64_t reportID) +char* rc_readReport(int64_t reportID) { if(reportID <= 0) { @@ -343,14 +343,14 @@ char* kscrash_readReport(int64_t reportID) return NULL; } - char* rawReport = kscrs_readReport(reportID); + char* rawReport = rccrs_readReport(reportID); if(rawReport == NULL) { RollbarCrashLOG_ERROR("Failed to load report ID %" PRIx64, reportID); return NULL; } - char* fixedReport = kscrf_fixupCrashReport(rawReport); + char* fixedReport = rccrf_fixupCrashReport(rawReport); if(fixedReport == NULL) { RollbarCrashLOG_ERROR("Failed to fixup report ID %" PRIx64, reportID); @@ -360,17 +360,17 @@ char* kscrash_readReport(int64_t reportID) return fixedReport; } -int64_t kscrash_addUserReport(const char* report, int reportLength) +int64_t rc_addUserReport(const char* report, int reportLength) { - return kscrs_addUserReport(report, reportLength); + return rccrs_addUserReport(report, reportLength); } -void kscrash_deleteAllReports() +void rc_deleteAllReports() { - kscrs_deleteAllReports(); + rccrs_deleteAllReports(); } -void kscrash_deleteReportWithID(int64_t reportID) +void rc_deleteReportWithID(int64_t reportID) { - kscrs_deleteReportWithID(reportID); + rccrs_deleteReportWithID(reportID); } diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashCachedData.c b/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashCachedData.c index f8e6c92c..cb11772a 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashCachedData.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashCachedData.c @@ -89,7 +89,7 @@ static void updateThreadList() { allThreadNames[i] = strdup(buffer); } - if(g_searchQueueNames && ksthread_getQueueName((RollbarCrashThread)thread, buffer, sizeof(buffer)) && buffer[0] != 0) + if(g_searchQueueNames && rcthread_getQueueName((RollbarCrashThread)thread, buffer, sizeof(buffer)) && buffer[0] != 0) { allQueueNames[i] = strdup(buffer); } @@ -164,7 +164,7 @@ static void* monitorCachedData(__unused void* const userData) return NULL; } -void ksccd_init(int pollingIntervalInSeconds) +void rcccd_init(int pollingIntervalInSeconds) { if (g_hasThreadStarted == true) { return ; @@ -185,7 +185,7 @@ void ksccd_init(int pollingIntervalInSeconds) pthread_attr_destroy(&attr); } -void ksccd_freeze() +void rcccd_freeze() { if(g_semaphoreCount++ <= 0) { @@ -194,7 +194,7 @@ void ksccd_freeze() } } -void ksccd_unfreeze() +void rcccd_unfreeze() { if(--g_semaphoreCount < 0) { @@ -203,12 +203,12 @@ void ksccd_unfreeze() } } -void ksccd_setSearchQueueNames(bool searchQueueNames) +void rcccd_setSearchQueueNames(bool searchQueueNames) { g_searchQueueNames = searchQueueNames; } -RollbarCrashThread* ksccd_getAllThreads(int* threadCount) +RollbarCrashThread* rcccd_getAllThreads(int* threadCount) { if(threadCount != NULL) { @@ -217,7 +217,7 @@ RollbarCrashThread* ksccd_getAllThreads(int* threadCount) return g_allMachThreads; } -const char* ksccd_getThreadName(RollbarCrashThread thread) +const char* rcccd_getThreadName(RollbarCrashThread thread) { if(g_allThreadNames != NULL) { @@ -232,7 +232,7 @@ const char* ksccd_getThreadName(RollbarCrashThread thread) return NULL; } -const char* ksccd_getQueueName(RollbarCrashThread thread) +const char* rcccd_getQueueName(RollbarCrashThread thread) { if(g_allQueueNames != NULL) { diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashCachedData.h b/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashCachedData.h index 1cdad054..bc6897b4 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashCachedData.h +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashCachedData.h @@ -29,15 +29,15 @@ #include "RollbarCrashThread.h" -void ksccd_init(int pollingIntervalInSeconds); +void rcccd_init(int pollingIntervalInSeconds); -void ksccd_freeze(void); -void ksccd_unfreeze(void); +void rcccd_freeze(void); +void rcccd_unfreeze(void); -void ksccd_setSearchQueueNames(bool searchQueueNames); +void rcccd_setSearchQueueNames(bool searchQueueNames); -RollbarCrashThread* ksccd_getAllThreads(int* threadCount); +RollbarCrashThread* rcccd_getAllThreads(int* threadCount); -const char* ksccd_getThreadName(RollbarCrashThread thread); +const char* rcccd_getThreadName(RollbarCrashThread thread); -const char* ksccd_getQueueName(RollbarCrashThread thread); +const char* rcccd_getQueueName(RollbarCrashThread thread); diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashReport.c b/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashReport.c index 48da6f85..be66d0eb 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashReport.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashReport.c @@ -120,27 +120,27 @@ static RollbarCrashReportWriteCallback g_userSectionWriteCallback; static void addBooleanElement(const RollbarCrashReportWriter* const writer, const char* const key, const bool value) { - ksjson_addBooleanElement(getJsonContext(writer), key, value); + rcjson_addBooleanElement(getJsonContext(writer), key, value); } static void addFloatingPointElement(const RollbarCrashReportWriter* const writer, const char* const key, const double value) { - ksjson_addFloatingPointElement(getJsonContext(writer), key, value); + rcjson_addFloatingPointElement(getJsonContext(writer), key, value); } static void addIntegerElement(const RollbarCrashReportWriter* const writer, const char* const key, const int64_t value) { - ksjson_addIntegerElement(getJsonContext(writer), key, value); + rcjson_addIntegerElement(getJsonContext(writer), key, value); } static void addUIntegerElement(const RollbarCrashReportWriter* const writer, const char* const key, const uint64_t value) { - ksjson_addUIntegerElement(getJsonContext(writer), key, value); + rcjson_addUIntegerElement(getJsonContext(writer), key, value); } static void addStringElement(const RollbarCrashReportWriter* const writer, const char* const key, const char* const value) { - ksjson_addStringElement(getJsonContext(writer), key, value, RollbarCrashJSON_SIZE_AUTOMATIC); + rcjson_addStringElement(getJsonContext(writer), key, value, RollbarCrashJSON_SIZE_AUTOMATIC); } static void addTextFileElement(const RollbarCrashReportWriter* const writer, const char* const key, const char* const filePath) @@ -152,7 +152,7 @@ static void addTextFileElement(const RollbarCrashReportWriter* const writer, con return; } - if(ksjson_beginStringElement(getJsonContext(writer), key) != RollbarCrashJSON_OK) + if(rcjson_beginStringElement(getJsonContext(writer), key) != RollbarCrashJSON_OK) { RollbarCrashLOG_ERROR("Could not start string element"); goto done; @@ -164,7 +164,7 @@ static void addTextFileElement(const RollbarCrashReportWriter* const writer, con bytesRead > 0; bytesRead = (int)read(fd, buffer, sizeof(buffer))) { - if(ksjson_appendStringElement(getJsonContext(writer), buffer, bytesRead) != RollbarCrashJSON_OK) + if(rcjson_appendStringElement(getJsonContext(writer), buffer, bytesRead) != RollbarCrashJSON_OK) { RollbarCrashLOG_ERROR("Could not append string element"); goto done; @@ -172,7 +172,7 @@ static void addTextFileElement(const RollbarCrashReportWriter* const writer, con } done: - ksjson_endStringElement(getJsonContext(writer)); + rcjson_endStringElement(getJsonContext(writer)); close(fd); } @@ -181,29 +181,29 @@ static void addDataElement(const RollbarCrashReportWriter* const writer, const char* const value, const int length) { - ksjson_addDataElement(getJsonContext(writer), key, value, length); + rcjson_addDataElement(getJsonContext(writer), key, value, length); } static void beginDataElement(const RollbarCrashReportWriter* const writer, const char* const key) { - ksjson_beginDataElement(getJsonContext(writer), key); + rcjson_beginDataElement(getJsonContext(writer), key); } static void appendDataElement(const RollbarCrashReportWriter* const writer, const char* const value, const int length) { - ksjson_appendDataElement(getJsonContext(writer), value, length); + rcjson_appendDataElement(getJsonContext(writer), value, length); } static void endDataElement(const RollbarCrashReportWriter* const writer) { - ksjson_endDataElement(getJsonContext(writer)); + rcjson_endDataElement(getJsonContext(writer)); } static void addUUIDElement(const RollbarCrashReportWriter* const writer, const char* const key, const unsigned char* const value) { if(value == NULL) { - ksjson_addNullElement(getJsonContext(writer), key); + rcjson_addNullElement(getJsonContext(writer), key); } else { @@ -240,7 +240,7 @@ static void addUUIDElement(const RollbarCrashReportWriter* const writer, const c *dst++ = g_hexNybbles[(*src++)&15]; } - ksjson_addStringElement(getJsonContext(writer), key, uuidBuffer, (int)(dst - uuidBuffer)); + rcjson_addStringElement(getJsonContext(writer), key, uuidBuffer, (int)(dst - uuidBuffer)); } } @@ -249,7 +249,7 @@ static void addJSONElement(const RollbarCrashReportWriter* const writer, const char* const jsonElement, bool closeLastContainer) { - int jsonResult = ksjson_addJSONElement(getJsonContext(writer), + int jsonResult = rcjson_addJSONElement(getJsonContext(writer), key, jsonElement, (int)strlen(jsonElement), @@ -260,17 +260,17 @@ static void addJSONElement(const RollbarCrashReportWriter* const writer, snprintf(errorBuff, sizeof(errorBuff), "Invalid JSON data: %s", - ksjson_stringForError(jsonResult)); - ksjson_beginObject(getJsonContext(writer), key); - ksjson_addStringElement(getJsonContext(writer), + rcjson_stringForError(jsonResult)); + rcjson_beginObject(getJsonContext(writer), key); + rcjson_addStringElement(getJsonContext(writer), RollbarCrashField_Error, errorBuff, RollbarCrashJSON_SIZE_AUTOMATIC); - ksjson_addStringElement(getJsonContext(writer), + rcjson_addStringElement(getJsonContext(writer), RollbarCrashField_JSONData, jsonElement, RollbarCrashJSON_SIZE_AUTOMATIC); - ksjson_endContainer(getJsonContext(writer)); + rcjson_endContainer(getJsonContext(writer)); } } @@ -279,22 +279,22 @@ static void addJSONElementFromFile(const RollbarCrashReportWriter* const writer, const char* const filePath, bool closeLastContainer) { - ksjson_addJSONFromFile(getJsonContext(writer), key, filePath, closeLastContainer); + rcjson_addJSONFromFile(getJsonContext(writer), key, filePath, closeLastContainer); } static void beginObject(const RollbarCrashReportWriter* const writer, const char* const key) { - ksjson_beginObject(getJsonContext(writer), key); + rcjson_beginObject(getJsonContext(writer), key); } static void beginArray(const RollbarCrashReportWriter* const writer, const char* const key) { - ksjson_beginArray(getJsonContext(writer), key); + rcjson_beginArray(getJsonContext(writer), key); } static void endContainer(const RollbarCrashReportWriter* const writer) { - ksjson_endContainer(getJsonContext(writer)); + rcjson_endContainer(getJsonContext(writer)); } @@ -302,7 +302,7 @@ static void addTextLinesFromFile(const RollbarCrashReportWriter* const writer, c { char readBuffer[1024]; RollbarCrashBufferedReader reader; - if(!ksfu_openBufferedReader(&reader, filePath, readBuffer, sizeof(readBuffer))) + if(!rcfu_openBufferedReader(&reader, filePath, readBuffer, sizeof(readBuffer))) { return; } @@ -312,23 +312,23 @@ static void addTextLinesFromFile(const RollbarCrashReportWriter* const writer, c for(;;) { int length = sizeof(buffer); - ksfu_readBufferedReaderUntilChar(&reader, '\n', buffer, &length); + rcfu_readBufferedReaderUntilChar(&reader, '\n', buffer, &length); if(length <= 0) { break; } buffer[length - 1] = '\0'; - ksjson_addStringElement(getJsonContext(writer), NULL, buffer, RollbarCrashJSON_SIZE_AUTOMATIC); + rcjson_addStringElement(getJsonContext(writer), NULL, buffer, RollbarCrashJSON_SIZE_AUTOMATIC); } } endContainer(writer); - ksfu_closeBufferedReader(&reader); + rcfu_closeBufferedReader(&reader); } static int addJSONData(const char* restrict const data, const int length, void* restrict userData) { RollbarCrashBufferedWriter* writer = (RollbarCrashBufferedWriter*)userData; - const bool success = ksfu_writeBufferedWriter(writer, data, length); + const bool success = rcfu_writeBufferedWriter(writer, data, length); return success ? RollbarCrashJSON_OK : RollbarCrashJSON_ERROR_CANNOT_ADD_DATA; } @@ -356,11 +356,11 @@ static bool isValidString(const void* const address) // Wrapped around the address range. return false; } - if(!ksmem_copySafely(address, buffer, sizeof(buffer))) + if(!rcmem_copySafely(address, buffer, sizeof(buffer))) { return false; } - return ksstring_isNullTerminatedUTF8String(buffer, kMinStringLength, sizeof(buffer)); + return rcstring_isNullTerminatedUTF8String(buffer, kMinStringLength, sizeof(buffer)); } /** Get the backtrace for the specified machine context. @@ -382,13 +382,13 @@ static bool getStackCursor(const RollbarCrash_MonitorContext* const crash, const struct RollbarCrashMachineContext* const machineContext, RollbarCrashStackCursor *cursor) { - if(ksmc_getThreadFromContext(machineContext) == ksmc_getThreadFromContext(crash->offendingMachineContext)) + if(rcmc_getThreadFromContext(machineContext) == rcmc_getThreadFromContext(crash->offendingMachineContext)) { *cursor = *((RollbarCrashStackCursor*)crash->stackCursor); return true; } - kssc_initWithMachineContext(cursor, RollbarCrashSC_STACK_OVERFLOW_THRESHOLD, machineContext); + rcsc_initWithMachineContext(cursor, RollbarCrashSC_STACK_OVERFLOW_THRESHOLD, machineContext); return true; } @@ -431,7 +431,7 @@ static void writeNSStringContents(const RollbarCrashReportWriter* const writer, { const void* object = (const void*)objectAddress; char buffer[200]; - if(ksobjc_copyStringContents(object, buffer, sizeof(buffer))) + if(rcobjc_copyStringContents(object, buffer, sizeof(buffer))) { writer->addStringElement(writer, key, buffer); } @@ -455,7 +455,7 @@ static void writeURLContents(const RollbarCrashReportWriter* const writer, { const void* object = (const void*)objectAddress; char buffer[200]; - if(ksobjc_copyStringContents(object, buffer, sizeof(buffer))) + if(rcobjc_copyStringContents(object, buffer, sizeof(buffer))) { writer->addStringElement(writer, key, buffer); } @@ -478,7 +478,7 @@ static void writeDateContents(const RollbarCrashReportWriter* const writer, __unused int* limit) { const void* object = (const void*)objectAddress; - writer->addFloatingPointElement(writer, key, ksobjc_dateContents(object)); + writer->addFloatingPointElement(writer, key, rcobjc_dateContents(object)); } /** Write a number to the report. @@ -498,7 +498,7 @@ static void writeNumberContents(const RollbarCrashReportWriter* const writer, __unused int* limit) { const void* object = (const void*)objectAddress; - writer->addFloatingPointElement(writer, key, ksobjc_numberAsFloat(object)); + writer->addFloatingPointElement(writer, key, rcobjc_numberAsFloat(object)); } /** Write an array to the report. @@ -519,7 +519,7 @@ static void writeArrayContents(const RollbarCrashReportWriter* const writer, { const void* object = (const void*)objectAddress; uintptr_t firstObject; - if(ksobjc_arrayContents(object, &firstObject, 1) == 1) + if(rcobjc_arrayContents(object, &firstObject, 1) == 1) { writeMemoryContents(writer, key, firstObject, limit); } @@ -561,14 +561,14 @@ static void writeUnknownObjectContents(const RollbarCrashReportWriter* const wri writer->beginObject(writer, key); { - if(ksobjc_isTaggedPointer(object)) + if(rcobjc_isTaggedPointer(object)) { - writer->addIntegerElement(writer, "tagged_payload", (int64_t)ksobjc_taggedPointerPayload(object)); + writer->addIntegerElement(writer, "tagged_payload", (int64_t)rcobjc_taggedPointerPayload(object)); } else { - const void* class = ksobjc_isaPointer(object); - int ivarCount = ksobjc_ivarList(class, ivars, sizeof(ivars)/sizeof(*ivars)); + const void* class = rcobjc_isaPointer(object); + int ivarCount = rcobjc_ivarList(class, ivars, sizeof(ivars)/sizeof(*ivars)); *limit -= ivarCount; for(int i = 0; i < ivarCount; i++) { @@ -576,62 +576,62 @@ static void writeUnknownObjectContents(const RollbarCrashReportWriter* const wri switch(ivar->type[0]) { case 'c': - ksobjc_ivarValue(object, ivar->index, &s8); + rcobjc_ivarValue(object, ivar->index, &s8); writer->addIntegerElement(writer, ivar->name, s8); break; case 'i': - ksobjc_ivarValue(object, ivar->index, &sInt); + rcobjc_ivarValue(object, ivar->index, &sInt); writer->addIntegerElement(writer, ivar->name, sInt); break; case 's': - ksobjc_ivarValue(object, ivar->index, &s16); + rcobjc_ivarValue(object, ivar->index, &s16); writer->addIntegerElement(writer, ivar->name, s16); break; case 'l': - ksobjc_ivarValue(object, ivar->index, &s32); + rcobjc_ivarValue(object, ivar->index, &s32); writer->addIntegerElement(writer, ivar->name, s32); break; case 'q': - ksobjc_ivarValue(object, ivar->index, &s64); + rcobjc_ivarValue(object, ivar->index, &s64); writer->addIntegerElement(writer, ivar->name, s64); break; case 'C': - ksobjc_ivarValue(object, ivar->index, &u8); + rcobjc_ivarValue(object, ivar->index, &u8); writer->addUIntegerElement(writer, ivar->name, u8); break; case 'I': - ksobjc_ivarValue(object, ivar->index, &uInt); + rcobjc_ivarValue(object, ivar->index, &uInt); writer->addUIntegerElement(writer, ivar->name, uInt); break; case 'S': - ksobjc_ivarValue(object, ivar->index, &u16); + rcobjc_ivarValue(object, ivar->index, &u16); writer->addUIntegerElement(writer, ivar->name, u16); break; case 'L': - ksobjc_ivarValue(object, ivar->index, &u32); + rcobjc_ivarValue(object, ivar->index, &u32); writer->addUIntegerElement(writer, ivar->name, u32); break; case 'Q': - ksobjc_ivarValue(object, ivar->index, &u64); + rcobjc_ivarValue(object, ivar->index, &u64); writer->addUIntegerElement(writer, ivar->name, u64); break; case 'f': - ksobjc_ivarValue(object, ivar->index, &f32); + rcobjc_ivarValue(object, ivar->index, &f32); writer->addFloatingPointElement(writer, ivar->name, f32); break; case 'd': - ksobjc_ivarValue(object, ivar->index, &f64); + rcobjc_ivarValue(object, ivar->index, &f64); writer->addFloatingPointElement(writer, ivar->name, f64); break; case 'B': - ksobjc_ivarValue(object, ivar->index, &b); + rcobjc_ivarValue(object, ivar->index, &b); writer->addBooleanElement(writer, ivar->name, b); break; case '*': case '@': case '#': case ':': - ksobjc_ivarValue(object, ivar->index, &pointer); + rcobjc_ivarValue(object, ivar->index, &pointer); writeMemoryContents(writer, ivar->name, (uintptr_t)pointer, limit); break; default: @@ -664,7 +664,7 @@ static void writeZombieIfPresent(const RollbarCrashReportWriter* const writer, { #if RollbarCrashCRASH_HAS_OBJC const void* object = (const void*)address; - const char* zombieClassName = kszombie_className(object); + const char* zombieClassName = rczombie_className(object); if(zombieClassName != NULL) { writer->addStringElement(writer, key, zombieClassName); @@ -678,20 +678,20 @@ static bool writeObjCObject(const RollbarCrashReportWriter* const writer, { #if RollbarCrashCRASH_HAS_OBJC const void* object = (const void*)address; - switch(ksobjc_objectType(object)) + switch(rcobjc_objectType(object)) { case RollbarCrashObjCTypeClass: writer->addStringElement(writer, RollbarCrashField_Type, RollbarCrashMemType_Class); - writer->addStringElement(writer, RollbarCrashField_Class, ksobjc_className(object)); + writer->addStringElement(writer, RollbarCrashField_Class, rcobjc_className(object)); return true; case RollbarCrashObjCTypeObject: { writer->addStringElement(writer, RollbarCrashField_Type, RollbarCrashMemType_Object); - const char* className = ksobjc_objectClassName(object); + const char* className = rcobjc_objectClassName(object); writer->addStringElement(writer, RollbarCrashField_Class, className); if(!isRestrictedClass(className)) { - switch(ksobjc_objectClassType(object)) + switch(rcobjc_objectClassType(object)) { case RollbarCrashObjCClassTypeString: writeNSStringContents(writer, RollbarCrashField_Value, address, limit); @@ -731,7 +731,7 @@ static bool writeObjCObject(const RollbarCrashReportWriter* const writer, } case RollbarCrashObjCTypeBlock: writer->addStringElement(writer, RollbarCrashField_Type, RollbarCrashMemType_Block); - const char* className = ksobjc_objectClassName(object); + const char* className = rcobjc_objectClassName(object); writer->addStringElement(writer, RollbarCrashField_Class, className); return true; case RollbarCrashObjCTypeUnknown: @@ -792,9 +792,9 @@ static bool isValidPointer(const uintptr_t address) } #if RollbarCrashCRASH_HAS_OBJC - if(ksobjc_isTaggedPointer((const void*)address)) + if(rcobjc_isTaggedPointer((const void*)address)) { - if(!ksobjc_isValidTaggedPointer((const void*)address)) + if(!rcobjc_isValidTaggedPointer((const void*)address)) { return false; } @@ -814,12 +814,12 @@ static bool isNotableAddress(const uintptr_t address) const void* object = (const void*)address; #if RollbarCrashCRASH_HAS_OBJC - if(kszombie_className(object) != NULL) + if(rczombie_className(object) != NULL) { return true; } - if(ksobjc_objectType(object) != RollbarCrashObjCTypeUnknown) + if(rcobjc_objectType(object) != RollbarCrashObjCTypeUnknown) { return true; } @@ -866,7 +866,7 @@ static void writeAddressReferencedByString(const RollbarCrashReportWriter* const const char* string) { uint64_t address = 0; - if(string == NULL || !ksstring_extractHexValue(string, (int)strlen(string), &address)) + if(string == NULL || !rcstring_extractHexValue(string, (int)strlen(string), &address)) { return; } @@ -901,7 +901,7 @@ static void writeBacktrace(const RollbarCrashReportWriter* const writer, { if(stackCursor->stackEntry.imageName != NULL) { - writer->addStringElement(writer, RollbarCrashField_ObjectName, ksfu_lastPathEntry(stackCursor->stackEntry.imageName)); + writer->addStringElement(writer, RollbarCrashField_ObjectName, rcfu_lastPathEntry(stackCursor->stackEntry.imageName)); } writer->addUIntegerElement(writer, RollbarCrashField_ObjectAddr, stackCursor->stackEntry.imageAddress); if(stackCursor->stackEntry.symbolName != NULL) @@ -939,14 +939,14 @@ static void writeStackContents(const RollbarCrashReportWriter* const writer, const struct RollbarCrashMachineContext* const machineContext, const bool isStackOverflow) { - uintptr_t sp = kscpu_stackPointer(machineContext); + uintptr_t sp = rccpu_stackPointer(machineContext); if((void*)sp == NULL) { return; } - uintptr_t lowAddress = sp + (uintptr_t)(kStackContentsPushedDistance * (int)sizeof(sp) * kscpu_stackGrowDirection() * -1); - uintptr_t highAddress = sp + (uintptr_t)(kStackContentsPoppedDistance * (int)sizeof(sp) * kscpu_stackGrowDirection()); + uintptr_t lowAddress = sp + (uintptr_t)(kStackContentsPushedDistance * (int)sizeof(sp) * rccpu_stackGrowDirection() * -1); + uintptr_t highAddress = sp + (uintptr_t)(kStackContentsPoppedDistance * (int)sizeof(sp) * rccpu_stackGrowDirection()); if(highAddress < lowAddress) { uintptr_t tmp = lowAddress; @@ -955,14 +955,14 @@ static void writeStackContents(const RollbarCrashReportWriter* const writer, } writer->beginObject(writer, key); { - writer->addStringElement(writer, RollbarCrashField_GrowDirection, kscpu_stackGrowDirection() > 0 ? "+" : "-"); + writer->addStringElement(writer, RollbarCrashField_GrowDirection, rccpu_stackGrowDirection() > 0 ? "+" : "-"); writer->addUIntegerElement(writer, RollbarCrashField_DumpStart, lowAddress); writer->addUIntegerElement(writer, RollbarCrashField_DumpEnd, highAddress); writer->addUIntegerElement(writer, RollbarCrashField_StackPtr, sp); writer->addBooleanElement(writer, RollbarCrashField_Overflow, isStackOverflow); uint8_t stackBuffer[kStackContentsTotalDistance * sizeof(sp)]; int copyLength = (int)(highAddress - lowAddress); - if(ksmem_copySafely((void*)lowAddress, stackBuffer, copyLength)) + if(rcmem_copySafely((void*)lowAddress, stackBuffer, copyLength)) { writer->addDataElement(writer, RollbarCrashField_Contents, (void*)stackBuffer, copyLength); } @@ -989,14 +989,14 @@ static void writeNotableStackContents(const RollbarCrashReportWriter* const writ const int backDistance, const int forwardDistance) { - uintptr_t sp = kscpu_stackPointer(machineContext); + uintptr_t sp = rccpu_stackPointer(machineContext); if((void*)sp == NULL) { return; } - uintptr_t lowAddress = sp + (uintptr_t)(backDistance * (int)sizeof(sp) * kscpu_stackGrowDirection() * -1); - uintptr_t highAddress = sp + (uintptr_t)(forwardDistance * (int)sizeof(sp) * kscpu_stackGrowDirection()); + uintptr_t lowAddress = sp + (uintptr_t)(backDistance * (int)sizeof(sp) * rccpu_stackGrowDirection() * -1); + uintptr_t highAddress = sp + (uintptr_t)(forwardDistance * (int)sizeof(sp) * rccpu_stackGrowDirection()); if(highAddress < lowAddress) { uintptr_t tmp = lowAddress; @@ -1007,7 +1007,7 @@ static void writeNotableStackContents(const RollbarCrashReportWriter* const writ char nameBuffer[40]; for(uintptr_t address = lowAddress; address < highAddress; address += sizeof(address)) { - if(ksmem_copySafely((void*)address, &contentsAsPointer, sizeof(contentsAsPointer))) + if(rcmem_copySafely((void*)address, &contentsAsPointer, sizeof(contentsAsPointer))) { sprintf(nameBuffer, "stack@%p", (void*)address); writeMemoryContentsIfNotable(writer, nameBuffer, contentsAsPointer); @@ -1034,17 +1034,17 @@ static void writeBasicRegisters(const RollbarCrashReportWriter* const writer, const char* registerName; writer->beginObject(writer, key); { - const int numRegisters = kscpu_numRegisters(); + const int numRegisters = rccpu_numRegisters(); for(int reg = 0; reg < numRegisters; reg++) { - registerName = kscpu_registerName(reg); + registerName = rccpu_registerName(reg); if(registerName == NULL) { snprintf(registerNameBuff, sizeof(registerNameBuff), "r%d", reg); registerName = registerNameBuff; } writer->addUIntegerElement(writer, registerName, - kscpu_registerValue(machineContext, reg)); + rccpu_registerValue(machineContext, reg)); } } writer->endContainer(writer); @@ -1066,17 +1066,17 @@ static void writeExceptionRegisters(const RollbarCrashReportWriter* const writer const char* registerName; writer->beginObject(writer, key); { - const int numRegisters = kscpu_numExceptionRegisters(); + const int numRegisters = rccpu_numExceptionRegisters(); for(int reg = 0; reg < numRegisters; reg++) { - registerName = kscpu_exceptionRegisterName(reg); + registerName = rccpu_exceptionRegisterName(reg); if(registerName == NULL) { snprintf(registerNameBuff, sizeof(registerNameBuff), "r%d", reg); registerName = registerNameBuff; } writer->addUIntegerElement(writer,registerName, - kscpu_exceptionRegisterValue(machineContext, reg)); + rccpu_exceptionRegisterValue(machineContext, reg)); } } writer->endContainer(writer); @@ -1097,7 +1097,7 @@ static void writeRegisters(const RollbarCrashReportWriter* const writer, writer->beginObject(writer, key); { writeBasicRegisters(writer, RollbarCrashField_Basic, machineContext); - if(ksmc_hasValidExceptionRegisters(machineContext)) + if(rcmc_hasValidExceptionRegisters(machineContext)) { writeExceptionRegisters(writer, RollbarCrashField_Exception, machineContext); } @@ -1116,10 +1116,10 @@ static void writeNotableRegisters(const RollbarCrashReportWriter* const writer, { char registerNameBuff[30]; const char* registerName; - const int numRegisters = kscpu_numRegisters(); + const int numRegisters = rccpu_numRegisters(); for(int reg = 0; reg < numRegisters; reg++) { - registerName = kscpu_registerName(reg); + registerName = rccpu_registerName(reg); if(registerName == NULL) { snprintf(registerNameBuff, sizeof(registerNameBuff), "r%d", reg); @@ -1127,7 +1127,7 @@ static void writeNotableRegisters(const RollbarCrashReportWriter* const writer, } writeMemoryContentsIfNotable(writer, registerName, - (uintptr_t)kscpu_registerValue(machineContext, reg)); + (uintptr_t)rccpu_registerValue(machineContext, reg)); } } @@ -1175,8 +1175,8 @@ static void writeThread(const RollbarCrashReportWriter* const writer, const int threadIndex, const bool shouldWriteNotableAddresses) { - bool isCrashedThread = ksmc_isCrashedContext(machineContext); - RollbarCrashThread thread = ksmc_getThreadFromContext(machineContext); + bool isCrashedThread = rcmc_isCrashedContext(machineContext); + RollbarCrashThread thread = rcmc_getThreadFromContext(machineContext); RollbarCrashLOG_DEBUG("Writing thread %x (index %d). is crashed: %d", thread, threadIndex, isCrashedThread); RollbarCrashStackCursor stackCursor; @@ -1188,23 +1188,23 @@ static void writeThread(const RollbarCrashReportWriter* const writer, { writeBacktrace(writer, RollbarCrashField_Backtrace, &stackCursor); } - if(ksmc_canHaveCPUState(machineContext)) + if(rcmc_canHaveCPUState(machineContext)) { writeRegisters(writer, RollbarCrashField_Registers, machineContext); } writer->addIntegerElement(writer, RollbarCrashField_Index, threadIndex); - const char* name = ksccd_getThreadName(thread); + const char* name = rcccd_getThreadName(thread); if(name != NULL) { writer->addStringElement(writer, RollbarCrashField_Name, name); } - name = ksccd_getQueueName(thread); + name = rcccd_getQueueName(thread); if(name != NULL) { writer->addStringElement(writer, RollbarCrashField_DispatchQueue, name); } writer->addBooleanElement(writer, RollbarCrashField_Crashed, isCrashedThread); - writer->addBooleanElement(writer, RollbarCrashField_CurrentThread, thread == ksthread_self()); + writer->addBooleanElement(writer, RollbarCrashField_CurrentThread, thread == rcthread_self()); if(isCrashedThread) { writeStackContents(writer, RollbarCrashField_Stack, machineContext, stackCursor.state.hasGivenUp); @@ -1231,8 +1231,8 @@ static void writeAllThreads(const RollbarCrashReportWriter* const writer, bool writeNotableAddresses) { const struct RollbarCrashMachineContext* const context = crash->offendingMachineContext; - RollbarCrashThread offendingThread = ksmc_getThreadFromContext(context); - int threadCount = ksmc_getThreadCount(context); + RollbarCrashThread offendingThread = rcmc_getThreadFromContext(context); + int threadCount = rcmc_getThreadCount(context); RollbarCrashMC_NEW_CONTEXT(machineContext); // Fetch info for all threads. @@ -1241,14 +1241,14 @@ static void writeAllThreads(const RollbarCrashReportWriter* const writer, RollbarCrashLOG_DEBUG("Writing %d threads.", threadCount); for(int i = 0; i < threadCount; i++) { - RollbarCrashThread thread = ksmc_getThreadAtIndex(context, i); + RollbarCrashThread thread = rcmc_getThreadAtIndex(context, i); if(thread == offendingThread) { writeThread(writer, NULL, crash, context, i, writeNotableAddresses); } else { - ksmc_getContextForThread(thread, machineContext, false); + rcmc_getContextForThread(thread, machineContext, false); writeThread(writer, NULL, crash, machineContext, i, writeNotableAddresses); } } @@ -1271,7 +1271,7 @@ static void writeBinaryImage(const RollbarCrashReportWriter* const writer, const int index) { RollbarCrashBinaryImage image = {0}; - if(!ksdl_getBinaryImage(index, &image)) + if(!rcdl_getBinaryImage(index, &image)) { return; } @@ -1308,7 +1308,7 @@ static void writeBinaryImage(const RollbarCrashReportWriter* const writer, */ static void writeBinaryImages(const RollbarCrashReportWriter* const writer, const char* const key) { - const int imageCount = ksdl_imageCount(); + const int imageCount = rcdl_imageCount(); writer->beginArray(writer, key); { @@ -1356,8 +1356,8 @@ static void writeError(const RollbarCrashReportWriter* const writer, #if RollbarCrashCRASH_HOST_APPLE writer->beginObject(writer, RollbarCrashField_Mach); { - const char* machExceptionName = ksmach_exceptionName(crash->mach.type); - const char* machCodeName = crash->mach.code == 0 ? NULL : ksmach_kernelReturnCodeName(crash->mach.code); + const char* machExceptionName = rcmach_exceptionName(crash->mach.type); + const char* machCodeName = crash->mach.code == 0 ? NULL : rcmach_kernelReturnCodeName(crash->mach.code); writer->addUIntegerElement(writer, RollbarCrashField_Exception, (unsigned)crash->mach.type); if(machExceptionName != NULL) { @@ -1374,8 +1374,8 @@ static void writeError(const RollbarCrashReportWriter* const writer, #endif writer->beginObject(writer, RollbarCrashField_Signal); { - const char* sigName = kssignal_signalName(crash->signal.signum); - const char* sigCodeName = kssignal_signalCodeName(crash->signal.signum, crash->signal.sigcode); + const char* sigName = rcsignal_signalName(crash->signal.signum); + const char* sigCodeName = rcsignal_signalCodeName(crash->signal.signum, crash->signal.sigcode); writer->addUIntegerElement(writer, RollbarCrashField_Signal, (unsigned)crash->signal.signum); if(sigName != NULL) { @@ -1594,7 +1594,7 @@ static void prepareReportWriter(RollbarCrashReportWriter* const writer, RollbarC #pragma mark - Main API - // ============================================================================ -void kscrashreport_writeRecrashReport(const RollbarCrash_MonitorContext* const monitorContext, const char* const path) +void rcreport_writeRecrashReport(const RollbarCrash_MonitorContext* const monitorContext, const char* const path) { char writeBuffer[1024]; RollbarCrashBufferedWriter bufferedWriter; @@ -1607,12 +1607,12 @@ void kscrashreport_writeRecrashReport(const RollbarCrash_MonitorContext* const m { RollbarCrashLOG_ERROR("Could not rename %s to %s: %s", path, tempPath, strerror(errno)); } - if(!ksfu_openBufferedWriter(&bufferedWriter, path, writeBuffer, sizeof(writeBuffer))) + if(!rcfu_openBufferedWriter(&bufferedWriter, path, writeBuffer, sizeof(writeBuffer))) { return; } - ksccd_freeze(); + rcccd_freeze(); RollbarCrashJSONEncodeContext jsonContext; jsonContext.userData = &bufferedWriter; @@ -1620,12 +1620,12 @@ void kscrashreport_writeRecrashReport(const RollbarCrash_MonitorContext* const m RollbarCrashReportWriter* writer = &concreteWriter; prepareReportWriter(writer, &jsonContext); - ksjson_beginEncode(getJsonContext(writer), true, addJSONData, &bufferedWriter); + rcjson_beginEncode(getJsonContext(writer), true, addJSONData, &bufferedWriter); writer->beginObject(writer, RollbarCrashField_Report); { writeRecrash(writer, RollbarCrashField_RecrashReport, tempPath); - ksfu_flushBufferedWriter(&bufferedWriter); + rcfu_flushBufferedWriter(&bufferedWriter); if(remove(tempPath) < 0) { RollbarCrashLOG_ERROR("Could not remove %s: %s", tempPath, strerror(errno)); @@ -1635,29 +1635,29 @@ void kscrashreport_writeRecrashReport(const RollbarCrash_MonitorContext* const m RollbarCrashReportType_Minimal, monitorContext->eventID, monitorContext->System.processName); - ksfu_flushBufferedWriter(&bufferedWriter); + rcfu_flushBufferedWriter(&bufferedWriter); writer->beginObject(writer, RollbarCrashField_Crash); { writeError(writer, RollbarCrashField_Error, monitorContext); - ksfu_flushBufferedWriter(&bufferedWriter); - int threadIndex = ksmc_indexOfThread(monitorContext->offendingMachineContext, - ksmc_getThreadFromContext(monitorContext->offendingMachineContext)); + rcfu_flushBufferedWriter(&bufferedWriter); + int threadIndex = rcmc_indexOfThread(monitorContext->offendingMachineContext, + rcmc_getThreadFromContext(monitorContext->offendingMachineContext)); writeThread(writer, RollbarCrashField_CrashedThread, monitorContext, monitorContext->offendingMachineContext, threadIndex, false); - ksfu_flushBufferedWriter(&bufferedWriter); + rcfu_flushBufferedWriter(&bufferedWriter); } writer->endContainer(writer); } writer->endContainer(writer); - ksjson_endEncode(getJsonContext(writer)); - ksfu_closeBufferedWriter(&bufferedWriter); - ksccd_unfreeze(); + rcjson_endEncode(getJsonContext(writer)); + rcfu_closeBufferedWriter(&bufferedWriter); + rcccd_unfreeze(); } static void writeSystemInfo(const RollbarCrashReportWriter* const writer, @@ -1717,18 +1717,18 @@ static void writeDebugInfo(const RollbarCrashReportWriter* const writer, } -void kscrashreport_writeStandardReport(const RollbarCrash_MonitorContext* const monitorContext, const char* const path) +void rcreport_writeStandardReport(const RollbarCrash_MonitorContext* const monitorContext, const char* const path) { RollbarCrashLOG_INFO("Writing crash report to %s", path); char writeBuffer[1024]; RollbarCrashBufferedWriter bufferedWriter; - if(!ksfu_openBufferedWriter(&bufferedWriter, path, writeBuffer, sizeof(writeBuffer))) + if(!rcfu_openBufferedWriter(&bufferedWriter, path, writeBuffer, sizeof(writeBuffer))) { return; } - ksccd_freeze(); + rcccd_freeze(); RollbarCrashJSONEncodeContext jsonContext; jsonContext.userData = &bufferedWriter; @@ -1736,7 +1736,7 @@ void kscrashreport_writeStandardReport(const RollbarCrash_MonitorContext* const RollbarCrashReportWriter* writer = &concreteWriter; prepareReportWriter(writer, &jsonContext); - ksjson_beginEncode(getJsonContext(writer), true, addJSONData, &bufferedWriter); + rcjson_beginEncode(getJsonContext(writer), true, addJSONData, &bufferedWriter); writer->beginObject(writer, RollbarCrashField_Report); { @@ -1745,33 +1745,33 @@ void kscrashreport_writeStandardReport(const RollbarCrash_MonitorContext* const RollbarCrashReportType_Standard, monitorContext->eventID, monitorContext->System.processName); - ksfu_flushBufferedWriter(&bufferedWriter); + rcfu_flushBufferedWriter(&bufferedWriter); writeBinaryImages(writer, RollbarCrashField_BinaryImages); - ksfu_flushBufferedWriter(&bufferedWriter); + rcfu_flushBufferedWriter(&bufferedWriter); writeProcessState(writer, RollbarCrashField_ProcessState, monitorContext); - ksfu_flushBufferedWriter(&bufferedWriter); + rcfu_flushBufferedWriter(&bufferedWriter); writeSystemInfo(writer, RollbarCrashField_System, monitorContext); - ksfu_flushBufferedWriter(&bufferedWriter); + rcfu_flushBufferedWriter(&bufferedWriter); writer->beginObject(writer, RollbarCrashField_Crash); { writeError(writer, RollbarCrashField_Error, monitorContext); - ksfu_flushBufferedWriter(&bufferedWriter); + rcfu_flushBufferedWriter(&bufferedWriter); writeAllThreads(writer, RollbarCrashField_Threads, monitorContext, g_introspectionRules.enabled); - ksfu_flushBufferedWriter(&bufferedWriter); + rcfu_flushBufferedWriter(&bufferedWriter); } writer->endContainer(writer); if(g_userInfoJSON != NULL) { addJSONElement(writer, RollbarCrashField_User, g_userInfoJSON, false); - ksfu_flushBufferedWriter(&bufferedWriter); + rcfu_flushBufferedWriter(&bufferedWriter); } else { @@ -1779,26 +1779,26 @@ void kscrashreport_writeStandardReport(const RollbarCrash_MonitorContext* const } if(g_userSectionWriteCallback != NULL) { - ksfu_flushBufferedWriter(&bufferedWriter); + rcfu_flushBufferedWriter(&bufferedWriter); if (monitorContext->currentSnapshotUserReported == false) { g_userSectionWriteCallback(writer); } } writer->endContainer(writer); - ksfu_flushBufferedWriter(&bufferedWriter); + rcfu_flushBufferedWriter(&bufferedWriter); writeDebugInfo(writer, RollbarCrashField_Debug, monitorContext); } writer->endContainer(writer); - ksjson_endEncode(getJsonContext(writer)); - ksfu_closeBufferedWriter(&bufferedWriter); - ksccd_unfreeze(); + rcjson_endEncode(getJsonContext(writer)); + rcfu_closeBufferedWriter(&bufferedWriter); + rcccd_unfreeze(); } -void kscrashreport_setUserInfoJSON(const char* const userInfoJSON) +void rcreport_setUserInfoJSON(const char* const userInfoJSON) { static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; RollbarCrashLOG_TRACE("set userInfoJSON to %p", userInfoJSON); @@ -1819,12 +1819,12 @@ void kscrashreport_setUserInfoJSON(const char* const userInfoJSON) pthread_mutex_unlock(&mutex); } -void kscrashreport_setIntrospectMemory(bool shouldIntrospectMemory) +void rcreport_setIntrospectMemory(bool shouldIntrospectMemory) { g_introspectionRules.enabled = shouldIntrospectMemory; } -void kscrashreport_setDoNotIntrospectClasses(const char** doNotIntrospectClasses, int length) +void rcreport_setDoNotIntrospectClasses(const char** doNotIntrospectClasses, int length) { const char** oldClasses = g_introspectionRules.restrictedClasses; int oldClassesLength = g_introspectionRules.restrictedClassesCount; @@ -1860,7 +1860,7 @@ void kscrashreport_setDoNotIntrospectClasses(const char** doNotIntrospectClasses } } -void kscrashreport_setUserSectionWriteCallback(const RollbarCrashReportWriteCallback userSectionWriteCallback) +void rcreport_setUserSectionWriteCallback(const RollbarCrashReportWriteCallback userSectionWriteCallback) { RollbarCrashLOG_TRACE("Set userSectionWriteCallback to %p", userSectionWriteCallback); g_userSectionWriteCallback = userSectionWriteCallback; diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashReport.h b/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashReport.h index 31071ac2..b5a14b91 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashReport.h +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashReport.h @@ -50,21 +50,21 @@ extern "C" { * * @param userInfoJSON The user information, in JSON format. */ -void kscrashreport_setUserInfoJSON(const char* const userInfoJSON); +void rcreport_setUserInfoJSON(const char* const userInfoJSON); /** Configure whether to introspect any interesting memory locations. * This can find things like strings or Objective-C classes. * * @param shouldIntrospectMemory If true, introspect memory. */ -void kscrashreport_setIntrospectMemory(bool shouldIntrospectMemory); +void rcreport_setIntrospectMemory(bool shouldIntrospectMemory); /** Specify which objective-c classes should not be introspected. * * @param doNotIntrospectClasses Array of class names. * @param length Length of the array. */ -void kscrashreport_setDoNotIntrospectClasses(const char** doNotIntrospectClasses, int length); +void rcreport_setDoNotIntrospectClasses(const char** doNotIntrospectClasses, int length); /** Set the function to call when writing the user section of the report. * This allows the user to add more fields to the user section at the time of the crash. @@ -72,7 +72,7 @@ void kscrashreport_setDoNotIntrospectClasses(const char** doNotIntrospectClasses * * @param userSectionWriteCallback The user section write callback. */ -void kscrashreport_setUserSectionWriteCallback(const RollbarCrashReportWriteCallback userSectionWriteCallback); +void rcreport_setUserSectionWriteCallback(const RollbarCrashReportWriteCallback userSectionWriteCallback); // ============================================================================ @@ -86,7 +86,7 @@ void kscrashreport_setUserSectionWriteCallback(const RollbarCrashReportWriteCall * * @param path The file to write to. */ -void kscrashreport_writeStandardReport(const struct RollbarCrash_MonitorContext* const monitorContext, +void rcreport_writeStandardReport(const struct RollbarCrash_MonitorContext* const monitorContext, const char* path); /** Write a minimal crash report to a file. @@ -96,7 +96,7 @@ void kscrashreport_writeStandardReport(const struct RollbarCrash_MonitorContext* * * @param path The file to write to. */ -void kscrashreport_writeRecrashReport(const struct RollbarCrash_MonitorContext* const monitorContext, +void rcreport_writeRecrashReport(const struct RollbarCrash_MonitorContext* const monitorContext, const char* path); diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashReportFixer.c b/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashReportFixer.c index cbad31c7..0bb8ed52 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashReportFixer.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashReportFixer.c @@ -148,7 +148,7 @@ static int onBooleanElement(const char* const name, void* const userData) { FixupContext* context = (FixupContext*)userData; - return ksjson_addBooleanElement(context->encodeContext, name, value); + return rcjson_addBooleanElement(context->encodeContext, name, value); } static int onFloatingPointElement(const char* const name, @@ -156,7 +156,7 @@ static int onFloatingPointElement(const char* const name, void* const userData) { FixupContext* context = (FixupContext*)userData; - return ksjson_addFloatingPointElement(context->encodeContext, name, value); + return rcjson_addFloatingPointElement(context->encodeContext, name, value); } static int onIntegerElement(const char* const name, @@ -171,18 +171,18 @@ static int onIntegerElement(const char* const name, if(matchesMinVersion(context, 3, 3, 0)) { - ksdate_utcStringFromMicroseconds(value, buffer); + rcdate_utcStringFromMicroseconds(value, buffer); } else { - ksdate_utcStringFromTimestamp((time_t)value, buffer); + rcdate_utcStringFromTimestamp((time_t)value, buffer); } - result = ksjson_addStringElement(context->encodeContext, name, buffer, (int)strlen(buffer)); + result = rcjson_addStringElement(context->encodeContext, name, buffer, (int)strlen(buffer)); } else { - result = ksjson_addIntegerElement(context->encodeContext, name, value); + result = rcjson_addIntegerElement(context->encodeContext, name, value); } return result; } @@ -191,7 +191,7 @@ static int onNullElement(const char* const name, void* const userData) { FixupContext* context = (FixupContext*)userData; - return ksjson_addNullElement(context->encodeContext, name); + return rcjson_addNullElement(context->encodeContext, name); } static int onStringElement(const char* const name, @@ -200,7 +200,7 @@ static int onStringElement(const char* const name, { FixupContext* context = (FixupContext*)userData; const char* stringValue = value; - int result = ksjson_addStringElement(context->encodeContext, name, stringValue, (int)strlen(stringValue)); + int result = rcjson_addStringElement(context->encodeContext, name, stringValue, (int)strlen(stringValue)); if(shouldSaveVersion(context, name)) { memset(context->reportVersionComponents, 0, sizeof(context->reportVersionComponents)); @@ -221,7 +221,7 @@ static int onBeginObject(const char* const name, void* const userData) { FixupContext* context = (FixupContext*)userData; - int result = ksjson_beginObject(context->encodeContext, name); + int result = rcjson_beginObject(context->encodeContext, name); if(!increaseDepth(context, name)) { return RollbarCrashJSON_ERROR_DATA_TOO_LONG; @@ -233,7 +233,7 @@ static int onBeginArray(const char* const name, void* const userData) { FixupContext* context = (FixupContext*)userData; - int result = ksjson_beginArray(context->encodeContext, name); + int result = rcjson_beginArray(context->encodeContext, name); if(!increaseDepth(context, name)) { return RollbarCrashJSON_ERROR_DATA_TOO_LONG; @@ -244,7 +244,7 @@ static int onBeginArray(const char* const name, static int onEndContainer(void* const userData) { FixupContext* context = (FixupContext*)userData; - int result = ksjson_endContainer(context->encodeContext); + int result = rcjson_endContainer(context->encodeContext); if(!decreaseDepth(context)) { // Do something; @@ -255,7 +255,7 @@ static int onEndContainer(void* const userData) static int onEndData(__unused void* const userData) { FixupContext* context = (FixupContext*)userData; - return ksjson_endEncode(context->encodeContext); + return rcjson_endEncode(context->encodeContext); } static int addJSONData(const char* data, int length, void* userData) @@ -272,7 +272,7 @@ static int addJSONData(const char* data, int length, void* userData) return RollbarCrashJSON_OK; } -char* kscrf_fixupCrashReport(const char* crashReport) +char* rccrf_fixupCrashReport(const char* crashReport) { if(crashReport == NULL) { @@ -306,15 +306,15 @@ char* kscrf_fixupCrashReport(const char* crashReport) .outputBytesLeft = fixedReportLength, }; - ksjson_beginEncode(&encodeContext, true, addJSONData, &fixupContext); + rcjson_beginEncode(&encodeContext, true, addJSONData, &fixupContext); int errorOffset = 0; - int result = ksjson_decode(crashReport, (int)strlen(crashReport), stringBuffer, stringBufferLength, &callbacks, &fixupContext, &errorOffset); + int result = rcjson_decode(crashReport, (int)strlen(crashReport), stringBuffer, stringBufferLength, &callbacks, &fixupContext, &errorOffset); *fixupContext.outputPtr = '\0'; free(stringBuffer); if(result != RollbarCrashJSON_OK) { - RollbarCrashLOG_ERROR("Could not decode report: %s", ksjson_stringForError(result)); + RollbarCrashLOG_ERROR("Could not decode report: %s", rcjson_stringForError(result)); free(fixedReport); return NULL; } diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashReportFixer.h b/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashReportFixer.h index 1655d22b..6e23dcb8 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashReportFixer.h +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashReportFixer.h @@ -41,7 +41,7 @@ extern "C" { * @return A fixed up crash report. * MEMORY MANAGEMENT WARNING: User is responsible for calling free() on the returned value. */ -char* kscrf_fixupCrashReport(const char* crashReport); +char* rccrf_fixupCrashReport(const char* crashReport); #ifdef __cplusplus diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashReportStore.c b/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashReportStore.c index 5f55c28c..e6bea7a4 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashReportStore.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashReportStore.c @@ -148,7 +148,7 @@ static void pruneReports() for(int i = 0; i < reportCount - g_maxReportCount; i++) { - kscrs_deleteReportWithID(reportIDs[i]); + rccrs_deleteReportWithID(reportIDs[i]); } } } @@ -173,18 +173,18 @@ static void initializeIDs() // Public API -void kscrs_initialize(const char* appName, const char* reportsPath) +void rccrs_initialize(const char* appName, const char* reportsPath) { pthread_mutex_lock(&g_mutex); g_appName = strdup(appName); g_reportsPath = strdup(reportsPath); - ksfu_makePath(reportsPath); + rcfu_makePath(reportsPath); pruneReports(); initializeIDs(); pthread_mutex_unlock(&g_mutex); } -int64_t kscrs_getNextCrashReport(char* crashReportPathBuffer) +int64_t rccrs_getNextCrashReport(char* crashReportPathBuffer) { int64_t nextID = getNextUniqueID(); if(crashReportPathBuffer) @@ -194,7 +194,7 @@ int64_t kscrs_getNextCrashReport(char* crashReportPathBuffer) return nextID; } -int kscrs_getReportCount() +int rccrs_getReportCount() { pthread_mutex_lock(&g_mutex); int count = getReportCount(); @@ -202,7 +202,7 @@ int kscrs_getReportCount() return count; } -int kscrs_getReportIDs(int64_t* reportIDs, int count) +int rccrs_getReportIDs(int64_t* reportIDs, int count) { pthread_mutex_lock(&g_mutex); count = getReportIDs(reportIDs, count); @@ -210,18 +210,18 @@ int kscrs_getReportIDs(int64_t* reportIDs, int count) return count; } -char* kscrs_readReport(int64_t reportID) +char* rccrs_readReport(int64_t reportID) { pthread_mutex_lock(&g_mutex); char path[RollbarCrashCRS_MAX_PATH_LENGTH]; getCrashReportPathByID(reportID, path); char* result; - ksfu_readEntireFile(path, &result, NULL, 2000000); + rcfu_readEntireFile(path, &result, NULL, 2000000); pthread_mutex_unlock(&g_mutex); return result; } -int64_t kscrs_addUserReport(const char* report, int reportLength) +int64_t rccrs_addUserReport(const char* report, int reportLength) { pthread_mutex_lock(&g_mutex); int64_t currentID = getNextUniqueID(); @@ -256,21 +256,21 @@ int64_t kscrs_addUserReport(const char* report, int reportLength) return currentID; } -void kscrs_deleteAllReports() +void rccrs_deleteAllReports() { pthread_mutex_lock(&g_mutex); - ksfu_deleteContentsOfPath(g_reportsPath); + rcfu_deleteContentsOfPath(g_reportsPath); pthread_mutex_unlock(&g_mutex); } -void kscrs_deleteReportWithID(int64_t reportID) +void rccrs_deleteReportWithID(int64_t reportID) { char path[RollbarCrashCRS_MAX_PATH_LENGTH]; getCrashReportPathByID(reportID, path); - ksfu_removeFile(path, true); + rcfu_removeFile(path, true); } -void kscrs_setMaxReportCount(int maxReportCount) +void rccrs_setMaxReportCount(int maxReportCount) { g_maxReportCount = maxReportCount; } diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashReportStore.h b/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashReportStore.h index 2dc29bd2..a4a9d610 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashReportStore.h +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashReportStore.h @@ -41,7 +41,7 @@ extern "C" { * @param appName The application's name. * @param reportsPath Full path to directory where the reports are to be stored (path will be created if needed). */ -void kscrs_initialize(const char* appName, const char* reportsPath); +void rccrs_initialize(const char* appName, const char* reportsPath); /** Get the next crash report to be generated. * Max length for paths is RollbarCrashCRS_MAX_PATH_LENGTH @@ -50,11 +50,11 @@ void kscrs_initialize(const char* appName, const char* reportsPath); * * @return the report ID of the next report. */ -int64_t kscrs_getNextCrashReport(char* crashReportPathBuffer); +int64_t rccrs_getNextCrashReport(char* crashReportPathBuffer); /** Get the number of reports on disk. */ -int kscrs_getReportCount(void); +int rccrs_getReportCount(void); /** Get a list of IDs for all reports on disk. * @@ -63,7 +63,7 @@ int kscrs_getReportCount(void); * * @return The number of report IDs that were placed in the array. */ -int kscrs_getReportIDs(int64_t* reportIDs, int count); +int rccrs_getReportIDs(int64_t* reportIDs, int count); /** Read a report. * @@ -72,7 +72,7 @@ int kscrs_getReportIDs(int64_t* reportIDs, int count); * @return The NULL terminated report, or NULL if not found. * MEMORY MANAGEMENT WARNING: User is responsible for calling free() on the returned value. */ -char* kscrs_readReport(int64_t reportID); +char* rccrs_readReport(int64_t reportID); /** Add a custom report to the store. * @@ -81,23 +81,23 @@ char* kscrs_readReport(int64_t reportID); * * @return the new report's ID. */ -int64_t kscrs_addUserReport(const char* report, int reportLength); +int64_t rccrs_addUserReport(const char* report, int reportLength); /** Delete all reports on disk. */ -void kscrs_deleteAllReports(void); +void rccrs_deleteAllReports(void); /** Delete report. * * @param reportID An ID of report to delete. */ -void kscrs_deleteReportWithID(int64_t reportID); +void rccrs_deleteReportWithID(int64_t reportID); /** Set the maximum number of reports allowed on disk before old ones get deleted. * * @param maxReportCount The maximum number of reports. */ - void kscrs_setMaxReportCount(int maxReportCount); + void rccrs_setMaxReportCount(int maxReportCount); #ifdef __cplusplus } diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU.c index e4ad2461..6cb5d055 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU.c @@ -36,14 +36,14 @@ #include "RollbarCrashLogger.h" -const char* kscpu_currentArch(void) +const char* rccpu_currentArch(void) { const NXArchInfo* archInfo = NXGetLocalArchInfo(); return archInfo == NULL ? NULL : archInfo->name; } #if RollbarCrashCRASH_HAS_THREADS_API -bool kscpu_i_fillState(const thread_t thread, +bool rccpu_i_fillState(const thread_t thread, const thread_state_t state, const thread_state_flavor_t flavor, const mach_msg_type_number_t stateCount) @@ -61,7 +61,7 @@ bool kscpu_i_fillState(const thread_t thread, return true; } #else -bool kscpu_i_fillState(__unused const thread_t thread, +bool rccpu_i_fillState(__unused const thread_t thread, __unused const thread_state_t state, __unused const thread_state_flavor_t flavor, __unused const mach_msg_type_number_t stateCount) diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU.h index 54271d0b..f1885b5a 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU.h +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU.h @@ -41,7 +41,7 @@ extern "C" { * * @return The current architecture. */ -const char* kscpu_currentArch(void); +const char* rccpu_currentArch(void); /** Get the frame pointer for a machine context. * The frame pointer marks the top of the call stack. @@ -50,7 +50,7 @@ const char* kscpu_currentArch(void); * * @return The context's frame pointer. */ -uintptr_t kscpu_framePointer(const struct RollbarCrashMachineContext* const context); +uintptr_t rccpu_framePointer(const struct RollbarCrashMachineContext* const context); /** Get the current stack pointer for a machine context. * @@ -58,7 +58,7 @@ uintptr_t kscpu_framePointer(const struct RollbarCrashMachineContext* const cont * * @return The context's stack pointer. */ -uintptr_t kscpu_stackPointer(const struct RollbarCrashMachineContext* const context); +uintptr_t rccpu_stackPointer(const struct RollbarCrashMachineContext* const context); /** Get the address of the instruction about to be, or being executed by a * machine context. @@ -67,7 +67,7 @@ uintptr_t kscpu_stackPointer(const struct RollbarCrashMachineContext* const cont * * @return The context's next instruction address. */ -uintptr_t kscpu_instructionAddress(const struct RollbarCrashMachineContext* const context); +uintptr_t rccpu_instructionAddress(const struct RollbarCrashMachineContext* const context); /** Get the address stored in the link register (arm only). This may * contain the first return address of the stack. @@ -76,7 +76,7 @@ uintptr_t kscpu_instructionAddress(const struct RollbarCrashMachineContext* cons * * @return The link register value. */ -uintptr_t kscpu_linkRegister(const struct RollbarCrashMachineContext* const context); +uintptr_t rccpu_linkRegister(const struct RollbarCrashMachineContext* const context); /** Get the address whose access caused the last fault. * @@ -84,14 +84,14 @@ uintptr_t kscpu_linkRegister(const struct RollbarCrashMachineContext* const cont * * @return The faulting address. */ -uintptr_t kscpu_faultAddress(const struct RollbarCrashMachineContext* const context); +uintptr_t rccpu_faultAddress(const struct RollbarCrashMachineContext* const context); /** Get the number of normal (not floating point or exception) registers the * currently running CPU has. * * @return The number of registers. */ -int kscpu_numRegisters(void); +int rccpu_numRegisters(void); /** Get the name of a normal register. * @@ -99,7 +99,7 @@ int kscpu_numRegisters(void); * * @return The register's name or NULL if not found. */ -const char* kscpu_registerName(int regNumber); +const char* rccpu_registerName(int regNumber); /** Get the value stored in a normal register. * @@ -107,13 +107,13 @@ const char* kscpu_registerName(int regNumber); * * @return The register's current value. */ -uint64_t kscpu_registerValue(const struct RollbarCrashMachineContext* const context, int regNumber); +uint64_t rccpu_registerValue(const struct RollbarCrashMachineContext* const context, int regNumber); /** Get the number of exception registers the currently running CPU has. * * @return The number of registers. */ -int kscpu_numExceptionRegisters(void); +int rccpu_numExceptionRegisters(void); /** Get the name of an exception register. * @@ -121,7 +121,7 @@ int kscpu_numExceptionRegisters(void); * * @return The register's name or NULL if not found. */ -const char* kscpu_exceptionRegisterName(int regNumber); +const char* rccpu_exceptionRegisterName(int regNumber); /** Get the value stored in an exception register. * @@ -129,19 +129,19 @@ const char* kscpu_exceptionRegisterName(int regNumber); * * @return The register's current value. */ -uint64_t kscpu_exceptionRegisterValue(const struct RollbarCrashMachineContext* const context, int regNumber); +uint64_t rccpu_exceptionRegisterValue(const struct RollbarCrashMachineContext* const context, int regNumber); /** Get the direction in which the stack grows on the current architecture. * * @return 1 or -1, depending on which direction the stack grows in. */ -int kscpu_stackGrowDirection(void); +int rccpu_stackGrowDirection(void); /** Fetch the CPU state for this context and store it in the context. * * @param destinationContext The context to fill. */ -void kscpu_getState(struct RollbarCrashMachineContext* destinationContext); +void rccpu_getState(struct RollbarCrashMachineContext* destinationContext); /** Strip PAC from an instruction pointer. * @@ -149,7 +149,7 @@ void kscpu_getState(struct RollbarCrashMachineContext* destinationContext); * * @return Instruction pointer without PAC. */ -uintptr_t kscpu_normaliseInstructionPointer(uintptr_t ip); +uintptr_t rccpu_normaliseInstructionPointer(uintptr_t ip); #ifdef __cplusplus } diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU_Apple.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU_Apple.h index b520fc97..ea05829f 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU_Apple.h +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU_Apple.h @@ -46,7 +46,7 @@ extern "C" { * * @return true if state fetching was successful. */ -bool kscpu_i_fillState(thread_t thread, +bool rccpu_i_fillState(thread_t thread, thread_state_t state, thread_state_flavor_t flavor, mach_msg_type_number_t stateCount); diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU_arm.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU_arm.c index 059856f5..86edeb29 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU_arm.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU_arm.c @@ -55,50 +55,50 @@ static const int g_exceptionRegisterNamesCount = sizeof(g_exceptionRegisterNames) / sizeof(*g_exceptionRegisterNames); -uintptr_t kscpu_framePointer(const RollbarCrashMachineContext* const context) +uintptr_t rccpu_framePointer(const RollbarCrashMachineContext* const context) { return context->machineContext.__ss.__r[7]; } -uintptr_t kscpu_stackPointer(const RollbarCrashMachineContext* const context) +uintptr_t rccpu_stackPointer(const RollbarCrashMachineContext* const context) { return context->machineContext.__ss.__sp; } -uintptr_t kscpu_instructionAddress(const RollbarCrashMachineContext* const context) +uintptr_t rccpu_instructionAddress(const RollbarCrashMachineContext* const context) { return context->machineContext.__ss.__pc; } -uintptr_t kscpu_linkRegister(const RollbarCrashMachineContext* const context) +uintptr_t rccpu_linkRegister(const RollbarCrashMachineContext* const context) { return context->machineContext.__ss.__lr; } -void kscpu_getState(RollbarCrashMachineContext* context) +void rccpu_getState(RollbarCrashMachineContext* context) { thread_t thread = context->thisThread; STRUCT_MCONTEXT_L* const machineContext = &context->machineContext; - kscpu_i_fillState(thread, (thread_state_t)&machineContext->__ss, ARM_THREAD_STATE, ARM_THREAD_STATE_COUNT); - kscpu_i_fillState(thread, (thread_state_t)&machineContext->__es, ARM_EXCEPTION_STATE, ARM_EXCEPTION_STATE_COUNT); + rccpu_i_fillState(thread, (thread_state_t)&machineContext->__ss, ARM_THREAD_STATE, ARM_THREAD_STATE_COUNT); + rccpu_i_fillState(thread, (thread_state_t)&machineContext->__es, ARM_EXCEPTION_STATE, ARM_EXCEPTION_STATE_COUNT); } -int kscpu_numRegisters(void) +int rccpu_numRegisters(void) { return g_registerNamesCount; } -const char* kscpu_registerName(const int regNumber) +const char* rccpu_registerName(const int regNumber) { - if(regNumber < kscpu_numRegisters()) + if(regNumber < rccpu_numRegisters()) { return g_registerNames[regNumber]; } return NULL; } -uint64_t kscpu_registerValue(const RollbarCrashMachineContext* const context, const int regNumber) +uint64_t rccpu_registerValue(const RollbarCrashMachineContext* const context, const int regNumber) { if(regNumber <= 12) { @@ -117,14 +117,14 @@ uint64_t kscpu_registerValue(const RollbarCrashMachineContext* const context, co return 0; } -int kscpu_numExceptionRegisters(void) +int rccpu_numExceptionRegisters(void) { return g_exceptionRegisterNamesCount; } -const char* kscpu_exceptionRegisterName(const int regNumber) +const char* rccpu_exceptionRegisterName(const int regNumber) { - if(regNumber < kscpu_numExceptionRegisters()) + if(regNumber < rccpu_numExceptionRegisters()) { return g_exceptionRegisterNames[regNumber]; } @@ -132,7 +132,7 @@ const char* kscpu_exceptionRegisterName(const int regNumber) return NULL; } -uint64_t kscpu_exceptionRegisterValue(const RollbarCrashMachineContext* const context, const int regNumber) +uint64_t rccpu_exceptionRegisterValue(const RollbarCrashMachineContext* const context, const int regNumber) { switch(regNumber) { @@ -148,17 +148,17 @@ uint64_t kscpu_exceptionRegisterValue(const RollbarCrashMachineContext* const co return 0; } -uintptr_t kscpu_faultAddress(const RollbarCrashMachineContext* const context) +uintptr_t rccpu_faultAddress(const RollbarCrashMachineContext* const context) { return context->machineContext.__es.__far; } -int kscpu_stackGrowDirection(void) +int rccpu_stackGrowDirection(void) { return -1; } -uintptr_t kscpu_normaliseInstructionPointer(uintptr_t ip) +uintptr_t rccpu_normaliseInstructionPointer(uintptr_t ip) { return ip; } diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU_arm64.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU_arm64.c index 71b168b1..7054cd5f 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU_arm64.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU_arm64.c @@ -58,50 +58,50 @@ static const int g_exceptionRegisterNamesCount = sizeof(g_exceptionRegisterNames) / sizeof(*g_exceptionRegisterNames); -uintptr_t kscpu_framePointer(const RollbarCrashMachineContext* const context) +uintptr_t rccpu_framePointer(const RollbarCrashMachineContext* const context) { return context->machineContext.__ss.__fp; } -uintptr_t kscpu_stackPointer(const RollbarCrashMachineContext* const context) +uintptr_t rccpu_stackPointer(const RollbarCrashMachineContext* const context) { return context->machineContext.__ss.__sp; } -uintptr_t kscpu_instructionAddress(const RollbarCrashMachineContext* const context) +uintptr_t rccpu_instructionAddress(const RollbarCrashMachineContext* const context) { return context->machineContext.__ss.__pc; } -uintptr_t kscpu_linkRegister(const RollbarCrashMachineContext* const context) +uintptr_t rccpu_linkRegister(const RollbarCrashMachineContext* const context) { return context->machineContext.__ss.__lr; } -void kscpu_getState(RollbarCrashMachineContext* context) +void rccpu_getState(RollbarCrashMachineContext* context) { thread_t thread = context->thisThread; STRUCT_MCONTEXT_L* const machineContext = &context->machineContext; - kscpu_i_fillState(thread, (thread_state_t)&machineContext->__ss, ARM_THREAD_STATE64, ARM_THREAD_STATE64_COUNT); - kscpu_i_fillState(thread, (thread_state_t)&machineContext->__es, ARM_EXCEPTION_STATE64, ARM_EXCEPTION_STATE64_COUNT); + rccpu_i_fillState(thread, (thread_state_t)&machineContext->__ss, ARM_THREAD_STATE64, ARM_THREAD_STATE64_COUNT); + rccpu_i_fillState(thread, (thread_state_t)&machineContext->__es, ARM_EXCEPTION_STATE64, ARM_EXCEPTION_STATE64_COUNT); } -int kscpu_numRegisters(void) +int rccpu_numRegisters(void) { return g_registerNamesCount; } -const char* kscpu_registerName(const int regNumber) +const char* rccpu_registerName(const int regNumber) { - if(regNumber < kscpu_numRegisters()) + if(regNumber < rccpu_numRegisters()) { return g_registerNames[regNumber]; } return NULL; } -uint64_t kscpu_registerValue(const RollbarCrashMachineContext* const context, const int regNumber) +uint64_t rccpu_registerValue(const RollbarCrashMachineContext* const context, const int regNumber) { if(regNumber <= 29) { @@ -121,14 +121,14 @@ uint64_t kscpu_registerValue(const RollbarCrashMachineContext* const context, co return 0; } -int kscpu_numExceptionRegisters(void) +int rccpu_numExceptionRegisters(void) { return g_exceptionRegisterNamesCount; } -const char* kscpu_exceptionRegisterName(const int regNumber) +const char* rccpu_exceptionRegisterName(const int regNumber) { - if(regNumber < kscpu_numExceptionRegisters()) + if(regNumber < rccpu_numExceptionRegisters()) { return g_exceptionRegisterNames[regNumber]; } @@ -136,7 +136,7 @@ const char* kscpu_exceptionRegisterName(const int regNumber) return NULL; } -uint64_t kscpu_exceptionRegisterValue(const RollbarCrashMachineContext* const context, const int regNumber) +uint64_t rccpu_exceptionRegisterValue(const RollbarCrashMachineContext* const context, const int regNumber) { switch(regNumber) { @@ -152,17 +152,17 @@ uint64_t kscpu_exceptionRegisterValue(const RollbarCrashMachineContext* const co return 0; } -uintptr_t kscpu_faultAddress(const RollbarCrashMachineContext* const context) +uintptr_t rccpu_faultAddress(const RollbarCrashMachineContext* const context) { return context->machineContext.__es.__far; } -int kscpu_stackGrowDirection(void) +int rccpu_stackGrowDirection(void) { return -1; } -uintptr_t kscpu_normaliseInstructionPointer(uintptr_t ip) +uintptr_t rccpu_normaliseInstructionPointer(uintptr_t ip) { return ip & RollbarCrashPACStrippingMask_ARM64e; } diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU_x86_32.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU_x86_32.c index d64d38a4..459e1b3d 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU_x86_32.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU_x86_32.c @@ -58,50 +58,50 @@ static const int g_exceptionRegisterNamesCount = sizeof(g_exceptionRegisterNames) / sizeof(*g_exceptionRegisterNames); -uintptr_t kscpu_framePointer(const RollbarCrashMachineContext* const context) +uintptr_t rccpu_framePointer(const RollbarCrashMachineContext* const context) { return context->machineContext.__ss.__ebp; } -uintptr_t kscpu_stackPointer(const RollbarCrashMachineContext* const context) +uintptr_t rccpu_stackPointer(const RollbarCrashMachineContext* const context) { return context->machineContext.__ss.__esp; } -uintptr_t kscpu_instructionAddress(const RollbarCrashMachineContext* const context) +uintptr_t rccpu_instructionAddress(const RollbarCrashMachineContext* const context) { return context->machineContext.__ss.__eip; } -uintptr_t kscpu_linkRegister(__unused const RollbarCrashMachineContext* const context) +uintptr_t rccpu_linkRegister(__unused const RollbarCrashMachineContext* const context) { return 0; } -void kscpu_getState(RollbarCrashMachineContext* context) +void rccpu_getState(RollbarCrashMachineContext* context) { thread_t thread = context->thisThread; STRUCT_MCONTEXT_L* const machineContext = &context->machineContext; - kscpu_i_fillState(thread, (thread_state_t)&machineContext->__ss, x86_THREAD_STATE32, x86_THREAD_STATE32_COUNT); - kscpu_i_fillState(thread, (thread_state_t)&machineContext->__es, x86_EXCEPTION_STATE32, x86_EXCEPTION_STATE32_COUNT); + rccpu_i_fillState(thread, (thread_state_t)&machineContext->__ss, x86_THREAD_STATE32, x86_THREAD_STATE32_COUNT); + rccpu_i_fillState(thread, (thread_state_t)&machineContext->__es, x86_EXCEPTION_STATE32, x86_EXCEPTION_STATE32_COUNT); } -int kscpu_numRegisters(void) +int rccpu_numRegisters(void) { return g_registerNamesCount; } -const char* kscpu_registerName(const int regNumber) +const char* rccpu_registerName(const int regNumber) { - if(regNumber < kscpu_numRegisters()) + if(regNumber < rccpu_numRegisters()) { return g_registerNames[regNumber]; } return NULL; } -uint64_t kscpu_registerValue(const RollbarCrashMachineContext* const context, const int regNumber) +uint64_t rccpu_registerValue(const RollbarCrashMachineContext* const context, const int regNumber) { switch(regNumber) { @@ -143,14 +143,14 @@ uint64_t kscpu_registerValue(const RollbarCrashMachineContext* const context, co return 0; } -int kscpu_numExceptionRegisters(void) +int rccpu_numExceptionRegisters(void) { return g_exceptionRegisterNamesCount; } -const char* kscpu_exceptionRegisterName(const int regNumber) +const char* rccpu_exceptionRegisterName(const int regNumber) { - if(regNumber < kscpu_numExceptionRegisters()) + if(regNumber < rccpu_numExceptionRegisters()) { return g_exceptionRegisterNames[regNumber]; } @@ -158,7 +158,7 @@ const char* kscpu_exceptionRegisterName(const int regNumber) return NULL; } -uint64_t kscpu_exceptionRegisterValue(const RollbarCrashMachineContext* const context, const int regNumber) +uint64_t rccpu_exceptionRegisterValue(const RollbarCrashMachineContext* const context, const int regNumber) { switch(regNumber) { @@ -174,17 +174,17 @@ uint64_t kscpu_exceptionRegisterValue(const RollbarCrashMachineContext* const co return 0; } -uintptr_t kscpu_faultAddress(const RollbarCrashMachineContext* const context) +uintptr_t rccpu_faultAddress(const RollbarCrashMachineContext* const context) { return context->machineContext.__es.__faultvaddr; } -int kscpu_stackGrowDirection(void) +int rccpu_stackGrowDirection(void) { return -1; } -uintptr_t kscpu_normaliseInstructionPointer(uintptr_t ip) +uintptr_t rccpu_normaliseInstructionPointer(uintptr_t ip) { return ip; } diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU_x86_64.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU_x86_64.c index 7d5ffa7d..54d738dc 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU_x86_64.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU_x86_64.c @@ -60,50 +60,50 @@ static const int g_exceptionRegisterNamesCount = sizeof(g_exceptionRegisterNames) / sizeof(*g_exceptionRegisterNames); -uintptr_t kscpu_framePointer(const RollbarCrashMachineContext* const context) +uintptr_t rccpu_framePointer(const RollbarCrashMachineContext* const context) { return context->machineContext.__ss.__rbp; } -uintptr_t kscpu_stackPointer(const RollbarCrashMachineContext* const context) +uintptr_t rccpu_stackPointer(const RollbarCrashMachineContext* const context) { return context->machineContext.__ss.__rsp; } -uintptr_t kscpu_instructionAddress(const RollbarCrashMachineContext* const context) +uintptr_t rccpu_instructionAddress(const RollbarCrashMachineContext* const context) { return context->machineContext.__ss.__rip; } -uintptr_t kscpu_linkRegister(__unused const RollbarCrashMachineContext* const context) +uintptr_t rccpu_linkRegister(__unused const RollbarCrashMachineContext* const context) { return 0; } -void kscpu_getState(RollbarCrashMachineContext* context) +void rccpu_getState(RollbarCrashMachineContext* context) { thread_t thread = context->thisThread; STRUCT_MCONTEXT_L* const machineContext = &context->machineContext; - kscpu_i_fillState(thread, (thread_state_t)&machineContext->__ss, x86_THREAD_STATE64, x86_THREAD_STATE64_COUNT); - kscpu_i_fillState(thread, (thread_state_t)&machineContext->__es, x86_EXCEPTION_STATE64, x86_EXCEPTION_STATE64_COUNT); + rccpu_i_fillState(thread, (thread_state_t)&machineContext->__ss, x86_THREAD_STATE64, x86_THREAD_STATE64_COUNT); + rccpu_i_fillState(thread, (thread_state_t)&machineContext->__es, x86_EXCEPTION_STATE64, x86_EXCEPTION_STATE64_COUNT); } -int kscpu_numRegisters(void) +int rccpu_numRegisters(void) { return g_registerNamesCount; } -const char* kscpu_registerName(const int regNumber) +const char* rccpu_registerName(const int regNumber) { - if(regNumber < kscpu_numRegisters()) + if(regNumber < rccpu_numRegisters()) { return g_registerNames[regNumber]; } return NULL; } -uint64_t kscpu_registerValue(const RollbarCrashMachineContext* const context, const int regNumber) +uint64_t rccpu_registerValue(const RollbarCrashMachineContext* const context, const int regNumber) { switch(regNumber) { @@ -155,14 +155,14 @@ uint64_t kscpu_registerValue(const RollbarCrashMachineContext* const context, co return 0; } -int kscpu_numExceptionRegisters(void) +int rccpu_numExceptionRegisters(void) { return g_exceptionRegisterNamesCount; } -const char* kscpu_exceptionRegisterName(const int regNumber) +const char* rccpu_exceptionRegisterName(const int regNumber) { - if(regNumber < kscpu_numExceptionRegisters()) + if(regNumber < rccpu_numExceptionRegisters()) { return g_exceptionRegisterNames[regNumber]; } @@ -170,7 +170,7 @@ const char* kscpu_exceptionRegisterName(const int regNumber) return NULL; } -uint64_t kscpu_exceptionRegisterValue(const RollbarCrashMachineContext* const context, const int regNumber) +uint64_t rccpu_exceptionRegisterValue(const RollbarCrashMachineContext* const context, const int regNumber) { switch(regNumber) { @@ -186,17 +186,17 @@ uint64_t kscpu_exceptionRegisterValue(const RollbarCrashMachineContext* const co return 0; } -uintptr_t kscpu_faultAddress(const RollbarCrashMachineContext* const context) +uintptr_t rccpu_faultAddress(const RollbarCrashMachineContext* const context) { return context->machineContext.__es.__faultvaddr; } -int kscpu_stackGrowDirection(void) +int rccpu_stackGrowDirection(void) { return -1; } -uintptr_t kscpu_normaliseInstructionPointer(uintptr_t ip) +uintptr_t rccpu_normaliseInstructionPointer(uintptr_t ip) { return ip; } diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCxaThrowSwapper.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCxaThrowSwapper.c index 8c9a9327..a5869abc 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCxaThrowSwapper.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCxaThrowSwapper.c @@ -316,7 +316,7 @@ static void rebind_symbols_for_image(const struct mach_header *header, intptr_t return; } - const segment_command_t *linkedit_segment = ksgs_getsegbynamefromheader((mach_header_t *) header, SEG_LINKEDIT); + const segment_command_t *linkedit_segment = rcgs_getsegbynamefromheader((mach_header_t *) header, SEG_LINKEDIT); // Find base symbol/string table addresses uintptr_t linkedit_base = (uintptr_t) slide + linkedit_segment->vmaddr - linkedit_segment->fileoff; @@ -329,7 +329,7 @@ static void rebind_symbols_for_image(const struct mach_header *header, intptr_t const section_t *lazy_sym_sect = NULL; const section_t *non_lazy_sym_sect = NULL; - const segment_command_t *data_seg = ksgs_getsegbynamefromheader((mach_header_t *) header, SEG_DATA); + const segment_command_t *data_seg = rcgs_getsegbynamefromheader((mach_header_t *) header, SEG_DATA); if (data_seg != NULL) { if (get_sections(data_seg, &lazy_sym_sect, &non_lazy_sym_sect)) @@ -339,7 +339,7 @@ static void rebind_symbols_for_image(const struct mach_header *header, intptr_t } } - const segment_command_t *data_const_seg = ksgs_getsegbynamefromheader((mach_header_t *) header, SEG_DATA_CONST); + const segment_command_t *data_const_seg = rcgs_getsegbynamefromheader((mach_header_t *) header, SEG_DATA_CONST); if (data_const_seg != NULL) { if (get_sections(data_const_seg, &lazy_sym_sect, &non_lazy_sym_sect)) @@ -350,7 +350,7 @@ static void rebind_symbols_for_image(const struct mach_header *header, intptr_t } } -int ksct_swap(const cxa_throw_type handler) +int rcct_swap(const cxa_throw_type handler) { if (g_cxa_originals == NULL) { diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCxaThrowSwapper.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCxaThrowSwapper.h index b2064f3e..0d7fae56 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCxaThrowSwapper.h +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCxaThrowSwapper.h @@ -36,7 +36,7 @@ typedef void (*cxa_throw_type)(void *, std::type_info *, void (*)(void *)); typedef void (*cxa_throw_type)(void *, void *, void (*)(void *)); #endif -int ksct_swap(const cxa_throw_type handler); +int rcct_swap(const cxa_throw_type handler); #ifdef __cplusplus } diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashDate.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashDate.c index 6643f728..e3ad9399 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashDate.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashDate.c @@ -26,7 +26,7 @@ #include #include -void ksdate_utcStringFromTimestamp(time_t timestamp, char* buffer21Chars) +void rcdate_utcStringFromTimestamp(time_t timestamp, char* buffer21Chars) { struct tm result = {0}; gmtime_r(×tamp, &result); @@ -39,7 +39,7 @@ void ksdate_utcStringFromTimestamp(time_t timestamp, char* buffer21Chars) result.tm_sec); } -void ksdate_utcStringFromMicroseconds(int64_t microseconds, char* buffer28Chars) +void rcdate_utcStringFromMicroseconds(int64_t microseconds, char* buffer28Chars) { struct tm result = {0}; time_t curtime = (time_t)(microseconds / 1000000); diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashDate.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashDate.h index 84cb0675..f88632f0 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashDate.h +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashDate.h @@ -38,7 +38,7 @@ extern "C" { * * @param buffer21Chars A buffer of at least 21 chars to hold the RFC3339 date string. */ -void ksdate_utcStringFromTimestamp(time_t timestamp, char* buffer21Chars); +void rcdate_utcStringFromTimestamp(time_t timestamp, char* buffer21Chars); /** Convert microseconds returned from `gettimeofday` to an RFC3339 string representation. * @@ -46,7 +46,7 @@ void ksdate_utcStringFromTimestamp(time_t timestamp, char* buffer21Chars); * * @param buffer28Chars A buffer of at least 28 chars to hold the RFC3339 date string with milliseconds precision. */ -void ksdate_utcStringFromMicroseconds(int64_t microseconds, char* buffer28Chars); +void rcdate_utcStringFromMicroseconds(int64_t microseconds, char* buffer28Chars); #ifdef __cplusplus } diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashDebug.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashDebug.c index 9e983321..dd862a3f 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashDebug.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashDebug.c @@ -40,7 +40,7 @@ * * @return true if we're being traced. */ -bool ksdebug_isBeingTraced(void) +bool rcdebug_isBeingTraced(void) { struct kinfo_proc procInfo; size_t structSize = sizeof(procInfo); diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashDebug.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashDebug.h index 4e83d106..4a91cedf 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashDebug.h +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashDebug.h @@ -44,7 +44,7 @@ extern "C" { * * @return true if we're being traced. */ -bool ksdebug_isBeingTraced(void); +bool rcdebug_isBeingTraced(void); #ifdef __cplusplus } diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashDynamicLinker.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashDynamicLinker.c index 7e27f5f4..2a5ea4ea 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashDynamicLinker.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashDynamicLinker.c @@ -172,7 +172,7 @@ static uintptr_t segmentBaseOfImageIndex(const uint32_t idx) return 0; } -uint32_t ksdl_imageNamed(const char* const imageName, bool exactMatch) +uint32_t rcdl_imageNamed(const char* const imageName, bool exactMatch) { if(imageName != NULL) { @@ -200,11 +200,11 @@ uint32_t ksdl_imageNamed(const char* const imageName, bool exactMatch) return UINT32_MAX; } -const uint8_t* ksdl_imageUUID(const char* const imageName, bool exactMatch) +const uint8_t* rcdl_imageUUID(const char* const imageName, bool exactMatch) { if(imageName != NULL) { - const uint32_t iImg = ksdl_imageNamed(imageName, exactMatch); + const uint32_t iImg = rcdl_imageNamed(imageName, exactMatch); if(iImg != UINT32_MAX) { const struct mach_header* header = _dyld_get_image_header(iImg); @@ -230,7 +230,7 @@ const uint8_t* ksdl_imageUUID(const char* const imageName, bool exactMatch) return NULL; } -bool ksdl_dladdr(const uintptr_t address, Dl_info* const info) +bool rcdl_dladdr(const uintptr_t address, Dl_info* const info) { info->dli_fname = NULL; info->dli_fbase = NULL; @@ -324,7 +324,7 @@ static bool isValidCrashInfoMessage(const char* str) { return false; } - int maxReadableBytes = ksmem_maxReadableBytes(str, RollbarCrashDL_MaxCrashInfoStringLength + 1); + int maxReadableBytes = rcmem_maxReadableBytes(str, RollbarCrashDL_MaxCrashInfoStringLength + 1); if(maxReadableBytes == 0) { return false; @@ -355,7 +355,7 @@ static void getCrashInfo(const struct mach_header* header, RollbarCrashBinaryIma RollbarCrashLOG_TRACE("Skipped reading crash info: section is too small"); return; } - if(!ksmem_isMemoryReadable(crashInfo, minimalSize)) + if(!rcmem_isMemoryReadable(crashInfo, minimalSize)) { RollbarCrashLOG_TRACE("Skipped reading crash info: section memory is not readable"); return; @@ -383,12 +383,12 @@ static void getCrashInfo(const struct mach_header* header, RollbarCrashBinaryIma } } -int ksdl_imageCount() +int rcdl_imageCount() { return (int)_dyld_image_count(); } -bool ksdl_getBinaryImage(int index, RollbarCrashBinaryImage* buffer) +bool rcdl_getBinaryImage(int index, RollbarCrashBinaryImage* buffer) { const struct mach_header* header = _dyld_get_image_header((unsigned)index); if(header == NULL) @@ -396,10 +396,10 @@ bool ksdl_getBinaryImage(int index, RollbarCrashBinaryImage* buffer) return false; } - return ksdl_getBinaryImageForHeader((const void*)header, _dyld_get_image_name((unsigned)index), buffer); + return rcdl_getBinaryImageForHeader((const void*)header, _dyld_get_image_name((unsigned)index), buffer); } -bool ksdl_getBinaryImageForHeader(const void* const header_ptr, const char* const image_name, RollbarCrashBinaryImage* buffer) +bool rcdl_getBinaryImageForHeader(const void* const header_ptr, const char* const image_name, RollbarCrashBinaryImage* buffer) { const struct mach_header* header = (const struct mach_header*)header_ptr; uintptr_t cmdPtr = firstCmdAfterHeader(header); diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashDynamicLinker.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashDynamicLinker.h index e202ed8a..26a402a5 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashDynamicLinker.h +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashDynamicLinker.h @@ -54,7 +54,7 @@ typedef struct /** Get the number of loaded binary images. */ -int ksdl_imageCount(void); +int rcdl_imageCount(void); /** Get information about a binary image. * @@ -64,7 +64,7 @@ int ksdl_imageCount(void); * * @return True if the image was successfully queried. */ -bool ksdl_getBinaryImage(int index, RollbarCrashBinaryImage* buffer); +bool rcdl_getBinaryImage(int index, RollbarCrashBinaryImage* buffer); /** Get information about a binary image based on mach_header. * @@ -76,7 +76,7 @@ bool ksdl_getBinaryImage(int index, RollbarCrashBinaryImage* buffer); * * @return True if the image was successfully queried. */ -bool ksdl_getBinaryImageForHeader(const void* const header_ptr, const char* const image_name, RollbarCrashBinaryImage* buffer); +bool rcdl_getBinaryImageForHeader(const void* const header_ptr, const char* const image_name, RollbarCrashBinaryImage* buffer); /** Find a loaded binary image with the specified name. * @@ -86,7 +86,7 @@ bool ksdl_getBinaryImageForHeader(const void* const header_ptr, const char* cons * * @return the index of the matched image, or UINT32_MAX if not found. */ -uint32_t ksdl_imageNamed(const char* const imageName, bool exactMatch); +uint32_t rcdl_imageNamed(const char* const imageName, bool exactMatch); /** Get the UUID of a loaded binary image with the specified name. * @@ -97,7 +97,7 @@ uint32_t ksdl_imageNamed(const char* const imageName, bool exactMatch); * @return A pointer to the binary (16 byte) UUID of the image, or NULL if it * wasn't found. */ -const uint8_t* ksdl_imageUUID(const char* const imageName, bool exactMatch); +const uint8_t* rcdl_imageUUID(const char* const imageName, bool exactMatch); /** async-safe version of dladdr. * @@ -113,7 +113,7 @@ const uint8_t* ksdl_imageUUID(const char* const imageName, bool exactMatch); * @param info Gets filled out by this function. * @return true if at least some information was found. */ -bool ksdl_dladdr(const uintptr_t address, Dl_info* const info); +bool rcdl_dladdr(const uintptr_t address, Dl_info* const info); #ifdef __cplusplus diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashFileUtils.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashFileUtils.c index b0336ba6..f74e6e21 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashFileUtils.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashFileUtils.c @@ -187,12 +187,12 @@ static bool deletePathContents(const char* path, bool deleteTopLevelPathAlso) freeDirListing(entries, entryCount); if(deleteTopLevelPathAlso) { - ksfu_removeFile(path, false); + rcfu_removeFile(path, false); } } else if(S_ISREG(statStruct.st_mode)) { - ksfu_removeFile(path, false); + rcfu_removeFile(path, false); } else { @@ -206,7 +206,7 @@ static bool deletePathContents(const char* path, bool deleteTopLevelPathAlso) #pragma mark - API - // ============================================================================ -const char* ksfu_lastPathEntry(const char* const path) +const char* rcfu_lastPathEntry(const char* const path) { if(path == NULL) { @@ -217,7 +217,7 @@ const char* ksfu_lastPathEntry(const char* const path) return lastFile == NULL ? path : lastFile + 1; } -bool ksfu_writeBytesToFD(const int fd, const char* const bytes, int length) +bool rcfu_writeBytesToFD(const int fd, const char* const bytes, int length) { const char* pos = bytes; while(length > 0) @@ -234,7 +234,7 @@ bool ksfu_writeBytesToFD(const int fd, const char* const bytes, int length) return true; } -bool ksfu_readBytesFromFD(const int fd, char* const bytes, int length) +bool rcfu_readBytesFromFD(const int fd, char* const bytes, int length) { char* pos = bytes; while(length > 0) @@ -251,7 +251,7 @@ bool ksfu_readBytesFromFD(const int fd, char* const bytes, int length) return true; } -bool ksfu_readEntireFile(const char* const path, char** data, int* length, int maxLength) +bool rcfu_readEntireFile(const char* const path, char** data, int* length, int maxLength) { bool isSuccessful = false; int bytesRead = 0; @@ -293,7 +293,7 @@ bool ksfu_readEntireFile(const char* const path, char** data, int* length, int m goto done; } - if(!ksfu_readBytesFromFD(fd, mem, bytesToRead)) + if(!rcfu_readBytesFromFD(fd, mem, bytesToRead)) { goto done; } @@ -322,7 +322,7 @@ bool ksfu_readEntireFile(const char* const path, char** data, int* length, int m return isSuccessful; } -bool ksfu_writeStringToFD(const int fd, const char* const string) +bool rcfu_writeStringToFD(const int fd, const char* const string) { if(*string != 0) { @@ -345,20 +345,20 @@ bool ksfu_writeStringToFD(const int fd, const char* const string) return false; } -bool ksfu_writeFmtToFD(const int fd, const char* const fmt, ...) +bool rcfu_writeFmtToFD(const int fd, const char* const fmt, ...) { if(*fmt != 0) { va_list args; va_start(args,fmt); - bool result = ksfu_writeFmtArgsToFD(fd, fmt, args); + bool result = rcfu_writeFmtArgsToFD(fd, fmt, args); va_end(args); return result; } return false; } -bool ksfu_writeFmtArgsToFD(const int fd, +bool rcfu_writeFmtArgsToFD(const int fd, const char* const fmt, va_list args) { @@ -366,12 +366,12 @@ bool ksfu_writeFmtArgsToFD(const int fd, { char buffer[RollbarCrashFU_WriteFmtBufferSize]; vsnprintf(buffer, sizeof(buffer), fmt, args); - return ksfu_writeStringToFD(fd, buffer); + return rcfu_writeStringToFD(fd, buffer); } return false; } -int ksfu_readLineFromFD(const int fd, char* const buffer, const int maxLength) +int rcfu_readLineFromFD(const int fd, char* const buffer, const int maxLength) { char* end = buffer + maxLength - 1; *end = 0; @@ -393,7 +393,7 @@ int ksfu_readLineFromFD(const int fd, char* const buffer, const int maxLength) return (int)(ch - buffer); } -bool ksfu_makePath(const char* absolutePath) +bool rcfu_makePath(const char* absolutePath) { bool isSuccessful = false; char* pathCopy = strdup(absolutePath); @@ -422,7 +422,7 @@ bool ksfu_makePath(const char* absolutePath) return isSuccessful; } -bool ksfu_removeFile(const char* path, bool mustExist) +bool rcfu_removeFile(const char* path, bool mustExist) { if(remove(path) < 0) { @@ -435,7 +435,7 @@ bool ksfu_removeFile(const char* path, bool mustExist) return true; } -bool ksfu_deleteContentsOfPath(const char* path) +bool rcfu_deleteContentsOfPath(const char* path) { if(path == NULL) { @@ -449,7 +449,7 @@ bool ksfu_deleteContentsOfPath(const char* path) return deletePathContents(path, false); } -bool ksfu_openBufferedWriter(RollbarCrashBufferedWriter* writer, const char* const path, char* writeBuffer, int writeBufferLength) +bool rcfu_openBufferedWriter(RollbarCrashBufferedWriter* writer, const char* const path, char* writeBuffer, int writeBufferLength) { writer->buffer = writeBuffer; writer->bufferLength = writeBufferLength; @@ -463,36 +463,36 @@ bool ksfu_openBufferedWriter(RollbarCrashBufferedWriter* writer, const char* con return true; } -void ksfu_closeBufferedWriter(RollbarCrashBufferedWriter* writer) +void rcfu_closeBufferedWriter(RollbarCrashBufferedWriter* writer) { if(writer->fd > 0) { - ksfu_flushBufferedWriter(writer); + rcfu_flushBufferedWriter(writer); close(writer->fd); writer->fd = -1; } } -bool ksfu_writeBufferedWriter(RollbarCrashBufferedWriter* writer, const char* restrict const data, const int length) +bool rcfu_writeBufferedWriter(RollbarCrashBufferedWriter* writer, const char* restrict const data, const int length) { if(length > writer->bufferLength - writer->position) { - ksfu_flushBufferedWriter(writer); + rcfu_flushBufferedWriter(writer); } if(length > writer->bufferLength) { - return ksfu_writeBytesToFD(writer->fd, data, length); + return rcfu_writeBytesToFD(writer->fd, data, length); } memcpy(writer->buffer + writer->position, data, length); writer->position += length; return true; } -bool ksfu_flushBufferedWriter(RollbarCrashBufferedWriter* writer) +bool rcfu_flushBufferedWriter(RollbarCrashBufferedWriter* writer) { if(writer->fd > 0 && writer->position > 0) { - if(!ksfu_writeBytesToFD(writer->fd, writer->buffer, writer->position)) + if(!rcfu_writeBytesToFD(writer->fd, writer->buffer, writer->position)) { return false; } @@ -534,7 +534,7 @@ static bool fillReadBuffer(RollbarCrashBufferedReader* reader) return true; } -int ksfu_readBufferedReader(RollbarCrashBufferedReader* reader, char* dstBuffer, int byteCount) +int rcfu_readBufferedReader(RollbarCrashBufferedReader* reader, char* dstBuffer, int byteCount) { int bytesRemaining = byteCount; int bytesConsumed = 0; @@ -566,7 +566,7 @@ int ksfu_readBufferedReader(RollbarCrashBufferedReader* reader, char* dstBuffer, return bytesConsumed; } -bool ksfu_readBufferedReaderUntilChar(RollbarCrashBufferedReader* reader, int ch, char* dstBuffer, int* length) +bool rcfu_readBufferedReaderUntilChar(RollbarCrashBufferedReader* reader, int ch, char* dstBuffer, int* length) { int bytesRemaining = *length; int bytesConsumed = 0; @@ -610,7 +610,7 @@ bool ksfu_readBufferedReaderUntilChar(RollbarCrashBufferedReader* reader, int ch return false; } -bool ksfu_openBufferedReader(RollbarCrashBufferedReader* reader, const char* const path, char* readBuffer, int readBufferLength) +bool rcfu_openBufferedReader(RollbarCrashBufferedReader* reader, const char* const path, char* readBuffer, int readBufferLength) { readBuffer[0] = '\0'; readBuffer[readBufferLength - 1] = '\0'; @@ -628,7 +628,7 @@ bool ksfu_openBufferedReader(RollbarCrashBufferedReader* reader, const char* con return true; } -void ksfu_closeBufferedReader(RollbarCrashBufferedReader* reader) +void rcfu_closeBufferedReader(RollbarCrashBufferedReader* reader) { if(reader->fd > 0) { diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashFileUtils.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashFileUtils.h index 0d797083..a05aaf49 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashFileUtils.h +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashFileUtils.h @@ -49,7 +49,7 @@ extern "C" { * * @return the last entry in the path. */ -const char* ksfu_lastPathEntry(const char* path); +const char* rcfu_lastPathEntry(const char* path); /** Write bytes to a file descriptor. * @@ -61,7 +61,7 @@ const char* ksfu_lastPathEntry(const char* path); * * @return true if the operation was successful. */ -bool ksfu_writeBytesToFD(const int fd, const char* bytes, int length); +bool rcfu_writeBytesToFD(const int fd, const char* bytes, int length); /** Read bytes from a file descriptor. * @@ -73,7 +73,7 @@ bool ksfu_writeBytesToFD(const int fd, const char* bytes, int length); * * @return true if the operation was successful. */ -bool ksfu_readBytesFromFD(const int fd, char* bytes, int length); +bool rcfu_readBytesFromFD(const int fd, char* bytes, int length); /** Read an entire file. Returns a buffer of file size + 1, null terminated. * @@ -89,7 +89,7 @@ bool ksfu_readBytesFromFD(const int fd, char* bytes, int length); * * @return true if the operation was successful. */ -bool ksfu_readEntireFile(const char* path, char** data, int* length, int maxLength); +bool rcfu_readEntireFile(const char* path, char** data, int* length, int maxLength); /** Write a string to a file. * @@ -99,7 +99,7 @@ bool ksfu_readEntireFile(const char* path, char** data, int* length, int maxLeng * * @return true if successful. */ -bool ksfu_writeStringToFD(const int fd, const char* string); +bool rcfu_writeStringToFD(const int fd, const char* string); /** Write a formatted string to a file. * @@ -109,7 +109,7 @@ bool ksfu_writeStringToFD(const int fd, const char* string); * * @return true if successful. */ -bool ksfu_writeFmtToFD(const int fd, const char* fmt, ...); +bool rcfu_writeFmtToFD(const int fd, const char* fmt, ...); /** Write a formatted string to a file. * @@ -121,7 +121,7 @@ bool ksfu_writeFmtToFD(const int fd, const char* fmt, ...); * * @return true if successful. */ -bool ksfu_writeFmtArgsToFD(const int fd, const char* fmt, va_list args); +bool rcfu_writeFmtArgsToFD(const int fd, const char* fmt, va_list args); /** Read a single line from a file. * @@ -133,7 +133,7 @@ bool ksfu_writeFmtArgsToFD(const int fd, const char* fmt, va_list args); * * @return The number of bytes read. */ -int ksfu_readLineFromFD(const int fd, char* buffer, int maxLength); +int rcfu_readLineFromFD(const int fd, char* buffer, int maxLength); /** Make all directories in a path. * @@ -141,7 +141,7 @@ int ksfu_readLineFromFD(const int fd, char* buffer, int maxLength); * * @return true if successful. */ -bool ksfu_makePath(const char* absolutePath); +bool rcfu_makePath(const char* absolutePath); /** Remove a file or directory. * @@ -151,7 +151,7 @@ bool ksfu_makePath(const char* absolutePath); * * @return true if successful. */ -bool ksfu_removeFile(const char* path, bool mustExist); +bool rcfu_removeFile(const char* path, bool mustExist); /** Delete the contents of a directory. * @@ -159,7 +159,7 @@ bool ksfu_removeFile(const char* path, bool mustExist); * * @return true if successful. */ -bool ksfu_deleteContentsOfPath(const char* path); +bool rcfu_deleteContentsOfPath(const char* path); /** Buffered writer structure. Everything inside should be considered internal use only. */ typedef struct @@ -182,13 +182,13 @@ typedef struct * * @return True if the file was successfully opened. */ -bool ksfu_openBufferedWriter(RollbarCrashBufferedWriter* writer, const char* const path, char* writeBuffer, int writeBufferLength); +bool rcfu_openBufferedWriter(RollbarCrashBufferedWriter* writer, const char* const path, char* writeBuffer, int writeBufferLength); /** Close a buffered writer. * * @param writer The writer to close. */ -void ksfu_closeBufferedWriter(RollbarCrashBufferedWriter* writer); +void rcfu_closeBufferedWriter(RollbarCrashBufferedWriter* writer); /** Write to a buffered writer. * @@ -200,7 +200,7 @@ void ksfu_closeBufferedWriter(RollbarCrashBufferedWriter* writer); * * @return True if the data was successfully written. */ -bool ksfu_writeBufferedWriter(RollbarCrashBufferedWriter* writer, const char* restrict const data, const int length); +bool rcfu_writeBufferedWriter(RollbarCrashBufferedWriter* writer, const char* restrict const data, const int length); /** Flush a buffered writer, writing all uncommitted data to disk. * @@ -208,7 +208,7 @@ bool ksfu_writeBufferedWriter(RollbarCrashBufferedWriter* writer, const char* re * * @return True if the buffer was successfully flushed. */ -bool ksfu_flushBufferedWriter(RollbarCrashBufferedWriter* writer); +bool rcfu_flushBufferedWriter(RollbarCrashBufferedWriter* writer); /** Buffered reader structure. Everything inside should be considered internal use only. */ typedef struct @@ -232,13 +232,13 @@ typedef struct * * @return True if the file was successfully opened. */ -bool ksfu_openBufferedReader(RollbarCrashBufferedReader* reader, const char* const path, char* readBuffer, int readBufferLength); +bool rcfu_openBufferedReader(RollbarCrashBufferedReader* reader, const char* const path, char* readBuffer, int readBufferLength); /** Close a buffered reader. * * @param reader The reader to close. */ -void ksfu_closeBufferedReader(RollbarCrashBufferedReader* reader); +void rcfu_closeBufferedReader(RollbarCrashBufferedReader* reader); /** Read from a buffered reader. * @@ -250,7 +250,7 @@ void ksfu_closeBufferedReader(RollbarCrashBufferedReader* reader); * * @return The number of bytes actually read. */ -int ksfu_readBufferedReader(RollbarCrashBufferedReader* reader, char* dstBuffer, int byteCount); +int rcfu_readBufferedReader(RollbarCrashBufferedReader* reader, char* dstBuffer, int byteCount); /** Read from a buffered reader until the specified character is encountered. * All bytes up to and including the character will be read. @@ -266,7 +266,7 @@ int ksfu_readBufferedReader(RollbarCrashBufferedReader* reader, char* dstBuffer, * * @return True if the character was found before giving up. */ -bool ksfu_readBufferedReaderUntilChar(RollbarCrashBufferedReader* reader, int ch, char* dstBuffer, int* length); +bool rcfu_readBufferedReaderUntilChar(RollbarCrashBufferedReader* reader, int ch, char* dstBuffer, int* length); #ifdef __cplusplus diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashID.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashID.c index d66d3c9c..924e636c 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashID.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashID.c @@ -27,7 +27,7 @@ #include -void ksid_generate(char* destinationBuffer37Bytes) +void rcid_generate(char* destinationBuffer37Bytes) { uuid_t uuid; uuid_generate(uuid); diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashID.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashID.h index b5bf3cab..40661b79 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashID.h +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashID.h @@ -34,7 +34,7 @@ extern "C" { * * @param destinationBuffer37Bytes Buffer of at least 37 bytes to hold the ID. */ -void ksid_generate(char* destinationBuffer37Bytes); +void rcid_generate(char* destinationBuffer37Bytes); #ifdef __cplusplus diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashJSONCodec.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashJSONCodec.c index 73f043c4..b7f4230b 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashJSONCodec.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashJSONCodec.c @@ -75,7 +75,7 @@ static char g_hexNybbles[] = '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; -const char* ksjson_stringForError(const int error) +const char* rcjson_stringForError(const int error) { switch (error) { @@ -249,7 +249,7 @@ static int addQuotedEscapedString(RollbarCrashJSONEncodeContext* const context, return result || closeResult; } -int ksjson_beginElement(RollbarCrashJSONEncodeContext* const context, const char* const name) +int rcjson_beginElement(RollbarCrashJSONEncodeContext* const context, const char* const name) { int result = RollbarCrashJSON_OK; @@ -312,18 +312,18 @@ int ksjson_beginElement(RollbarCrashJSONEncodeContext* const context, const char return result; } -int ksjson_addRawJSONData(RollbarCrashJSONEncodeContext* const context, +int rcjson_addRawJSONData(RollbarCrashJSONEncodeContext* const context, const char* const data, const int length) { return addJSONData(context, data, length); } -int ksjson_addBooleanElement(RollbarCrashJSONEncodeContext* const context, +int rcjson_addBooleanElement(RollbarCrashJSONEncodeContext* const context, const char* const name, const bool value) { - int result = ksjson_beginElement(context, name); + int result = rcjson_beginElement(context, name); unlikely_if(result != RollbarCrashJSON_OK) { return result; @@ -338,11 +338,11 @@ int ksjson_addBooleanElement(RollbarCrashJSONEncodeContext* const context, } } -int ksjson_addFloatingPointElement(RollbarCrashJSONEncodeContext* const context, +int rcjson_addFloatingPointElement(RollbarCrashJSONEncodeContext* const context, const char* const name, double value) { - int result = ksjson_beginElement(context, name); + int result = rcjson_beginElement(context, name); unlikely_if(result != RollbarCrashJSON_OK) { return result; @@ -352,11 +352,11 @@ int ksjson_addFloatingPointElement(RollbarCrashJSONEncodeContext* const context, return addJSONData(context, buff, (int)strlen(buff)); } -int ksjson_addIntegerElement(RollbarCrashJSONEncodeContext* const context, +int rcjson_addIntegerElement(RollbarCrashJSONEncodeContext* const context, const char* const name, int64_t value) { - int result = ksjson_beginElement(context, name); + int result = rcjson_beginElement(context, name); unlikely_if(result != RollbarCrashJSON_OK) { return result; @@ -366,11 +366,11 @@ int ksjson_addIntegerElement(RollbarCrashJSONEncodeContext* const context, return addJSONData(context, buff, (int)strlen(buff)); } -int ksjson_addUIntegerElement(RollbarCrashJSONEncodeContext* const context, +int rcjson_addUIntegerElement(RollbarCrashJSONEncodeContext* const context, const char* const name, uint64_t value) { - int result = ksjson_beginElement(context, name); + int result = rcjson_beginElement(context, name); unlikely_if(result != RollbarCrashJSON_OK) { return result; @@ -380,10 +380,10 @@ int ksjson_addUIntegerElement(RollbarCrashJSONEncodeContext* const context, return addJSONData(context, buff, (int)strlen(buff)); } -int ksjson_addNullElement(RollbarCrashJSONEncodeContext* const context, +int rcjson_addNullElement(RollbarCrashJSONEncodeContext* const context, const char* const name) { - int result = ksjson_beginElement(context, name); + int result = rcjson_beginElement(context, name); unlikely_if(result != RollbarCrashJSON_OK) { return result; @@ -391,16 +391,16 @@ int ksjson_addNullElement(RollbarCrashJSONEncodeContext* const context, return addJSONData(context, "null", 4); } -int ksjson_addStringElement(RollbarCrashJSONEncodeContext* const context, +int rcjson_addStringElement(RollbarCrashJSONEncodeContext* const context, const char* const name, const char* const value, int length) { unlikely_if(value == NULL) { - return ksjson_addNullElement(context, name); + return rcjson_addNullElement(context, name); } - int result = ksjson_beginElement(context, name); + int result = rcjson_beginElement(context, name); unlikely_if(result != RollbarCrashJSON_OK) { return result; @@ -412,10 +412,10 @@ int ksjson_addStringElement(RollbarCrashJSONEncodeContext* const context, return addQuotedEscapedString(context, value, length); } -int ksjson_beginStringElement(RollbarCrashJSONEncodeContext* const context, +int rcjson_beginStringElement(RollbarCrashJSONEncodeContext* const context, const char* const name) { - int result = ksjson_beginElement(context, name); + int result = rcjson_beginElement(context, name); unlikely_if(result != RollbarCrashJSON_OK) { return result; @@ -423,43 +423,43 @@ int ksjson_beginStringElement(RollbarCrashJSONEncodeContext* const context, return addJSONData(context, "\"", 1); } -int ksjson_appendStringElement(RollbarCrashJSONEncodeContext* const context, +int rcjson_appendStringElement(RollbarCrashJSONEncodeContext* const context, const char* const value, int length) { return addEscapedString(context, value, length); } -int ksjson_endStringElement(RollbarCrashJSONEncodeContext* const context) +int rcjson_endStringElement(RollbarCrashJSONEncodeContext* const context) { return addJSONData(context, "\"", 1); } -int ksjson_addDataElement(RollbarCrashJSONEncodeContext* const context, +int rcjson_addDataElement(RollbarCrashJSONEncodeContext* const context, const char* name, const char* value, int length) { int result = RollbarCrashJSON_OK; - result = ksjson_beginDataElement(context, name); + result = rcjson_beginDataElement(context, name); if(result == RollbarCrashJSON_OK) { - result = ksjson_appendDataElement(context, value, length); + result = rcjson_appendDataElement(context, value, length); } if(result == RollbarCrashJSON_OK) { - result = ksjson_endDataElement(context); + result = rcjson_endDataElement(context); } return result; } -int ksjson_beginDataElement(RollbarCrashJSONEncodeContext* const context, +int rcjson_beginDataElement(RollbarCrashJSONEncodeContext* const context, const char* const name) { - return ksjson_beginStringElement(context, name); + return rcjson_beginStringElement(context, name); } -int ksjson_appendDataElement(RollbarCrashJSONEncodeContext* const context, +int rcjson_appendDataElement(RollbarCrashJSONEncodeContext* const context, const char* const value, int length) { @@ -481,17 +481,17 @@ int ksjson_appendDataElement(RollbarCrashJSONEncodeContext* const context, return result; } -int ksjson_endDataElement(RollbarCrashJSONEncodeContext* const context) +int rcjson_endDataElement(RollbarCrashJSONEncodeContext* const context) { - return ksjson_endStringElement(context); + return rcjson_endStringElement(context); } -int ksjson_beginArray(RollbarCrashJSONEncodeContext* const context, +int rcjson_beginArray(RollbarCrashJSONEncodeContext* const context, const char* const name) { likely_if(context->containerLevel >= 0) { - int result = ksjson_beginElement(context, name); + int result = rcjson_beginElement(context, name); unlikely_if(result != RollbarCrashJSON_OK) { return result; @@ -505,12 +505,12 @@ int ksjson_beginArray(RollbarCrashJSONEncodeContext* const context, return addJSONData(context, "[", 1); } -int ksjson_beginObject(RollbarCrashJSONEncodeContext* const context, +int rcjson_beginObject(RollbarCrashJSONEncodeContext* const context, const char* const name) { likely_if(context->containerLevel >= 0) { - int result = ksjson_beginElement(context, name); + int result = rcjson_beginElement(context, name); unlikely_if(result != RollbarCrashJSON_OK) { return result; @@ -524,7 +524,7 @@ int ksjson_beginObject(RollbarCrashJSONEncodeContext* const context, return addJSONData(context, "{", 1); } -int ksjson_endContainer(RollbarCrashJSONEncodeContext* const context) +int rcjson_endContainer(RollbarCrashJSONEncodeContext* const context) { unlikely_if(context->containerLevel <= 0) { @@ -554,7 +554,7 @@ int ksjson_endContainer(RollbarCrashJSONEncodeContext* const context) return addJSONData(context, isObject ? "}" : "]", 1); } -void ksjson_beginEncode(RollbarCrashJSONEncodeContext* const context, +void rcjson_beginEncode(RollbarCrashJSONEncodeContext* const context, bool prettyPrint, RollbarCrashJSONAddDataFunc addJSONDataFunc, void* const userData) @@ -566,12 +566,12 @@ void ksjson_beginEncode(RollbarCrashJSONEncodeContext* const context, context->containerFirstEntry = true; } -int ksjson_endEncode(RollbarCrashJSONEncodeContext* const context) +int rcjson_endEncode(RollbarCrashJSONEncodeContext* const context) { int result = RollbarCrashJSON_OK; while(context->containerLevel > 0) { - unlikely_if((result = ksjson_endContainer(context)) != RollbarCrashJSON_OK) + unlikely_if((result = rcjson_endContainer(context)) != RollbarCrashJSON_OK) { return result; } @@ -602,7 +602,7 @@ typedef struct int stringBufferLength; /** The callbacks to call while decoding. */ RollbarCrashJSONDecodeCallbacks* const callbacks; - /** Data that was specified when calling ksjson_decode(). */ + /** Data that was specified when calling rcjson_decode(). */ void* userData; } RollbarCrashJSONDecodeContext; @@ -1133,7 +1133,7 @@ static int decodeElement(const char* const name, RollbarCrashJSONDecodeContext* return RollbarCrashJSON_ERROR_INVALID_CHARACTER; } -int ksjson_decode(const char* const data, +int rcjson_decode(const char* const data, int length, char* stringBuffer, int stringBufferLength, @@ -1224,7 +1224,7 @@ static int addJSONFromFile_onBooleanElement(const char* const name, void* const userData) { JSONFromFileContext* context = (JSONFromFileContext*)userData; - int result = ksjson_addBooleanElement(context->encodeContext, name, value); + int result = rcjson_addBooleanElement(context->encodeContext, name, value); context->updateDecoderCallback(context); return result; } @@ -1234,7 +1234,7 @@ static int addJSONFromFile_onFloatingPointElement(const char* const name, void* const userData) { JSONFromFileContext* context = (JSONFromFileContext*)userData; - int result = ksjson_addFloatingPointElement(context->encodeContext, name, value); + int result = rcjson_addFloatingPointElement(context->encodeContext, name, value); context->updateDecoderCallback(context); return result; } @@ -1244,7 +1244,7 @@ static int addJSONFromFile_onIntegerElement(const char* const name, void* const userData) { JSONFromFileContext* context = (JSONFromFileContext*)userData; - int result = ksjson_addIntegerElement(context->encodeContext, name, value); + int result = rcjson_addIntegerElement(context->encodeContext, name, value); context->updateDecoderCallback(context); return result; } @@ -1253,7 +1253,7 @@ static int addJSONFromFile_onNullElement(const char* const name, void* const userData) { JSONFromFileContext* context = (JSONFromFileContext*)userData; - int result = ksjson_addNullElement(context->encodeContext, name); + int result = rcjson_addNullElement(context->encodeContext, name); context->updateDecoderCallback(context); return result; } @@ -1263,7 +1263,7 @@ static int addJSONFromFile_onStringElement(const char* const name, void* const userData) { JSONFromFileContext* context = (JSONFromFileContext*)userData; - int result = ksjson_addStringElement(context->encodeContext, name, value, (int)strlen(value)); + int result = rcjson_addStringElement(context->encodeContext, name, value, (int)strlen(value)); context->updateDecoderCallback(context); return result; } @@ -1272,7 +1272,7 @@ static int addJSONFromFile_onBeginObject(const char* const name, void* const userData) { JSONFromFileContext* context = (JSONFromFileContext*)userData; - int result = ksjson_beginObject(context->encodeContext, name); + int result = rcjson_beginObject(context->encodeContext, name); context->updateDecoderCallback(context); return result; } @@ -1281,7 +1281,7 @@ static int addJSONFromFile_onBeginArray(const char* const name, void* const userData) { JSONFromFileContext* context = (JSONFromFileContext*)userData; - int result = ksjson_beginArray(context->encodeContext, name); + int result = rcjson_beginArray(context->encodeContext, name); context->updateDecoderCallback(context); return result; } @@ -1292,7 +1292,7 @@ static int addJSONFromFile_onEndContainer(void* const userData) int result = RollbarCrashJSON_OK; if(context->closeLastContainer || context->encodeContext->containerLevel > 2) { - result = ksjson_endContainer(context->encodeContext); + result = rcjson_endContainer(context->encodeContext); } context->updateDecoderCallback(context); return result; @@ -1303,7 +1303,7 @@ static int addJSONFromFile_onEndData(__unused void* const userData) return RollbarCrashJSON_OK; } -int ksjson_addJSONFromFile(RollbarCrashJSONEncodeContext* const encodeContext, +int rcjson_addJSONFromFile(RollbarCrashJSONEncodeContext* const encodeContext, const char* restrict const name, const char* restrict const filename, const bool closeLastContainer) @@ -1358,13 +1358,13 @@ int ksjson_addJSONFromFile(RollbarCrashJSONEncodeContext* const encodeContext, close(fd); while(closeLastContainer && encodeContext->containerLevel > containerLevel) { - ksjson_endContainer(encodeContext); + rcjson_endContainer(encodeContext); } return result; } -int ksjson_addJSONElement(RollbarCrashJSONEncodeContext* const encodeContext, +int rcjson_addJSONElement(RollbarCrashJSONEncodeContext* const encodeContext, const char* restrict const name, const char* restrict const jsonData, const int jsonDataLength, @@ -1413,7 +1413,7 @@ int ksjson_addJSONElement(RollbarCrashJSONEncodeContext* const encodeContext, int result = decodeElement(name, &decodeContext); while(closeLastContainer && encodeContext->containerLevel > containerLevel) { - ksjson_endContainer(encodeContext); + rcjson_endContainer(encodeContext); } return result; diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashJSONCodec.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashJSONCodec.h index c6277700..de3c4e59 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashJSONCodec.h +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashJSONCodec.h @@ -79,7 +79,7 @@ enum * * @return A string describing the error. */ -const char* ksjson_stringForError(const int error); +const char* rcjson_stringForError(const int error); // ============================================================================ @@ -131,7 +131,7 @@ typedef struct * * @param userData User-specified data which gets passed to addJSONData. */ -void ksjson_beginEncode(RollbarCrashJSONEncodeContext* context, +void rcjson_beginEncode(RollbarCrashJSONEncodeContext* context, bool prettyPrint, RollbarCrashJSONAddDataFunc addJSONData, void* userData); @@ -140,7 +140,7 @@ void ksjson_beginEncode(RollbarCrashJSONEncodeContext* context, * * @return RollbarCrashJSON_OK if the process was successful. */ -int ksjson_endEncode(RollbarCrashJSONEncodeContext* context); +int rcjson_endEncode(RollbarCrashJSONEncodeContext* context); /** Add a boolean element. * @@ -152,7 +152,7 @@ int ksjson_endEncode(RollbarCrashJSONEncodeContext* context); * * @return RollbarCrashJSON_OK if the process was successful. */ -int ksjson_addBooleanElement(RollbarCrashJSONEncodeContext* context, +int rcjson_addBooleanElement(RollbarCrashJSONEncodeContext* context, const char* name, bool value); @@ -166,7 +166,7 @@ int ksjson_addBooleanElement(RollbarCrashJSONEncodeContext* context, * * @return RollbarCrashJSON_OK if the process was successful. */ -int ksjson_addIntegerElement(RollbarCrashJSONEncodeContext* context, +int rcjson_addIntegerElement(RollbarCrashJSONEncodeContext* context, const char* name, int64_t value); @@ -180,7 +180,7 @@ int ksjson_addIntegerElement(RollbarCrashJSONEncodeContext* context, * * @return RollbarCrashJSON_OK if the process was successful. */ -int ksjson_addUIntegerElement(RollbarCrashJSONEncodeContext* const context, +int rcjson_addUIntegerElement(RollbarCrashJSONEncodeContext* const context, const char* const name, uint64_t value); @@ -194,7 +194,7 @@ int ksjson_addUIntegerElement(RollbarCrashJSONEncodeContext* const context, * * @return RollbarCrashJSON_OK if the process was successful. */ -int ksjson_addFloatingPointElement(RollbarCrashJSONEncodeContext* context, +int rcjson_addFloatingPointElement(RollbarCrashJSONEncodeContext* context, const char* name, double value); @@ -206,7 +206,7 @@ int ksjson_addFloatingPointElement(RollbarCrashJSONEncodeContext* context, * * @return RollbarCrashJSON_OK if the process was successful. */ -int ksjson_addNullElement(RollbarCrashJSONEncodeContext* context, +int rcjson_addNullElement(RollbarCrashJSONEncodeContext* context, const char* name); /** Add a string element. @@ -221,7 +221,7 @@ int ksjson_addNullElement(RollbarCrashJSONEncodeContext* context, * * @return RollbarCrashJSON_OK if the process was successful. */ -int ksjson_addStringElement(RollbarCrashJSONEncodeContext* context, +int rcjson_addStringElement(RollbarCrashJSONEncodeContext* context, const char* name, const char* value, int length); @@ -236,7 +236,7 @@ int ksjson_addStringElement(RollbarCrashJSONEncodeContext* context, * * @return RollbarCrashJSON_OK if the process was successful. */ -int ksjson_beginStringElement(RollbarCrashJSONEncodeContext* context, +int rcjson_beginStringElement(RollbarCrashJSONEncodeContext* context, const char* name); /** Add a string fragment to an incrementally-built string element. @@ -249,7 +249,7 @@ int ksjson_beginStringElement(RollbarCrashJSONEncodeContext* context, * * @return RollbarCrashJSON_OK if the process was successful. */ -int ksjson_appendStringElement(RollbarCrashJSONEncodeContext* context, +int rcjson_appendStringElement(RollbarCrashJSONEncodeContext* context, const char* value, int length); @@ -259,7 +259,7 @@ int ksjson_appendStringElement(RollbarCrashJSONEncodeContext* context, * * @return RollbarCrashJSON_OK if the process was successful. */ -int ksjson_endStringElement(RollbarCrashJSONEncodeContext* context); +int rcjson_endStringElement(RollbarCrashJSONEncodeContext* context); /** Add a string element. The element will be converted to string-coded hex. * @@ -273,7 +273,7 @@ int ksjson_endStringElement(RollbarCrashJSONEncodeContext* context); * * @return RollbarCrashJSON_OK if the process was successful. */ -int ksjson_addDataElement(RollbarCrashJSONEncodeContext* const context, +int rcjson_addDataElement(RollbarCrashJSONEncodeContext* const context, const char* name, const char* value, int length); @@ -289,7 +289,7 @@ int ksjson_addDataElement(RollbarCrashJSONEncodeContext* const context, * * @return RollbarCrashJSON_OK if the process was successful. */ -int ksjson_beginDataElement(RollbarCrashJSONEncodeContext* const context, +int rcjson_beginDataElement(RollbarCrashJSONEncodeContext* const context, const char* const name); /** Add a data fragment to an incrementally-built data element. @@ -302,7 +302,7 @@ int ksjson_beginDataElement(RollbarCrashJSONEncodeContext* const context, * * @return RollbarCrashJSON_OK if the process was successful. */ -int ksjson_appendDataElement(RollbarCrashJSONEncodeContext* const context, +int rcjson_appendDataElement(RollbarCrashJSONEncodeContext* const context, const char* const value, int length); @@ -312,7 +312,7 @@ int ksjson_appendDataElement(RollbarCrashJSONEncodeContext* const context, * * @return RollbarCrashJSON_OK if the process was successful. */ -int ksjson_endDataElement(RollbarCrashJSONEncodeContext* const context); +int rcjson_endDataElement(RollbarCrashJSONEncodeContext* const context); /** Add a pre-formatted JSON element. * @@ -328,7 +328,7 @@ int ksjson_endDataElement(RollbarCrashJSONEncodeContext* const context); * * @return RollbarCrashJSON_OK if the process was successful. */ -int ksjson_addJSONElement(RollbarCrashJSONEncodeContext* const encodeContext, +int rcjson_addJSONElement(RollbarCrashJSONEncodeContext* const encodeContext, const char* restrict const name, const char* restrict const jsonData, const int jsonDataLength, @@ -342,7 +342,7 @@ int ksjson_addJSONElement(RollbarCrashJSONEncodeContext* const encodeContext, * * @return RollbarCrashJSON_OK if the process was successful. */ -int ksjson_beginObject(RollbarCrashJSONEncodeContext* context, +int rcjson_beginObject(RollbarCrashJSONEncodeContext* context, const char* name); /** Begin a new array container. @@ -353,7 +353,7 @@ int ksjson_beginObject(RollbarCrashJSONEncodeContext* context, * * @return RollbarCrashJSON_OK if the process was successful. */ -int ksjson_beginArray(RollbarCrashJSONEncodeContext* context, +int rcjson_beginArray(RollbarCrashJSONEncodeContext* context, const char* name); /** Begin a generic JSON element, adding any necessary JSON preamble text, @@ -364,7 +364,7 @@ int ksjson_beginArray(RollbarCrashJSONEncodeContext* context, * * @param name The name of the next element (only needed if parent is a dictionary). */ -int ksjson_beginElement(RollbarCrashJSONEncodeContext* const context, +int rcjson_beginElement(RollbarCrashJSONEncodeContext* const context, const char* const name); /** Add JSON data manually. @@ -378,7 +378,7 @@ int ksjson_beginElement(RollbarCrashJSONEncodeContext* const context, * * @return RollbarCrashJSON_OK if the process was successful. */ -int ksjson_addRawJSONData(RollbarCrashJSONEncodeContext* const context, +int rcjson_addRawJSONData(RollbarCrashJSONEncodeContext* const context, const char* const data, const int length); @@ -388,7 +388,7 @@ int ksjson_addRawJSONData(RollbarCrashJSONEncodeContext* const context, * * @return RollbarCrashJSON_OK if the process was successful. */ -int ksjson_endContainer(RollbarCrashJSONEncodeContext* context); +int rcjson_endContainer(RollbarCrashJSONEncodeContext* context); /** Decode and add JSON data from a file. * @@ -400,7 +400,7 @@ int ksjson_endContainer(RollbarCrashJSONEncodeContext* context); * * @param closeLastContainer If false, do not close the last container. */ -int ksjson_addJSONFromFile(RollbarCrashJSONEncodeContext* const context, +int rcjson_addJSONFromFile(RollbarCrashJSONEncodeContext* const context, const char* restrict const name, const char* restrict const filename, const bool closeLastContainer); @@ -423,7 +423,7 @@ typedef struct RollbarCrashJSONDecodeCallbacks * * @param value The element's value. * - * @param userData Data that was specified when calling ksjson_decode(). + * @param userData Data that was specified when calling rcjson_decode(). * * @return RollbarCrashJSON_OK if decoding should continue. */ @@ -437,7 +437,7 @@ typedef struct RollbarCrashJSONDecodeCallbacks * * @param value The element's value. * - * @param userData Data that was specified when calling ksjson_decode(). + * @param userData Data that was specified when calling rcjson_decode(). * * @return RollbarCrashJSON_OK if decoding should continue. */ @@ -451,7 +451,7 @@ typedef struct RollbarCrashJSONDecodeCallbacks * * @param value The element's value. * - * @param userData Data that was specified when calling ksjson_decode(). + * @param userData Data that was specified when calling rcjson_decode(). * * @return RollbarCrashJSON_OK if decoding should continue. */ @@ -463,7 +463,7 @@ typedef struct RollbarCrashJSONDecodeCallbacks * * @param name The element's name. * - * @param userData Data that was specified when calling ksjson_decode(). + * @param userData Data that was specified when calling rcjson_decode(). * * @return RollbarCrashJSON_OK if decoding should continue. */ @@ -476,7 +476,7 @@ typedef struct RollbarCrashJSONDecodeCallbacks * * @param value The element's value. * - * @param userData Data that was specified when calling ksjson_decode(). + * @param userData Data that was specified when calling rcjson_decode(). * * @return RollbarCrashJSON_OK if decoding should continue. */ @@ -488,7 +488,7 @@ typedef struct RollbarCrashJSONDecodeCallbacks * * @param name The object's name. * - * @param userData Data that was specified when calling ksjson_decode(). + * @param userData Data that was specified when calling rcjson_decode(). * * @return RollbarCrashJSON_OK if decoding should continue. */ @@ -499,7 +499,7 @@ typedef struct RollbarCrashJSONDecodeCallbacks * * @param name The array's name. * - * @param userData Data that was specified when calling ksjson_decode(). + * @param userData Data that was specified when calling rcjson_decode(). * * @return RollbarCrashJSON_OK if decoding should continue. */ @@ -509,7 +509,7 @@ typedef struct RollbarCrashJSONDecodeCallbacks /** Called when leaving the current container and returning to the next * higher level container. * - * @param userData Data that was specified when calling ksjson_decode(). + * @param userData Data that was specified when calling rcjson_decode(). * * @return RollbarCrashJSON_OK if decoding should continue. */ @@ -517,7 +517,7 @@ typedef struct RollbarCrashJSONDecodeCallbacks /** Called when the end of the input data is reached. * - * @param userData Data that was specified when calling ksjson_decode(). + * @param userData Data that was specified when calling rcjson_decode(). * * @return RollbarCrashJSON_OK if decoding should continue. */ @@ -546,7 +546,7 @@ typedef struct RollbarCrashJSONDecodeCallbacks * * @return RollbarCrashJSON_OK if succesful. An error code otherwise. */ -int ksjson_decode(const char* data, +int rcjson_decode(const char* data, int length, char* stringBuffer, int stringBufferLength, diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashJSONCodecObjC.m b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashJSONCodecObjC.m index 603c9c78..9c478f0a 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashJSONCodecObjC.m +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashJSONCodecObjC.m @@ -315,7 +315,7 @@ static int encodeObject(RollbarCrashJSONCodec* codec, id object, NSString* name, if([object isKindOfClass:[NSString class]]) { NSData* data = [object dataUsingEncoding:NSUTF8StringEncoding]; - result = ksjson_addStringElement(context, cName, data.bytes, (int)data.length); + result = rcjson_addStringElement(context, cName, data.bytes, (int)data.length); if(result == RollbarCrashJSON_ERROR_INVALID_CHARACTER) { codec.error = [NSError errorWithDomain:@"RollbarCrashJSONCodecObjC" @@ -334,17 +334,17 @@ static int encodeObject(RollbarCrashJSONCodec* codec, id object, NSString* name, case kCFNumberFloatType: case kCFNumberCGFloatType: case kCFNumberDoubleType: - return ksjson_addFloatingPointElement(context, cName, [object doubleValue]); + return rcjson_addFloatingPointElement(context, cName, [object doubleValue]); case kCFNumberCharType: - return ksjson_addBooleanElement(context, cName, [object boolValue]); + return rcjson_addBooleanElement(context, cName, [object boolValue]); default: - return ksjson_addIntegerElement(context, cName, [object longLongValue]); + return rcjson_addIntegerElement(context, cName, [object longLongValue]); } } if([object isKindOfClass:[NSArray class]]) { - if((result = ksjson_beginArray(context, cName)) != RollbarCrashJSON_OK) + if((result = rcjson_beginArray(context, cName)) != RollbarCrashJSON_OK) { return result; } @@ -355,12 +355,12 @@ static int encodeObject(RollbarCrashJSONCodec* codec, id object, NSString* name, return result; } } - return ksjson_endContainer(context); + return rcjson_endContainer(context); } if([object isKindOfClass:[NSDictionary class]]) { - if((result = ksjson_beginObject(context, cName)) != RollbarCrashJSON_OK) + if((result = rcjson_beginObject(context, cName)) != RollbarCrashJSON_OK) { return result; } @@ -376,27 +376,27 @@ static int encodeObject(RollbarCrashJSONCodec* codec, id object, NSString* name, return result; } } - return ksjson_endContainer(context); + return rcjson_endContainer(context); } if([object isKindOfClass:[NSNull class]]) { - return ksjson_addNullElement(context, cName); + return rcjson_addNullElement(context, cName); } if([object isKindOfClass:[NSDate class]]) { char string[21]; time_t timestamp = (time_t)((NSDate*)object).timeIntervalSince1970; - ksdate_utcStringFromTimestamp(timestamp, string); + rcdate_utcStringFromTimestamp(timestamp, string); NSData* data = [NSData dataWithBytes:string length:strnlen(string, 20)]; - return ksjson_addStringElement(context, cName, data.bytes, (int)data.length); + return rcjson_addStringElement(context, cName, data.bytes, (int)data.length); } if([object isKindOfClass:[NSData class]]) { NSData* data = (NSData*)object; - return ksjson_addDataElement(context, cName, data.bytes, (int)data.length); + return rcjson_addDataElement(context, cName, data.bytes, (int)data.length); } codec.error = [NSError errorWithDomain:@"RollbarCrashJSONCodecObjC" @@ -414,7 +414,7 @@ + (NSData*) encode:(id) object { NSMutableData* data = [NSMutableData data]; RollbarCrashJSONEncodeContext JSONContext; - ksjson_beginEncode(&JSONContext, + rcjson_beginEncode(&JSONContext, encodeOptions & RollbarCrashJSONEncodeOptionPretty, addJSONData, (__bridge void*)data); @@ -437,7 +437,7 @@ + (id) decode:(NSData*) JSONData decodeOptions:decodeOptions]; NSMutableData* stringData = [NSMutableData dataWithLength:10001]; int errorOffset; - int result = ksjson_decode(JSONData.bytes, + int result = rcjson_decode(JSONData.bytes, (int)JSONData.length, stringData.mutableBytes, (int)stringData.length, @@ -448,7 +448,7 @@ + (id) decode:(NSData*) JSONData codec.error = [NSError errorWithDomain:@"RollbarCrashJSONCodecObjC" code:0 description:@"%s (offset %d)", - ksjson_stringForError(result), + rcjson_stringForError(result), errorOffset]; } if(error != nil) diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashLogger.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashLogger.c index 8e7631ae..3727e3f8 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashLogger.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashLogger.c @@ -148,7 +148,7 @@ static inline void setLogFD(int fd) g_fd = fd; } -bool kslog_setLogFilename(const char* filename, bool overwrite) +bool rclog_setLogFilename(const char* filename, bool overwrite) { static int fd = -1; if(filename != NULL) @@ -218,7 +218,7 @@ static inline void flushLog(void) fflush(g_file); } -bool kslog_setLogFilename(const char* filename, bool overwrite) +bool rclog_setLogFilename(const char* filename, bool overwrite) { static FILE* file = NULL; FILE* oldFile = file; @@ -247,9 +247,9 @@ bool kslog_setLogFilename(const char* filename, bool overwrite) #endif -bool kslog_clearLogFile() +bool rclog_clearLogFile() { - return kslog_setLogFilename(g_logFilename, true); + return rclog_setLogFilename(g_logFilename, true); } @@ -257,7 +257,7 @@ bool kslog_clearLogFile() #pragma mark - C - // =========================================================================== -void i_kslog_logCBasic(const char* const fmt, ...) +void i_rclog_logCBasic(const char* const fmt, ...) { va_list args; va_start(args,fmt); @@ -267,7 +267,7 @@ void i_kslog_logCBasic(const char* const fmt, ...) flushLog(); } -void i_kslog_logC(const char* const level, +void i_rclog_logC(const char* const level, const char* const file, const int line, const char* const function, @@ -290,7 +290,7 @@ void i_kslog_logC(const char* const level, #if RollbarCrashCRASH_HAS_OBJC #include -void i_kslog_logObjCBasic(CFStringRef fmt, ...) +void i_rclog_logObjCBasic(CFStringRef fmt, ...) { if(fmt == NULL) { @@ -319,7 +319,7 @@ void i_kslog_logObjCBasic(CFStringRef fmt, ...) CFRelease(entry); } -void i_kslog_logObjC(const char* const level, +void i_rclog_logObjC(const char* const level, const char* const file, const int line, const char* const function, @@ -329,7 +329,7 @@ void i_kslog_logObjC(const char* const level, if(fmt == NULL) { logFmt = CFStringCreateWithCString(NULL, "%s: %s (%u): %s: (null)", kCFStringEncodingUTF8); - i_kslog_logObjCBasic(logFmt, level, lastPathEntry(file), line, function); + i_rclog_logObjCBasic(logFmt, level, lastPathEntry(file), line, function); } else { @@ -339,7 +339,7 @@ void i_kslog_logObjC(const char* const level, va_end(args); logFmt = CFStringCreateWithCString(NULL, "%s: %s (%u): %s: %@", kCFStringEncodingUTF8); - i_kslog_logObjCBasic(logFmt, level, lastPathEntry(file), line, function, entry); + i_rclog_logObjCBasic(logFmt, level, lastPathEntry(file), line, function, entry); CFRelease(entry); } diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashLogger.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashLogger.h index 335901bc..04649a12 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashLogger.h +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashLogger.h @@ -159,29 +159,29 @@ extern "C" { #import -void i_kslog_logObjC(const char* level, +void i_rclog_logObjC(const char* level, const char* file, int line, const char* function, CFStringRef fmt, ...); -void i_kslog_logObjCBasic(CFStringRef fmt, ...); +void i_rclog_logObjCBasic(CFStringRef fmt, ...); -#define i_RollbarCrashLOG_FULL(LEVEL,FILE,LINE,FUNCTION,FMT,...) i_kslog_logObjC(LEVEL,FILE,LINE,FUNCTION,(__bridge CFStringRef)FMT,##__VA_ARGS__) -#define i_RollbarCrashLOG_BASIC(FMT, ...) i_kslog_logObjCBasic((__bridge CFStringRef)FMT,##__VA_ARGS__) +#define i_RollbarCrashLOG_FULL(LEVEL,FILE,LINE,FUNCTION,FMT,...) i_rclog_logObjC(LEVEL,FILE,LINE,FUNCTION,(__bridge CFStringRef)FMT,##__VA_ARGS__) +#define i_RollbarCrashLOG_BASIC(FMT, ...) i_rclog_logObjCBasic((__bridge CFStringRef)FMT,##__VA_ARGS__) #else // __OBJC__ -void i_kslog_logC(const char* level, +void i_rclog_logC(const char* level, const char* file, int line, const char* function, const char* fmt, ...); -void i_kslog_logCBasic(const char* fmt, ...); +void i_rclog_logCBasic(const char* fmt, ...); -#define i_RollbarCrashLOG_FULL i_kslog_logC -#define i_RollbarCrashLOG_BASIC i_kslog_logCBasic +#define i_RollbarCrashLOG_FULL i_rclog_logC +#define i_RollbarCrashLOG_BASIC i_rclog_logCBasic #endif // __OBJC__ @@ -256,10 +256,10 @@ void i_kslog_logCBasic(const char* fmt, ...); * * @param overwrite If true, overwrite the log file. */ -bool kslog_setLogFilename(const char* filename, bool overwrite); +bool rclog_setLogFilename(const char* filename, bool overwrite); /** Clear the log file. */ -bool kslog_clearLogFile(void); +bool rclog_clearLogFile(void); /** Tests if the logger would print at the specified level. * diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashMach.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashMach.c index 81ff081b..8160a529 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashMach.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashMach.c @@ -29,7 +29,7 @@ #define RETURN_NAME_FOR_ENUM(A) case A: return #A -const char* ksmach_exceptionName(const int64_t exceptionType) +const char* rcmach_exceptionName(const int64_t exceptionType) { switch (exceptionType) { @@ -47,7 +47,7 @@ const char* ksmach_exceptionName(const int64_t exceptionType) return NULL; } -const char* ksmach_kernelReturnCodeName(const int64_t returnCode) +const char* rcmach_kernelReturnCodeName(const int64_t returnCode) { switch (returnCode) { @@ -110,7 +110,7 @@ const char* ksmach_kernelReturnCodeName(const int64_t returnCode) #define EXC_UNIX_BAD_PIPE 0x10001 /* SIGPIPE */ #define EXC_UNIX_ABORT 0x10002 /* SIGABRT */ -int ksmach_machExceptionForSignal(const int sigNum) +int rcmach_machExceptionForSignal(const int sigNum) { switch(sigNum) { @@ -139,7 +139,7 @@ int ksmach_machExceptionForSignal(const int sigNum) return 0; } -int ksmach_signalForMachException(const int exception, +int rcmach_signalForMachException(const int exception, const mach_exception_code_t code) { switch(exception) diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashMach.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashMach.h index 770b2b11..15120f25 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashMach.h +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashMach.h @@ -38,7 +38,7 @@ extern "C" { * * @return The exception's name or NULL if not found. */ -const char* ksmach_exceptionName(int64_t exceptionType); +const char* rcmach_exceptionName(int64_t exceptionType); /** Get the name of a mach kernel return code. * @@ -46,7 +46,7 @@ const char* ksmach_exceptionName(int64_t exceptionType); * * @return The code's name or NULL if not found. */ -const char* ksmach_kernelReturnCodeName(int64_t returnCode); +const char* rcmach_kernelReturnCodeName(int64_t returnCode); /** Get the signal equivalent of a mach exception. * @@ -56,7 +56,7 @@ const char* ksmach_kernelReturnCodeName(int64_t returnCode); * * @return The matching signal, or 0 if not found. */ -int ksmach_signalForMachException(int exception, int64_t code); +int rcmach_signalForMachException(int exception, int64_t code); /** Get the mach exception equivalent of a signal. * @@ -64,7 +64,7 @@ int ksmach_signalForMachException(int exception, int64_t code); * * @return The matching mach exception, or 0 if not found. */ -int ksmach_machExceptionForSignal(int signal); +int rcmach_machExceptionForSignal(int signal); #ifdef __cplusplus diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashMachineContext.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashMachineContext.c index 9b2e5236..603b4089 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashMachineContext.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashMachineContext.c @@ -53,7 +53,7 @@ static int g_reservedThreadsCount = 0; static inline bool isStackOverflow(const RollbarCrashMachineContext* const context) { RollbarCrashStackCursor stackCursor; - kssc_initWithMachineContext(&stackCursor, RollbarCrashSC_STACK_OVERFLOW_THRESHOLD, context); + rcsc_initWithMachineContext(&stackCursor, RollbarCrashSC_STACK_OVERFLOW_THRESHOLD, context); while(stackCursor.advanceCursor(&stackCursor)) { } @@ -96,29 +96,29 @@ static inline bool getThreadList(RollbarCrashMachineContext* context) return true; } -int ksmc_contextSize() +int rcmc_contextSize() { return sizeof(RollbarCrashMachineContext); } -RollbarCrashThread ksmc_getThreadFromContext(const RollbarCrashMachineContext* const context) +RollbarCrashThread rcmc_getThreadFromContext(const RollbarCrashMachineContext* const context) { return context->thisThread; } -bool ksmc_getContextForThread(RollbarCrashThread thread, RollbarCrashMachineContext* destinationContext, bool isCrashedContext) +bool rcmc_getContextForThread(RollbarCrashThread thread, RollbarCrashMachineContext* destinationContext, bool isCrashedContext) { RollbarCrashLOG_DEBUG("Fill thread 0x%x context into %p. is crashed = %d", thread, destinationContext, isCrashedContext); memset(destinationContext, 0, sizeof(*destinationContext)); destinationContext->thisThread = (thread_t)thread; - destinationContext->isCurrentThread = thread == ksthread_self(); + destinationContext->isCurrentThread = thread == rcthread_self(); destinationContext->isCrashedContext = isCrashedContext; destinationContext->isSignalContext = false; - if(ksmc_canHaveCPUState(destinationContext)) + if(rcmc_canHaveCPUState(destinationContext)) { - kscpu_getState(destinationContext); + rccpu_getState(destinationContext); } - if(ksmc_isCrashedContext(destinationContext)) + if(rcmc_isCrashedContext(destinationContext)) { destinationContext->isStackOverflow = isStackOverflow(destinationContext); getThreadList(destinationContext); @@ -127,12 +127,12 @@ bool ksmc_getContextForThread(RollbarCrashThread thread, RollbarCrashMachineCont return true; } -bool ksmc_getContextForSignal(void* signalUserContext, RollbarCrashMachineContext* destinationContext) +bool rcmc_getContextForSignal(void* signalUserContext, RollbarCrashMachineContext* destinationContext) { RollbarCrashLOG_DEBUG("Get context from signal user context and put into %p.", destinationContext); _STRUCT_MCONTEXT* sourceContext = ((SignalUserContext*)signalUserContext)->UC_MCONTEXT; memcpy(&destinationContext->machineContext, sourceContext, sizeof(destinationContext->machineContext)); - destinationContext->thisThread = (thread_t)ksthread_self(); + destinationContext->thisThread = (thread_t)rcthread_self(); destinationContext->isCrashedContext = true; destinationContext->isSignalContext = true; destinationContext->isStackOverflow = isStackOverflow(destinationContext); @@ -141,7 +141,7 @@ bool ksmc_getContextForSignal(void* signalUserContext, RollbarCrashMachineContex return true; } -void ksmc_addReservedThread(RollbarCrashThread thread) +void rcmc_addReservedThread(RollbarCrashThread thread) { int nextIndex = g_reservedThreadsCount; if(nextIndex > g_reservedThreadsMaxIndex) @@ -166,13 +166,13 @@ static inline bool isThreadInList(thread_t thread, RollbarCrashThread* list, int } #endif -void ksmc_suspendEnvironment(__unused thread_act_array_t *suspendedThreads, __unused mach_msg_type_number_t *numSuspendedThreads) +void rcmc_suspendEnvironment(__unused thread_act_array_t *suspendedThreads, __unused mach_msg_type_number_t *numSuspendedThreads) { #if RollbarCrashCRASH_HAS_THREADS_API RollbarCrashLOG_DEBUG("Suspending environment."); kern_return_t kr; const task_t thisTask = mach_task_self(); - const thread_t thisThread = (thread_t)ksthread_self(); + const thread_t thisThread = (thread_t)rcthread_self(); if((kr = task_threads(thisTask, suspendedThreads, numSuspendedThreads)) != KERN_SUCCESS) { @@ -197,17 +197,17 @@ void ksmc_suspendEnvironment(__unused thread_act_array_t *suspendedThreads, __un #endif } -void ksmc_resumeEnvironment(__unused thread_act_array_t threads, __unused mach_msg_type_number_t numThreads) +void rcmc_resumeEnvironment(__unused thread_act_array_t threads, __unused mach_msg_type_number_t numThreads) { #if RollbarCrashCRASH_HAS_THREADS_API RollbarCrashLOG_DEBUG("Resuming environment."); kern_return_t kr; const task_t thisTask = mach_task_self(); - const thread_t thisThread = (thread_t)ksthread_self(); + const thread_t thisThread = (thread_t)rcthread_self(); if(threads == NULL || numThreads == 0) { - RollbarCrashLOG_ERROR("we should call ksmc_suspendEnvironment() first"); + RollbarCrashLOG_ERROR("we should call rcmc_suspendEnvironment() first"); return; } @@ -234,18 +234,18 @@ void ksmc_resumeEnvironment(__unused thread_act_array_t threads, __unused mach_m #endif } -int ksmc_getThreadCount(const RollbarCrashMachineContext* const context) +int rcmc_getThreadCount(const RollbarCrashMachineContext* const context) { return context->threadCount; } -RollbarCrashThread ksmc_getThreadAtIndex(const RollbarCrashMachineContext* const context, int index) +RollbarCrashThread rcmc_getThreadAtIndex(const RollbarCrashMachineContext* const context, int index) { return context->allThreads[index]; } -int ksmc_indexOfThread(const RollbarCrashMachineContext* const context, RollbarCrashThread thread) +int rcmc_indexOfThread(const RollbarCrashMachineContext* const context, RollbarCrashThread thread) { RollbarCrashLOG_TRACE("check thread vs %d threads", context->threadCount); for(int i = 0; i < (int)context->threadCount; i++) @@ -259,7 +259,7 @@ int ksmc_indexOfThread(const RollbarCrashMachineContext* const context, RollbarC return -1; } -bool ksmc_isCrashedContext(const RollbarCrashMachineContext* const context) +bool rcmc_isCrashedContext(const RollbarCrashMachineContext* const context) { return context->isCrashedContext; } @@ -274,12 +274,12 @@ static inline bool isSignalContext(const RollbarCrashMachineContext* const conte return context->isSignalContext; } -bool ksmc_canHaveCPUState(const RollbarCrashMachineContext* const context) +bool rcmc_canHaveCPUState(const RollbarCrashMachineContext* const context) { return !isContextForCurrentThread(context) || isSignalContext(context); } -bool ksmc_hasValidExceptionRegisters(const RollbarCrashMachineContext* const context) +bool rcmc_hasValidExceptionRegisters(const RollbarCrashMachineContext* const context) { - return ksmc_canHaveCPUState(context) && ksmc_isCrashedContext(context); + return rcmc_canHaveCPUState(context) && rcmc_isCrashedContext(context); } diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashMemory.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashMemory.c index bfdd1ae8..3716b2f2 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashMemory.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashMemory.c @@ -113,7 +113,7 @@ static inline bool isMemoryReadable(const void* const memory, const int byteCoun return bytesRemaining == 0; } -int ksmem_maxReadableBytes(const void* const memory, const int tryByteCount) +int rcmem_maxReadableBytes(const void* const memory, const int tryByteCount) { const int testBufferSize = sizeof(g_memoryTestBuffer); const uint8_t* currentPosition = memory; @@ -132,17 +132,17 @@ int ksmem_maxReadableBytes(const void* const memory, const int tryByteCount) return tryByteCount - bytesRemaining; } -bool ksmem_isMemoryReadable(const void* const memory, const int byteCount) +bool rcmem_isMemoryReadable(const void* const memory, const int byteCount) { return isMemoryReadable(memory, byteCount); } -int ksmem_copyMaxPossible(const void* restrict const src, void* restrict const dst, const int byteCount) +int rcmem_copyMaxPossible(const void* restrict const src, void* restrict const dst, const int byteCount) { return copyMaxPossible(src, dst, byteCount); } -bool ksmem_copySafely(const void* restrict const src, void* restrict const dst, const int byteCount) +bool rcmem_copySafely(const void* restrict const src, void* restrict const dst, const int byteCount) { return copySafely(src, dst, byteCount); } diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashMemory.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashMemory.h index 0174935e..96ed53cf 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashMemory.h +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashMemory.h @@ -29,8 +29,8 @@ */ -#ifndef HDR_ksmemory_h -#define HDR_ksmemory_h +#ifndef HDR_rcmemory_h +#define HDR_rcmemory_h #ifdef __cplusplus extern "C" { @@ -47,7 +47,7 @@ extern "C" { * * @return True if the memory can be safely read. */ -bool ksmem_isMemoryReadable(const void* const memory, const int byteCount); +bool rcmem_isMemoryReadable(const void* const memory, const int byteCount); /** Test how much memory is readable from the specified pointer. * @@ -56,7 +56,7 @@ bool ksmem_isMemoryReadable(const void* const memory, const int byteCount); * * @return The number of bytes that are readable from that address. */ -int ksmem_maxReadableBytes(const void* const memory, const int tryByteCount); +int rcmem_maxReadableBytes(const void* const memory, const int tryByteCount); /** Copy memory safely. If the memory is not accessible, returns false * rather than crashing. @@ -69,7 +69,7 @@ int ksmem_maxReadableBytes(const void* const memory, const int tryByteCount); * * @return true if successful. */ -bool ksmem_copySafely(const void* restrict const src, void* restrict const dst, int byteCount); +bool rcmem_copySafely(const void* restrict const src, void* restrict const dst, int byteCount); /** Copies up to numBytes of data from src to dest, stopping if memory * becomes inaccessible. @@ -82,10 +82,10 @@ bool ksmem_copySafely(const void* restrict const src, void* restrict const dst, * * @return The number of bytes actually copied. */ -int ksmem_copyMaxPossible(const void* restrict const src, void* restrict const dst, int byteCount); +int rcmem_copyMaxPossible(const void* restrict const src, void* restrict const dst, int byteCount); #ifdef __cplusplus } #endif -#endif // HDR_ksmemory_h +#endif // HDR_rcmemory_h diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashObjC.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashObjC.c index cec4796f..34bd3805 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashObjC.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashObjC.c @@ -215,7 +215,7 @@ static const struct class_t* decodeIsaPointer(const void* const isaPointer) static const void* getIsaPointer(const void* const objectOrClassPtr) { // This is wrong. Should not get class data here. -// if(ksobjc_isTaggedPointer(objectOrClassPtr)) +// if(rcobjc_isTaggedPointer(objectOrClassPtr)) // { // return getClassDataFromTaggedPointer(objectOrClassPtr)->class; // } @@ -497,7 +497,7 @@ static bool isValidName(const char* const name, const int maxLength) } char buffer[maxLength]; - int length = ksmem_copyMaxPossible(name, buffer, maxLength); + int length = rcmem_copyMaxPossible(name, buffer, maxLength); if(length == 0 || !VALID_NAME_START_CHAR(name[0])) { return false; @@ -527,7 +527,7 @@ static bool isValidIvarType(const char* const type) return false; } - int length = ksmem_copyMaxPossible(type, buffer, maxLength); + int length = rcmem_copyMaxPossible(type, buffer, maxLength); if(length == 0 || !VALID_TYPE_CHAR(type[0])) { return false; @@ -551,7 +551,7 @@ static bool containsValidExtData(class_rw_t *rw) if (ext_ptr & 0x1UL) { ext_ptr &= ~0x1UL; struct class_rw_ext_t *rw_ext = (struct class_rw_ext_t *)ext_ptr; - if (!ksmem_isMemoryReadable(rw_ext, sizeof(*rw_ext))) { + if (!rcmem_isMemoryReadable(rw_ext, sizeof(*rw_ext))) { return false; } } @@ -561,12 +561,12 @@ static bool containsValidExtData(class_rw_t *rw) static bool containsValidROData(const void* const classPtr) { const struct class_t* const class = classPtr; - if(!ksmem_isMemoryReadable(class, sizeof(*class))) + if(!rcmem_isMemoryReadable(class, sizeof(*class))) { return false; } class_rw_t* rw = getClassRW(class); - if(!ksmem_isMemoryReadable(rw, sizeof(*rw))) + if(!rcmem_isMemoryReadable(rw, sizeof(*rw))) { return false; } @@ -574,7 +574,7 @@ static bool containsValidROData(const void* const classPtr) return false; } const class_ro_t* ro = getClassRO(class); - if(!ksmem_isMemoryReadable(ro, sizeof(*ro))) + if(!rcmem_isMemoryReadable(ro, sizeof(*ro))) { return false; } @@ -589,7 +589,7 @@ static bool containsValidIvarData(const void* const classPtr) { return true; } - if(!ksmem_isMemoryReadable(ivars, sizeof(*ivars))) + if(!rcmem_isMemoryReadable(ivars, sizeof(*ivars))) { return false; } @@ -600,15 +600,15 @@ static bool containsValidIvarData(const void* const classPtr) uint8_t* ivarPtr = (uint8_t*)(&ivars->first) + ivars->entsizeAndFlags; for(uint32_t i = 1; i < ivars->count; i++) { - if(!ksmem_copySafely(ivarPtr, &ivar, sizeof(ivar))) + if(!rcmem_copySafely(ivarPtr, &ivar, sizeof(ivar))) { return false; } - if(!ksmem_isMemoryReadable(ivarPtr, (int)ivars->entsizeAndFlags)) + if(!rcmem_isMemoryReadable(ivarPtr, (int)ivars->entsizeAndFlags)) { return false; } - if(!ksmem_isMemoryReadable(ivar.offset, sizeof(*ivar.offset))) + if(!rcmem_isMemoryReadable(ivar.offset, sizeof(*ivar.offset))) { return false; } @@ -634,13 +634,13 @@ static bool containsValidClassName(const void* const classPtr) static bool hasValidIsaPointer(const void* object) { const struct class_t* isaPtr = getIsaPointer(object); - return ksmem_isMemoryReadable(isaPtr, sizeof(*isaPtr)); + return rcmem_isMemoryReadable(isaPtr, sizeof(*isaPtr)); } static inline bool isValidClass(const void* classPtr) { const class_t* class = classPtr; - if(!ksmem_isMemoryReadable(class, sizeof(*class))) + if(!rcmem_isMemoryReadable(class, sizeof(*class))) { return false; } @@ -666,7 +666,7 @@ static inline bool isValidObject(const void* objectPtr) return isValidTaggedPointer(objectPtr); } const class_t* object = objectPtr; - if(!ksmem_isMemoryReadable(object, sizeof(*object))) + if(!rcmem_isMemoryReadable(object, sizeof(*object))) { return false; } @@ -687,32 +687,32 @@ static inline bool isValidObject(const void* objectPtr) #pragma mark - Basic Objective-C Queries - //====================================================================== -const void* ksobjc_isaPointer(const void* const objectOrClassPtr) +const void* rcobjc_isaPointer(const void* const objectOrClassPtr) { return getIsaPointer(objectOrClassPtr); } -const void* ksobjc_superClass(const void* const classPtr) +const void* rcobjc_superClass(const void* const classPtr) { return getSuperClass(classPtr); } -bool ksobjc_isMetaClass(const void* const classPtr) +bool rcobjc_isMetaClass(const void* const classPtr) { return isMetaClass(classPtr); } -bool ksobjc_isRootClass(const void* const classPtr) +bool rcobjc_isRootClass(const void* const classPtr) { return isRootClass(classPtr); } -const char* ksobjc_className(const void* classPtr) +const char* rcobjc_className(const void* classPtr) { return getClassName(classPtr); } -const char* ksobjc_objectClassName(const void* objectPtr) +const char* rcobjc_objectClassName(const void* objectPtr) { if(isTaggedPointer(objectPtr)) { @@ -727,7 +727,7 @@ const char* ksobjc_objectClassName(const void* objectPtr) return getClassName(isaPtr); } -bool ksobjc_isClassNamed(const void* const classPtr, const char* const className) +bool rcobjc_isClassNamed(const void* const classPtr, const char* const className) { const char* name = getClassName(classPtr); if(name == NULL || className == NULL) @@ -737,7 +737,7 @@ bool ksobjc_isClassNamed(const void* const classPtr, const char* const className return strcmp(name, className) == 0; } -bool ksobjc_isKindOfClass(const void* const classPtr, const char* const className) +bool rcobjc_isKindOfClass(const void* const classPtr, const char* const className) { if(className == NULL) { @@ -766,7 +766,7 @@ bool ksobjc_isKindOfClass(const void* const classPtr, const char* const classNam return false; } -const void* ksobjc_baseClass(const void* const classPtr) +const void* rcobjc_baseClass(const void* const classPtr) { const struct class_t* superClass = classPtr; const struct class_t* subClass = classPtr; @@ -787,7 +787,7 @@ const void* ksobjc_baseClass(const void* const classPtr) return NULL; } -int ksobjc_ivarCount(const void* const classPtr) +int rcobjc_ivarCount(const void* const classPtr) { const struct ivar_list_t* ivars = getClassRO(classPtr)->ivars; if(ivars == NULL) @@ -797,7 +797,7 @@ int ksobjc_ivarCount(const void* const classPtr) return (int)ivars->count; } -int ksobjc_ivarList(const void* const classPtr, RollbarCrashObjCIvar* dstIvars, int ivarsCount) +int rcobjc_ivarList(const void* const classPtr, RollbarCrashObjCIvar* dstIvars, int ivarsCount) { // TODO: Check this for a possible bad access. if(dstIvars == NULL) @@ -805,7 +805,7 @@ int ksobjc_ivarList(const void* const classPtr, RollbarCrashObjCIvar* dstIvars, return 0; } - int count = ksobjc_ivarCount(classPtr); + int count = rcobjc_ivarCount(classPtr); if(count == 0) { return 0; @@ -830,7 +830,7 @@ int ksobjc_ivarList(const void* const classPtr, RollbarCrashObjCIvar* dstIvars, return count; } -bool ksobjc_ivarNamed(const void* const classPtr, const char* name, RollbarCrashObjCIvar* dst) +bool rcobjc_ivarNamed(const void* const classPtr, const char* name, RollbarCrashObjCIvar* dst) { if(name == NULL) { @@ -854,7 +854,7 @@ bool ksobjc_ivarNamed(const void* const classPtr, const char* name, RollbarCrash return false; } -bool ksobjc_ivarValue(const void* const objectPtr, int ivarIndex, void* dst) +bool rcobjc_ivarValue(const void* const objectPtr, int ivarIndex, void* dst) { if(isTaggedPointer(objectPtr)) { @@ -885,21 +885,21 @@ bool ksobjc_ivarValue(const void* const objectPtr, int ivarIndex, void* dst) const struct ivar_t* ivar = (void*)(ivarPtr + (uintptr_t)ivars->entsizeAndFlags * (uintptr_t)ivarIndex); uintptr_t valuePtr = (uintptr_t)objectPtr + (uintptr_t)*ivar->offset; - if(!ksmem_copySafely((void*)valuePtr, dst, (int)ivar->size)) + if(!rcmem_copySafely((void*)valuePtr, dst, (int)ivar->size)) { return false; } return true; } -uintptr_t ksobjc_taggedPointerPayload(const void* taggedObjectPtr) +uintptr_t rcobjc_taggedPointerPayload(const void* taggedObjectPtr) { return getTaggedPayload(taggedObjectPtr); } static inline bool isBlockClass(const void* class) { - const void* baseClass = ksobjc_baseClass(class); + const void* baseClass = rcobjc_baseClass(class); if(baseClass == NULL) { return false; @@ -912,7 +912,7 @@ static inline bool isBlockClass(const void* class) return strcmp(name, g_blockBaseClassName) == 0; } -RollbarCrashObjCType ksobjc_objectType(const void* objectOrClassPtr) +RollbarCrashObjCType rcobjc_objectType(const void* objectOrClassPtr) { if(objectOrClassPtr == NULL) { @@ -955,7 +955,7 @@ RollbarCrashObjCType ksobjc_objectType(const void* objectOrClassPtr) static bool objectIsValid(__unused const void* object) { - // If it passed ksobjc_objectType, it's been validated as much as + // If it passed rcobjc_objectType, it's been validated as much as // possible. return true; } @@ -999,14 +999,14 @@ static bool stringIsValid(const void* const stringPtr) struct __CFString temp; uint8_t oneByte; CFIndex length = -1; - if(!ksmem_copySafely(string, &temp, sizeof(string->base))) + if(!rcmem_copySafely(string, &temp, sizeof(string->base))) { return false; } if(__CFStrIsInline(string)) { - if(!ksmem_copySafely(&string->variants.inline1, &temp, sizeof(string->variants.inline1))) + if(!rcmem_copySafely(&string->variants.inline1, &temp, sizeof(string->variants.inline1))) { return false; } @@ -1014,7 +1014,7 @@ static bool stringIsValid(const void* const stringPtr) } else if(__CFStrIsMutable(string)) { - if(!ksmem_copySafely(&string->variants.notInlineMutable, &temp, sizeof(string->variants.notInlineMutable))) + if(!rcmem_copySafely(&string->variants.notInlineMutable, &temp, sizeof(string->variants.notInlineMutable))) { return false; } @@ -1022,7 +1022,7 @@ static bool stringIsValid(const void* const stringPtr) } else if(!__CFStrHasLengthByte(string)) { - if(!ksmem_copySafely(&string->variants.notInlineImmutable1, &temp, sizeof(string->variants.notInlineImmutable1))) + if(!rcmem_copySafely(&string->variants.notInlineImmutable1, &temp, sizeof(string->variants.notInlineImmutable1))) { return false; } @@ -1030,11 +1030,11 @@ static bool stringIsValid(const void* const stringPtr) } else { - if(!ksmem_copySafely(&string->variants.notInlineImmutable2, &temp, sizeof(string->variants.notInlineImmutable2))) + if(!rcmem_copySafely(&string->variants.notInlineImmutable2, &temp, sizeof(string->variants.notInlineImmutable2))) { return false; } - if(!ksmem_copySafely(__CFStrContents(string), &oneByte, sizeof(oneByte))) + if(!rcmem_copySafely(__CFStrContents(string), &oneByte, sizeof(oneByte))) { return false; } @@ -1047,7 +1047,7 @@ static bool stringIsValid(const void* const stringPtr) } else if(length > 0) { - if(!ksmem_copySafely(stringStart(string), &oneByte, sizeof(oneByte))) + if(!rcmem_copySafely(stringStart(string), &oneByte, sizeof(oneByte))) { return false; } @@ -1055,7 +1055,7 @@ static bool stringIsValid(const void* const stringPtr) return true; } -int ksobjc_stringLength(const void* const stringPtr) +int rcobjc_stringLength(const void* const stringPtr) { if(isTaggedPointer(stringPtr) && isTaggedPointerNSString(stringPtr)) { @@ -1198,7 +1198,7 @@ static int copy8BitString(const void* const src, void* const dst, int charCount, { charCount = maxByteCount - 1; } - unlikely_if(!ksmem_copySafely(src, dst, charCount)) + unlikely_if(!rcmem_copySafely(src, dst, charCount)) { *((uint8_t*)dst) = 0; return 0; @@ -1208,14 +1208,14 @@ static int copy8BitString(const void* const src, void* const dst, int charCount, return charCount; } -int ksobjc_copyStringContents(const void* stringPtr, char* dst, int maxByteCount) +int rcobjc_copyStringContents(const void* stringPtr, char* dst, int maxByteCount) { if(isTaggedPointer(stringPtr) && isTaggedPointerNSString(stringPtr)) { return extractTaggedNSString(stringPtr, dst, maxByteCount); } const struct __CFString* string = stringPtr; - int charCount = ksobjc_stringLength(string); + int charCount = rcobjc_stringLength(string); const char* src = stringStart(string); if(__CFStrIsUnicode(string)) @@ -1233,7 +1233,7 @@ static int stringDescription(const void* object, char* buffer, int bufferLength) pBuffer += objectDescription(object, pBuffer, (int)(pEnd - pBuffer)); pBuffer += stringPrintf(pBuffer, (int)(pEnd - pBuffer), ": \""); - pBuffer += ksobjc_copyStringContents(object, pBuffer, (int)(pEnd - pBuffer)); + pBuffer += rcobjc_copyStringContents(object, pBuffer, (int)(pEnd - pBuffer)); pBuffer += stringPrintf(pBuffer, (int)(pEnd - pBuffer), "\""); return (int)(pBuffer - buffer); @@ -1257,17 +1257,17 @@ static int taggedStringDescription(const void* object, char* buffer, __unused in static bool urlIsValid(const void* const urlPtr) { struct __CFURL url; - if(!ksmem_copySafely(urlPtr, &url, sizeof(url))) + if(!rcmem_copySafely(urlPtr, &url, sizeof(url))) { return false; } return stringIsValid(url._string); } -int ksobjc_copyURLContents(const void* const urlPtr, char* dst, int maxLength) +int rcobjc_copyURLContents(const void* const urlPtr, char* dst, int maxLength) { const struct __CFURL* url = urlPtr; - return ksobjc_copyStringContents(url->_string, dst, maxLength); + return rcobjc_copyStringContents(url->_string, dst, maxLength); } static int urlDescription(const void* object, char* buffer, int bufferLength) @@ -1277,7 +1277,7 @@ static int urlDescription(const void* object, char* buffer, int bufferLength) pBuffer += objectDescription(object, pBuffer, (int)(pEnd - pBuffer)); pBuffer += stringPrintf(pBuffer, (int)(pEnd - pBuffer), ": \""); - pBuffer += ksobjc_copyURLContents(object, pBuffer, (int)(pEnd - pBuffer)); + pBuffer += rcobjc_copyURLContents(object, pBuffer, (int)(pEnd - pBuffer)); pBuffer += stringPrintf(pBuffer, (int)(pEnd - pBuffer), "\""); return (int)(pBuffer - buffer); @@ -1291,10 +1291,10 @@ static int urlDescription(const void* object, char* buffer, int bufferLength) static bool dateIsValid(const void* const datePtr) { struct __CFDate temp; - return ksmem_copySafely(datePtr, &temp, sizeof(temp)); + return rcmem_copySafely(datePtr, &temp, sizeof(temp)); } -CFAbsoluteTime ksobjc_dateContents(const void* const datePtr) +CFAbsoluteTime rcobjc_dateContents(const void* const datePtr) { if(isValidTaggedPointer(datePtr)) { @@ -1309,7 +1309,7 @@ static int dateDescription(const void* object, char* buffer, int bufferLength) char* pBuffer = buffer; char* pEnd = buffer + bufferLength; - CFAbsoluteTime time = ksobjc_dateContents(object); + CFAbsoluteTime time = rcobjc_dateContents(object); pBuffer += objectDescription(object, pBuffer, (int)(pEnd - pBuffer)); pBuffer += stringPrintf(pBuffer, (int)(pEnd - pBuffer), ": %f", time); @@ -1374,19 +1374,19 @@ static int taggedDateDescription(const void* object, char* buffer, int bufferLen NSNUMBER_CASE( kCFNumberCGFloatType, CGFloat, RETURN_TYPE, data ) \ } -Float64 ksobjc_numberAsFloat(const void* object) +Float64 rcobjc_numberAsFloat(const void* object) { EXTRACT_AND_RETURN_NSNUMBER(object, Float64); return NAN; } -int64_t ksobjc_numberAsInteger(const void* object) +int64_t rcobjc_numberAsInteger(const void* object) { EXTRACT_AND_RETURN_NSNUMBER(object, int64_t); return 0; } -bool ksobjc_numberIsFloat(const void* object) +bool rcobjc_numberIsFloat(const void* object) { return CFNumberIsFloatType((CFNumberRef)object); } @@ -1394,7 +1394,7 @@ bool ksobjc_numberIsFloat(const void* object) static bool numberIsValid(const void* const datePtr) { struct __CFNumber temp; - return ksmem_copySafely(datePtr, &temp, sizeof(temp)); + return rcmem_copySafely(datePtr, &temp, sizeof(temp)); } static int numberDescription(const void* object, char* buffer, int bufferLength) @@ -1404,14 +1404,14 @@ static int numberDescription(const void* object, char* buffer, int bufferLength) pBuffer += objectDescription(object, pBuffer, (int)(pEnd - pBuffer)); - if(ksobjc_numberIsFloat(object)) + if(rcobjc_numberIsFloat(object)) { - Float64 value = ksobjc_numberAsFloat(object); + Float64 value = rcobjc_numberAsFloat(object); pBuffer += stringPrintf(pBuffer, (int)(pEnd - pBuffer), ": %lf", value); } else { - int64_t value = ksobjc_numberAsInteger(object); + int64_t value = rcobjc_numberAsInteger(object); pBuffer += stringPrintf(pBuffer, (int)(pEnd - pBuffer), ": %" PRId64, value); } @@ -1458,7 +1458,7 @@ static inline bool nsarrayIsMutable(const void* const arrayPtr) static inline bool nsarrayIsValid(const void* const arrayPtr) { struct NSArray temp; - return ksmem_copySafely(arrayPtr, &temp, sizeof(temp.basic)); + return rcmem_copySafely(arrayPtr, &temp, sizeof(temp.basic)); } static inline int nsarrayCount(const void* const arrayPtr) @@ -1479,13 +1479,13 @@ static int nsarrayContents(const void* const arrayPtr, uintptr_t* contents, int } count = (int)array->basic.count; } - // TODO: implement this (requires bit-field unpacking) in ksobj_ivarValue + // TODO: implement this (requires bit-field unpacking) in rcobjc_ivarValue if(nsarrayIsMutable(arrayPtr)) { return 0; } - if(!ksmem_copySafely(&array->basic.firstEntry, contents, (int)sizeof(*contents) * count)) + if(!rcmem_copySafely(&array->basic.firstEntry, contents, (int)sizeof(*contents) * count)) { return 0; } @@ -1496,7 +1496,7 @@ static int nsarrayContents(const void* const arrayPtr, uintptr_t* contents, int static inline bool cfarrayIsValid(const void* const arrayPtr) { struct __CFArray temp; - if(!ksmem_copySafely(arrayPtr, &temp, sizeof(temp))) + if(!rcmem_copySafely(arrayPtr, &temp, sizeof(temp))) { return false; } @@ -1506,7 +1506,7 @@ static inline bool cfarrayIsValid(const void* const arrayPtr) if(array->_store != NULL) { struct __CFArrayDeque deque; - if(!ksmem_copySafely(array->_store, &deque, sizeof(deque))) + if(!rcmem_copySafely(array->_store, &deque, sizeof(deque))) { return false; } @@ -1539,7 +1539,7 @@ static int cfarrayContents(const void* const arrayPtr, uintptr_t* contents, int } const void* firstEntry = cfarrayData(array); - if(!ksmem_copySafely(firstEntry, contents, (int)sizeof(*contents) * count)) + if(!rcmem_copySafely(firstEntry, contents, (int)sizeof(*contents) * count)) { return 0; } @@ -1554,7 +1554,7 @@ static bool isCFArray(const void* const arrayPtr) -int ksobjc_arrayCount(const void* const arrayPtr) +int rcobjc_arrayCount(const void* const arrayPtr) { if(isCFArray(arrayPtr)) { @@ -1563,7 +1563,7 @@ int ksobjc_arrayCount(const void* const arrayPtr) return nsarrayCount(arrayPtr); } -int ksobjc_arrayContents(const void* const arrayPtr, uintptr_t* contents, int count) +int rcobjc_arrayContents(const void* const arrayPtr, uintptr_t* contents, int count) { if(isCFArray(arrayPtr)) { @@ -1589,12 +1589,12 @@ static int arrayDescription(const void* object, char* buffer, int bufferLength) pBuffer += objectDescription(object, pBuffer, (int)(pEnd - pBuffer)); pBuffer += stringPrintf(pBuffer, (int)(pEnd - pBuffer), ": ["); - if(pBuffer < pEnd-1 && ksobjc_arrayCount(object) > 0) + if(pBuffer < pEnd-1 && rcobjc_arrayCount(object) > 0) { uintptr_t contents = 0; - if(ksobjc_arrayContents(object, &contents, 1) == 1) + if(rcobjc_arrayContents(object, &contents, 1) == 1) { - pBuffer += ksobjc_getDescription((void*)contents, pBuffer, (int)(pEnd - pBuffer)); + pBuffer += rcobjc_getDescription((void*)contents, pBuffer, (int)(pEnd - pBuffer)); } } pBuffer += stringPrintf(pBuffer, (int)(pEnd - pBuffer), "]"); @@ -1607,13 +1607,13 @@ static int arrayDescription(const void* object, char* buffer, int bufferLength) #pragma mark - NSDictionary (BROKEN) - //====================================================================== -bool ksobjc_dictionaryFirstEntry(const void* dict, uintptr_t* key, uintptr_t* value) +bool rcobjc_dictionaryFirstEntry(const void* dict, uintptr_t* key, uintptr_t* value) { // TODO: This is broken. // Ensure memory is valid. struct __CFBasicHash copy; - if(!ksmem_copySafely(dict, ©, sizeof(copy))) + if(!rcmem_copySafely(dict, ©, sizeof(copy))) { return false; } @@ -1623,34 +1623,34 @@ bool ksobjc_dictionaryFirstEntry(const void* dict, uintptr_t* key, uintptr_t* va uintptr_t* values = (uintptr_t*)ht->pointers; // Dereference key and value pointers. - if(!ksmem_copySafely(keys, &keys, sizeof(keys))) + if(!rcmem_copySafely(keys, &keys, sizeof(keys))) { return false; } - if(!ksmem_copySafely(values, &values, sizeof(values))) + if(!rcmem_copySafely(values, &values, sizeof(values))) { return false; } // Copy to destination. - if(!ksmem_copySafely(keys, key, sizeof(*key))) + if(!rcmem_copySafely(keys, key, sizeof(*key))) { return false; } - if(!ksmem_copySafely(values, value, sizeof(*value))) + if(!rcmem_copySafely(values, value, sizeof(*value))) { return false; } return true; } -//bool ksobjc_dictionaryContents(const void* dict, uintptr_t* keys, uintptr_t* values, CFIndex* count) +//bool rcobjc_dictionaryContents(const void* dict, uintptr_t* keys, uintptr_t* values, CFIndex* count) //{ // struct CFBasicHash copy; // void* pointers[100]; // -// if(!ksmem_copySafely(dict, ©, sizeof(copy))) +// if(!rcmem_copySafely(dict, ©, sizeof(copy))) // { // return false; // } @@ -1658,7 +1658,7 @@ bool ksobjc_dictionaryFirstEntry(const void* dict, uintptr_t* key, uintptr_t* va // struct CFBasicHash* ht = (struct CFBasicHash*)dict; // int values_offset = 0; // int keys_offset = copy.bits.keys_offset; -// if(!ksmem_copySafely(&ht->pointers, pointers, sizeof(*pointers) * keys_offset)) +// if(!rcmem_copySafely(&ht->pointers, pointers, sizeof(*pointers) * keys_offset)) // { // return false; // } @@ -1666,7 +1666,7 @@ bool ksobjc_dictionaryFirstEntry(const void* dict, uintptr_t* key, uintptr_t* va // return true; //} -int ksobjc_dictionaryCount(const void* dict) +int rcobjc_dictionaryCount(const void* dict) { // TODO: Implement me #pragma unused(dict) @@ -1678,23 +1678,23 @@ int ksobjc_dictionaryCount(const void* dict) #pragma mark - General Queries - //====================================================================== -int ksobjc_getDescription(void* object, char* buffer, int bufferLength) +int rcobjc_getDescription(void* object, char* buffer, int bufferLength) { const ClassData* data = getClassDataFromObject(object); return data->description(object, buffer, bufferLength); } -bool ksobjc_isTaggedPointer(const void* const pointer) +bool rcobjc_isTaggedPointer(const void* const pointer) { return isTaggedPointer(pointer); } -bool ksobjc_isValidTaggedPointer(const void* const pointer) +bool rcobjc_isValidTaggedPointer(const void* const pointer) { return isValidTaggedPointer(pointer); } -bool ksobjc_isValidObject(const void* object) +bool rcobjc_isValidObject(const void* object) { if(!isValidObject(object)) { @@ -1704,7 +1704,7 @@ bool ksobjc_isValidObject(const void* object) return data->isValidObject(object); } -RollbarCrashObjCClassType ksobjc_objectClassType(const void* object) +RollbarCrashObjCClassType rcobjc_objectClassType(const void* object) { const ClassData* data = getClassDataFromObject(object); return data->type; diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashObjC.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashObjC.h index bd4d83be..1df0dfbf 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashObjC.h +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashObjC.h @@ -74,14 +74,14 @@ typedef struct * @param pointer The pointer to check. * @return true if it's a tagged pointer. */ -bool ksobjc_isTaggedPointer(const void* const pointer); +bool rcobjc_isTaggedPointer(const void* const pointer); /** Check if a pointer is a valid tagged pointer. * * @param pointer The pointer to check. * @return true if it's a valid tagged pointer. */ -bool ksobjc_isValidTaggedPointer(const void* const pointer); +bool rcobjc_isValidTaggedPointer(const void* const pointer); /** Query a pointer to see what kind of object it points to. * If the pointer points to a class, this method will verify that its basic @@ -92,7 +92,7 @@ bool ksobjc_isValidTaggedPointer(const void* const pointer); * * Warning: In order to ensure that an object is both valid and accessible, * always call this method on an object or class pointer (including - * those returned by ksobjc_isaPointer() and ksobjc_superclass()) + * those returned by rcobjc_isaPointer() and rcobjc_superclass()) * BEFORE calling any other function in this module. * * @param objectOrClassPtr Pointer to something that may be an object or class. @@ -100,7 +100,7 @@ bool ksobjc_isValidTaggedPointer(const void* const pointer); * @return The type of object, or RollbarCrashObjCTypeNone if it was not an object or * was inaccessible. */ -RollbarCrashObjCType ksobjc_objectType(const void* objectOrClassPtr); +RollbarCrashObjCType rcobjc_objectType(const void* objectOrClassPtr); /** Check that an object contains valid data. * If the object is of a recognized type (string, date, array, etc), @@ -112,7 +112,7 @@ RollbarCrashObjCType ksobjc_objectType(const void* objectOrClassPtr); * * @return true if the object is valid. */ -bool ksobjc_isValidObject(const void* object); +bool rcobjc_isValidObject(const void* object); /** Fetch the isa pointer from an object or class. * @@ -120,7 +120,7 @@ bool ksobjc_isValidObject(const void* object); * * @return The isa pointer. */ -const void* ksobjc_isaPointer(const void* objectOrClassPtr); +const void* rcobjc_isaPointer(const void* objectOrClassPtr); /** Fetch the super class pointer from a class. * @@ -128,7 +128,7 @@ const void* ksobjc_isaPointer(const void* objectOrClassPtr); * * @return the super class. */ -const void* ksobjc_superClass(const void* classPtr); +const void* rcobjc_superClass(const void* classPtr); /** Get the base class this class is derived from. * It will always return the highest level non-root class in the hierarchy @@ -139,7 +139,7 @@ const void* ksobjc_superClass(const void* classPtr); * * @return The base class. */ -const void* ksobjc_baseClass(const void* const classPtr); +const void* rcobjc_baseClass(const void* const classPtr); /** Check if a class is a meta class. * @@ -147,7 +147,7 @@ const void* ksobjc_baseClass(const void* const classPtr); * * @return true if the class is a meta class. */ -bool ksobjc_isMetaClass(const void* classPtr); +bool rcobjc_isMetaClass(const void* classPtr); /** Check if a class is a root class. * @@ -155,7 +155,7 @@ bool ksobjc_isMetaClass(const void* classPtr); * * @return true if the class is a root class. */ -bool ksobjc_isRootClass(const void* classPtr); +bool rcobjc_isRootClass(const void* classPtr); /** Get the name of a class. * @@ -163,7 +163,7 @@ bool ksobjc_isRootClass(const void* classPtr); * * @return the name, or NULL if the name inaccessible. */ -const char* ksobjc_className(const void* classPtr); +const char* rcobjc_className(const void* classPtr); /** Get the name of an object's class. * This also handles tagged pointers. @@ -172,7 +172,7 @@ const char* ksobjc_className(const void* classPtr); * * @return the name, or NULL if the name is inaccessible. */ -const char* ksobjc_objectClassName(const void* objectPtr); +const char* rcobjc_objectClassName(const void* objectPtr); /** Check if a class has a specific name. * @@ -182,10 +182,10 @@ const char* ksobjc_objectClassName(const void* objectPtr); * * @return true if the class has the specified name. */ -bool ksobjc_isClassNamed(const void* const classPtr, const char* const className); +bool rcobjc_isClassNamed(const void* const classPtr, const char* const className); /** Check if a class is of the specified type or a subclass thereof. - * Note: This function is considerably slower than ksobjc_baseClassName(). + * Note: This function is considerably slower than rcobjc_baseClassName(). * * @param classPtr Pointer to a valid class. * @@ -193,7 +193,7 @@ bool ksobjc_isClassNamed(const void* const classPtr, const char* const className * * @return true if the class is of the specified type or a subclass of that type. */ -bool ksobjc_isKindOfClass(const void* classPtr, const char* className); +bool rcobjc_isKindOfClass(const void* classPtr, const char* className); /** Get the number of ivars registered with a class. * @@ -201,7 +201,7 @@ bool ksobjc_isKindOfClass(const void* classPtr, const char* className); * * @return The number of ivars. */ -int ksobjc_ivarCount(const void* classPtr); +int rcobjc_ivarCount(const void* classPtr); /** Get information about ivars in a class. * @@ -213,7 +213,7 @@ int ksobjc_ivarCount(const void* classPtr); * * @return The number of ivars copied. */ -int ksobjc_ivarList(const void* classPtr, RollbarCrashObjCIvar* dstIvars, int ivarsCount); +int rcobjc_ivarList(const void* classPtr, RollbarCrashObjCIvar* dstIvars, int ivarsCount); /** Get ivar information by name/ * @@ -225,7 +225,7 @@ int ksobjc_ivarList(const void* classPtr, RollbarCrashObjCIvar* dstIvars, int iv * * @return true if the operation was successful. */ -bool ksobjc_ivarNamed(const void* const classPtr, const char* name, RollbarCrashObjCIvar* dst); +bool rcobjc_ivarNamed(const void* const classPtr, const char* name, RollbarCrashObjCIvar* dst); /** Get the value of an ivar in an object. * @@ -237,7 +237,7 @@ bool ksobjc_ivarNamed(const void* const classPtr, const char* name, RollbarCrash * * @return true if the operation was successful. */ -bool ksobjc_ivarValue(const void* objectPtr, int ivarIndex, void* dst); +bool rcobjc_ivarValue(const void* objectPtr, int ivarIndex, void* dst); /* Get the payload from a tagged pointer. * @@ -245,7 +245,7 @@ bool ksobjc_ivarValue(const void* objectPtr, int ivarIndex, void* dst); * * @return the payload value. */ -uintptr_t ksobjc_taggedPointerPayload(const void* taggedObjectPtr); +uintptr_t rcobjc_taggedPointerPayload(const void* taggedObjectPtr); /** Generate a description of an object. * @@ -265,7 +265,7 @@ uintptr_t ksobjc_taggedPointerPayload(const void* taggedObjectPtr); * * @return the number of bytes copied (not including null terminator). */ -int ksobjc_getDescription(void* object, char* buffer, int bufferLength); +int rcobjc_getDescription(void* object, char* buffer, int bufferLength); /** Get the class type of an object. * There are a number of common class types that RollbarCrashObjC understamds, @@ -275,7 +275,7 @@ int ksobjc_getDescription(void* object, char* buffer, int bufferLength); * * @return The class type, or RollbarCrashObjCClassTypeUnknown if it couldn't be determined. */ -RollbarCrashObjCClassType ksobjc_objectClassType(const void* object); +RollbarCrashObjCClassType rcobjc_objectClassType(const void* object); //====================================================================== @@ -287,14 +287,14 @@ RollbarCrashObjCClassType ksobjc_objectClassType(const void* object); * @param object The number to query. * @return true if the number is floating point. */ -bool ksobjc_numberIsFloat(const void* object); +bool rcobjc_numberIsFloat(const void* object); /** Get the contents of a number as a floating point value. * * @param object The number. * @return The value. */ -double ksobjc_numberAsFloat(const void* object); +double rcobjc_numberAsFloat(const void* object); /** Get the contents of a number as an integer value. * If the number was stored as floating point, it will be @@ -303,7 +303,7 @@ double ksobjc_numberAsFloat(const void* object); * @param object The number. * @return The value. */ -int64_t ksobjc_numberAsInteger(const void* object); +int64_t rcobjc_numberAsInteger(const void* object); /** Copy the contents of a date object. * @@ -311,7 +311,7 @@ int64_t ksobjc_numberAsInteger(const void* object); * * @return Time interval since Jan 1 2001 00:00:00 GMT. */ -double ksobjc_dateContents(const void* datePtr); +double rcobjc_dateContents(const void* datePtr); /** Copy the contents of a URL object. * @@ -326,7 +326,7 @@ double ksobjc_dateContents(const void* datePtr); * * @return the number of bytes copied (not including null terminator). */ -int ksobjc_copyURLContents(const void* nsurl, char* dst, int maxLength); +int rcobjc_copyURLContents(const void* nsurl, char* dst, int maxLength); /** Get the length of a string in characters. * @@ -334,7 +334,7 @@ int ksobjc_copyURLContents(const void* nsurl, char* dst, int maxLength); * * @return The length of the string. */ -int ksobjc_stringLength(const void* const stringPtr); +int rcobjc_stringLength(const void* const stringPtr); /** Copy the contents of a string object. * @@ -349,7 +349,7 @@ int ksobjc_stringLength(const void* const stringPtr); * * @return the number of bytes copied (not including null terminator). */ -int ksobjc_copyStringContents(const void* string, char* dst, int maxLength); +int rcobjc_copyStringContents(const void* string, char* dst, int maxLength); /** Get an NSArray's count. * @@ -357,7 +357,7 @@ int ksobjc_copyStringContents(const void* string, char* dst, int maxLength); * * @return The array's count. */ -int ksobjc_arrayCount(const void* arrayPtr); +int rcobjc_arrayCount(const void* arrayPtr); /** Get an NSArray's contents. * @@ -369,7 +369,7 @@ int ksobjc_arrayCount(const void* arrayPtr); * * @return The number of items copied. */ -int ksobjc_arrayContents(const void* arrayPtr, uintptr_t* contents, int count); +int rcobjc_arrayContents(const void* arrayPtr, uintptr_t* contents, int count); //====================================================================== @@ -388,11 +388,11 @@ int ksobjc_arrayContents(const void* arrayPtr, uintptr_t* contents, int count); * * @return true if the operation was successful. */ -bool ksobjc_dictionaryFirstEntry(const void* dict, uintptr_t* key, uintptr_t* value); +bool rcobjc_dictionaryFirstEntry(const void* dict, uintptr_t* key, uintptr_t* value); /** UNIMPLEMENTED */ -int ksobjc_dictionaryCount(const void* dict); +int rcobjc_dictionaryCount(const void* dict); #ifdef __cplusplus diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashSignalInfo.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashSignalInfo.c index 00b3187b..7501de2a 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashSignalInfo.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashSignalInfo.c @@ -133,7 +133,7 @@ static const int g_fatalSignals[] = SIGTRAP, }; -const char* kssignal_signalName(const int sigNum) +const char* rcsignal_signalName(const int sigNum) { for(int i = 0; i < g_fatalSignalsCount; i++) { @@ -145,7 +145,7 @@ const char* kssignal_signalName(const int sigNum) return NULL; } -const char* kssignal_signalCodeName(const int sigNum, const int code) +const char* rcsignal_signalCodeName(const int sigNum, const int code) { for(int si = 0; si < g_fatalSignalsCount; si++) { @@ -163,12 +163,12 @@ const char* kssignal_signalCodeName(const int sigNum, const int code) return NULL; } -const int* kssignal_fatalSignals(void) +const int* rcsignal_fatalSignals(void) { return g_fatalSignals; } -int kssignal_numFatalSignals(void) +int rcsignal_numFatalSignals(void) { return g_fatalSignalsCount; } diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashSignalInfo.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashSignalInfo.h index 0d6643bb..128e267b 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashSignalInfo.h +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashSignalInfo.h @@ -46,7 +46,7 @@ extern "C" { * * @return The signal's name or NULL if not found. */ -const char* kssignal_signalName(int signal); +const char* rcsignal_signalName(int signal); /** Get the name of a signal's subcode. * @@ -56,19 +56,19 @@ const char* kssignal_signalName(int signal); * * @return The code's name or NULL if not found. */ -const char* kssignal_signalCodeName(int signal, int code); +const char* rcsignal_signalCodeName(int signal, int code); /** Get a list of fatal signals. * * @return A list of fatal signals. */ -const int* kssignal_fatalSignals(void); +const int* rcsignal_fatalSignals(void); /** Get the size of the fatal signals list. * * @return The size of the fatal signals list. */ -int kssignal_numFatalSignals(void); +int rcsignal_numFatalSignals(void); #ifdef __cplusplus diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor.c index d35bc98d..082d6372 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor.c @@ -36,7 +36,7 @@ static bool g_advanceCursor(__unused RollbarCrashStackCursor *cursor) return false; } -void kssc_resetCursor(RollbarCrashStackCursor *cursor) +void rcsc_resetCursor(RollbarCrashStackCursor *cursor) { cursor->state.currentDepth = 0; cursor->state.hasGivenUp = false; @@ -47,12 +47,12 @@ void kssc_resetCursor(RollbarCrashStackCursor *cursor) cursor->stackEntry.symbolName = NULL; } -void kssc_initCursor(RollbarCrashStackCursor *cursor, +void rcsc_initCursor(RollbarCrashStackCursor *cursor, void (*resetCursor)(RollbarCrashStackCursor*), bool (*advanceCursor)(RollbarCrashStackCursor*)) { - cursor->symbolicate = kssymbolicator_symbolicate; + cursor->symbolicate = rcsymbolicator_symbolicate; cursor->advanceCursor = advanceCursor != NULL ? advanceCursor : g_advanceCursor; - cursor->resetCursor = resetCursor != NULL ? resetCursor : kssc_resetCursor; + cursor->resetCursor = resetCursor != NULL ? resetCursor : rcsc_resetCursor; cursor->resetCursor(cursor); } diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor.h index 17908124..2e233835 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor.h +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor.h @@ -95,7 +95,7 @@ typedef struct RollbarCrashStackCursor * * @param advanceCursor Function to advance the cursor (NULL = default: Do nothing and return false). */ -void kssc_initCursor(RollbarCrashStackCursor *cursor, +void rcsc_initCursor(RollbarCrashStackCursor *cursor, void (*resetCursor)(RollbarCrashStackCursor*), bool (*advanceCursor)(RollbarCrashStackCursor*)); @@ -104,7 +104,7 @@ void kssc_initCursor(RollbarCrashStackCursor *cursor, * * @param cursor The cursor to reset. */ -void kssc_resetCursor(RollbarCrashStackCursor *cursor); +void rcsc_resetCursor(RollbarCrashStackCursor *cursor); #ifdef __cplusplus diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor_Backtrace.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor_Backtrace.c index 859e4117..4dde7a80 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor_Backtrace.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor_Backtrace.c @@ -40,7 +40,7 @@ static bool advanceCursor(RollbarCrashStackCursor *cursor) // Bug: The system sometimes gives a backtrace with an extra 0x00000001 at the end. if(nextAddress > 1) { - cursor->stackEntry.address = kscpu_normaliseInstructionPointer(nextAddress); + cursor->stackEntry.address = rccpu_normaliseInstructionPointer(nextAddress); cursor->state.currentDepth++; return true; } @@ -48,9 +48,9 @@ static bool advanceCursor(RollbarCrashStackCursor *cursor) return false; } -void kssc_initWithBacktrace(RollbarCrashStackCursor *cursor, const uintptr_t* backtrace, int backtraceLength, int skipEntries) +void rcsc_initWithBacktrace(RollbarCrashStackCursor *cursor, const uintptr_t* backtrace, int backtraceLength, int skipEntries) { - kssc_initCursor(cursor, kssc_resetCursor, advanceCursor); + rcsc_initCursor(cursor, rcsc_resetCursor, advanceCursor); RollbarCrashStackCursor_Backtrace_Context* context = (RollbarCrashStackCursor_Backtrace_Context*)cursor->context; context->skippedEntries = skipEntries; context->backtraceLength = backtraceLength; diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor_Backtrace.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor_Backtrace.h index 9ae212d3..a6052c85 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor_Backtrace.h +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor_Backtrace.h @@ -53,7 +53,7 @@ typedef struct * * @param skipEntries The number of stack entries to skip. */ -void kssc_initWithBacktrace(RollbarCrashStackCursor *cursor, const uintptr_t* backtrace, int backtraceLength, int skipEntries); +void rcsc_initWithBacktrace(RollbarCrashStackCursor *cursor, const uintptr_t* backtrace, int backtraceLength, int skipEntries); #ifdef __cplusplus diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor_MachineContext.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor_MachineContext.c index eb5b15b7..4e50ae7e 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor_MachineContext.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor_MachineContext.c @@ -111,7 +111,7 @@ static bool advanceCursor(RollbarCrashStackCursor *cursor) if(context->instructionAddress == 0 && cursor->state.currentDepth == 0) { - context->instructionAddress = kscpu_instructionAddress(context->machineContext); + context->instructionAddress = rccpu_instructionAddress(context->machineContext); nextAddress = context->instructionAddress; goto successfulExit; } @@ -119,7 +119,7 @@ static bool advanceCursor(RollbarCrashStackCursor *cursor) if(context->linkRegister == 0 && !context->isPastFramePointer) { // Link register, if available, is the second address in the trace. - context->linkRegister = kscpu_linkRegister(context->machineContext); + context->linkRegister = rccpu_linkRegister(context->machineContext); if(context->linkRegister != 0) { nextAddress = context->linkRegister; @@ -133,11 +133,11 @@ static bool advanceCursor(RollbarCrashStackCursor *cursor) { return false; } - context->currentFrame.previous = (struct FrameEntry*)kscpu_framePointer(context->machineContext); + context->currentFrame.previous = (struct FrameEntry*)rccpu_framePointer(context->machineContext); context->isPastFramePointer = true; } - if(!ksmem_copySafely(context->currentFrame.previous, &context->currentFrame, sizeof(context->currentFrame))) + if(!rcmem_copySafely(context->currentFrame.previous, &context->currentFrame, sizeof(context->currentFrame))) { return false; } @@ -149,14 +149,14 @@ static bool advanceCursor(RollbarCrashStackCursor *cursor) nextAddress = context->currentFrame.return_address; successfulExit: - cursor->stackEntry.address = kscpu_normaliseInstructionPointer(nextAddress); + cursor->stackEntry.address = rccpu_normaliseInstructionPointer(nextAddress); cursor->state.currentDepth++; return true; } static void resetCursor(RollbarCrashStackCursor* cursor) { - kssc_resetCursor(cursor); + rcsc_resetCursor(cursor); MachineContextCursor* context = (MachineContextCursor*)cursor->context; context->currentFrame.previous = 0; context->currentFrame.return_address = 0; @@ -165,9 +165,9 @@ static void resetCursor(RollbarCrashStackCursor* cursor) context->isPastFramePointer = 0; } -void kssc_initWithMachineContext(RollbarCrashStackCursor *cursor, int maxStackDepth, const struct RollbarCrashMachineContext* machineContext) +void rcsc_initWithMachineContext(RollbarCrashStackCursor *cursor, int maxStackDepth, const struct RollbarCrashMachineContext* machineContext) { - kssc_initCursor(cursor, resetCursor, advanceCursor); + rcsc_initCursor(cursor, resetCursor, advanceCursor); MachineContextCursor* context = (MachineContextCursor*)cursor->context; context->machineContext = machineContext; context->maxStackDepth = maxStackDepth; diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor_MachineContext.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor_MachineContext.h index 50fb48ea..344c84aa 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor_MachineContext.h +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor_MachineContext.h @@ -41,7 +41,7 @@ extern "C" { * * @param machineContext The machine context whose stack to walk. */ -void kssc_initWithMachineContext(RollbarCrashStackCursor *cursor, int maxStackDepth, const struct RollbarCrashMachineContext* machineContext); +void rcsc_initWithMachineContext(RollbarCrashStackCursor *cursor, int maxStackDepth, const struct RollbarCrashMachineContext* machineContext); #ifdef __cplusplus diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor_SelfThread.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor_SelfThread.c index 13477860..b752fce0 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor_SelfThread.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor_SelfThread.c @@ -38,9 +38,9 @@ typedef struct uintptr_t backtrace[0]; } SelfThreadContext; -void kssc_initSelfThread(RollbarCrashStackCursor *cursor, int skipEntries) +void rcsc_initSelfThread(RollbarCrashStackCursor *cursor, int skipEntries) { SelfThreadContext* context = (SelfThreadContext*)cursor->context; int backtraceLength = backtrace((void**)context->backtrace, MAX_BACKTRACE_LENGTH); - kssc_initWithBacktrace(cursor, context->backtrace, backtraceLength, skipEntries + 1); + rcsc_initWithBacktrace(cursor, context->backtrace, backtraceLength, skipEntries + 1); } diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor_SelfThread.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor_SelfThread.h index 2ff73917..3770e70d 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor_SelfThread.h +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor_SelfThread.h @@ -41,7 +41,7 @@ extern "C" { * * @param skipEntries The number of stack entries to skip. */ -void kssc_initSelfThread(RollbarCrashStackCursor *cursor, int skipEntries); +void rcsc_initSelfThread(RollbarCrashStackCursor *cursor, int skipEntries); #ifdef __cplusplus diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashString.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashString.c index f933c642..b8d604e6 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashString.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashString.c @@ -59,7 +59,7 @@ static const int g_continuationByteCount[0x40] = 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 0, 0, }; -bool ksstring_isNullTerminatedUTF8String(const void* memory, +bool rcstring_isNullTerminatedUTF8String(const void* memory, int minLength, int maxLength) { @@ -128,7 +128,7 @@ static const unsigned int g_hexConversion[] = INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, INV, }; -bool ksstring_extractHexValue(const char* string, int stringLength, uint64_t* const result) +bool rcstring_extractHexValue(const char* string, int stringLength, uint64_t* const result) { if(stringLength > 0) { diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashString.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashString.h index e5146bf6..937ffa81 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashString.h +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashString.h @@ -44,7 +44,7 @@ extern "C" { * * @param maxLength The maximum length to be considered a valid string. */ -bool ksstring_isNullTerminatedUTF8String(const void* memory, int minLength, int maxLength); +bool rcstring_isNullTerminatedUTF8String(const void* memory, int minLength, int maxLength); /** Extract a hex value in the form "0x123456789abcdef" from a string. * @@ -56,7 +56,7 @@ bool ksstring_isNullTerminatedUTF8String(const void* memory, int minLength, int * * @return true if the operation was successful. */ -bool ksstring_extractHexValue(const char* string, int stringLength, uint64_t* result); +bool rcstring_extractHexValue(const char* string, int stringLength, uint64_t* result); #ifdef __cplusplus diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashSymbolicator.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashSymbolicator.c index b2eefb6e..86f6f432 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashSymbolicator.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashSymbolicator.c @@ -52,15 +52,15 @@ #define CALL_INSTRUCTION_FROM_RETURN_ADDRESS(A) (DETAG_INSTRUCTION_ADDRESS((A)) - 1) -uintptr_t kssymbolicator_callInstructionAddress(const uintptr_t returnAddress) +uintptr_t rcsymbolicator_callInstructionAddress(const uintptr_t returnAddress) { return CALL_INSTRUCTION_FROM_RETURN_ADDRESS(returnAddress); } -bool kssymbolicator_symbolicate(RollbarCrashStackCursor *cursor) +bool rcsymbolicator_symbolicate(RollbarCrashStackCursor *cursor) { Dl_info symbolsBuffer; - if(ksdl_dladdr(CALL_INSTRUCTION_FROM_RETURN_ADDRESS(cursor->stackEntry.address), &symbolsBuffer)) + if(rcdl_dladdr(CALL_INSTRUCTION_FROM_RETURN_ADDRESS(cursor->stackEntry.address), &symbolsBuffer)) { cursor->stackEntry.imageAddress = (uintptr_t)symbolsBuffer.dli_fbase; cursor->stackEntry.imageName = symbolsBuffer.dli_fname; diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashSymbolicator.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashSymbolicator.h index a3445ee1..9d8d5b18 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashSymbolicator.h +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashSymbolicator.h @@ -40,7 +40,7 @@ extern "C" { * * @return Call address of the function. */ -uintptr_t kssymbolicator_callInstructionAddress(const uintptr_t returnAddress); +uintptr_t rcsymbolicator_callInstructionAddress(const uintptr_t returnAddress); /** Symbolicate a stack cursor. * @@ -48,7 +48,7 @@ uintptr_t kssymbolicator_callInstructionAddress(const uintptr_t returnAddress); * * @return True if successful. */ -bool kssymbolicator_symbolicate(RollbarCrashStackCursor *cursor); +bool rcsymbolicator_symbolicate(RollbarCrashStackCursor *cursor); #ifdef __cplusplus diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashSysCtl.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashSysCtl.c index 0ecdc542..3f646f31 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashSysCtl.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashSysCtl.c @@ -53,7 +53,7 @@ if(0 != (CALL)) \ return 0; \ } -int32_t kssysctl_int32(const int major_cmd, const int minor_cmd) +int32_t rcsysctl_int32(const int major_cmd, const int minor_cmd) { int cmd[2] = {major_cmd, minor_cmd}; int32_t value = 0; @@ -69,7 +69,7 @@ int32_t kssysctl_int32(const int major_cmd, const int minor_cmd) return value; } -int32_t kssysctl_int32ForName(const char* const name) +int32_t rcsysctl_int32ForName(const char* const name) { int32_t value = 0; size_t size = sizeof(value); @@ -79,7 +79,7 @@ int32_t kssysctl_int32ForName(const char* const name) return value; } -uint32_t kssysctl_uint32(const int major_cmd, const int minor_cmd) +uint32_t rcsysctl_uint32(const int major_cmd, const int minor_cmd) { int cmd[2] = {major_cmd, minor_cmd}; uint32_t value = 0; @@ -95,7 +95,7 @@ uint32_t kssysctl_uint32(const int major_cmd, const int minor_cmd) return value; } -uint32_t kssysctl_uint32ForName(const char* const name) +uint32_t rcsysctl_uint32ForName(const char* const name) { uint32_t value = 0; size_t size = sizeof(value); @@ -105,7 +105,7 @@ uint32_t kssysctl_uint32ForName(const char* const name) return value; } -int64_t kssysctl_int64(const int major_cmd, const int minor_cmd) +int64_t rcsysctl_int64(const int major_cmd, const int minor_cmd) { int cmd[2] = {major_cmd, minor_cmd}; int64_t value = 0; @@ -121,7 +121,7 @@ int64_t kssysctl_int64(const int major_cmd, const int minor_cmd) return value; } -int64_t kssysctl_int64ForName(const char* const name) +int64_t rcsysctl_int64ForName(const char* const name) { int64_t value = 0; size_t size = sizeof(value); @@ -131,7 +131,7 @@ int64_t kssysctl_int64ForName(const char* const name) return value; } -uint64_t kssysctl_uint64(const int major_cmd, const int minor_cmd) +uint64_t rcsysctl_uint64(const int major_cmd, const int minor_cmd) { int cmd[2] = {major_cmd, minor_cmd}; uint64_t value = 0; @@ -147,7 +147,7 @@ uint64_t kssysctl_uint64(const int major_cmd, const int minor_cmd) return value; } -uint64_t kssysctl_uint64ForName(const char* const name) +uint64_t rcsysctl_uint64ForName(const char* const name) { uint64_t value = 0; size_t size = sizeof(value); @@ -157,7 +157,7 @@ uint64_t kssysctl_uint64ForName(const char* const name) return value; } -int kssysctl_string(const int major_cmd, +int rcsysctl_string(const int major_cmd, const int minor_cmd, char*const value, const int maxSize) @@ -175,7 +175,7 @@ int kssysctl_string(const int major_cmd, return (int)size; } -int kssysctl_stringForName(const char* const name, +int rcsysctl_stringForName(const char* const name, char* const value, const int maxSize) { @@ -186,7 +186,7 @@ int kssysctl_stringForName(const char* const name, return (int)size; } -struct timeval kssysctl_timeval(const int major_cmd, const int minor_cmd) +struct timeval rcsysctl_timeval(const int major_cmd, const int minor_cmd) { int cmd[2] = {major_cmd, minor_cmd}; struct timeval value = {0}; @@ -201,7 +201,7 @@ struct timeval kssysctl_timeval(const int major_cmd, const int minor_cmd) return value; } -struct timeval kssysctl_timevalForName(const char* const name) +struct timeval rcsysctl_timevalForName(const char* const name) { struct timeval value = {0}; size_t size = sizeof(value); @@ -215,7 +215,7 @@ struct timeval kssysctl_timevalForName(const char* const name) return value; } -bool kssysctl_getProcessInfo(const int pid, +bool rcsysctl_getProcessInfo(const int pid, struct kinfo_proc* const procInfo) { int cmd[4] = {CTL_KERN, KERN_PROC, KERN_PROC_PID, pid}; @@ -230,7 +230,7 @@ bool kssysctl_getProcessInfo(const int pid, return true; } -bool kssysctl_getMacAddress(const char* const name, +bool rcsysctl_getMacAddress(const char* const name, char* const macAddressBuffer) { // Based off http://iphonedevelopertips.com/device/determine-mac-address.html diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashSysCtl.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashSysCtl.h index 60b7d637..5cc5fe34 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashSysCtl.h +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashSysCtl.h @@ -50,7 +50,7 @@ extern "C" { * * @return The value returned by sysctl. */ -int32_t kssysctl_int32(int major_cmd, int minor_cmd); +int32_t rcsysctl_int32(int major_cmd, int minor_cmd); /** Get an int32 value via sysctl by name. * @@ -58,7 +58,7 @@ int32_t kssysctl_int32(int major_cmd, int minor_cmd); * * @return The value returned by sysctl. */ -int32_t kssysctl_int32ForName(const char* name); +int32_t rcsysctl_int32ForName(const char* name); /** Get a uint32 value via sysctl. * @@ -68,7 +68,7 @@ int32_t kssysctl_int32ForName(const char* name); * * @return The value returned by sysctl. */ -uint32_t kssysctl_uint32(int major_cmd, int minor_cmd); +uint32_t rcsysctl_uint32(int major_cmd, int minor_cmd); /** Get a uint32 value via sysctl by name. * @@ -76,7 +76,7 @@ uint32_t kssysctl_uint32(int major_cmd, int minor_cmd); * * @return The value returned by sysctl. */ -uint32_t kssysctl_uint32ForName(const char* name); +uint32_t rcsysctl_uint32ForName(const char* name); /** Get an int64 value via sysctl. * @@ -86,7 +86,7 @@ uint32_t kssysctl_uint32ForName(const char* name); * * @return The value returned by sysctl. */ -int64_t kssysctl_int64(int major_cmd, int minor_cmd); +int64_t rcsysctl_int64(int major_cmd, int minor_cmd); /** Get an int64 value via sysctl by name. * @@ -94,7 +94,7 @@ int64_t kssysctl_int64(int major_cmd, int minor_cmd); * * @return The value returned by sysctl. */ -int64_t kssysctl_int64ForName(const char* name); +int64_t rcsysctl_int64ForName(const char* name); /** Get a uint64 value via sysctl. * @@ -104,7 +104,7 @@ int64_t kssysctl_int64ForName(const char* name); * * @return The value returned by sysctl. */ -uint64_t kssysctl_uint64(int major_cmd, int minor_cmd); +uint64_t rcsysctl_uint64(int major_cmd, int minor_cmd); /** Get a uint64 value via sysctl by name. * @@ -112,7 +112,7 @@ uint64_t kssysctl_uint64(int major_cmd, int minor_cmd); * * @return The value returned by sysctl. */ -uint64_t kssysctl_uint64ForName(const char* name); +uint64_t rcsysctl_uint64ForName(const char* name); /** Get a string value via sysctl. * @@ -128,7 +128,7 @@ uint64_t kssysctl_uint64ForName(const char* name); * @return The number of bytes written (or that would have been written if * value is NULL). */ -int kssysctl_string(int major_cmd, int minor_cmd, char* value, int maxSize); +int rcsysctl_string(int major_cmd, int minor_cmd, char* value, int maxSize); /** Get a string value via sysctl by name. * @@ -142,7 +142,7 @@ int kssysctl_string(int major_cmd, int minor_cmd, char* value, int maxSize); * @return The number of bytes written (or that would have been written if * value is NULL). */ -int kssysctl_stringForName(const char* name, char* value, int maxSize); +int rcsysctl_stringForName(const char* name, char* value, int maxSize); /** Get a timeval value via sysctl. * @@ -152,7 +152,7 @@ int kssysctl_stringForName(const char* name, char* value, int maxSize); * * @return The value returned by sysctl. */ -struct timeval kssysctl_timeval(int major_cmd, int minor_cmd); +struct timeval rcsysctl_timeval(int major_cmd, int minor_cmd); /** Get a timeval value via sysctl by name. * @@ -160,7 +160,7 @@ struct timeval kssysctl_timeval(int major_cmd, int minor_cmd); * * @return The value returned by sysctl. */ -struct timeval kssysctl_timevalForName(const char* name); +struct timeval rcsysctl_timevalForName(const char* name); /** Get information about a process. * @@ -170,7 +170,7 @@ struct timeval kssysctl_timevalForName(const char* name); * * @return true if the operation was successful. */ -bool kssysctl_getProcessInfo(int pid, struct kinfo_proc* procInfo); +bool rcsysctl_getProcessInfo(int pid, struct kinfo_proc* procInfo); /** Get the MAC address of the specified interface. * Note: As of iOS 7 this will always return a fixed value of 02:00:00:00:00:00. @@ -181,7 +181,7 @@ bool kssysctl_getProcessInfo(int pid, struct kinfo_proc* procInfo); * * @return true if the address was successfully retrieved. */ -bool kssysctl_getMacAddress(const char* name, char* macAddressBuffer); +bool rcsysctl_getMacAddress(const char* name, char* macAddressBuffer); #ifdef __cplusplus diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashThread.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashThread.c index 87dcafdf..3d6de6aa 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashThread.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashThread.c @@ -39,14 +39,14 @@ #include -RollbarCrashThread ksthread_self() +RollbarCrashThread rcthread_self() { thread_t thread_self = mach_thread_self(); mach_port_deallocate(mach_task_self(), thread_self); return (RollbarCrashThread)thread_self; } -bool ksthread_getThreadName(const RollbarCrashThread thread, char* const buffer, int bufLength) +bool rcthread_getThreadName(const RollbarCrashThread thread, char* const buffer, int bufLength) { // WARNING: This implementation is no longer async-safe! @@ -54,7 +54,7 @@ bool ksthread_getThreadName(const RollbarCrashThread thread, char* const buffer, return pthread_getname_np(pthread, buffer, (unsigned)bufLength) == 0; } -bool ksthread_getQueueName(const RollbarCrashThread thread, char* const buffer, int bufLength) +bool rcthread_getQueueName(const RollbarCrashThread thread, char* const buffer, int bufLength) { // WARNING: This implementation is no longer async-safe! @@ -71,13 +71,13 @@ bool ksthread_getQueueName(const RollbarCrashThread thread, char* const buffer, } thread_identifier_info_t idInfo = (thread_identifier_info_t)info; - if(!ksmem_isMemoryReadable(idInfo, sizeof(*idInfo))) + if(!rcmem_isMemoryReadable(idInfo, sizeof(*idInfo))) { RollbarCrashLOG_DEBUG("Thread %p has an invalid thread identifier info %p", thread, idInfo); return false; } dispatch_queue_t* dispatch_queue_ptr = (dispatch_queue_t*)idInfo->dispatch_qaddr; - if(!ksmem_isMemoryReadable(dispatch_queue_ptr, sizeof(*dispatch_queue_ptr))) + if(!rcmem_isMemoryReadable(dispatch_queue_ptr, sizeof(*dispatch_queue_ptr))) { RollbarCrashLOG_DEBUG("Thread %p has an invalid dispatch queue pointer %p", thread, dispatch_queue_ptr); return false; diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashgetsect.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashgetsect.c index 6c91f8fe..929654c4 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashgetsect.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashgetsect.c @@ -48,7 +48,7 @@ #include "RollbarCrashgetsect.h" #include -const segment_command_t *ksgs_getsegbynamefromheader(const mach_header_t *header, const char *seg_name) +const segment_command_t *rcgs_getsegbynamefromheader(const mach_header_t *header, const char *seg_name) { segment_command_t *sgp; unsigned long i; diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashgetsect.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashgetsect.h index b7be00da..dea906da 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashgetsect.h +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashgetsect.h @@ -38,7 +38,7 @@ extern "C" { * It just looks through the load commands. Since these are mapped into the text * segment they are read only and thus const. */ -const segment_command_t *ksgs_getsegbynamefromheader(const mach_header_t *header, const char *seg_name); +const segment_command_t *rcgs_getsegbynamefromheader(const mach_header_t *header, const char *seg_name); #ifdef __cplusplus } diff --git a/RollbarNotifier/Sources/RollbarCrash/Reporting/Filters/RollbarCrashReportFilterBasic.m b/RollbarNotifier/Sources/RollbarCrash/Reporting/Filters/RollbarCrashReportFilterBasic.m index 2053ba89..a71bed02 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Reporting/Filters/RollbarCrashReportFilterBasic.m +++ b/RollbarNotifier/Sources/RollbarCrash/Reporting/Filters/RollbarCrashReportFilterBasic.m @@ -44,7 +44,7 @@ + (RollbarCrashReportFilterPassthrough*) filter - (void) filterReports:(NSArray*) reports onCompletion:(RollbarCrashReportFilterCompletion) onCompletion { - kscrash_callCompletion(onCompletion, reports, YES, nil); + rc_callCompletion(onCompletion, reports, YES, nil); } @end @@ -117,7 +117,7 @@ + (RollbarCrashReportFilterCombine*) filterWithFiltersAndKeys:(id) firstFilter, { NSMutableArray* filters = [NSMutableArray array]; NSMutableArray* keys = [NSMutableArray array]; - ksva_iterate_list(firstFilter, [self argBlockWithFilters:filters andKeys:keys]); + rcva_iterate_list(firstFilter, [self argBlockWithFilters:filters andKeys:keys]); return [[self alloc] initWithFilters:filters keys:keys]; } @@ -125,7 +125,7 @@ - (id) initWithFiltersAndKeys:(id) firstFilter, ... { NSMutableArray* filters = [NSMutableArray array]; NSMutableArray* keys = [NSMutableArray array]; - ksva_iterate_list(firstFilter, [[self class] argBlockWithFilters:filters andKeys:keys]); + rcva_iterate_list(firstFilter, [[self class] argBlockWithFilters:filters andKeys:keys]); return [self initWithFilters:filters keys:keys]; } @@ -138,13 +138,13 @@ - (void) filterReports:(NSArray*) reports if(filterCount == 0) { - kscrash_callCompletion(onCompletion, reports, YES, nil); + rc_callCompletion(onCompletion, reports, YES, nil); return; } if(filterCount != [keys count]) { - kscrash_callCompletion(onCompletion, reports, NO, + rc_callCompletion(onCompletion, reports, NO, [NSError errorWithDomain:[[self class] description] code:0 description:@"Key/filter mismatch (%d keys, %d filters", @@ -173,14 +173,14 @@ - (void) filterReports:(NSArray*) reports { if(!completed) { - kscrash_callCompletion(onCompletion, + rc_callCompletion(onCompletion, filteredReports, completed, filterError); } else if(filteredReports == nil) { - kscrash_callCompletion(onCompletion, filteredReports, NO, + rc_callCompletion(onCompletion, filteredReports, NO, [NSError errorWithDomain:[[self class] description] code:0 description:@"filteredReports was nil"]); @@ -217,7 +217,7 @@ - (void) filterReports:(NSArray*) reports [combinedReports addObject:dict]; } - kscrash_callCompletion(onCompletion, combinedReports, completed, filterError); + rc_callCompletion(onCompletion, combinedReports, completed, filterError); disposeOfCompletion(); } copy]; weakFilterCompletion = filterCompletion; @@ -244,13 +244,13 @@ @implementation RollbarCrashReportFilterPipeline + (RollbarCrashReportFilterPipeline*) filterWithFilters:(id) firstFilter, ... { - ksva_list_to_nsarray(firstFilter, filters); + rcva_list_to_nsarray(firstFilter, filters); return [[self alloc] initWithFiltersArray:filters]; } - (id) initWithFilters:(id) firstFilter, ... { - ksva_list_to_nsarray(firstFilter, filters); + rcva_list_to_nsarray(firstFilter, filters); return [self initWithFiltersArray:filters]; } @@ -289,7 +289,7 @@ - (void) filterReports:(NSArray*) reports if(filterCount == 0) { - kscrash_callCompletion(onCompletion, reports, YES, nil); + rc_callCompletion(onCompletion, reports, YES, nil); return; } @@ -312,14 +312,14 @@ - (void) filterReports:(NSArray*) reports { if(!completed) { - kscrash_callCompletion(onCompletion, + rc_callCompletion(onCompletion, filteredReports, completed, filterError); } else if(filteredReports == nil) { - kscrash_callCompletion(onCompletion, filteredReports, NO, + rc_callCompletion(onCompletion, filteredReports, NO, [NSError errorWithDomain:[[self class] description] code:0 description:@"filteredReports was nil"]); @@ -338,7 +338,7 @@ - (void) filterReports:(NSArray*) reports } // All filters complete, or a filter failed. - kscrash_callCompletion(onCompletion, filteredReports, completed, filterError); + rc_callCompletion(onCompletion, filteredReports, completed, filterError); disposeOfCompletion(); } copy]; weakFilterCompletion = filterCompletion; @@ -399,7 +399,7 @@ - (void) filterReports:(NSArray*) reports { if(!self.allowNotFound) { - kscrash_callCompletion(onCompletion, filteredReports, NO, + rc_callCompletion(onCompletion, filteredReports, NO, [NSError errorWithDomain:[[self class] description] code:0 description:@"Key not found: %@", self.key]); @@ -412,7 +412,7 @@ - (void) filterReports:(NSArray*) reports [filteredReports addObject:object]; } } - kscrash_callCompletion(onCompletion, filteredReports, YES, nil); + rc_callCompletion(onCompletion, filteredReports, YES, nil); } @end @@ -432,13 +432,13 @@ @implementation RollbarCrashReportFilterConcatenate + (RollbarCrashReportFilterConcatenate*) filterWithSeparatorFmt:(NSString*) separatorFmt keys:(id) firstKey, ... { - ksva_list_to_nsarray(firstKey, keys); + rcva_list_to_nsarray(firstKey, keys); return [[self alloc] initWithSeparatorFmt:separatorFmt keysArray:keys]; } - (id) initWithSeparatorFmt:(NSString*) separatorFmt keys:(id) firstKey, ... { - ksva_list_to_nsarray(firstKey, keys); + rcva_list_to_nsarray(firstKey, keys); return [self initWithSeparatorFmt:separatorFmt keysArray:keys]; } @@ -488,7 +488,7 @@ - (void) filterReports:(NSArray*) reports } [filteredReports addObject:concatenated]; } - kscrash_callCompletion(onCompletion, filteredReports, YES, nil); + rc_callCompletion(onCompletion, filteredReports, YES, nil); } @end @@ -506,13 +506,13 @@ @implementation RollbarCrashReportFilterSubset + (RollbarCrashReportFilterSubset*) filterWithKeys:(id) firstKeyPath, ... { - ksva_list_to_nsarray(firstKeyPath, keyPaths); + rcva_list_to_nsarray(firstKeyPath, keyPaths); return [[self alloc] initWithKeysArray:keyPaths]; } - (id) initWithKeys:(id) firstKeyPath, ... { - ksva_list_to_nsarray(firstKeyPath, keyPaths); + rcva_list_to_nsarray(firstKeyPath, keyPaths); return [self initWithKeysArray:keyPaths]; } @@ -550,7 +550,7 @@ - (void) filterReports:(NSArray*) reports id object = [report objectForKeyPath:keyPath]; if(object == nil) { - kscrash_callCompletion(onCompletion, filteredReports, NO, + rc_callCompletion(onCompletion, filteredReports, NO, [NSError errorWithDomain:[[self class] description] code:0 description:@"Report did not have key path %@", keyPath]); @@ -560,7 +560,7 @@ - (void) filterReports:(NSArray*) reports } [filteredReports addObject:subset]; } - kscrash_callCompletion(onCompletion, filteredReports, YES, nil); + rc_callCompletion(onCompletion, filteredReports, YES, nil); } @end @@ -583,7 +583,7 @@ - (void) filterReports:(NSArray*) reports [filteredReports addObject:converted]; } - kscrash_callCompletion(onCompletion, filteredReports, YES, nil); + rc_callCompletion(onCompletion, filteredReports, YES, nil); } @end @@ -605,7 +605,7 @@ - (void) filterReports:(NSArray*) reports NSData* converted = [report dataUsingEncoding:NSUTF8StringEncoding]; if(converted == nil) { - kscrash_callCompletion(onCompletion, filteredReports, NO, + rc_callCompletion(onCompletion, filteredReports, NO, [NSError errorWithDomain:[[self class] description] code:0 description:@"Could not convert report to UTF-8"]); @@ -617,7 +617,7 @@ - (void) filterReports:(NSArray*) reports } } - kscrash_callCompletion(onCompletion, filteredReports, YES, nil); + rc_callCompletion(onCompletion, filteredReports, YES, nil); } @end diff --git a/RollbarNotifier/Sources/RollbarCrash/Reporting/Filters/Tools/RollbarCrashVarArgs.h b/RollbarNotifier/Sources/RollbarCrash/Reporting/Filters/Tools/RollbarCrashVarArgs.h index cb5b7f6e..b9d65b1e 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Reporting/Filters/Tools/RollbarCrashVarArgs.h +++ b/RollbarNotifier/Sources/RollbarCrash/Reporting/Filters/Tools/RollbarCrashVarArgs.h @@ -29,14 +29,14 @@ * easier in Objective-C. All macros assume that the varargs list contains only * objective-c objects or object-like structures (assignable to type id). * - * The base macro ksva_iterate_list() iterates over the variable arguments, + * The base macro rcva_iterate_list() iterates over the variable arguments, * invoking a block for each argument, until it encounters a terminating nil. * * The other macros are for convenience when converting to common collections. */ -/** Block type used by ksva_iterate_list. +/** Block type used by rcva_iterate_list. * * @param entry The current argument in the vararg list. */ @@ -49,16 +49,16 @@ typedef void (^RollbarCrashVA_Block)(id entry); * @param FIRST_ARG_NAME The name of the first argument in the vararg list. * @param BLOCK A code block of type RollbarCrashVA_Block. */ -#define ksva_iterate_list(FIRST_ARG_NAME, BLOCK) \ +#define rcva_iterate_list(FIRST_ARG_NAME, BLOCK) \ { \ - RollbarCrashVA_Block ksva_block = BLOCK; \ - va_list ksva_args; \ - va_start(ksva_args,FIRST_ARG_NAME); \ - for(id ksva_arg = FIRST_ARG_NAME; ksva_arg != nil; ksva_arg = va_arg(ksva_args, id)) \ + RollbarCrashVA_Block rcva_block = BLOCK; \ + va_list rcva_args; \ + va_start(rcva_args,FIRST_ARG_NAME); \ + for(id rcva_arg = FIRST_ARG_NAME; rcva_arg != nil; rcva_arg = va_arg(rcva_args, id)) \ { \ - ksva_block(ksva_arg); \ + rcva_block(rcva_arg); \ } \ - va_end(ksva_args); \ + va_end(rcva_args); \ } /** @@ -68,9 +68,9 @@ typedef void (^RollbarCrashVA_Block)(id entry); * @param FIRST_ARG_NAME The name of the first argument in the vararg list. * @param ARRAY_NAME The name of the array to create in the current scope. */ -#define ksva_list_to_nsarray(FIRST_ARG_NAME, ARRAY_NAME) \ +#define rcva_list_to_nsarray(FIRST_ARG_NAME, ARRAY_NAME) \ NSMutableArray* ARRAY_NAME = [NSMutableArray array]; \ - ksva_iterate_list(FIRST_ARG_NAME, ^(id entry) \ + rcva_iterate_list(FIRST_ARG_NAME, ^(id entry) \ { \ [ARRAY_NAME addObject:entry]; \ }) @@ -84,20 +84,20 @@ typedef void (^RollbarCrashVA_Block)(id entry); * @param FIRST_ARG_NAME The name of the first argument in the vararg list. * @param DICT_NAME The name of the dictionary to create in the current scope. */ -#define ksva_list_to_nsdictionary(FIRST_ARG_NAME, DICT_NAME) \ +#define rcva_list_to_nsdictionary(FIRST_ARG_NAME, DICT_NAME) \ NSMutableDictionary* DICT_NAME = [NSMutableDictionary dictionary]; \ { \ - __block id ksva_object = nil; \ - ksva_iterate_list(FIRST_ARG_NAME, ^(id entry) \ + __block id rcva_object = nil; \ + rcva_iterate_list(FIRST_ARG_NAME, ^(id entry) \ { \ - if(ksva_object == nil) \ + if(rcva_object == nil) \ { \ - ksva_object = entry; \ + rcva_object = entry; \ } \ else \ { \ - [DICT_NAME setObject:ksva_object forKey:entry]; \ - ksva_object = nil; \ + [DICT_NAME setObject:rcva_object forKey:entry]; \ + rcva_object = nil; \ } \ }); \ } diff --git a/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrash.h b/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrash.h index d46e0461..396175c4 100644 --- a/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrash.h +++ b/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrash.h @@ -101,7 +101,7 @@ typedef enum /** If YES, attempt to fetch dispatch queue names for each running thread. * - * WARNING: There is a chance that this will crash on a ksthread_getQueueName() call! + * WARNING: There is a chance that this will crash on a rcthread_getQueueName() call! * * Enable at your own risk. * diff --git a/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashC.h b/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashC.h index e3ef4e74..27dd6954 100644 --- a/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashC.h +++ b/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashC.h @@ -50,7 +50,7 @@ extern "C" { * * @return The crash types that are being handled. */ -RollbarCrashMonitorType kscrash_install(const char* appName, const char* const installPath); +RollbarCrashMonitorType rc_install(const char* appName, const char* const installPath); /** Set the crash types that will be handled. * Some crash types may not be enabled depending on circumstances (e.g. running @@ -63,14 +63,14 @@ RollbarCrashMonitorType kscrash_install(const char* appName, const char* const i * successfully installed. Otherwise it represents which monitors it * will attempt to activate when RollbarCrash installs. */ -RollbarCrashMonitorType kscrash_setMonitoring(RollbarCrashMonitorType monitors); +RollbarCrashMonitorType rc_setMonitoring(RollbarCrashMonitorType monitors); /** Set the user-supplied data in JSON format. * * @param userInfoJSON Pre-baked JSON containing user-supplied information. * NULL = delete. */ -void kscrash_setUserInfoJSON(const char* const userInfoJSON); +void rc_setUserInfoJSON(const char* const userInfoJSON); /** Set the maximum time to allow the main thread to run without returning. * If a task occupies the main thread for longer than this interval, the @@ -87,17 +87,17 @@ void kscrash_setUserInfoJSON(const char* const userInfoJSON); * * Default: 0 */ -void kscrash_setDeadlockWatchdogInterval(double deadlockWatchdogInterval); +void rc_setDeadlockWatchdogInterval(double deadlockWatchdogInterval); /** If true, attempt to fetch dispatch queue names for each running thread. * - * WARNING: There is a chance that this will crash on a ksthread_getQueueName() call! + * WARNING: There is a chance that this will crash on a rcthread_getQueueName() call! * * Enable at your own risk. * * Default: false */ -void kscrash_setSearchQueueNames(bool searchQueueNames); +void rc_setSearchQueueNames(bool searchQueueNames); /** If true, introspect memory contents during a crash. * Any Objective-C objects or C strings near the stack pointer or referenced by @@ -106,7 +106,7 @@ void kscrash_setSearchQueueNames(bool searchQueueNames); * * Default: false */ -void kscrash_setIntrospectMemory(bool introspectMemory); +void rc_setIntrospectMemory(bool introspectMemory); /** List of Objective-C classes that should never be introspected. * Whenever a class in this list is encountered, only the class name will be recorded. @@ -114,7 +114,7 @@ void kscrash_setIntrospectMemory(bool introspectMemory); * * Default: NULL */ -void kscrash_setDoNotIntrospectClasses(const char** doNotIntrospectClasses, int length); +void rc_setDoNotIntrospectClasses(const char** doNotIntrospectClasses, int length); /** Set the callback to invoke upon a crash. * @@ -127,7 +127,7 @@ void kscrash_setDoNotIntrospectClasses(const char** doNotIntrospectClasses, int * * Default: NULL */ -void kscrash_setCrashNotifyCallback(const RollbarCrashReportWriteCallback onCrashNotify); +void rc_setCrashNotifyCallback(const RollbarCrashReportWriteCallback onCrashNotify); typedef void (*RollbarCrashReportWrittenCallback)(int64_t reportID); @@ -140,24 +140,24 @@ typedef void (*RollbarCrashReportWrittenCallback)(int64_t reportID); * give the callee an opportunity to react to the report. * NULL = ignore. */ -void kscrash_setReportWrittenCallback(const RollbarCrashReportWrittenCallback onReportWrittenNotify); +void rc_setReportWrittenCallback(const RollbarCrashReportWrittenCallback onReportWrittenNotify); /** Set if RollbarCrashLOG console messages should be appended to the report. * * @param shouldAddConsoleLogToReport If true, add the log to the report. */ -void kscrash_setAddConsoleLogToReport(bool shouldAddConsoleLogToReport); +void rc_setAddConsoleLogToReport(bool shouldAddConsoleLogToReport); /** Set if RollbarCrash should print the previous log to the console on startup. * This is for debugging purposes. */ -void kscrash_setPrintPreviousLog(bool shouldPrintPreviousLog); +void rc_setPrintPreviousLog(bool shouldPrintPreviousLog); /** Set the maximum number of reports allowed on disk before old ones get deleted. * * @param maxReportCount The maximum number of reports. */ -void kscrash_setMaxReportCount(int maxReportCount); +void rc_setMaxReportCount(int maxReportCount); /** Report a custom, user defined exception. * This can be useful when dealing with scripting languages. @@ -181,7 +181,7 @@ void kscrash_setMaxReportCount(int maxReportCount); * * @param terminateProgram If true, do not return from this function call. Terminate the program instead. */ -void kscrash_reportUserException(const char* name, +void rc_reportUserException(const char* name, const char* reason, const char* language, const char* lineOfCode, @@ -200,35 +200,35 @@ void enableSwapCxaThrow(void); /** Notify the crash reporter of RollbarCrash being added to Objective-C runtime system. */ -void kscrash_notifyObjCLoad(void); +void rc_notifyObjCLoad(void); /** Notify the crash reporter of the application active state. * * @param isActive true if the application is active, otherwise false. */ -void kscrash_notifyAppActive(bool isActive); +void rc_notifyAppActive(bool isActive); /** Notify the crash reporter of the application foreground/background state. * * @param isInForeground true if the application is in the foreground, false if * it is in the background. */ -void kscrash_notifyAppInForeground(bool isInForeground); +void rc_notifyAppInForeground(bool isInForeground); /** Notify the crash reporter that the application is terminating. */ -void kscrash_notifyAppTerminate(void); +void rc_notifyAppTerminate(void); /** Notify the crash reporter that the application has crashed. */ -void kscrash_notifyAppCrash(void); +void rc_notifyAppCrash(void); #pragma mark -- Reporting -- /** Get the number of reports on disk. */ -int kscrash_getReportCount(void); +int rc_getReportCount(void); /** Get a list of IDs for all reports on disk. * @@ -237,7 +237,7 @@ int kscrash_getReportCount(void); * * @return The number of report IDs that were placed in the array. */ -int kscrash_getReportIDs(int64_t* reportIDs, int count); +int rc_getReportIDs(int64_t* reportIDs, int count); /** Read a report. * @@ -246,7 +246,7 @@ int kscrash_getReportIDs(int64_t* reportIDs, int count); * @return The NULL terminated report, or NULL if not found. * MEMORY MANAGEMENT WARNING: User is responsible for calling free() on the returned value. */ -char* kscrash_readReport(int64_t reportID); +char* rc_readReport(int64_t reportID); /** Add a custom report to the store. * @@ -255,17 +255,17 @@ char* kscrash_readReport(int64_t reportID); * * @return the new report's ID. */ -int64_t kscrash_addUserReport(const char* report, int reportLength); +int64_t rc_addUserReport(const char* report, int reportLength); /** Delete all reports on disk. */ -void kscrash_deleteAllReports(void); +void rc_deleteAllReports(void); /** Delete report. * * @param reportID An ID of report to delete. */ -void kscrash_deleteReportWithID(int64_t reportID); +void rc_deleteReportWithID(int64_t reportID); #ifdef __cplusplus diff --git a/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashMachineContext.h b/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashMachineContext.h index a4029a12..aa57b3a2 100644 --- a/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashMachineContext.h +++ b/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashMachineContext.h @@ -38,11 +38,11 @@ extern "C" { /** Suspend the runtime environment. */ -void ksmc_suspendEnvironment(thread_act_array_t *suspendedThreads, mach_msg_type_number_t *numSuspendedThreads); +void rcmc_suspendEnvironment(thread_act_array_t *suspendedThreads, mach_msg_type_number_t *numSuspendedThreads); /** Resume the runtime environment. */ -void ksmc_resumeEnvironment(thread_act_array_t threads, mach_msg_type_number_t numThreads); +void rcmc_resumeEnvironment(thread_act_array_t threads, mach_msg_type_number_t numThreads); /** Create a new machine context on the stack. * This macro creates a storage object on the stack, as well as a pointer of type @@ -55,14 +55,14 @@ void ksmc_resumeEnvironment(thread_act_array_t threads, mach_msg_type_number_t n * @param NAME The C identifier to give the pointer. */ #define RollbarCrashMC_NEW_CONTEXT(NAME) \ - char ksmc_##NAME##_storage[ksmc_contextSize()]; \ - struct RollbarCrashMachineContext* NAME = (struct RollbarCrashMachineContext*)ksmc_##NAME##_storage + char rcmc_##NAME##_storage[rcmc_contextSize()]; \ + struct RollbarCrashMachineContext* NAME = (struct RollbarCrashMachineContext*)rcmc_##NAME##_storage struct RollbarCrashMachineContext; /** Get the internal size of a machine context. */ -int ksmc_contextSize(void); +int rcmc_contextSize(void); /** Fill in a machine context from a thread. * @@ -72,7 +72,7 @@ int ksmc_contextSize(void); * * @return true if successful. */ -bool ksmc_getContextForThread(RollbarCrashThread thread, struct RollbarCrashMachineContext* destinationContext, bool isCrashedContext); +bool rcmc_getContextForThread(RollbarCrashThread thread, struct RollbarCrashMachineContext* destinationContext, bool isCrashedContext); /** Fill in a machine context from a signal handler. * A signal handler context is always assumed to be a crashed context. @@ -82,7 +82,7 @@ bool ksmc_getContextForThread(RollbarCrashThread thread, struct RollbarCrashMach * * @return true if successful. */ -bool ksmc_getContextForSignal(void* signalUserContext, struct RollbarCrashMachineContext* destinationContext); +bool rcmc_getContextForSignal(void* signalUserContext, struct RollbarCrashMachineContext* destinationContext); /** Get the thread associated with a machine context. * @@ -90,7 +90,7 @@ bool ksmc_getContextForSignal(void* signalUserContext, struct RollbarCrashMachin * * @return The associated thread. */ -RollbarCrashThread ksmc_getThreadFromContext(const struct RollbarCrashMachineContext* const context); +RollbarCrashThread rcmc_getThreadFromContext(const struct RollbarCrashMachineContext* const context); /** Get the number of threads stored in a machine context. * @@ -98,7 +98,7 @@ RollbarCrashThread ksmc_getThreadFromContext(const struct RollbarCrashMachineCon * * @return The number of threads. */ -int ksmc_getThreadCount(const struct RollbarCrashMachineContext* const context); +int rcmc_getThreadCount(const struct RollbarCrashMachineContext* const context); /** Get a thread from a machine context. * @@ -107,7 +107,7 @@ int ksmc_getThreadCount(const struct RollbarCrashMachineContext* const context); * * @return The thread. */ -RollbarCrashThread ksmc_getThreadAtIndex(const struct RollbarCrashMachineContext* const context, int index); +RollbarCrashThread rcmc_getThreadAtIndex(const struct RollbarCrashMachineContext* const context, int index); /** Get the index of a thread. * @@ -116,25 +116,25 @@ RollbarCrashThread ksmc_getThreadAtIndex(const struct RollbarCrashMachineContext * * @return The thread's index, or -1 if it couldn't be determined. */ -int ksmc_indexOfThread(const struct RollbarCrashMachineContext* const context, RollbarCrashThread thread); +int rcmc_indexOfThread(const struct RollbarCrashMachineContext* const context, RollbarCrashThread thread); /** Check if this is a crashed context. */ -bool ksmc_isCrashedContext(const struct RollbarCrashMachineContext* const context); +bool rcmc_isCrashedContext(const struct RollbarCrashMachineContext* const context); /** Check if this context can have stored CPU state. */ -bool ksmc_canHaveCPUState(const struct RollbarCrashMachineContext* const context); +bool rcmc_canHaveCPUState(const struct RollbarCrashMachineContext* const context); /** Check if this context has valid exception registers. */ -bool ksmc_hasValidExceptionRegisters(const struct RollbarCrashMachineContext* const context); +bool rcmc_hasValidExceptionRegisters(const struct RollbarCrashMachineContext* const context); /** Add a thread to the reserved threads list. * * @param thread The thread to add to the list. */ -void ksmc_addReservedThread(RollbarCrashThread thread); +void rcmc_addReservedThread(RollbarCrashThread thread); #ifdef __cplusplus diff --git a/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashMonitor.h b/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashMonitor.h index de118f46..78ddb778 100644 --- a/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashMonitor.h +++ b/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashMonitor.h @@ -53,17 +53,17 @@ struct RollbarCrash_MonitorContext; * * @param monitorTypes Which monitors should be active. */ -void kscm_setActiveMonitors(RollbarCrashMonitorType monitorTypes); +void rcm_setActiveMonitors(RollbarCrashMonitorType monitorTypes); /** Get the currently active monitors. */ -RollbarCrashMonitorType kscm_getActiveMonitors(void); +RollbarCrashMonitorType rcm_getActiveMonitors(void); /** Set the callback to call when an event is captured. * * @param onEvent Called whenever an event is captured. */ -void kscm_setEventCallback(void (*onEvent)(struct RollbarCrash_MonitorContext* monitorContext)); +void rcm_setEventCallback(void (*onEvent)(struct RollbarCrash_MonitorContext* monitorContext)); // ============================================================================ @@ -82,13 +82,13 @@ typedef struct * * @oaram isAsyncSafeEnvironment If true, only async-safe functions are allowed from now on. */ -bool kscm_notifyFatalExceptionCaptured(bool isAsyncSafeEnvironment); +bool rcm_notifyFatalExceptionCaptured(bool isAsyncSafeEnvironment); /** Start general exception processing. * * @oaram context Contextual information about the exception. */ -void kscm_handleException(struct RollbarCrash_MonitorContext* context); +void rcm_handleException(struct RollbarCrash_MonitorContext* context); #ifdef __cplusplus diff --git a/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashMonitorType.h b/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashMonitorType.h index 7275fc26..342b94f1 100644 --- a/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashMonitorType.h +++ b/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashMonitorType.h @@ -127,13 +127,13 @@ typedef enum #define RollbarCrashMonitorTypeRequired (RollbarCrashMonitorTypeSystem | RollbarCrashMonitorTypeApplicationState) /** Effectively disables automatica reporting. The only way to generate a report - * in this mode is by manually calling kscrash_reportUserException(). + * in this mode is by manually calling rc_reportUserException(). */ #define RollbarCrashMonitorTypeManual (RollbarCrashMonitorTypeRequired | RollbarCrashMonitorTypeUserReported) #define RollbarCrashMonitorTypeNone 0 -const char* kscrashmonitortype_name(RollbarCrashMonitorType monitorType); +const char* rcmonitortype_name(RollbarCrashMonitorType monitorType); #ifdef __cplusplus diff --git a/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashMonitor_System.h b/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashMonitor_System.h index 9e2dcc33..ed52875b 100644 --- a/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashMonitor_System.h +++ b/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashMonitor_System.h @@ -37,7 +37,7 @@ extern "C" { /** Access the Monitor API. */ - RollbarCrashMonitorAPI* kscm_system_getAPI(void); + RollbarCrashMonitorAPI* rcm_system_getAPI(void); #ifdef __cplusplus diff --git a/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashReportFilter.h b/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashReportFilter.h index 09cbda7e..b47ccc99 100644 --- a/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashReportFilter.h +++ b/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashReportFilter.h @@ -62,7 +62,7 @@ typedef void(^RollbarCrashReportFilterCompletion)(NSArray* filteredReports, BOOL * @param completed The parameter to send as "completed". * @param error The parameter to send as "error". */ -static inline void kscrash_callCompletion(RollbarCrashReportFilterCompletion onCompletion, +static inline void rc_callCompletion(RollbarCrashReportFilterCompletion onCompletion, NSArray* filteredReports, BOOL completed, NSError* error) diff --git a/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashThread.h b/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashThread.h index f5515f52..980b6796 100644 --- a/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashThread.h +++ b/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashThread.h @@ -49,7 +49,7 @@ typedef uintptr_t RollbarCrashThread; * * @return true if a name was found. */ -bool ksthread_getThreadName(const RollbarCrashThread thread, char* const buffer, int bufLength); +bool rcthread_getThreadName(const RollbarCrashThread thread, char* const buffer, int bufLength); /** Get the name of a thread's dispatch queue. Internally, a queue name will * never be more than 64 characters long. @@ -62,7 +62,7 @@ bool ksthread_getThreadName(const RollbarCrashThread thread, char* const buffer, * * @return true if a name or label was found. */ -bool ksthread_getQueueName(RollbarCrashThread thread, char* buffer, int bufLength); +bool rcthread_getQueueName(RollbarCrashThread thread, char* buffer, int bufLength); /* Get the current mach thread ID. * mach_thread_self() receives a send right for the thread port which needs to @@ -71,7 +71,7 @@ bool ksthread_getQueueName(RollbarCrashThread thread, char* buffer, int bufLengt * * @return The current thread ID. */ -RollbarCrashThread ksthread_self(void); +RollbarCrashThread rcthread_self(void); #ifdef __cplusplus diff --git a/RollbarNotifier/Sources/RollbarCrashReport/Diagnostic/RollbarCrashDiagnosticFilter.swift b/RollbarNotifier/Sources/RollbarCrashReport/Diagnostic/RollbarCrashDiagnosticFilter.swift index 77049a25..268750d8 100644 --- a/RollbarNotifier/Sources/RollbarCrashReport/Diagnostic/RollbarCrashDiagnosticFilter.swift +++ b/RollbarNotifier/Sources/RollbarCrashReport/Diagnostic/RollbarCrashDiagnosticFilter.swift @@ -53,7 +53,7 @@ public class RollbarCrashDiagnosticFilter: NSObject, RollbarCrashReportFilter { /// - Parameter report: The `Report` to diagnose. /// - Returns: A new `Report` with the parsed diagnostic information. private func diagnose(_ report: Report) -> Result { - let kscrashDiagnostics = report.crash.diagnosis? + let crashDiagnostics = report.crash.diagnosis? .split(separator: "\n") .map { Diagnostic($0, source: report.crashType) } ?? [] @@ -70,12 +70,12 @@ public class RollbarCrashDiagnosticFilter: NSObject, RollbarCrashReportFilter { : diagnostic } - let diagnostic = kscrashDiagnostics.first + let diagnostic = crashDiagnostics.first ?? dyldDiagnostics.first(where: { $0.source != "libsystem_sim_platform.dylib" }) var diagnosedReport = report diagnosedReport.crash.diagnosis = diagnostic?.diagnosis - diagnosedReport.crash.diagnostics = kscrashDiagnostics + dyldDiagnostics + diagnosedReport.crash.diagnostics = crashDiagnostics + dyldDiagnostics return .success(diagnosedReport) } diff --git a/RollbarNotifier/Sources/RollbarNotifier/RollbarCrashCollector.m b/RollbarNotifier/Sources/RollbarNotifier/RollbarCrashCollector.m index 4d767c6a..74f9687c 100644 --- a/RollbarNotifier/Sources/RollbarNotifier/RollbarCrashCollector.m +++ b/RollbarNotifier/Sources/RollbarNotifier/RollbarCrashCollector.m @@ -42,7 +42,7 @@ - (void)filterReports:(NSArray *)reports [Rollbar logCrashReport:report]; } - kscrash_callCompletion(completion, reports, YES, nil); + rc_callCompletion(completion, reports, YES, nil); } @end From c2f9cc57aae4c37e673a56591ec4d5aeba03ec50 Mon Sep 17 00:00:00 2001 From: Matias Pequeno Date: Thu, 6 Jul 2023 12:11:59 -0300 Subject: [PATCH 4/4] Rename internal KSCrash logger to RCLOG_* --- .../Installations/RollbarCrashInstallation.m | 2 +- .../Recording/Monitors/RollbarCrashMonitor.c | 18 +-- .../Monitors/RollbarCrashMonitor_AppState.c | 24 ++-- .../RollbarCrashMonitor_CPPException.cpp | 10 +- .../Monitors/RollbarCrashMonitor_Deadlock.m | 8 +- .../RollbarCrashMonitor_MachException.c | 74 +++++------ .../RollbarCrashMonitor_NSException.m | 14 +- .../Monitors/RollbarCrashMonitor_Signal.c | 30 ++--- .../Monitors/RollbarCrashMonitor_System.m | 4 +- .../Monitors/RollbarCrashMonitor_User.c | 4 +- .../Monitors/RollbarCrashMonitor_Zombie.c | 10 +- .../RollbarCrash/Recording/RollbarCrash.m | 20 +-- .../RollbarCrash/Recording/RollbarCrashC.c | 16 +-- .../Recording/RollbarCrashCachedData.c | 4 +- .../Recording/RollbarCrashReport.c | 28 ++-- .../Recording/RollbarCrashReportFixer.c | 2 +- .../Recording/RollbarCrashReportStore.c | 10 +- .../Recording/Tools/RollbarCrashCPU.c | 4 +- .../Recording/Tools/RollbarCrashCPU_arm.c | 6 +- .../Recording/Tools/RollbarCrashCPU_arm64.c | 6 +- .../Recording/Tools/RollbarCrashCPU_x86_32.c | 6 +- .../Recording/Tools/RollbarCrashCPU_x86_64.c | 6 +- .../Recording/Tools/RollbarCrashDebug.c | 2 +- .../Tools/RollbarCrashDynamicLinker.c | 14 +- .../Recording/Tools/RollbarCrashFileUtils.c | 38 +++--- .../Recording/Tools/RollbarCrashJSONCodec.c | 60 ++++----- .../Recording/Tools/RollbarCrashLogger.c | 8 +- .../Recording/Tools/RollbarCrashLogger.h | 122 +++++++++--------- .../Tools/RollbarCrashMachineContext.c | 38 +++--- .../Recording/Tools/RollbarCrashStackCursor.c | 2 +- .../Recording/Tools/RollbarCrashSysCtl.c | 18 +-- .../Recording/Tools/RollbarCrashThread.c | 16 +-- .../Filters/RollbarCrashReportFilterBasic.m | 4 +- .../RollbarCrash/include/RollbarCrashC.h | 2 +- 34 files changed, 315 insertions(+), 315 deletions(-) diff --git a/RollbarNotifier/Sources/RollbarCrash/Installations/RollbarCrashInstallation.m b/RollbarNotifier/Sources/RollbarCrash/Installations/RollbarCrashInstallation.m index 155f0858..3a41ba07 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Installations/RollbarCrashInstallation.m +++ b/RollbarNotifier/Sources/RollbarCrash/Installations/RollbarCrashInstallation.m @@ -144,7 +144,7 @@ - (void) setValue:(id) value NSData* jsonData = [RollbarCrashJSONCodec encode:value options:RollbarCrashJSONEncodeOptionPretty | RollbarCrashJSONEncodeOptionSorted error:&error]; if(jsonData == nil) { - RollbarCrashLOG_ERROR(@"Could not set value %@ for property %@: %@", value, self.key, error); + RCLOG_ERROR(@"Could not set value %@ for property %@: %@", value, self.key, error); } else { diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor.c index 0a50468b..1124ca8f 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor.c @@ -167,20 +167,20 @@ void rcm_setActiveMonitors(RollbarCrashMonitorType monitorTypes) if(!hasWarned) { hasWarned = true; - RollbarCrashLOGBASIC_WARN(" ************************ Crash Handler Notice ************************"); - RollbarCrashLOGBASIC_WARN(" * App is running in a debugger. Masking out unsafe monitors. *"); - RollbarCrashLOGBASIC_WARN(" * This means that most crashes WILL NOT BE RECORDED while debugging! *"); - RollbarCrashLOGBASIC_WARN(" **********************************************************************"); + RCLOGBASIC_WARN(" ************************ Crash Handler Notice ************************"); + RCLOGBASIC_WARN(" * App is running in a debugger. Masking out unsafe monitors. *"); + RCLOGBASIC_WARN(" * This means that most crashes WILL NOT BE RECORDED while debugging! *"); + RCLOGBASIC_WARN(" **********************************************************************"); } monitorTypes &= RollbarCrashMonitorTypeDebuggerSafe; } if(g_requiresAsyncSafety && (monitorTypes & RollbarCrashMonitorTypeAsyncUnsafe)) { - RollbarCrashLOG_DEBUG("Async-safe environment detected. Masking out unsafe monitors."); + RCLOG_DEBUG("Async-safe environment detected. Masking out unsafe monitors."); monitorTypes &= RollbarCrashMonitorTypeAsyncSafe; } - RollbarCrashLOG_DEBUG("Changing active monitors from 0x%x tp 0x%x.", g_activeMonitors, monitorTypes); + RCLOG_DEBUG("Changing active monitors from 0x%x tp 0x%x.", g_activeMonitors, monitorTypes); RollbarCrashMonitorType activeMonitors = RollbarCrashMonitorTypeNone; for(int i = 0; i < g_monitorsCount; i++) @@ -198,7 +198,7 @@ void rcm_setActiveMonitors(RollbarCrashMonitorType monitorTypes) } } - RollbarCrashLOG_DEBUG("Active monitors are now 0x%x.", activeMonitors); + RCLOG_DEBUG("Active monitors are now 0x%x.", activeMonitors); g_activeMonitors = activeMonitors; } @@ -222,7 +222,7 @@ bool rcm_notifyFatalExceptionCaptured(bool isAsyncSafeEnvironment) g_handlingFatalException = true; if(g_crashedDuringExceptionHandling) { - RollbarCrashLOG_INFO("Detected crash in the crash reporter. Uninstalling RollbarCrash."); + RCLOG_INFO("Detected crash in the crash reporter. Uninstalling RollbarCrash."); rcm_setActiveMonitors(RollbarCrashMonitorTypeNone); } return g_crashedDuringExceptionHandling; @@ -250,7 +250,7 @@ void rcm_handleException(struct RollbarCrash_MonitorContext* context) g_handlingFatalException = false; } else { if(g_handlingFatalException && !g_crashedDuringExceptionHandling) { - RollbarCrashLOG_DEBUG("Exception is fatal. Restoring original handlers."); + RCLOG_DEBUG("Exception is fatal. Restoring original handlers."); rcm_setActiveMonitors(RollbarCrashMonitorTypeNone); } } diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_AppState.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_AppState.c index 6190d66a..157e715f 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_AppState.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_AppState.c @@ -111,7 +111,7 @@ static int onIntegerElement(const char* const name, const int64_t value, void* c { if(value != kFormatVersion) { - RollbarCrashLOG_ERROR("Expected version 1 but got %" PRId64, value); + RCLOG_ERROR("Expected version 1 but got %" PRId64, value); return RollbarCrashJSON_ERROR_INVALID_DATA; } } @@ -208,7 +208,7 @@ static bool loadState(const char* const path) int length; if(!rcfu_readEntireFile(path, &data, &length, 50000)) { - RollbarCrashLOG_ERROR("%s: Could not load file", path); + RCLOG_ERROR("%s: Could not load file", path); return false; } @@ -236,7 +236,7 @@ static bool loadState(const char* const path) free(data); if(result != RollbarCrashJSON_OK) { - RollbarCrashLOG_ERROR("%s, offset %d: %s", + RCLOG_ERROR("%s, offset %d: %s", path, errorOffset, rcjson_stringForError(result)); return false; } @@ -254,7 +254,7 @@ static bool saveState(const char* const path) int fd = open(path, O_RDWR | O_CREAT | O_TRUNC, 0644); if(fd < 0) { - RollbarCrashLOG_ERROR("Could not open file %s for writing: %s", + RCLOG_ERROR("Could not open file %s for writing: %s", path, strerror(errno)); return false; @@ -314,7 +314,7 @@ static bool saveState(const char* const path) close(fd); if(result != RollbarCrashJSON_OK) { - RollbarCrashLOG_ERROR("%s: %s", + RCLOG_ERROR("%s: %s", path, rcjson_stringForError(result)); return false; } @@ -328,14 +328,14 @@ static void updateAppState(void) if(g_state.applicationIsActive) { - RollbarCrashLOG_TRACE("Updating activeDurationSinceLaunch: %f and activeDurationSinceLastCrash: %f with duration: %f", + RCLOG_TRACE("Updating activeDurationSinceLaunch: %f and activeDurationSinceLastCrash: %f with duration: %f", g_state.activeDurationSinceLaunch, g_state.activeDurationSinceLastCrash, duration); g_state.activeDurationSinceLaunch += duration; g_state.activeDurationSinceLastCrash += duration; } else if(!g_state.applicationIsInForeground) { - RollbarCrashLOG_TRACE("Updating backgroundDurationSinceLaunch: %f and backgroundDurationSinceLastCrash: %f with duration: %f", + RCLOG_TRACE("Updating backgroundDurationSinceLaunch: %f and backgroundDurationSinceLastCrash: %f with duration: %f", g_state.backgroundDurationSinceLaunch, g_state.backgroundDurationSinceLastCrash, duration); g_state.backgroundDurationSinceLaunch += duration; g_state.backgroundDurationSinceLastCrash += duration; @@ -380,7 +380,7 @@ bool rcstate_reset() void rcstate_notifyObjCLoad(void) { - RollbarCrashLOG_TRACE("RollbarCrash has been loaded!"); + RCLOG_TRACE("RollbarCrash has been loaded!"); memset(&g_state, 0, sizeof(g_state)); g_state.applicationIsInForeground = false; g_state.applicationIsActive = true; @@ -394,13 +394,13 @@ void rcstate_notifyAppActive(const bool isActive) g_state.applicationIsActive = isActive; if(isActive) { - RollbarCrashLOG_TRACE("Updating transition time from: %f to: %f", g_state.appStateTransitionTime, getCurrentTime()); + RCLOG_TRACE("Updating transition time from: %f to: %f", g_state.appStateTransitionTime, getCurrentTime()); g_state.appStateTransitionTime = getCurrentTime(); } else { double duration = timeSince(g_state.appStateTransitionTime); - RollbarCrashLOG_TRACE("Updating activeDurationSinceLaunch: %f and activeDurationSinceLastCrash: %f with duration: %f", + RCLOG_TRACE("Updating activeDurationSinceLaunch: %f and activeDurationSinceLastCrash: %f with duration: %f", g_state.activeDurationSinceLaunch, g_state.activeDurationSinceLastCrash, duration); g_state.activeDurationSinceLaunch += duration; g_state.activeDurationSinceLastCrash += duration; @@ -418,7 +418,7 @@ void rcstate_notifyAppInForeground(const bool isInForeground) if(isInForeground) { double duration = getCurrentTime() - g_state.appStateTransitionTime; - RollbarCrashLOG_TRACE("Updating backgroundDurationSinceLaunch: %f and backgroundDurationSinceLastCrash: %f with duration: %f", + RCLOG_TRACE("Updating backgroundDurationSinceLaunch: %f and backgroundDurationSinceLastCrash: %f with duration: %f", g_state.backgroundDurationSinceLaunch, g_state.backgroundDurationSinceLastCrash, duration); g_state.backgroundDurationSinceLaunch += duration; g_state.backgroundDurationSinceLastCrash += duration; @@ -445,7 +445,7 @@ void rcstate_notifyAppTerminate(void) void rcstate_notifyAppCrash(void) { - RollbarCrashLOG_TRACE("Trying to update AppState. g_isEnabled: %d", g_isEnabled); + RCLOG_TRACE("Trying to update AppState. g_isEnabled: %d", g_isEnabled); if(g_isEnabled) { const char* const stateFilePath = g_stateFilePath; diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_CPPException.cpp b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_CPPException.cpp index d7a4b811..783f968a 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_CPPException.cpp +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_CPPException.cpp @@ -112,7 +112,7 @@ static void CPPExceptionTerminate(void) thread_act_array_t threads = NULL; mach_msg_type_number_t numThreads = 0; rcmc_suspendEnvironment(&threads, &numThreads); - RollbarCrashLOG_DEBUG("Trapped c++ exception"); + RCLOG_DEBUG("Trapped c++ exception"); const char* name = NULL; std::type_info* tinfo = __cxxabiv1::__cxa_current_exception_type(); if(tinfo != NULL) @@ -130,7 +130,7 @@ static void CPPExceptionTerminate(void) const char* description = descriptionBuff; descriptionBuff[0] = 0; - RollbarCrashLOG_DEBUG("Discovering what kind of exception was thrown."); + RCLOG_DEBUG("Discovering what kind of exception was thrown."); g_captureNextStackTrace = false; try { @@ -169,7 +169,7 @@ catch(TYPE value)\ RollbarCrashMC_NEW_CONTEXT(machineContext); rcmc_getContextForThread(rcthread_self(), machineContext, true); - RollbarCrashLOG_DEBUG("Filling out context."); + RCLOG_DEBUG("Filling out context."); crashContext->crashType = RollbarCrashMonitorTypeCPPException; crashContext->eventID = g_eventID; crashContext->registersAreValid = false; @@ -183,11 +183,11 @@ catch(TYPE value)\ } else { - RollbarCrashLOG_DEBUG("Detected NSException. Letting the current NSException handler deal with it."); + RCLOG_DEBUG("Detected NSException. Letting the current NSException handler deal with it."); } rcmc_resumeEnvironment(threads, numThreads); - RollbarCrashLOG_DEBUG("Calling original terminate handler."); + RCLOG_DEBUG("Calling original terminate handler."); g_originalTerminateHandler(); } diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_Deadlock.m b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_Deadlock.m index 531d994a..ea4fdc29 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_Deadlock.m +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_Deadlock.m @@ -119,7 +119,7 @@ - (void) handleDeadlock char eventID[37]; rcid_generate(eventID); - RollbarCrashLOG_DEBUG(@"Filling out context."); + RCLOG_DEBUG(@"Filling out context."); RollbarCrash_MonitorContext* crashContext = &g_monitorContext; memset(crashContext, 0, sizeof(*crashContext)); crashContext->crashType = RollbarCrashMonitorTypeMainThreadDeadlock; @@ -131,7 +131,7 @@ - (void) handleDeadlock rcm_handleException(crashContext); rcmc_resumeEnvironment(threads, numThreads); - RollbarCrashLOG_DEBUG(@"Calling abort()"); + RCLOG_DEBUG(@"Calling abort()"); abort(); } @@ -189,13 +189,13 @@ static void setEnabled(bool isEnabled) g_isEnabled = isEnabled; if(isEnabled) { - RollbarCrashLOG_DEBUG(@"Creating new deadlock monitor."); + RCLOG_DEBUG(@"Creating new deadlock monitor."); initialize(); g_monitor = [[RollbarCrashDeadlockMonitor alloc] init]; } else { - RollbarCrashLOG_DEBUG(@"Stopping deadlock monitor."); + RCLOG_DEBUG(@"Stopping deadlock monitor."); [g_monitor cancel]; g_monitor = nil; } diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_MachException.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_MachException.c index 65b2617c..b670929a 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_MachException.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_MachException.c @@ -163,10 +163,10 @@ static char g_secondaryEventID[37]; */ static void restoreExceptionPorts(void) { - RollbarCrashLOG_DEBUG("Restoring original exception ports."); + RCLOG_DEBUG("Restoring original exception ports."); if(g_previousExceptionPorts.count == 0) { - RollbarCrashLOG_DEBUG("Original exception ports were already restored."); + RCLOG_DEBUG("Original exception ports were already restored."); return; } @@ -176,7 +176,7 @@ static void restoreExceptionPorts(void) // Reinstall old exception ports. for(mach_msg_type_number_t i = 0; i < g_previousExceptionPorts.count; i++) { - RollbarCrashLOG_TRACE("Restoring port index %d", i); + RCLOG_TRACE("Restoring port index %d", i); kr = task_set_exception_ports(thisTask, g_previousExceptionPorts.masks[i], g_previousExceptionPorts.ports[i], @@ -184,11 +184,11 @@ static void restoreExceptionPorts(void) g_previousExceptionPorts.flavors[i]); if(kr != KERN_SUCCESS) { - RollbarCrashLOG_ERROR("task_set_exception_ports: %s", + RCLOG_ERROR("task_set_exception_ports: %s", mach_error_string(kr)); } } - RollbarCrashLOG_DEBUG("Exception ports restored."); + RCLOG_DEBUG("Exception ports restored."); g_previousExceptionPorts.count = 0; } @@ -276,14 +276,14 @@ static void* handleExceptions(void* const userData) pthread_setname_np(threadName); if(threadName == kThreadSecondary) { - RollbarCrashLOG_DEBUG("This is the secondary thread. Suspending."); + RCLOG_DEBUG("This is the secondary thread. Suspending."); thread_suspend((thread_t)rcthread_self()); eventID = g_secondaryEventID; } for(;;) { - RollbarCrashLOG_DEBUG("Waiting for mach exception"); + RCLOG_DEBUG("Waiting for mach exception"); // Wait for a message. kern_return_t kr = mach_msg(&exceptionMessage.header, @@ -299,10 +299,10 @@ static void* handleExceptions(void* const userData) } // Loop and try again on failure. - RollbarCrashLOG_ERROR("mach_msg: %s", mach_error_string(kr)); + RCLOG_ERROR("mach_msg: %s", mach_error_string(kr)); } - RollbarCrashLOG_DEBUG("Trapped mach exception code 0x%llx, subcode 0x%llx", + RCLOG_DEBUG("Trapped mach exception code 0x%llx, subcode 0x%llx", exceptionMessage.code[0], exceptionMessage.code[1]); if(g_isEnabled) { @@ -312,29 +312,29 @@ static void* handleExceptions(void* const userData) g_isHandlingCrash = true; rcm_notifyFatalExceptionCaptured(true); - RollbarCrashLOG_DEBUG("Exception handler is installed. Continuing exception handling."); + RCLOG_DEBUG("Exception handler is installed. Continuing exception handling."); // Switch to the secondary thread if necessary, or uninstall the handler // to avoid a death loop. if(rcthread_self() == g_primaryMachThread) { - RollbarCrashLOG_DEBUG("This is the primary exception thread. Activating secondary thread."); + RCLOG_DEBUG("This is the primary exception thread. Activating secondary thread."); // TODO: This was put here to avoid a freeze. Does secondary thread ever fire? restoreExceptionPorts(); if(thread_resume(g_secondaryMachThread) != KERN_SUCCESS) { - RollbarCrashLOG_DEBUG("Could not activate secondary thread. Restoring original exception ports."); + RCLOG_DEBUG("Could not activate secondary thread. Restoring original exception ports."); } } else { - RollbarCrashLOG_DEBUG("This is the secondary exception thread.");// Restoring original exception ports."); + RCLOG_DEBUG("This is the secondary exception thread.");// Restoring original exception ports."); // restoreExceptionPorts(); } // Fill out crash information - RollbarCrashLOG_DEBUG("Fetching machine state."); + RCLOG_DEBUG("Fetching machine state."); RollbarCrashMC_NEW_CONTEXT(machineContext); RollbarCrash_MonitorContext* crashContext = &g_monitorContext; crashContext->offendingMachineContext = machineContext; @@ -342,7 +342,7 @@ static void* handleExceptions(void* const userData) if(rcmc_getContextForThread(exceptionMessage.thread.name, machineContext, true)) { rcsc_initWithMachineContext(&g_stackCursor, RollbarCrashSC_MAX_STACK_DEPTH, machineContext); - RollbarCrashLOG_TRACE("Fault address %p, instruction address %p", + RCLOG_TRACE("Fault address %p, instruction address %p", rccpu_faultAddress(machineContext), rccpu_instructionAddress(machineContext)); if(exceptionMessage.exception == EXC_BAD_ACCESS) { @@ -354,7 +354,7 @@ static void* handleExceptions(void* const userData) } } - RollbarCrashLOG_DEBUG("Filling out context."); + RCLOG_DEBUG("Filling out context."); crashContext->crashType = RollbarCrashMonitorTypeMachException; crashContext->eventID = eventID; crashContext->registersAreValid = true; @@ -373,12 +373,12 @@ static void* handleExceptions(void* const userData) rcm_handleException(crashContext); - RollbarCrashLOG_DEBUG("Crash handling complete. Restoring original handlers."); + RCLOG_DEBUG("Crash handling complete. Restoring original handlers."); g_isHandlingCrash = false; rcmc_resumeEnvironment(threads, numThreads); } - RollbarCrashLOG_DEBUG("Replying to mach exception message."); + RCLOG_DEBUG("Replying to mach exception message."); // Send a reply saying "I didn't handle this exception". replyMessage.header = exceptionMessage.header; replyMessage.NDR = exceptionMessage.NDR; @@ -402,7 +402,7 @@ static void* handleExceptions(void* const userData) static void uninstallExceptionHandler() { - RollbarCrashLOG_DEBUG("Uninstalling mach exception handler."); + RCLOG_DEBUG("Uninstalling mach exception handler."); // NOTE: Do not deallocate the exception port. If a secondary crash occurs // it will hang the process. @@ -413,7 +413,7 @@ static void uninstallExceptionHandler() if(g_primaryPThread != 0 && g_primaryMachThread != thread_self) { - RollbarCrashLOG_DEBUG("Canceling primary exception thread."); + RCLOG_DEBUG("Canceling primary exception thread."); if(g_isHandlingCrash) { thread_terminate(g_primaryMachThread); @@ -427,7 +427,7 @@ static void uninstallExceptionHandler() } if(g_secondaryPThread != 0 && g_secondaryMachThread != thread_self) { - RollbarCrashLOG_DEBUG("Canceling secondary exception thread."); + RCLOG_DEBUG("Canceling secondary exception thread."); if(g_isHandlingCrash) { thread_terminate(g_secondaryMachThread); @@ -441,12 +441,12 @@ static void uninstallExceptionHandler() } g_exceptionPort = MACH_PORT_NULL; - RollbarCrashLOG_DEBUG("Mach exception handlers uninstalled."); + RCLOG_DEBUG("Mach exception handlers uninstalled."); } static bool installExceptionHandler() { - RollbarCrashLOG_DEBUG("Installing mach exception handler."); + RCLOG_DEBUG("Installing mach exception handler."); bool attributes_created = false; pthread_attr_t attr; @@ -461,7 +461,7 @@ static bool installExceptionHandler() EXC_MASK_SOFTWARE | EXC_MASK_BREAKPOINT; - RollbarCrashLOG_DEBUG("Backing up original exception ports."); + RCLOG_DEBUG("Backing up original exception ports."); kr = task_get_exception_ports(thisTask, mask, g_previousExceptionPorts.masks, @@ -471,35 +471,35 @@ static bool installExceptionHandler() g_previousExceptionPorts.flavors); if(kr != KERN_SUCCESS) { - RollbarCrashLOG_ERROR("task_get_exception_ports: %s", mach_error_string(kr)); + RCLOG_ERROR("task_get_exception_ports: %s", mach_error_string(kr)); goto failed; } if(g_exceptionPort == MACH_PORT_NULL) { - RollbarCrashLOG_DEBUG("Allocating new port with receive rights."); + RCLOG_DEBUG("Allocating new port with receive rights."); kr = mach_port_allocate(thisTask, MACH_PORT_RIGHT_RECEIVE, &g_exceptionPort); if(kr != KERN_SUCCESS) { - RollbarCrashLOG_ERROR("mach_port_allocate: %s", mach_error_string(kr)); + RCLOG_ERROR("mach_port_allocate: %s", mach_error_string(kr)); goto failed; } - RollbarCrashLOG_DEBUG("Adding send rights to port."); + RCLOG_DEBUG("Adding send rights to port."); kr = mach_port_insert_right(thisTask, g_exceptionPort, g_exceptionPort, MACH_MSG_TYPE_MAKE_SEND); if(kr != KERN_SUCCESS) { - RollbarCrashLOG_ERROR("mach_port_insert_right: %s", mach_error_string(kr)); + RCLOG_ERROR("mach_port_insert_right: %s", mach_error_string(kr)); goto failed; } } - RollbarCrashLOG_DEBUG("Installing port as exception handler."); + RCLOG_DEBUG("Installing port as exception handler."); kr = task_set_exception_ports(thisTask, mask, g_exceptionPort, @@ -507,11 +507,11 @@ static bool installExceptionHandler() THREAD_STATE_NONE); if(kr != KERN_SUCCESS) { - RollbarCrashLOG_ERROR("task_set_exception_ports: %s", mach_error_string(kr)); + RCLOG_ERROR("task_set_exception_ports: %s", mach_error_string(kr)); goto failed; } - RollbarCrashLOG_DEBUG("Creating secondary exception thread (suspended)."); + RCLOG_DEBUG("Creating secondary exception thread (suspended)."); pthread_attr_init(&attr); attributes_created = true; pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); @@ -521,32 +521,32 @@ static bool installExceptionHandler() (void*)kThreadSecondary); if(error != 0) { - RollbarCrashLOG_ERROR("pthread_create_suspended_np: %s", strerror(error)); + RCLOG_ERROR("pthread_create_suspended_np: %s", strerror(error)); goto failed; } g_secondaryMachThread = pthread_mach_thread_np(g_secondaryPThread); rcmc_addReservedThread(g_secondaryMachThread); - RollbarCrashLOG_DEBUG("Creating primary exception thread."); + RCLOG_DEBUG("Creating primary exception thread."); error = pthread_create(&g_primaryPThread, &attr, &handleExceptions, (void*)kThreadPrimary); if(error != 0) { - RollbarCrashLOG_ERROR("pthread_create: %s", strerror(error)); + RCLOG_ERROR("pthread_create: %s", strerror(error)); goto failed; } pthread_attr_destroy(&attr); g_primaryMachThread = pthread_mach_thread_np(g_primaryPThread); rcmc_addReservedThread(g_primaryMachThread); - RollbarCrashLOG_DEBUG("Mach exception handler installed."); + RCLOG_DEBUG("Mach exception handler installed."); return true; failed: - RollbarCrashLOG_DEBUG("Failed to install mach exception handler."); + RCLOG_DEBUG("Failed to install mach exception handler."); if(attributes_created) { pthread_attr_destroy(&attr); diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_NSException.m b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_NSException.m index 9c70fd92..5ecd934e 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_NSException.m +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_NSException.m @@ -59,7 +59,7 @@ */ static void handleException(NSException* exception, BOOL currentSnapshotUserReported) { - RollbarCrashLOG_DEBUG(@"Trapped exception %@", exception); + RCLOG_DEBUG(@"Trapped exception %@", exception); if(g_isEnabled) { thread_act_array_t threads = NULL; @@ -67,7 +67,7 @@ static void handleException(NSException* exception, BOOL currentSnapshotUserRepo rcmc_suspendEnvironment(&threads, &numThreads); rcm_notifyFatalExceptionCaptured(false); - RollbarCrashLOG_DEBUG(@"Filling out context."); + RCLOG_DEBUG(@"Filling out context."); NSArray* addresses = [exception callStackReturnAddresses]; NSUInteger numFrames = addresses.count; uintptr_t* callstack = malloc(numFrames * sizeof(*callstack)); @@ -96,7 +96,7 @@ static void handleException(NSException* exception, BOOL currentSnapshotUserRepo crashContext->stackCursor = &cursor; crashContext->currentSnapshotUserReported = currentSnapshotUserReported; - RollbarCrashLOG_DEBUG(@"Calling main crash handler."); + RCLOG_DEBUG(@"Calling main crash handler."); rcm_handleException(crashContext); free(callstack); @@ -105,7 +105,7 @@ static void handleException(NSException* exception, BOOL currentSnapshotUserRepo } if (g_previousUncaughtExceptionHandler != NULL) { - RollbarCrashLOG_DEBUG(@"Calling original exception handler."); + RCLOG_DEBUG(@"Calling original exception handler."); g_previousUncaughtExceptionHandler(exception); } } @@ -130,17 +130,17 @@ static void setEnabled(bool isEnabled) g_isEnabled = isEnabled; if(isEnabled) { - RollbarCrashLOG_DEBUG(@"Backing up original handler."); + RCLOG_DEBUG(@"Backing up original handler."); g_previousUncaughtExceptionHandler = NSGetUncaughtExceptionHandler(); - RollbarCrashLOG_DEBUG(@"Setting new handler."); + RCLOG_DEBUG(@"Setting new handler."); NSSetUncaughtExceptionHandler(&handleUncaughtException); RollbarCrash.sharedInstance.uncaughtExceptionHandler = &handleUncaughtException; RollbarCrash.sharedInstance.currentSnapshotUserReportedExceptionHandler = &handleCurrentSnapshotUserReportedException; } else { - RollbarCrashLOG_DEBUG(@"Restoring original handler."); + RCLOG_DEBUG(@"Restoring original handler."); NSSetUncaughtExceptionHandler(g_previousUncaughtExceptionHandler); } } diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_Signal.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_Signal.c index 35b4e410..75ca1158 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_Signal.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_Signal.c @@ -81,7 +81,7 @@ static char g_eventID[37]; */ static void handleSignal(int sigNum, siginfo_t* signalInfo, void* userContext) { - RollbarCrashLOG_DEBUG("Trapped signal %d", sigNum); + RCLOG_DEBUG("Trapped signal %d", sigNum); if(g_isEnabled) { thread_act_array_t threads = NULL; @@ -89,7 +89,7 @@ static void handleSignal(int sigNum, siginfo_t* signalInfo, void* userContext) rcmc_suspendEnvironment(&threads, &numThreads); rcm_notifyFatalExceptionCaptured(false); - RollbarCrashLOG_DEBUG("Filling out context."); + RCLOG_DEBUG("Filling out context."); RollbarCrashMC_NEW_CONTEXT(machineContext); rcmc_getContextForSignal(userContext, machineContext); rcsc_initWithMachineContext(&g_stackCursor, RollbarCrashSC_MAX_STACK_DEPTH, machineContext); @@ -110,7 +110,7 @@ static void handleSignal(int sigNum, siginfo_t* signalInfo, void* userContext) rcmc_resumeEnvironment(threads, numThreads); } - RollbarCrashLOG_DEBUG("Re-raising signal for regular handlers to catch."); + RCLOG_DEBUG("Re-raising signal for regular handlers to catch."); raise(sigNum); } @@ -121,21 +121,21 @@ static void handleSignal(int sigNum, siginfo_t* signalInfo, void* userContext) static bool installSignalHandler() { - RollbarCrashLOG_DEBUG("Installing signal handler."); + RCLOG_DEBUG("Installing signal handler."); #if RollbarCrashCRASH_HAS_SIGNAL_STACK if(g_signalStack.ss_size == 0) { - RollbarCrashLOG_DEBUG("Allocating signal stack area."); + RCLOG_DEBUG("Allocating signal stack area."); g_signalStack.ss_size = SIGSTKSZ; g_signalStack.ss_sp = malloc(g_signalStack.ss_size); } - RollbarCrashLOG_DEBUG("Setting signal stack area."); + RCLOG_DEBUG("Setting signal stack area."); if(sigaltstack(&g_signalStack, NULL) != 0) { - RollbarCrashLOG_ERROR("signalstack: %s", strerror(errno)); + RCLOG_ERROR("signalstack: %s", strerror(errno)); goto failed; } #endif @@ -145,7 +145,7 @@ static bool installSignalHandler() if(g_previousSignalHandlers == NULL) { - RollbarCrashLOG_DEBUG("Allocating memory to store previous signal handlers."); + RCLOG_DEBUG("Allocating memory to store previous signal handlers."); g_previousSignalHandlers = malloc(sizeof(*g_previousSignalHandlers) * (unsigned)fatalSignalsCount); } @@ -160,7 +160,7 @@ static bool installSignalHandler() for(int i = 0; i < fatalSignalsCount; i++) { - RollbarCrashLOG_DEBUG("Assigning handler for signal %d", fatalSignals[i]); + RCLOG_DEBUG("Assigning handler for signal %d", fatalSignals[i]); if(sigaction(fatalSignals[i], &action, &g_previousSignalHandlers[i]) != 0) { char sigNameBuff[30]; @@ -170,7 +170,7 @@ static bool installSignalHandler() snprintf(sigNameBuff, sizeof(sigNameBuff), "%d", fatalSignals[i]); sigName = sigNameBuff; } - RollbarCrashLOG_ERROR("sigaction (%s): %s", sigName, strerror(errno)); + RCLOG_ERROR("sigaction (%s): %s", sigName, strerror(errno)); // Try to reverse the damage for(i--;i >= 0; i--) { @@ -179,31 +179,31 @@ static bool installSignalHandler() goto failed; } } - RollbarCrashLOG_DEBUG("Signal handlers installed."); + RCLOG_DEBUG("Signal handlers installed."); return true; failed: - RollbarCrashLOG_DEBUG("Failed to install signal handlers."); + RCLOG_DEBUG("Failed to install signal handlers."); return false; } static void uninstallSignalHandler(void) { - RollbarCrashLOG_DEBUG("Uninstalling signal handlers."); + RCLOG_DEBUG("Uninstalling signal handlers."); const int* fatalSignals = rcsignal_fatalSignals(); int fatalSignalsCount = rcsignal_numFatalSignals(); for(int i = 0; i < fatalSignalsCount; i++) { - RollbarCrashLOG_DEBUG("Restoring original handler for signal %d", fatalSignals[i]); + RCLOG_DEBUG("Restoring original handler for signal %d", fatalSignals[i]); sigaction(fatalSignals[i], &g_previousSignalHandlers[i], NULL); } #if RollbarCrashCRASH_HAS_SIGNAL_STACK g_signalStack = (stack_t){0}; #endif - RollbarCrashLOG_DEBUG("Signal handlers uninstalled."); + RCLOG_DEBUG("Signal handlers uninstalled."); } static void setEnabled(bool isEnabled) diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_System.m b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_System.m index 36f0d9cd..b9a221ca 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_System.m +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_System.m @@ -171,7 +171,7 @@ static bool VMStats(vm_statistics_data_t* const vmStats, vm_size_t* const pageSi if((kr = host_page_size(hostPort, pageSize)) != KERN_SUCCESS) { - RollbarCrashLOG_ERROR(@"host_page_size: %s", mach_error_string(kr)); + RCLOG_ERROR(@"host_page_size: %s", mach_error_string(kr)); return false; } @@ -182,7 +182,7 @@ static bool VMStats(vm_statistics_data_t* const vmStats, vm_size_t* const pageSi &hostSize); if(kr != KERN_SUCCESS) { - RollbarCrashLOG_ERROR(@"host_statistics: %s", mach_error_string(kr)); + RCLOG_ERROR(@"host_statistics: %s", mach_error_string(kr)); return false; } diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_User.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_User.c index 4a0d292f..9f228e1f 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_User.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_User.c @@ -50,7 +50,7 @@ void rcm_reportUserException(const char* name, { if(!g_isEnabled) { - RollbarCrashLOG_WARN("User-reported exception monitor is not installed. Exception has not been recorded."); + RCLOG_WARN("User-reported exception monitor is not installed. Exception has not been recorded."); } else { @@ -73,7 +73,7 @@ void rcm_reportUserException(const char* name, rcsc_initSelfThread(&stackCursor, 0); - RollbarCrashLOG_DEBUG("Filling out context."); + RCLOG_DEBUG("Filling out context."); RollbarCrash_MonitorContext context; memset(&context, 0, sizeof(context)); context.crashType = RollbarCrashMonitorTypeUserReported; diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_Zombie.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_Zombie.c index aa36d269..0bf65180 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_Zombie.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Monitors/RollbarCrashMonitor_Zombie.c @@ -84,22 +84,22 @@ static bool copyStringIvar(const void* self, const char* ivarName, char* buffer, } else { - RollbarCrashLOG_DEBUG("rcobjc_copyStringContents %s failed", ivarName); + RCLOG_DEBUG("rcobjc_copyStringContents %s failed", ivarName); } } else { - RollbarCrashLOG_DEBUG("rcobjc_isValidObject %s failed", ivarName); + RCLOG_DEBUG("rcobjc_isValidObject %s failed", ivarName); } } else { - RollbarCrashLOG_DEBUG("rcobjc_ivarValue %s failed", ivarName); + RCLOG_DEBUG("rcobjc_ivarValue %s failed", ivarName); } } else { - RollbarCrashLOG_DEBUG("rcobjc_ivarNamed %s failed", ivarName); + RCLOG_DEBUG("rcobjc_ivarNamed %s failed", ivarName); } return false; } @@ -161,7 +161,7 @@ static void install() g_zombieCache = calloc(cacheSize, sizeof(*g_zombieCache)); if(g_zombieCache == NULL) { - RollbarCrashLOG_ERROR("Error: Could not allocate %u bytes of memory. RollbarCrashZombie NOT installed!", + RCLOG_ERROR("Error: Could not allocate %u bytes of memory. RollbarCrashZombie NOT installed!", cacheSize * sizeof(*g_zombieCache)); return; } diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrash.m b/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrash.m index 6d6ef6f7..af7d7991 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrash.m +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrash.m @@ -75,13 +75,13 @@ @interface RollbarCrash () YES); if([directories count] == 0) { - RollbarCrashLOG_ERROR(@"Could not locate cache directory path."); + RCLOG_ERROR(@"Could not locate cache directory path."); return nil; } NSString* cachePath = [directories objectAtIndex:0]; if([cachePath length] == 0) { - RollbarCrashLOG_ERROR(@"Could not locate cache directory path."); + RCLOG_ERROR(@"Could not locate cache directory path."); return nil; } NSString* pathEnd = [@"RollbarCrash" stringByAppendingPathComponent:getBundleName()]; @@ -152,7 +152,7 @@ - (id) initWithBasePath:(NSString *)basePath self.basePath = basePath; if(self.basePath == nil) { - RollbarCrashLOG_ERROR(@"Failed to initialize crash handler. Crash reporting disabled."); + RCLOG_ERROR(@"Failed to initialize crash handler. Crash reporting disabled."); return nil; } self.deleteBehaviorAfterSendAll = RollbarCrashDeleteAlways; @@ -188,7 +188,7 @@ - (void) setUserInfo:(NSDictionary*) userInfo error:&error]]; if(error != NULL) { - RollbarCrashLOG_ERROR(@"Could not serialize user info: %@", error); + RCLOG_ERROR(@"Could not serialize user info: %@", error); return; } } @@ -329,15 +329,15 @@ - (void) sendAllReportsWithCompletion:(RollbarCrashReportFilterCompletion) onCom { NSArray* reports = [self allReports]; - RollbarCrashLOG_INFO(@"Sending %d crash reports", [reports count]); + RCLOG_INFO(@"Sending %d crash reports", [reports count]); [self sendReports:reports onCompletion:^(NSArray* filteredReports, BOOL completed, NSError* error) { - RollbarCrashLOG_DEBUG(@"Process finished with completion: %d", completed); + RCLOG_DEBUG(@"Process finished with completion: %d", completed); if(error != nil) { - RollbarCrashLOG_ERROR(@"Failed to send reports: %@", error); + RCLOG_ERROR(@"Failed to send reports: %@", error); } if((self.deleteBehaviorAfterSendAll == RollbarCrashDeleteOnSucess && completed) || self.deleteBehaviorAfterSendAll == RollbarCrashDeleteAlways) @@ -378,7 +378,7 @@ - (void) reportUserException:(NSString*) name NSData* jsonData = [RollbarCrashJSONCodec encode:stackTrace options:0 error:&error]; if(jsonData == nil || error != nil) { - RollbarCrashLOG_ERROR(@"Error encoding stack trace to JSON: %@", error); + RCLOG_ERROR(@"Error encoding stack trace to JSON: %@", error); // Don't return, since we can still record other useful information. } NSString* jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]; @@ -505,11 +505,11 @@ - (NSDictionary*) reportWithIntID:(int64_t) reportID error:&error]; if(error != nil) { - RollbarCrashLOG_ERROR(@"Encountered error loading crash report %" PRIx64 ": %@", reportID, error); + RCLOG_ERROR(@"Encountered error loading crash report %" PRIx64 ": %@", reportID, error); } if(crashReport == nil) { - RollbarCrashLOG_ERROR(@"Could not load crash report"); + RCLOG_ERROR(@"Could not load crash report"); return nil; } [self doctorReport:crashReport]; diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashC.c b/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashC.c index 1c58d63a..dd4ebafa 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashC.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashC.c @@ -96,7 +96,7 @@ static void printPreviousLog(const char* filePath) static void notifyOfBeforeInstallationState(void) { - RollbarCrashLOG_DEBUG("Notifying of pre-installation state"); + RCLOG_DEBUG("Notifying of pre-installation state"); switch (g_lastApplicationState) { case RollbarCrashApplicationStateDidBecomeActive: @@ -125,7 +125,7 @@ static void notifyOfBeforeInstallationState(void) static void onCrash(struct RollbarCrash_MonitorContext* monitorContext) { if (monitorContext->currentSnapshotUserReported == false) { - RollbarCrashLOG_DEBUG("Updating application state to note crash."); + RCLOG_DEBUG("Updating application state to note crash."); rcstate_notifyAppCrash(); } monitorContext->consoleLogPath = g_shouldAddConsoleLogToReport ? g_consoleLogPath : NULL; @@ -155,11 +155,11 @@ static void onCrash(struct RollbarCrash_MonitorContext* monitorContext) RollbarCrashMonitorType rc_install(const char* appName, const char* const installPath) { - RollbarCrashLOG_DEBUG("Installing crash reporter."); + RCLOG_DEBUG("Installing crash reporter."); if(g_installed) { - RollbarCrashLOG_DEBUG("Crash reporter already installed."); + RCLOG_DEBUG("Crash reporter already installed."); return g_monitoring; } g_installed = 1; @@ -186,7 +186,7 @@ RollbarCrashMonitorType rc_install(const char* appName, const char* const instal rcm_setEventCallback(onCrash); RollbarCrashMonitorType monitors = rc_setMonitoring(g_monitoring); - RollbarCrashLOG_DEBUG("Installation complete."); + RCLOG_DEBUG("Installation complete."); notifyOfBeforeInstallationState(); @@ -339,21 +339,21 @@ char* rc_readReport(int64_t reportID) { if(reportID <= 0) { - RollbarCrashLOG_ERROR("Report ID was %" PRIx64, reportID); + RCLOG_ERROR("Report ID was %" PRIx64, reportID); return NULL; } char* rawReport = rccrs_readReport(reportID); if(rawReport == NULL) { - RollbarCrashLOG_ERROR("Failed to load report ID %" PRIx64, reportID); + RCLOG_ERROR("Failed to load report ID %" PRIx64, reportID); return NULL; } char* fixedReport = rccrf_fixupCrashReport(rawReport); if(fixedReport == NULL) { - RollbarCrashLOG_ERROR("Failed to fixup report ID %" PRIx64, reportID); + RCLOG_ERROR("Failed to fixup report ID %" PRIx64, reportID); } free(rawReport); diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashCachedData.c b/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashCachedData.c index cb11772a..81e128a3 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashCachedData.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashCachedData.c @@ -69,7 +69,7 @@ static void updateThreadList() kern_return_t kr; if((kr = task_threads(thisTask, &threads, &allThreadsCount)) != KERN_SUCCESS) { - RollbarCrashLOG_ERROR("task_threads: %s", mach_error_string(kr)); + RCLOG_ERROR("task_threads: %s", mach_error_string(kr)); return; } @@ -180,7 +180,7 @@ void rcccd_init(int pollingIntervalInSeconds) "RollbarCrash Cached Data Monitor"); if(error != 0) { - RollbarCrashLOG_ERROR("pthread_create_suspended_np: %s", strerror(error)); + RCLOG_ERROR("pthread_create_suspended_np: %s", strerror(error)); } pthread_attr_destroy(&attr); } diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashReport.c b/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashReport.c index be66d0eb..f5323963 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashReport.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashReport.c @@ -148,13 +148,13 @@ static void addTextFileElement(const RollbarCrashReportWriter* const writer, con const int fd = open(filePath, O_RDONLY); if(fd < 0) { - RollbarCrashLOG_ERROR("Could not open file %s: %s", filePath, strerror(errno)); + RCLOG_ERROR("Could not open file %s: %s", filePath, strerror(errno)); return; } if(rcjson_beginStringElement(getJsonContext(writer), key) != RollbarCrashJSON_OK) { - RollbarCrashLOG_ERROR("Could not start string element"); + RCLOG_ERROR("Could not start string element"); goto done; } @@ -166,7 +166,7 @@ static void addTextFileElement(const RollbarCrashReportWriter* const writer, con { if(rcjson_appendStringElement(getJsonContext(writer), buffer, bytesRead) != RollbarCrashJSON_OK) { - RollbarCrashLOG_ERROR("Could not append string element"); + RCLOG_ERROR("Could not append string element"); goto done; } } @@ -635,7 +635,7 @@ static void writeUnknownObjectContents(const RollbarCrashReportWriter* const wri writeMemoryContents(writer, ivar->name, (uintptr_t)pointer, limit); break; default: - RollbarCrashLOG_DEBUG("%s: Unknown ivar type [%s]", ivar->name, ivar->type); + RCLOG_DEBUG("%s: Unknown ivar type [%s]", ivar->name, ivar->type); } } } @@ -1177,7 +1177,7 @@ static void writeThread(const RollbarCrashReportWriter* const writer, { bool isCrashedThread = rcmc_isCrashedContext(machineContext); RollbarCrashThread thread = rcmc_getThreadFromContext(machineContext); - RollbarCrashLOG_DEBUG("Writing thread %x (index %d). is crashed: %d", thread, threadIndex, isCrashedThread); + RCLOG_DEBUG("Writing thread %x (index %d). is crashed: %d", thread, threadIndex, isCrashedThread); RollbarCrashStackCursor stackCursor; bool hasBacktrace = getStackCursor(crash, machineContext, &stackCursor); @@ -1238,7 +1238,7 @@ static void writeAllThreads(const RollbarCrashReportWriter* const writer, // Fetch info for all threads. writer->beginArray(writer, key); { - RollbarCrashLOG_DEBUG("Writing %d threads.", threadCount); + RCLOG_DEBUG("Writing %d threads.", threadCount); for(int i = 0; i < threadCount; i++) { RollbarCrashThread thread = rcmc_getThreadAtIndex(context, i); @@ -1457,7 +1457,7 @@ static void writeError(const RollbarCrashReportWriter* const writer, case RollbarCrashMonitorTypeSystem: case RollbarCrashMonitorTypeApplicationState: case RollbarCrashMonitorTypeZombie: - RollbarCrashLOG_ERROR("Crash monitor type 0x%x shouldn't be able to cause events!", crash->crashType); + RCLOG_ERROR("Crash monitor type 0x%x shouldn't be able to cause events!", crash->crashType); break; } } @@ -1601,11 +1601,11 @@ void rcreport_writeRecrashReport(const RollbarCrash_MonitorContext* const monito static char tempPath[RollbarCrashFU_MAX_PATH_LENGTH]; strncpy(tempPath, path, sizeof(tempPath) - 10); strncpy(tempPath + strlen(tempPath) - 5, ".old", 5); - RollbarCrashLOG_INFO("Writing recrash report to %s", path); + RCLOG_INFO("Writing recrash report to %s", path); if(rename(path, tempPath) < 0) { - RollbarCrashLOG_ERROR("Could not rename %s to %s: %s", path, tempPath, strerror(errno)); + RCLOG_ERROR("Could not rename %s to %s: %s", path, tempPath, strerror(errno)); } if(!rcfu_openBufferedWriter(&bufferedWriter, path, writeBuffer, sizeof(writeBuffer))) { @@ -1628,7 +1628,7 @@ void rcreport_writeRecrashReport(const RollbarCrash_MonitorContext* const monito rcfu_flushBufferedWriter(&bufferedWriter); if(remove(tempPath) < 0) { - RollbarCrashLOG_ERROR("Could not remove %s: %s", tempPath, strerror(errno)); + RCLOG_ERROR("Could not remove %s: %s", tempPath, strerror(errno)); } writeReportInfo(writer, RollbarCrashField_Report, @@ -1719,7 +1719,7 @@ static void writeDebugInfo(const RollbarCrashReportWriter* const writer, void rcreport_writeStandardReport(const RollbarCrash_MonitorContext* const monitorContext, const char* const path) { - RollbarCrashLOG_INFO("Writing crash report to %s", path); + RCLOG_INFO("Writing crash report to %s", path); char writeBuffer[1024]; RollbarCrashBufferedWriter bufferedWriter; @@ -1801,7 +1801,7 @@ void rcreport_writeStandardReport(const RollbarCrash_MonitorContext* const monit void rcreport_setUserInfoJSON(const char* const userInfoJSON) { static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; - RollbarCrashLOG_TRACE("set userInfoJSON to %p", userInfoJSON); + RCLOG_TRACE("set userInfoJSON to %p", userInfoJSON); pthread_mutex_lock(&mutex); if(g_userInfoJSON != NULL) @@ -1837,7 +1837,7 @@ void rcreport_setDoNotIntrospectClasses(const char** doNotIntrospectClasses, int newClasses = malloc(sizeof(*newClasses) * (unsigned)newClassesLength); if(newClasses == NULL) { - RollbarCrashLOG_ERROR("Could not allocate memory"); + RCLOG_ERROR("Could not allocate memory"); return; } @@ -1862,6 +1862,6 @@ void rcreport_setDoNotIntrospectClasses(const char** doNotIntrospectClasses, int void rcreport_setUserSectionWriteCallback(const RollbarCrashReportWriteCallback userSectionWriteCallback) { - RollbarCrashLOG_TRACE("Set userSectionWriteCallback to %p", userSectionWriteCallback); + RCLOG_TRACE("Set userSectionWriteCallback to %p", userSectionWriteCallback); g_userSectionWriteCallback = userSectionWriteCallback; } diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashReportFixer.c b/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashReportFixer.c index 0bb8ed52..d5eae02d 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashReportFixer.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashReportFixer.c @@ -314,7 +314,7 @@ char* rccrf_fixupCrashReport(const char* crashReport) free(stringBuffer); if(result != RollbarCrashJSON_OK) { - RollbarCrashLOG_ERROR("Could not decode report: %s", rcjson_stringForError(result)); + RCLOG_ERROR("Could not decode report: %s", rcjson_stringForError(result)); free(fixedReport); return NULL; } diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashReportStore.c b/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashReportStore.c index e6bea7a4..e84c0b96 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashReportStore.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/RollbarCrashReportStore.c @@ -88,7 +88,7 @@ static int getReportCount() DIR* dir = opendir(g_reportsPath); if(dir == NULL) { - RollbarCrashLOG_ERROR("Could not open directory %s", g_reportsPath); + RCLOG_ERROR("Could not open directory %s", g_reportsPath); goto done; } struct dirent* ent; @@ -114,7 +114,7 @@ static int getReportIDs(int64_t* reportIDs, int count) DIR* dir = opendir(g_reportsPath); if(dir == NULL) { - RollbarCrashLOG_ERROR("Could not open directory %s", g_reportsPath); + RCLOG_ERROR("Could not open directory %s", g_reportsPath); goto done; } @@ -231,19 +231,19 @@ int64_t rccrs_addUserReport(const char* report, int reportLength) int fd = open(crashReportPath, O_WRONLY | O_CREAT, 0644); if(fd < 0) { - RollbarCrashLOG_ERROR("Could not open file %s: %s", crashReportPath, strerror(errno)); + RCLOG_ERROR("Could not open file %s: %s", crashReportPath, strerror(errno)); goto done; } int bytesWritten = (int)write(fd, report, (unsigned)reportLength); if(bytesWritten < 0) { - RollbarCrashLOG_ERROR("Could not write to file %s: %s", crashReportPath, strerror(errno)); + RCLOG_ERROR("Could not write to file %s: %s", crashReportPath, strerror(errno)); goto done; } else if(bytesWritten < reportLength) { - RollbarCrashLOG_ERROR("Expected to write %d bytes to file %s, but only wrote %d", crashReportPath, reportLength, bytesWritten); + RCLOG_ERROR("Expected to write %d bytes to file %s, but only wrote %d", crashReportPath, reportLength, bytesWritten); } done: diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU.c index 6cb5d055..79e88623 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU.c @@ -48,14 +48,14 @@ bool rccpu_i_fillState(const thread_t thread, const thread_state_flavor_t flavor, const mach_msg_type_number_t stateCount) { - RollbarCrashLOG_TRACE("Filling thread state with flavor %x.", flavor); + RCLOG_TRACE("Filling thread state with flavor %x.", flavor); mach_msg_type_number_t stateCountBuff = stateCount; kern_return_t kr; kr = thread_get_state(thread, flavor, state, &stateCountBuff); if(kr != KERN_SUCCESS) { - RollbarCrashLOG_ERROR("thread_get_state: %s", mach_error_string(kr)); + RCLOG_ERROR("thread_get_state: %s", mach_error_string(kr)); return false; } return true; diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU_arm.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU_arm.c index 86edeb29..39b68fc0 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU_arm.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU_arm.c @@ -113,7 +113,7 @@ uint64_t rccpu_registerValue(const RollbarCrashMachineContext* const context, co case 16: return context->machineContext.__ss.__cpsr; } - RollbarCrashLOG_ERROR("Invalid register number: %d", regNumber); + RCLOG_ERROR("Invalid register number: %d", regNumber); return 0; } @@ -128,7 +128,7 @@ const char* rccpu_exceptionRegisterName(const int regNumber) { return g_exceptionRegisterNames[regNumber]; } - RollbarCrashLOG_ERROR("Invalid register number: %d", regNumber); + RCLOG_ERROR("Invalid register number: %d", regNumber); return NULL; } @@ -144,7 +144,7 @@ uint64_t rccpu_exceptionRegisterValue(const RollbarCrashMachineContext* const co return context->machineContext.__es.__far; } - RollbarCrashLOG_ERROR("Invalid register number: %d", regNumber); + RCLOG_ERROR("Invalid register number: %d", regNumber); return 0; } diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU_arm64.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU_arm64.c index 7054cd5f..81142469 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU_arm64.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU_arm64.c @@ -117,7 +117,7 @@ uint64_t rccpu_registerValue(const RollbarCrashMachineContext* const context, co case 34: return context->machineContext.__ss.__cpsr; } - RollbarCrashLOG_ERROR("Invalid register number: %d", regNumber); + RCLOG_ERROR("Invalid register number: %d", regNumber); return 0; } @@ -132,7 +132,7 @@ const char* rccpu_exceptionRegisterName(const int regNumber) { return g_exceptionRegisterNames[regNumber]; } - RollbarCrashLOG_ERROR("Invalid register number: %d", regNumber); + RCLOG_ERROR("Invalid register number: %d", regNumber); return NULL; } @@ -148,7 +148,7 @@ uint64_t rccpu_exceptionRegisterValue(const RollbarCrashMachineContext* const co return context->machineContext.__es.__far; } - RollbarCrashLOG_ERROR("Invalid register number: %d", regNumber); + RCLOG_ERROR("Invalid register number: %d", regNumber); return 0; } diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU_x86_32.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU_x86_32.c index 459e1b3d..0c829376 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU_x86_32.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU_x86_32.c @@ -139,7 +139,7 @@ uint64_t rccpu_registerValue(const RollbarCrashMachineContext* const context, co return context->machineContext.__ss.__gs; } - RollbarCrashLOG_ERROR("Invalid register number: %d", regNumber); + RCLOG_ERROR("Invalid register number: %d", regNumber); return 0; } @@ -154,7 +154,7 @@ const char* rccpu_exceptionRegisterName(const int regNumber) { return g_exceptionRegisterNames[regNumber]; } - RollbarCrashLOG_ERROR("Invalid register number: %d", regNumber); + RCLOG_ERROR("Invalid register number: %d", regNumber); return NULL; } @@ -170,7 +170,7 @@ uint64_t rccpu_exceptionRegisterValue(const RollbarCrashMachineContext* const co return context->machineContext.__es.__faultvaddr; } - RollbarCrashLOG_ERROR("Invalid register number: %d", regNumber); + RCLOG_ERROR("Invalid register number: %d", regNumber); return 0; } diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU_x86_64.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU_x86_64.c index 54d738dc..81dc5c25 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU_x86_64.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashCPU_x86_64.c @@ -151,7 +151,7 @@ uint64_t rccpu_registerValue(const RollbarCrashMachineContext* const context, co return context->machineContext.__ss.__gs; } - RollbarCrashLOG_ERROR("Invalid register number: %d", regNumber); + RCLOG_ERROR("Invalid register number: %d", regNumber); return 0; } @@ -166,7 +166,7 @@ const char* rccpu_exceptionRegisterName(const int regNumber) { return g_exceptionRegisterNames[regNumber]; } - RollbarCrashLOG_ERROR("Invalid register number: %d", regNumber); + RCLOG_ERROR("Invalid register number: %d", regNumber); return NULL; } @@ -182,7 +182,7 @@ uint64_t rccpu_exceptionRegisterValue(const RollbarCrashMachineContext* const co return context->machineContext.__es.__faultvaddr; } - RollbarCrashLOG_ERROR("Invalid register number: %d", regNumber); + RCLOG_ERROR("Invalid register number: %d", regNumber); return 0; } diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashDebug.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashDebug.c index dd862a3f..0fed6b77 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashDebug.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashDebug.c @@ -48,7 +48,7 @@ bool rcdebug_isBeingTraced(void) if(sysctl(mib, sizeof(mib)/sizeof(*mib), &procInfo, &structSize, NULL, 0) != 0) { - RollbarCrashLOG_ERROR("sysctl: %s", strerror(errno)); + RCLOG_ERROR("sysctl: %s", strerror(errno)); return false; } diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashDynamicLinker.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashDynamicLinker.c index 2a5ea4ea..d3355c98 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashDynamicLinker.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashDynamicLinker.c @@ -348,37 +348,37 @@ static void getCrashInfo(const struct mach_header* header, RollbarCrashBinaryIma return; } - RollbarCrashLOG_TRACE("Found crash info section in binary: %s", buffer->name); + RCLOG_TRACE("Found crash info section in binary: %s", buffer->name); const unsigned int minimalSize = offsetof(crash_info_t, reserved); // Include message and message2 if(size < minimalSize) { - RollbarCrashLOG_TRACE("Skipped reading crash info: section is too small"); + RCLOG_TRACE("Skipped reading crash info: section is too small"); return; } if(!rcmem_isMemoryReadable(crashInfo, minimalSize)) { - RollbarCrashLOG_TRACE("Skipped reading crash info: section memory is not readable"); + RCLOG_TRACE("Skipped reading crash info: section memory is not readable"); return; } if(crashInfo->version != 4 && crashInfo->version != 5) { - RollbarCrashLOG_TRACE("Skipped reading crash info: invalid version '%d'", crashInfo->version); + RCLOG_TRACE("Skipped reading crash info: invalid version '%d'", crashInfo->version); return; } if(crashInfo->message == NULL && crashInfo->message2 == NULL) { - RollbarCrashLOG_TRACE("Skipped reading crash info: both messages are null"); + RCLOG_TRACE("Skipped reading crash info: both messages are null"); return; } if(isValidCrashInfoMessage(crashInfo->message)) { - RollbarCrashLOG_DEBUG("Found first message: %s", crashInfo->message); + RCLOG_DEBUG("Found first message: %s", crashInfo->message); buffer->crashInfoMessage = crashInfo->message; } if(isValidCrashInfoMessage(crashInfo->message2)) { - RollbarCrashLOG_DEBUG("Found second message: %s", crashInfo->message2); + RCLOG_DEBUG("Found second message: %s", crashInfo->message2); buffer->crashInfoMessage2 = crashInfo->message2; } } diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashFileUtils.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashFileUtils.c index f74e6e21..4690ae4c 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashFileUtils.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashFileUtils.c @@ -80,7 +80,7 @@ static int dirContentsCount(const char* path) DIR* dir = opendir(path); if(dir == NULL) { - RollbarCrashLOG_ERROR("Error reading directory %s: %s", path, strerror(errno)); + RCLOG_ERROR("Error reading directory %s: %s", path, strerror(errno)); return 0; } @@ -106,7 +106,7 @@ static void dirContents(const char* path, char*** entries, int* count) dir = opendir(path); if(dir == NULL) { - RollbarCrashLOG_ERROR("Error reading directory %s: %s", path, strerror(errno)); + RCLOG_ERROR("Error reading directory %s: %s", path, strerror(errno)); goto done; } @@ -117,7 +117,7 @@ static void dirContents(const char* path, char*** entries, int* count) { if(index >= entryCount) { - RollbarCrashLOG_ERROR("Contents of %s have been mutated", path); + RCLOG_ERROR("Contents of %s have been mutated", path); goto done; } entryList[index] = strdup(ent->d_name); @@ -158,7 +158,7 @@ static bool deletePathContents(const char* path, bool deleteTopLevelPathAlso) struct stat statStruct = {0}; if(stat(path, &statStruct) != 0) { - RollbarCrashLOG_ERROR("Could not stat %s: %s", path, strerror(errno)); + RCLOG_ERROR("Could not stat %s: %s", path, strerror(errno)); return false; } if(S_ISDIR(statStruct.st_mode)) @@ -196,7 +196,7 @@ static bool deletePathContents(const char* path, bool deleteTopLevelPathAlso) } else { - RollbarCrashLOG_ERROR("Could not delete %s: Not a regular file.", path); + RCLOG_ERROR("Could not delete %s: Not a regular file.", path); return false; } return true; @@ -225,7 +225,7 @@ bool rcfu_writeBytesToFD(const int fd, const char* const bytes, int length) int bytesWritten = (int)write(fd, pos, (unsigned)length); if(bytesWritten == -1) { - RollbarCrashLOG_ERROR("Could not write to fd %d: %s", fd, strerror(errno)); + RCLOG_ERROR("Could not write to fd %d: %s", fd, strerror(errno)); return false; } length -= bytesWritten; @@ -242,7 +242,7 @@ bool rcfu_readBytesFromFD(const int fd, char* const bytes, int length) int bytesRead = (int)read(fd, pos, (unsigned)length); if(bytesRead == -1) { - RollbarCrashLOG_ERROR("Could not write to fd %d: %s", fd, strerror(errno)); + RCLOG_ERROR("Could not write to fd %d: %s", fd, strerror(errno)); return false; } length -= bytesRead; @@ -262,14 +262,14 @@ bool rcfu_readEntireFile(const char* const path, char** data, int* length, int m struct stat st; if(stat(path, &st) < 0) { - RollbarCrashLOG_ERROR("Could not stat %s: %s", path, strerror(errno)); + RCLOG_ERROR("Could not stat %s: %s", path, strerror(errno)); goto done; } fd = open(path, O_RDONLY); if(fd < 0) { - RollbarCrashLOG_ERROR("Could not open %s: %s", path, strerror(errno)); + RCLOG_ERROR("Could not open %s: %s", path, strerror(errno)); goto done; } @@ -281,7 +281,7 @@ bool rcfu_readEntireFile(const char* const path, char** data, int* length, int m { if(lseek(fd, -bytesToRead, SEEK_END) < 0) { - RollbarCrashLOG_ERROR("Could not seek to %d from end of %s: %s", -bytesToRead, path, strerror(errno)); + RCLOG_ERROR("Could not seek to %d from end of %s: %s", -bytesToRead, path, strerror(errno)); goto done; } } @@ -289,7 +289,7 @@ bool rcfu_readEntireFile(const char* const path, char** data, int* length, int m mem = malloc((unsigned)bytesToRead + 1); if(mem == NULL) { - RollbarCrashLOG_ERROR("Out of memory"); + RCLOG_ERROR("Out of memory"); goto done; } @@ -333,7 +333,7 @@ bool rcfu_writeStringToFD(const int fd, const char* const string) int bytesWritten = (int)write(fd, pos, (unsigned)bytesToWrite); if(bytesWritten == -1) { - RollbarCrashLOG_ERROR("Could not write to fd %d: %s", + RCLOG_ERROR("Could not write to fd %d: %s", fd, strerror(errno)); return false; } @@ -381,7 +381,7 @@ int rcfu_readLineFromFD(const int fd, char* const buffer, const int maxLength) int bytesRead = (int)read(fd, ch, 1); if(bytesRead < 0) { - RollbarCrashLOG_ERROR("Could not read from fd %d: %s", fd, strerror(errno)); + RCLOG_ERROR("Could not read from fd %d: %s", fd, strerror(errno)); return -1; } else if(bytesRead == 0 || *ch == '\n') @@ -404,7 +404,7 @@ bool rcfu_makePath(const char* absolutePath) *ptr = '\0'; if(mkdir(pathCopy, S_IRWXU) < 0 && errno != EEXIST) { - RollbarCrashLOG_ERROR("Could not create directory %s: %s", pathCopy, strerror(errno)); + RCLOG_ERROR("Could not create directory %s: %s", pathCopy, strerror(errno)); goto done; } *ptr = '/'; @@ -412,7 +412,7 @@ bool rcfu_makePath(const char* absolutePath) } if(mkdir(pathCopy, S_IRWXU) < 0 && errno != EEXIST) { - RollbarCrashLOG_ERROR("Could not create directory %s: %s", pathCopy, strerror(errno)); + RCLOG_ERROR("Could not create directory %s: %s", pathCopy, strerror(errno)); goto done; } isSuccessful = true; @@ -428,7 +428,7 @@ bool rcfu_removeFile(const char* path, bool mustExist) { if(mustExist || errno != ENOENT) { - RollbarCrashLOG_ERROR("Could not delete %s: %s", path, strerror(errno)); + RCLOG_ERROR("Could not delete %s: %s", path, strerror(errno)); } return false; } @@ -457,7 +457,7 @@ bool rcfu_openBufferedWriter(RollbarCrashBufferedWriter* writer, const char* con writer->fd = open(path, O_RDWR | O_CREAT | O_EXCL, 0644); if(writer->fd < 0) { - RollbarCrashLOG_ERROR("Could not open crash report file %s: %s", path, strerror(errno)); + RCLOG_ERROR("Could not open crash report file %s: %s", path, strerror(errno)); return false; } return true; @@ -523,7 +523,7 @@ static bool fillReadBuffer(RollbarCrashBufferedReader* reader) int bytesRead = (int)read(reader->fd, reader->buffer + reader->dataEndPos, (size_t)bytesToRead); if(bytesRead < 0) { - RollbarCrashLOG_ERROR("Could not read: %s", strerror(errno)); + RCLOG_ERROR("Could not read: %s", strerror(errno)); return false; } else @@ -621,7 +621,7 @@ bool rcfu_openBufferedReader(RollbarCrashBufferedReader* reader, const char* con reader->fd = open(path, O_RDONLY); if(reader->fd < 0) { - RollbarCrashLOG_ERROR("Could not open file %s: %s", path, strerror(errno)); + RCLOG_ERROR("Could not open file %s: %s", path, strerror(errno)); return false; } fillReadBuffer(reader); diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashJSONCodec.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashJSONCodec.c index b7f4230b..2dae5c69 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashJSONCodec.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashJSONCodec.c @@ -49,7 +49,7 @@ #if RollbarCrashJSONCODEC_UseRollbarCrashLogger #include "RollbarCrashLogger.h" #else - #define RollbarCrashLOG_DEBUG(FMT, ...) + #define RCLOG_DEBUG(FMT, ...) #endif /** The work buffer size to use when escaping string values. @@ -175,7 +175,7 @@ static int appendEscapedString(RollbarCrashJSONEncodeContext* const context, default: unlikely_if((unsigned char)*src < ' ') { - RollbarCrashLOG_DEBUG("Invalid character 0x%02x in string: %s", + RCLOG_DEBUG("Invalid character 0x%02x in string: %s", *src, string); return RollbarCrashJSON_ERROR_INVALID_CHARACTER; } @@ -287,7 +287,7 @@ int rcjson_beginElement(RollbarCrashJSONEncodeContext* const context, const char { unlikely_if(name == NULL) { - RollbarCrashLOG_DEBUG("Name was null inside an object"); + RCLOG_DEBUG("Name was null inside an object"); return RollbarCrashJSON_ERROR_INVALID_DATA; } unlikely_if((result = addQuotedEscapedString(context, name, (int)strlen(name))) != RollbarCrashJSON_OK) @@ -732,7 +732,7 @@ static int writeUTF8(unsigned int character, char** dst) } // If we get here, the character cannot be converted to valid UTF-8. - RollbarCrashLOG_DEBUG("Invalid unicode: 0x%04x", character); + RCLOG_DEBUG("Invalid unicode: 0x%04x", character); return RollbarCrashJSON_ERROR_INVALID_CHARACTER; } @@ -741,7 +741,7 @@ static int decodeString(RollbarCrashJSONDecodeContext* context, char* dstBuffer, *dstBuffer = '\0'; unlikely_if(*context->bufferPtr != '\"') { - RollbarCrashLOG_DEBUG("Expected '\"' but got '%c'", *context->bufferPtr); + RCLOG_DEBUG("Expected '\"' but got '%c'", *context->bufferPtr); return RollbarCrashJSON_ERROR_INVALID_CHARACTER; } @@ -758,7 +758,7 @@ static int decodeString(RollbarCrashJSONDecodeContext* context, char* dstBuffer, } unlikely_if(src >= context->bufferEnd) { - RollbarCrashLOG_DEBUG("Premature end of data"); + RCLOG_DEBUG("Premature end of data"); return RollbarCrashJSON_ERROR_INCOMPLETE; } const char* srcEnd = src; @@ -766,7 +766,7 @@ static int decodeString(RollbarCrashJSONDecodeContext* context, char* dstBuffer, int length = (int)(srcEnd - src); if(length >= dstBufferLength) { - RollbarCrashLOG_DEBUG("String is too long"); + RCLOG_DEBUG("String is too long"); return RollbarCrashJSON_ERROR_DATA_TOO_LONG; } @@ -821,7 +821,7 @@ static int decodeString(RollbarCrashJSONDecodeContext* context, char* dstBuffer, { unlikely_if(src + 5 > srcEnd) { - RollbarCrashLOG_DEBUG("Premature end of data"); + RCLOG_DEBUG("Premature end of data"); return RollbarCrashJSON_ERROR_INCOMPLETE; } unsigned int accum = @@ -831,7 +831,7 @@ static int decodeString(RollbarCrashJSONDecodeContext* context, char* dstBuffer, g_hexConversion[src[4]]; unlikely_if(accum > 0xffff) { - RollbarCrashLOG_DEBUG("Invalid unicode sequence: %c%c%c%c", + RCLOG_DEBUG("Invalid unicode sequence: %c%c%c%c", src[1], src[2], src[3], src[4]); return RollbarCrashJSON_ERROR_INVALID_CHARACTER; } @@ -839,7 +839,7 @@ static int decodeString(RollbarCrashJSONDecodeContext* context, char* dstBuffer, // UTF-16 Trail surrogate on its own. unlikely_if(accum >= 0xdc00 && accum <= 0xdfff) { - RollbarCrashLOG_DEBUG("Unexpected trail surrogate: 0x%04x", + RCLOG_DEBUG("Unexpected trail surrogate: 0x%04x", accum); return RollbarCrashJSON_ERROR_INVALID_CHARACTER; } @@ -850,13 +850,13 @@ static int decodeString(RollbarCrashJSONDecodeContext* context, char* dstBuffer, // Fetch trail surrogate. unlikely_if(src + 11 > srcEnd) { - RollbarCrashLOG_DEBUG("Premature end of data"); + RCLOG_DEBUG("Premature end of data"); return RollbarCrashJSON_ERROR_INCOMPLETE; } unlikely_if(src[5] != '\\' || src[6] != 'u') { - RollbarCrashLOG_DEBUG("Expected \"\\u\" but got: \"%c%c\"", + RCLOG_DEBUG("Expected \"\\u\" but got: \"%c%c\"", src[5], src[6]); return RollbarCrashJSON_ERROR_INVALID_CHARACTER; } @@ -868,7 +868,7 @@ static int decodeString(RollbarCrashJSONDecodeContext* context, char* dstBuffer, g_hexConversion[src[4]]; unlikely_if(accum2 < 0xdc00 || accum2 > 0xdfff) { - RollbarCrashLOG_DEBUG("Invalid trail surrogate: 0x%04x", + RCLOG_DEBUG("Invalid trail surrogate: 0x%04x", accum2); return RollbarCrashJSON_ERROR_INVALID_CHARACTER; } @@ -885,7 +885,7 @@ static int decodeString(RollbarCrashJSONDecodeContext* context, char* dstBuffer, continue; } default: - RollbarCrashLOG_DEBUG("Invalid control character '%c'", *src); + RCLOG_DEBUG("Invalid control character '%c'", *src); return RollbarCrashJSON_ERROR_INVALID_CHARACTER; } } @@ -900,7 +900,7 @@ static int decodeElement(const char* const name, RollbarCrashJSONDecodeContext* SKIP_WHITESPACE(context); unlikely_if(context->bufferPtr >= context->bufferEnd) { - RollbarCrashLOG_DEBUG("Premature end of data"); + RCLOG_DEBUG("Premature end of data"); return RollbarCrashJSON_ERROR_INCOMPLETE; } @@ -938,7 +938,7 @@ static int decodeElement(const char* const name, RollbarCrashJSONDecodeContext* context->bufferPtr++; } } - RollbarCrashLOG_DEBUG("Premature end of data"); + RCLOG_DEBUG("Premature end of data"); return RollbarCrashJSON_ERROR_INCOMPLETE; } case '{': @@ -967,7 +967,7 @@ static int decodeElement(const char* const name, RollbarCrashJSONDecodeContext* } unlikely_if(*context->bufferPtr != ':') { - RollbarCrashLOG_DEBUG("Expected ':' but got '%c'", *context->bufferPtr); + RCLOG_DEBUG("Expected ':' but got '%c'", *context->bufferPtr); return RollbarCrashJSON_ERROR_INVALID_CHARACTER; } context->bufferPtr++; @@ -984,7 +984,7 @@ static int decodeElement(const char* const name, RollbarCrashJSONDecodeContext* context->bufferPtr++; } } - RollbarCrashLOG_DEBUG("Premature end of data"); + RCLOG_DEBUG("Premature end of data"); return RollbarCrashJSON_ERROR_INCOMPLETE; } case '\"': @@ -1000,7 +1000,7 @@ static int decodeElement(const char* const name, RollbarCrashJSONDecodeContext* { unlikely_if(context->bufferEnd - context->bufferPtr < 5) { - RollbarCrashLOG_DEBUG("Premature end of data"); + RCLOG_DEBUG("Premature end of data"); return RollbarCrashJSON_ERROR_INCOMPLETE; } unlikely_if(!(context->bufferPtr[1] == 'a' && @@ -1008,7 +1008,7 @@ static int decodeElement(const char* const name, RollbarCrashJSONDecodeContext* context->bufferPtr[3] == 's' && context->bufferPtr[4] == 'e')) { - RollbarCrashLOG_DEBUG("Expected \"false\" but got \"f%c%c%c%c\"", + RCLOG_DEBUG("Expected \"false\" but got \"f%c%c%c%c\"", context->bufferPtr[1], context->bufferPtr[2], context->bufferPtr[3], context->bufferPtr[4]); return RollbarCrashJSON_ERROR_INVALID_CHARACTER; } @@ -1019,14 +1019,14 @@ static int decodeElement(const char* const name, RollbarCrashJSONDecodeContext* { unlikely_if(context->bufferEnd - context->bufferPtr < 4) { - RollbarCrashLOG_DEBUG("Premature end of data"); + RCLOG_DEBUG("Premature end of data"); return RollbarCrashJSON_ERROR_INCOMPLETE; } unlikely_if(!(context->bufferPtr[1] == 'r' && context->bufferPtr[2] == 'u' && context->bufferPtr[3] == 'e')) { - RollbarCrashLOG_DEBUG("Expected \"true\" but got \"t%c%c%c\"", + RCLOG_DEBUG("Expected \"true\" but got \"t%c%c%c\"", context->bufferPtr[1], context->bufferPtr[2], context->bufferPtr[3]); return RollbarCrashJSON_ERROR_INVALID_CHARACTER; } @@ -1037,14 +1037,14 @@ static int decodeElement(const char* const name, RollbarCrashJSONDecodeContext* { unlikely_if(context->bufferEnd - context->bufferPtr < 4) { - RollbarCrashLOG_DEBUG("Premature end of data"); + RCLOG_DEBUG("Premature end of data"); return RollbarCrashJSON_ERROR_INCOMPLETE; } unlikely_if(!(context->bufferPtr[1] == 'u' && context->bufferPtr[2] == 'l' && context->bufferPtr[3] == 'l')) { - RollbarCrashLOG_DEBUG("Expected \"null\" but got \"n%c%c%c\"", + RCLOG_DEBUG("Expected \"null\" but got \"n%c%c%c\"", context->bufferPtr[1], context->bufferPtr[2], context->bufferPtr[3]); return RollbarCrashJSON_ERROR_INVALID_CHARACTER; } @@ -1056,7 +1056,7 @@ static int decodeElement(const char* const name, RollbarCrashJSONDecodeContext* context->bufferPtr++; unlikely_if(!isdigit(*context->bufferPtr)) { - RollbarCrashLOG_DEBUG("Not a digit: '%c'", *context->bufferPtr); + RCLOG_DEBUG("Not a digit: '%c'", *context->bufferPtr); return RollbarCrashJSON_ERROR_INVALID_CHARACTER; } // Fall through @@ -1085,7 +1085,7 @@ static int decodeElement(const char* const name, RollbarCrashJSONDecodeContext* unlikely_if(context->bufferPtr >= context->bufferEnd) { - RollbarCrashLOG_DEBUG("Premature end of data"); + RCLOG_DEBUG("Premature end of data"); return RollbarCrashJSON_ERROR_INCOMPLETE; } @@ -1106,7 +1106,7 @@ static int decodeElement(const char* const name, RollbarCrashJSONDecodeContext* unlikely_if(context->bufferPtr >= context->bufferEnd) { - RollbarCrashLOG_DEBUG("Premature end of data"); + RCLOG_DEBUG("Premature end of data"); return RollbarCrashJSON_ERROR_INCOMPLETE; } @@ -1117,7 +1117,7 @@ static int decodeElement(const char* const name, RollbarCrashJSONDecodeContext* int len = (int)(context->bufferPtr - start); if(len >= context->stringBufferLength) { - RollbarCrashLOG_DEBUG("Number is too long."); + RCLOG_DEBUG("Number is too long."); return RollbarCrashJSON_ERROR_DATA_TOO_LONG; } strncpy(context->stringBuffer, start, len); @@ -1129,7 +1129,7 @@ static int decodeElement(const char* const name, RollbarCrashJSONDecodeContext* return context->callbacks->onFloatingPointElement(name, value, context->userData); } } - RollbarCrashLOG_DEBUG("Invalid character '%c'", *context->bufferPtr); + RCLOG_DEBUG("Invalid character '%c'", *context->bufferPtr); return RollbarCrashJSON_ERROR_INVALID_CHARACTER; } @@ -1211,7 +1211,7 @@ static void updateDecoder_readFile(struct JSONFromFileContext* context) { if(bytesRead < 0) { - RollbarCrashLOG_ERROR("Error reading file %s: %s", context->sourceFilename, strerror(errno)); + RCLOG_ERROR("Error reading file %s: %s", context->sourceFilename, strerror(errno)); } context->isEOF = true; } diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashLogger.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashLogger.c index 3727e3f8..00bcb5ca 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashLogger.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashLogger.c @@ -54,8 +54,8 @@ * * Unless you're logging from within signal handlers, it's safe to set it to 0. */ -#ifndef RollbarCrashLOGGER_CBufferSize -#define RollbarCrashLOGGER_CBufferSize 1024 +#ifndef RCLOGGER_CBufferSize +#define RCLOGGER_CBufferSize 1024 #endif /** Where console logs will be written */ @@ -94,7 +94,7 @@ static inline void writeFmtToLog(const char* fmt, ...) va_end(args); } -#if RollbarCrashLOGGER_CBufferSize > 0 +#if RCLOGGER_CBufferSize > 0 /** The file descriptor where log entries get written. */ static int g_fd = -1; @@ -128,7 +128,7 @@ static inline void writeFmtArgsToLog(const char* fmt, va_list args) } else { - char buffer[RollbarCrashLOGGER_CBufferSize]; + char buffer[RCLOGGER_CBufferSize]; vsnprintf(buffer, sizeof(buffer), fmt, args); writeToLog(buffer); } diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashLogger.h b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashLogger.h index 04649a12..57ece917 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashLogger.h +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashLogger.h @@ -63,13 +63,13 @@ * in objective-C files and regular strings in regular C files): * * Code: - * RollbarCrashLOG_ERROR(@"Some error message"); + * RCLOG_ERROR(@"Some error message"); * * Prints: * 2011-07-16 05:41:01.379 TestApp[4439:f803] ERROR: SomeClass.m (21): -[SomeFunction]: Some error message * * Code: - * RollbarCrashLOG_INFO(@"Info about %@", someObject); + * RCLOG_INFO(@"Info about %@", someObject); * * Prints: * 2011-07-16 05:44:05.239 TestApp[4473:f803] INFO : SomeClass.m (20): -[SomeFunction]: Info about @@ -79,7 +79,7 @@ * except they respect the RollbarCrashLogger_Level setting: * * Code: - * RollbarCrashLOGBASIC_ERROR(@"A basic log entry"); + * RCLOGBASIC_ERROR(@"A basic log entry"); * * Prints: * 2011-07-16 05:44:05.916 TestApp[4473:f803] A basic log entry @@ -89,12 +89,12 @@ * in C files do not print the NSLog preamble: * * Objective-C version: - * RollbarCrashLOG_ERROR(@"Some error message"); + * RCLOG_ERROR(@"Some error message"); * * 2011-07-16 05:41:01.379 TestApp[4439:f803] ERROR: SomeClass.m (21): -[SomeFunction]: Some error message * * C version: - * RollbarCrashLOG_ERROR("Some error message"); + * RCLOG_ERROR("Some error message"); * * ERROR: SomeClass.c (21): SomeFunction(): Some error message * @@ -107,7 +107,7 @@ * "RollbarCrashLogger_LocalLevel" define. Note that it must be defined BEFORE * including RollbarCrashLogger.h * - * The RollbarCrashLOG_XX() and RollbarCrashLOGBASIC_XX() macros will print out based on the LOWER + * The RCLOG_XX() and RCLOGBASIC_XX() macros will print out based on the LOWER * of RollbarCrashLogger_Level and RollbarCrashLogger_LocalLevel, so if RollbarCrashLogger_Level is DEBUG * and RollbarCrashLogger_LocalLevel is TRACE, it will print all the way down to the trace * level for the local file where RollbarCrashLogger_LocalLevel was defined, and to the @@ -167,8 +167,8 @@ void i_rclog_logObjC(const char* level, void i_rclog_logObjCBasic(CFStringRef fmt, ...); -#define i_RollbarCrashLOG_FULL(LEVEL,FILE,LINE,FUNCTION,FMT,...) i_rclog_logObjC(LEVEL,FILE,LINE,FUNCTION,(__bridge CFStringRef)FMT,##__VA_ARGS__) -#define i_RollbarCrashLOG_BASIC(FMT, ...) i_rclog_logObjCBasic((__bridge CFStringRef)FMT,##__VA_ARGS__) +#define i_RCLOG_FULL(LEVEL,FILE,LINE,FUNCTION,FMT,...) i_rclog_logObjC(LEVEL,FILE,LINE,FUNCTION,(__bridge CFStringRef)FMT,##__VA_ARGS__) +#define i_RCLOG_BASIC(FMT, ...) i_rclog_logObjCBasic((__bridge CFStringRef)FMT,##__VA_ARGS__) #else // __OBJC__ @@ -180,35 +180,35 @@ void i_rclog_logC(const char* level, void i_rclog_logCBasic(const char* fmt, ...); -#define i_RollbarCrashLOG_FULL i_rclog_logC -#define i_RollbarCrashLOG_BASIC i_rclog_logCBasic +#define i_RCLOG_FULL i_rclog_logC +#define i_RCLOG_BASIC i_rclog_logCBasic #endif // __OBJC__ /* Back up any existing defines by the same name */ #ifdef RollbarCrash_NONE - #define RollbarCrashLOG_BAK_NONE RollbarCrash_NONE + #define RCLOG_BAK_NONE RollbarCrash_NONE #undef RollbarCrash_NONE #endif #ifdef ERROR - #define RollbarCrashLOG_BAK_ERROR ERROR + #define RCLOG_BAK_ERROR ERROR #undef ERROR #endif #ifdef WARN - #define RollbarCrashLOG_BAK_WARN WARN + #define RCLOG_BAK_WARN WARN #undef WARN #endif #ifdef INFO - #define RollbarCrashLOG_BAK_INFO INFO + #define RCLOG_BAK_INFO INFO #undef INFO #endif #ifdef DEBUG - #define RollbarCrashLOG_BAK_DEBUG DEBUG + #define RCLOG_BAK_DEBUG DEBUG #undef DEBUG #endif #ifdef TRACE - #define RollbarCrashLOG_BAK_TRACE TRACE + #define RCLOG_BAK_TRACE TRACE #undef TRACE #endif @@ -236,8 +236,8 @@ void i_rclog_logCBasic(const char* fmt, ...); #define RollbarCrashLogger_LocalLevel RollbarCrashLogger_Level_None #endif -#define a_RollbarCrashLOG_FULL(LEVEL, FMT, ...) \ - i_RollbarCrashLOG_FULL(LEVEL, \ +#define a_RCLOG_FULL(LEVEL, FMT, ...) \ + i_RCLOG_FULL(LEVEL, \ __FILE__, \ __LINE__, \ __PRETTY_FUNCTION__, \ @@ -272,7 +272,7 @@ bool rclog_clearLogFile(void); * * @return TRUE if the logger would print at the specified level. */ -#define RollbarCrashLOG_PRINTS_AT_LEVEL(LEVEL) \ +#define RCLOG_PRINTS_AT_LEVEL(LEVEL) \ (RollbarCrashLogger_Level >= LEVEL || RollbarCrashLogger_LocalLevel >= LEVEL) /** Log a message regardless of the log settings. @@ -280,8 +280,8 @@ bool rclog_clearLogFile(void); * * @param FMT The format specifier, followed by its arguments. */ -#define RollbarCrashLOG_ALWAYS(FMT, ...) a_RollbarCrashLOG_FULL("FORCE", FMT, ##__VA_ARGS__) -#define RollbarCrashLOGBASIC_ALWAYS(FMT, ...) i_RollbarCrashLOG_BASIC(FMT, ##__VA_ARGS__) +#define RCLOG_ALWAYS(FMT, ...) a_RCLOG_FULL("FORCE", FMT, ##__VA_ARGS__) +#define RCLOGBASIC_ALWAYS(FMT, ...) i_RCLOG_BASIC(FMT, ##__VA_ARGS__) /** Log an error. @@ -289,12 +289,12 @@ bool rclog_clearLogFile(void); * * @param FMT The format specifier, followed by its arguments. */ -#if RollbarCrashLOG_PRINTS_AT_LEVEL(RollbarCrashLogger_Level_Error) - #define RollbarCrashLOG_ERROR(FMT, ...) a_RollbarCrashLOG_FULL("ERROR", FMT, ##__VA_ARGS__) - #define RollbarCrashLOGBASIC_ERROR(FMT, ...) i_RollbarCrashLOG_BASIC(FMT, ##__VA_ARGS__) +#if RCLOG_PRINTS_AT_LEVEL(RollbarCrashLogger_Level_Error) + #define RCLOG_ERROR(FMT, ...) a_RCLOG_FULL("ERROR", FMT, ##__VA_ARGS__) + #define RCLOGBASIC_ERROR(FMT, ...) i_RCLOG_BASIC(FMT, ##__VA_ARGS__) #else - #define RollbarCrashLOG_ERROR(FMT, ...) - #define RollbarCrashLOGBASIC_ERROR(FMT, ...) + #define RCLOG_ERROR(FMT, ...) + #define RCLOGBASIC_ERROR(FMT, ...) #endif /** Log a warning. @@ -302,12 +302,12 @@ bool rclog_clearLogFile(void); * * @param FMT The format specifier, followed by its arguments. */ -#if RollbarCrashLOG_PRINTS_AT_LEVEL(RollbarCrashLogger_Level_Warn) - #define RollbarCrashLOG_WARN(FMT, ...) a_RollbarCrashLOG_FULL("WARN ", FMT, ##__VA_ARGS__) - #define RollbarCrashLOGBASIC_WARN(FMT, ...) i_RollbarCrashLOG_BASIC(FMT, ##__VA_ARGS__) +#if RCLOG_PRINTS_AT_LEVEL(RollbarCrashLogger_Level_Warn) + #define RCLOG_WARN(FMT, ...) a_RCLOG_FULL("WARN ", FMT, ##__VA_ARGS__) + #define RCLOGBASIC_WARN(FMT, ...) i_RCLOG_BASIC(FMT, ##__VA_ARGS__) #else - #define RollbarCrashLOG_WARN(FMT, ...) - #define RollbarCrashLOGBASIC_WARN(FMT, ...) + #define RCLOG_WARN(FMT, ...) + #define RCLOGBASIC_WARN(FMT, ...) #endif /** Log an info message. @@ -315,12 +315,12 @@ bool rclog_clearLogFile(void); * * @param FMT The format specifier, followed by its arguments. */ -#if RollbarCrashLOG_PRINTS_AT_LEVEL(RollbarCrashLogger_Level_Info) - #define RollbarCrashLOG_INFO(FMT, ...) a_RollbarCrashLOG_FULL("INFO ", FMT, ##__VA_ARGS__) - #define RollbarCrashLOGBASIC_INFO(FMT, ...) i_RollbarCrashLOG_BASIC(FMT, ##__VA_ARGS__) +#if RCLOG_PRINTS_AT_LEVEL(RollbarCrashLogger_Level_Info) + #define RCLOG_INFO(FMT, ...) a_RCLOG_FULL("INFO ", FMT, ##__VA_ARGS__) + #define RCLOGBASIC_INFO(FMT, ...) i_RCLOG_BASIC(FMT, ##__VA_ARGS__) #else - #define RollbarCrashLOG_INFO(FMT, ...) - #define RollbarCrashLOGBASIC_INFO(FMT, ...) + #define RCLOG_INFO(FMT, ...) + #define RCLOGBASIC_INFO(FMT, ...) #endif /** Log a debug message. @@ -328,12 +328,12 @@ bool rclog_clearLogFile(void); * * @param FMT The format specifier, followed by its arguments. */ -#if RollbarCrashLOG_PRINTS_AT_LEVEL(RollbarCrashLogger_Level_Debug) - #define RollbarCrashLOG_DEBUG(FMT, ...) a_RollbarCrashLOG_FULL("DEBUG", FMT, ##__VA_ARGS__) - #define RollbarCrashLOGBASIC_DEBUG(FMT, ...) i_RollbarCrashLOG_BASIC(FMT, ##__VA_ARGS__) +#if RCLOG_PRINTS_AT_LEVEL(RollbarCrashLogger_Level_Debug) + #define RCLOG_DEBUG(FMT, ...) a_RCLOG_FULL("DEBUG", FMT, ##__VA_ARGS__) + #define RCLOGBASIC_DEBUG(FMT, ...) i_RCLOG_BASIC(FMT, ##__VA_ARGS__) #else - #define RollbarCrashLOG_DEBUG(FMT, ...) - #define RollbarCrashLOGBASIC_DEBUG(FMT, ...) + #define RCLOG_DEBUG(FMT, ...) + #define RCLOGBASIC_DEBUG(FMT, ...) #endif /** Log a trace message. @@ -341,12 +341,12 @@ bool rclog_clearLogFile(void); * * @param FMT The format specifier, followed by its arguments. */ -#if RollbarCrashLOG_PRINTS_AT_LEVEL(RollbarCrashLogger_Level_Trace) - #define RollbarCrashLOG_TRACE(FMT, ...) a_RollbarCrashLOG_FULL("TRACE", FMT, ##__VA_ARGS__) - #define RollbarCrashLOGBASIC_TRACE(FMT, ...) i_RollbarCrashLOG_BASIC(FMT, ##__VA_ARGS__) +#if RCLOG_PRINTS_AT_LEVEL(RollbarCrashLogger_Level_Trace) + #define RCLOG_TRACE(FMT, ...) a_RCLOG_FULL("TRACE", FMT, ##__VA_ARGS__) + #define RCLOGBASIC_TRACE(FMT, ...) i_RCLOG_BASIC(FMT, ##__VA_ARGS__) #else - #define RollbarCrashLOG_TRACE(FMT, ...) - #define RollbarCrashLOGBASIC_TRACE(FMT, ...) + #define RCLOG_TRACE(FMT, ...) + #define RCLOGBASIC_TRACE(FMT, ...) #endif @@ -357,29 +357,29 @@ bool rclog_clearLogFile(void); /* Put everything back to the way we found it. */ #undef ERROR -#ifdef RollbarCrashLOG_BAK_ERROR - #define ERROR RollbarCrashLOG_BAK_ERROR - #undef RollbarCrashLOG_BAK_ERROR +#ifdef RCLOG_BAK_ERROR + #define ERROR RCLOG_BAK_ERROR + #undef RCLOG_BAK_ERROR #endif #undef WARNING -#ifdef RollbarCrashLOG_BAK_WARN - #define WARNING RollbarCrashLOG_BAK_WARN - #undef RollbarCrashLOG_BAK_WARN +#ifdef RCLOG_BAK_WARN + #define WARNING RCLOG_BAK_WARN + #undef RCLOG_BAK_WARN #endif #undef INFO -#ifdef RollbarCrashLOG_BAK_INFO - #define INFO RollbarCrashLOG_BAK_INFO - #undef RollbarCrashLOG_BAK_INFO +#ifdef RCLOG_BAK_INFO + #define INFO RCLOG_BAK_INFO + #undef RCLOG_BAK_INFO #endif #undef DEBUG -#ifdef RollbarCrashLOG_BAK_DEBUG - #define DEBUG RollbarCrashLOG_BAK_DEBUG - #undef RollbarCrashLOG_BAK_DEBUG +#ifdef RCLOG_BAK_DEBUG + #define DEBUG RCLOG_BAK_DEBUG + #undef RCLOG_BAK_DEBUG #endif #undef TRACE -#ifdef RollbarCrashLOG_BAK_TRACE - #define TRACE RollbarCrashLOG_BAK_TRACE - #undef RollbarCrashLOG_BAK_TRACE +#ifdef RCLOG_BAK_TRACE + #define TRACE RCLOG_BAK_TRACE + #undef RCLOG_BAK_TRACE #endif diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashMachineContext.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashMachineContext.c index 603b4089..f1541c03 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashMachineContext.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashMachineContext.c @@ -63,22 +63,22 @@ static inline bool isStackOverflow(const RollbarCrashMachineContext* const conte static inline bool getThreadList(RollbarCrashMachineContext* context) { const task_t thisTask = mach_task_self(); - RollbarCrashLOG_DEBUG("Getting thread list"); + RCLOG_DEBUG("Getting thread list"); kern_return_t kr; thread_act_array_t threads; mach_msg_type_number_t actualThreadCount; if((kr = task_threads(thisTask, &threads, &actualThreadCount)) != KERN_SUCCESS) { - RollbarCrashLOG_ERROR("task_threads: %s", mach_error_string(kr)); + RCLOG_ERROR("task_threads: %s", mach_error_string(kr)); return false; } - RollbarCrashLOG_TRACE("Got %d threads", context->threadCount); + RCLOG_TRACE("Got %d threads", context->threadCount); int threadCount = (int)actualThreadCount; int maxThreadCount = sizeof(context->allThreads) / sizeof(context->allThreads[0]); if(threadCount > maxThreadCount) { - RollbarCrashLOG_ERROR("Thread count %d is higher than maximum of %d", threadCount, maxThreadCount); + RCLOG_ERROR("Thread count %d is higher than maximum of %d", threadCount, maxThreadCount); threadCount = maxThreadCount; } for(int i = 0; i < threadCount; i++) @@ -108,7 +108,7 @@ RollbarCrashThread rcmc_getThreadFromContext(const RollbarCrashMachineContext* c bool rcmc_getContextForThread(RollbarCrashThread thread, RollbarCrashMachineContext* destinationContext, bool isCrashedContext) { - RollbarCrashLOG_DEBUG("Fill thread 0x%x context into %p. is crashed = %d", thread, destinationContext, isCrashedContext); + RCLOG_DEBUG("Fill thread 0x%x context into %p. is crashed = %d", thread, destinationContext, isCrashedContext); memset(destinationContext, 0, sizeof(*destinationContext)); destinationContext->thisThread = (thread_t)thread; destinationContext->isCurrentThread = thread == rcthread_self(); @@ -123,13 +123,13 @@ bool rcmc_getContextForThread(RollbarCrashThread thread, RollbarCrashMachineCont destinationContext->isStackOverflow = isStackOverflow(destinationContext); getThreadList(destinationContext); } - RollbarCrashLOG_TRACE("Context retrieved."); + RCLOG_TRACE("Context retrieved."); return true; } bool rcmc_getContextForSignal(void* signalUserContext, RollbarCrashMachineContext* destinationContext) { - RollbarCrashLOG_DEBUG("Get context from signal user context and put into %p.", destinationContext); + RCLOG_DEBUG("Get context from signal user context and put into %p.", destinationContext); _STRUCT_MCONTEXT* sourceContext = ((SignalUserContext*)signalUserContext)->UC_MCONTEXT; memcpy(&destinationContext->machineContext, sourceContext, sizeof(destinationContext->machineContext)); destinationContext->thisThread = (thread_t)rcthread_self(); @@ -137,7 +137,7 @@ bool rcmc_getContextForSignal(void* signalUserContext, RollbarCrashMachineContex destinationContext->isSignalContext = true; destinationContext->isStackOverflow = isStackOverflow(destinationContext); getThreadList(destinationContext); - RollbarCrashLOG_TRACE("Context retrieved."); + RCLOG_TRACE("Context retrieved."); return true; } @@ -146,7 +146,7 @@ void rcmc_addReservedThread(RollbarCrashThread thread) int nextIndex = g_reservedThreadsCount; if(nextIndex > g_reservedThreadsMaxIndex) { - RollbarCrashLOG_ERROR("Too many reserved threads (%d). Max is %d", nextIndex, g_reservedThreadsMaxIndex); + RCLOG_ERROR("Too many reserved threads (%d). Max is %d", nextIndex, g_reservedThreadsMaxIndex); return; } g_reservedThreads[g_reservedThreadsCount++] = thread; @@ -169,14 +169,14 @@ static inline bool isThreadInList(thread_t thread, RollbarCrashThread* list, int void rcmc_suspendEnvironment(__unused thread_act_array_t *suspendedThreads, __unused mach_msg_type_number_t *numSuspendedThreads) { #if RollbarCrashCRASH_HAS_THREADS_API - RollbarCrashLOG_DEBUG("Suspending environment."); + RCLOG_DEBUG("Suspending environment."); kern_return_t kr; const task_t thisTask = mach_task_self(); const thread_t thisThread = (thread_t)rcthread_self(); if((kr = task_threads(thisTask, suspendedThreads, numSuspendedThreads)) != KERN_SUCCESS) { - RollbarCrashLOG_ERROR("task_threads: %s", mach_error_string(kr)); + RCLOG_ERROR("task_threads: %s", mach_error_string(kr)); return; } @@ -188,26 +188,26 @@ void rcmc_suspendEnvironment(__unused thread_act_array_t *suspendedThreads, __un if((kr = thread_suspend(thread)) != KERN_SUCCESS) { // Record the error and keep going. - RollbarCrashLOG_ERROR("thread_suspend (%08x): %s", thread, mach_error_string(kr)); + RCLOG_ERROR("thread_suspend (%08x): %s", thread, mach_error_string(kr)); } } } - RollbarCrashLOG_DEBUG("Suspend complete."); + RCLOG_DEBUG("Suspend complete."); #endif } void rcmc_resumeEnvironment(__unused thread_act_array_t threads, __unused mach_msg_type_number_t numThreads) { #if RollbarCrashCRASH_HAS_THREADS_API - RollbarCrashLOG_DEBUG("Resuming environment."); + RCLOG_DEBUG("Resuming environment."); kern_return_t kr; const task_t thisTask = mach_task_self(); const thread_t thisThread = (thread_t)rcthread_self(); if(threads == NULL || numThreads == 0) { - RollbarCrashLOG_ERROR("we should call rcmc_suspendEnvironment() first"); + RCLOG_ERROR("we should call rcmc_suspendEnvironment() first"); return; } @@ -219,7 +219,7 @@ void rcmc_resumeEnvironment(__unused thread_act_array_t threads, __unused mach_m if((kr = thread_resume(thread)) != KERN_SUCCESS) { // Record the error and keep going. - RollbarCrashLOG_ERROR("thread_resume (%08x): %s", thread, mach_error_string(kr)); + RCLOG_ERROR("thread_resume (%08x): %s", thread, mach_error_string(kr)); } } } @@ -230,7 +230,7 @@ void rcmc_resumeEnvironment(__unused thread_act_array_t threads, __unused mach_m } vm_deallocate(thisTask, (vm_address_t)threads, sizeof(thread_t) * numThreads); - RollbarCrashLOG_DEBUG("Resume complete."); + RCLOG_DEBUG("Resume complete."); #endif } @@ -247,10 +247,10 @@ RollbarCrashThread rcmc_getThreadAtIndex(const RollbarCrashMachineContext* const int rcmc_indexOfThread(const RollbarCrashMachineContext* const context, RollbarCrashThread thread) { - RollbarCrashLOG_TRACE("check thread vs %d threads", context->threadCount); + RCLOG_TRACE("check thread vs %d threads", context->threadCount); for(int i = 0; i < (int)context->threadCount; i++) { - RollbarCrashLOG_TRACE("%d: %x vs %x", i, thread, context->allThreads[i]); + RCLOG_TRACE("%d: %x vs %x", i, thread, context->allThreads[i]); if(context->allThreads[i] == thread) { return i; diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor.c index 082d6372..3b929dfd 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashStackCursor.c @@ -32,7 +32,7 @@ static bool g_advanceCursor(__unused RollbarCrashStackCursor *cursor) { - RollbarCrashLOG_WARN("No stack cursor has been set. For C++, this means that hooking __cxa_throw() failed for some reason. Embedded frameworks can cause this: https://github.com/kstenerud/RollbarCrash/issues/205"); + RCLOG_WARN("No stack cursor has been set. For C++, this means that hooking __cxa_throw() failed for some reason. Embedded frameworks can cause this: https://github.com/kstenerud/RollbarCrash/issues/205"); return false; } diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashSysCtl.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashSysCtl.c index 3f646f31..fff4ad95 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashSysCtl.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashSysCtl.c @@ -40,7 +40,7 @@ #define CHECK_SYSCTL_NAME(TYPE, CALL) \ if(0 != (CALL)) \ { \ - RollbarCrashLOG_ERROR("Could not get %s value for %s: %s", \ + RCLOG_ERROR("Could not get %s value for %s: %s", \ #CALL, name, strerror(errno)); \ return 0; \ } @@ -48,7 +48,7 @@ if(0 != (CALL)) \ #define CHECK_SYSCTL_CMD(TYPE, CALL) \ if(0 != (CALL)) \ { \ - RollbarCrashLOG_ERROR("Could not get %s value for %d,%d: %s", \ + RCLOG_ERROR("Could not get %s value for %d,%d: %s", \ #CALL, major_cmd, minor_cmd, strerror(errno)); \ return 0; \ } @@ -194,7 +194,7 @@ struct timeval rcsysctl_timeval(const int major_cmd, const int minor_cmd) if(0 != sysctl(cmd, sizeof(cmd)/sizeof(*cmd), &value, &size, NULL, 0)) { - RollbarCrashLOG_ERROR("Could not get timeval value for %d,%d: %s", + RCLOG_ERROR("Could not get timeval value for %d,%d: %s", major_cmd, minor_cmd, strerror(errno)); } @@ -208,7 +208,7 @@ struct timeval rcsysctl_timevalForName(const char* const name) if(0 != sysctlbyname(name, &value, &size, NULL, 0)) { - RollbarCrashLOG_ERROR("Could not get timeval value for %s: %s", + RCLOG_ERROR("Could not get timeval value for %s: %s", name, strerror(errno)); } @@ -223,7 +223,7 @@ bool rcsysctl_getProcessInfo(const int pid, if(0 != sysctl(cmd, sizeof(cmd)/sizeof(*cmd), procInfo, &size, NULL, 0)) { - RollbarCrashLOG_ERROR("Could not get the name for process %d: %s", + RCLOG_ERROR("Could not get the name for process %d: %s", pid, strerror(errno)); return false; } @@ -246,7 +246,7 @@ bool rcsysctl_getMacAddress(const char* const name, }; if(mib[5] == 0) { - RollbarCrashLOG_ERROR("Could not get interface index for %s: %s", + RCLOG_ERROR("Could not get interface index for %s: %s", name, strerror(errno)); return false; } @@ -254,7 +254,7 @@ bool rcsysctl_getMacAddress(const char* const name, size_t length; if(sysctl(mib, 6, NULL, &length, NULL, 0) != 0) { - RollbarCrashLOG_ERROR("Could not get interface data for %s: %s", + RCLOG_ERROR("Could not get interface data for %s: %s", name, strerror(errno)); return false; } @@ -262,13 +262,13 @@ bool rcsysctl_getMacAddress(const char* const name, void* ifBuffer = malloc(length); if(ifBuffer == NULL) { - RollbarCrashLOG_ERROR("Out of memory"); + RCLOG_ERROR("Out of memory"); return false; } if(sysctl(mib, 6, ifBuffer, &length, NULL, 0) != 0) { - RollbarCrashLOG_ERROR("Could not get interface data for %s: %s", + RCLOG_ERROR("Could not get interface data for %s: %s", name, strerror(errno)); free(ifBuffer); return false; diff --git a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashThread.c b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashThread.c index 3d6de6aa..14a8f0ee 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashThread.c +++ b/RollbarNotifier/Sources/RollbarCrash/Recording/Tools/RollbarCrashThread.c @@ -66,27 +66,27 @@ bool rcthread_getQueueName(const RollbarCrashThread thread, char* const buffer, kr = thread_info((thread_t)thread, THREAD_IDENTIFIER_INFO, info, &inOutSize); if(kr != KERN_SUCCESS) { - RollbarCrashLOG_TRACE("Error getting thread_info with flavor THREAD_IDENTIFIER_INFO from mach thread : %s", mach_error_string(kr)); + RCLOG_TRACE("Error getting thread_info with flavor THREAD_IDENTIFIER_INFO from mach thread : %s", mach_error_string(kr)); return false; } thread_identifier_info_t idInfo = (thread_identifier_info_t)info; if(!rcmem_isMemoryReadable(idInfo, sizeof(*idInfo))) { - RollbarCrashLOG_DEBUG("Thread %p has an invalid thread identifier info %p", thread, idInfo); + RCLOG_DEBUG("Thread %p has an invalid thread identifier info %p", thread, idInfo); return false; } dispatch_queue_t* dispatch_queue_ptr = (dispatch_queue_t*)idInfo->dispatch_qaddr; if(!rcmem_isMemoryReadable(dispatch_queue_ptr, sizeof(*dispatch_queue_ptr))) { - RollbarCrashLOG_DEBUG("Thread %p has an invalid dispatch queue pointer %p", thread, dispatch_queue_ptr); + RCLOG_DEBUG("Thread %p has an invalid dispatch queue pointer %p", thread, dispatch_queue_ptr); return false; } //thread_handle shouldn't be 0 also, because //identifier_info->dispatch_qaddr = identifier_info->thread_handle + get_dispatchqueue_offset_from_proc(thread->task->bsd_info); if(dispatch_queue_ptr == NULL || idInfo->thread_handle == 0 || *dispatch_queue_ptr == NULL) { - RollbarCrashLOG_TRACE("This thread doesn't have a dispatch queue attached : %p", thread); + RCLOG_TRACE("This thread doesn't have a dispatch queue attached : %p", thread); return false; } @@ -94,10 +94,10 @@ bool rcthread_getQueueName(const RollbarCrashThread thread, char* const buffer, const char* queue_name = dispatch_queue_get_label(dispatch_queue); if(queue_name == NULL) { - RollbarCrashLOG_TRACE("Error while getting dispatch queue name : %p", dispatch_queue); + RCLOG_TRACE("Error while getting dispatch queue name : %p", dispatch_queue); return false; } - RollbarCrashLOG_TRACE("Dispatch queue name: %s", queue_name); + RCLOG_TRACE("Dispatch queue name: %s", queue_name); int length = (int)strlen(queue_name); // Queue label must be a null terminated string. @@ -112,12 +112,12 @@ bool rcthread_getQueueName(const RollbarCrashThread thread, char* const buffer, if(queue_name[iLabel] != 0) { // Found a non-null, invalid char. - RollbarCrashLOG_TRACE("Queue label contains invalid chars"); + RCLOG_TRACE("Queue label contains invalid chars"); return false; } bufLength = MIN(length, bufLength - 1);//just strlen, without null-terminator strncpy(buffer, queue_name, bufLength); buffer[bufLength] = 0;//terminate string - RollbarCrashLOG_TRACE("Queue label = %s", buffer); + RCLOG_TRACE("Queue label = %s", buffer); return true; } diff --git a/RollbarNotifier/Sources/RollbarCrash/Reporting/Filters/RollbarCrashReportFilterBasic.m b/RollbarNotifier/Sources/RollbarCrash/Reporting/Filters/RollbarCrashReportFilterBasic.m index a71bed02..ce5985cd 100644 --- a/RollbarNotifier/Sources/RollbarCrash/Reporting/Filters/RollbarCrashReportFilterBasic.m +++ b/RollbarNotifier/Sources/RollbarCrash/Reporting/Filters/RollbarCrashReportFilterBasic.m @@ -84,7 +84,7 @@ + (RollbarCrashVA_Block) argBlockWithFilters:(NSMutableArray*) filters andKeys:( { if(entry == nil) { - RollbarCrashLOG_ERROR(@"key entry was nil"); + RCLOG_ERROR(@"key entry was nil"); } else { @@ -99,7 +99,7 @@ + (RollbarCrashVA_Block) argBlockWithFilters:(NSMutableArray*) filters andKeys:( } if(![entry conformsToProtocol:@protocol(RollbarCrashReportFilter)]) { - RollbarCrashLOG_ERROR(@"Not a filter: %@", entry); + RCLOG_ERROR(@"Not a filter: %@", entry); // Cause next key entry to fail as well. return; } diff --git a/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashC.h b/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashC.h index 27dd6954..c4f34449 100644 --- a/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashC.h +++ b/RollbarNotifier/Sources/RollbarCrash/include/RollbarCrashC.h @@ -142,7 +142,7 @@ typedef void (*RollbarCrashReportWrittenCallback)(int64_t reportID); */ void rc_setReportWrittenCallback(const RollbarCrashReportWrittenCallback onReportWrittenNotify); -/** Set if RollbarCrashLOG console messages should be appended to the report. +/** Set if RCLOG console messages should be appended to the report. * * @param shouldAddConsoleLogToReport If true, add the log to the report. */