Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions Crashlytics/Crashlytics/Components/FIRCLSBinaryImage.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ __BEGIN_DECLS
#define FIRCLSUUIDStringLength (33)

typedef struct {
_Atomic(void*) volatile baseAddress;
_Atomic(void *) volatile baseAddress;
uint64_t size;
#if CLS_DWARF_UNWINDING_SUPPORTED
const void* ehFrame;
const void *ehFrame;
#endif
#if CLS_COMPACT_UNWINDING_SUPPORTED
const void* unwindInfo;
const void *unwindInfo;
#endif
const void* crashInfo;
const void *crashInfo;
#if CLS_BINARY_IMAGE_RUNTIME_NODE_RECORD_NAME
char name[CLS_BINARY_IMAGE_RUNTIME_NODE_NAME_SIZE];
#endif
Expand All @@ -56,7 +56,7 @@ typedef struct {
} FIRCLSBinaryImageDetails;

typedef struct {
const char* path;
const char *path;
} FIRCLSBinaryImageReadOnlyContext;

typedef struct {
Expand All @@ -68,13 +68,13 @@ void FIRCLSBinaryImageInit(void);

#if CLS_COMPACT_UNWINDING_SUPPORTED
bool FIRCLSBinaryImageSafeFindImageForAddress(uintptr_t address,
FIRCLSBinaryImageRuntimeNode* image);
bool FIRCLSBinaryImageSafeHasUnwindInfo(FIRCLSBinaryImageRuntimeNode* image);
FIRCLSBinaryImageRuntimeNode *image);
bool FIRCLSBinaryImageSafeHasUnwindInfo(FIRCLSBinaryImageRuntimeNode *image);
#endif

bool FIRCLSBinaryImageFindImageForUUID(const char* uuidString,
FIRCLSBinaryImageDetails* imageDetails);
bool FIRCLSBinaryImageFindImageForUUID(const char *uuidString,
FIRCLSBinaryImageDetails *imageDetails);

bool FIRCLSBinaryImageRecordMainExecutable(FIRCLSFile* file);
bool FIRCLSBinaryImageRecordMainExecutable(FIRCLSFile *file);

__END_DECLS
8 changes: 4 additions & 4 deletions Crashlytics/Crashlytics/Components/FIRCLSHost.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@
#include "Crashlytics/Crashlytics/Helpers/FIRCLSFile.h"

typedef struct {
const char* documentDirectoryPath;
const char *documentDirectoryPath;
vm_size_t pageSize;
} FIRCLSHostReadOnlyContext;

__BEGIN_DECLS

void FIRCLSHostInitialize(FIRCLSHostReadOnlyContext* roContext);
void FIRCLSHostInitialize(FIRCLSHostReadOnlyContext *roContext);

vm_size_t FIRCLSHostGetPageSize(void);

bool FIRCLSHostRecord(FIRCLSFile* file);
bool FIRCLSHostRecord(FIRCLSFile *file);

void FIRCLSHostWriteDiskUsage(FIRCLSFile* file);
void FIRCLSHostWriteDiskUsage(FIRCLSFile *file);

bool FIRCLSHostIsRosettaTranslated(void);

Expand Down
4 changes: 2 additions & 2 deletions Crashlytics/Crashlytics/Handlers/FIRCLSHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@

__BEGIN_DECLS

void FIRCLSHandler(FIRCLSFile* file,
void FIRCLSHandler(FIRCLSFile *file,
thread_t crashedThread,
void* uapVoid,
void *uapVoid,
bool shouldSuspendThread);

__END_DECLS
8 changes: 4 additions & 4 deletions Crashlytics/Crashlytics/Handlers/FIRCLSMachException.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,21 +59,21 @@ typedef struct {
typedef struct {
mach_port_t port;
pthread_t thread;
const char* path;
const char *path;

exception_mask_t mask;
FIRCLSMachExceptionOriginalPorts originalPorts;
} FIRCLSMachExceptionReadContext;

#pragma mark - API
void FIRCLSMachExceptionInit(FIRCLSMachExceptionReadContext* context);
void FIRCLSMachExceptionInit(FIRCLSMachExceptionReadContext *context);

void FIRCLSMachExceptionCheckHandlers(void);

void FIRCLSMachExceptionNameLookup(exception_type_t number,
mach_exception_data_type_t code,
const char** name,
const char** codeName);
const char **name,
const char **codeName);
#else

#define CLS_MACH_EXCEPTION_HANDLER_STACK_SIZE 0
Expand Down
12 changes: 6 additions & 6 deletions Crashlytics/Crashlytics/Handlers/FIRCLSSignal.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,24 +33,24 @@
#define FIRCLSSignalCount (7)

typedef struct {
const char* path;
const char *path;
struct sigaction originalActions[FIRCLSSignalCount];

#if CLS_USE_SIGALTSTACK
stack_t originalStack;
#endif
} FIRCLSSignalReadContext;

void FIRCLSSignalInitialize(FIRCLSSignalReadContext* roContext);
void FIRCLSSignalInitialize(FIRCLSSignalReadContext *roContext);
void FIRCLSSignalCheckHandlers(void);

void FIRCLSSignalSafeRemoveHandlers(bool includingAbort);
bool FIRCLSSignalSafeInstallPreexistingHandlers(FIRCLSSignalReadContext* roContext,
bool FIRCLSSignalSafeInstallPreexistingHandlers(FIRCLSSignalReadContext *roContext,
const int signal,
siginfo_t* info,
void* uapVoid);
siginfo_t *info,
void *uapVoid);

void FIRCLSSignalNameLookup(int number, int code, const char** name, const char** codeName);
void FIRCLSSignalNameLookup(int number, int code, const char **name, const char **codeName);

void FIRCLSSignalEnumerateHandledSignals(void (^block)(int idx, int signal));
#endif
14 changes: 7 additions & 7 deletions Crashlytics/Crashlytics/Helpers/FIRCLSAllocate.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,26 +23,26 @@ typedef enum { CLS_READONLY = 0, CLS_READWRITE = 1 } FIRCLSAllocationType;

typedef struct {
size_t size;
void* start;
_Atomic(void*) volatile cursor;
void *start;
_Atomic(void *) volatile cursor;
} FIRCLSAllocationRegion;

typedef struct {
void* buffer;
void *buffer;
bool protectionEnabled;
FIRCLSAllocationRegion writeableRegion;
FIRCLSAllocationRegion readableRegion;
} FIRCLSAllocator;
typedef FIRCLSAllocator* FIRCLSAllocatorRef;
typedef FIRCLSAllocator *FIRCLSAllocatorRef;

FIRCLSAllocatorRef FIRCLSAllocatorCreate(size_t writableSpace, size_t readableSpace);
void FIRCLSAllocatorDestroy(FIRCLSAllocatorRef allocator);

bool FIRCLSAllocatorProtect(FIRCLSAllocatorRef allocator);
bool FIRCLSAllocatorUnprotect(FIRCLSAllocatorRef allocator);

void* FIRCLSAllocatorSafeAllocate(FIRCLSAllocatorRef allocator,
void *FIRCLSAllocatorSafeAllocate(FIRCLSAllocatorRef allocator,
size_t size,
FIRCLSAllocationType type);
const char* FIRCLSAllocatorSafeStrdup(FIRCLSAllocatorRef allocator, const char* string);
void FIRCLSAllocatorFree(FIRCLSAllocatorRef allocator, void* ptr);
const char *FIRCLSAllocatorSafeStrdup(FIRCLSAllocatorRef allocator, const char *string);
void FIRCLSAllocatorFree(FIRCLSAllocatorRef allocator, void *ptr);
16 changes: 8 additions & 8 deletions Crashlytics/Crashlytics/Helpers/FIRCLSThreadState.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,16 @@ typedef _STRUCT_UCONTEXT _STRUCT_UCONTEXT64;

#pragma mark Register Access

uintptr_t FIRCLSThreadContextGetPC(FIRCLSThreadContext* registers);
uintptr_t FIRCLSThreadContextGetStackPointer(const FIRCLSThreadContext* registers);
uintptr_t FIRCLSThreadContextGetFramePointer(const FIRCLSThreadContext* registers);
uintptr_t FIRCLSThreadContextGetPC(FIRCLSThreadContext *registers);
uintptr_t FIRCLSThreadContextGetStackPointer(const FIRCLSThreadContext *registers);
uintptr_t FIRCLSThreadContextGetFramePointer(const FIRCLSThreadContext *registers);

bool FIRCLSThreadContextSetPC(FIRCLSThreadContext* registers, uintptr_t value);
bool FIRCLSThreadContextSetStackPointer(FIRCLSThreadContext* registers, uintptr_t value);
bool FIRCLSThreadContextSetFramePointer(FIRCLSThreadContext* registers, uintptr_t value);
bool FIRCLSThreadContextSetPC(FIRCLSThreadContext *registers, uintptr_t value);
bool FIRCLSThreadContextSetStackPointer(FIRCLSThreadContext *registers, uintptr_t value);
bool FIRCLSThreadContextSetFramePointer(FIRCLSThreadContext *registers, uintptr_t value);

// The link register only exists on ARM platforms.
#if CLS_CPU_ARM || CLS_CPU_ARM64
uintptr_t FIRCLSThreadContextGetLinkRegister(const FIRCLSThreadContext* registers);
bool FIRCLSThreadContextSetLinkRegister(FIRCLSThreadContext* registers, uintptr_t value);
uintptr_t FIRCLSThreadContextGetLinkRegister(const FIRCLSThreadContext *registers);
bool FIRCLSThreadContextSetLinkRegister(FIRCLSThreadContext *registers, uintptr_t value);
#endif
26 changes: 13 additions & 13 deletions Crashlytics/Crashlytics/Unwind/Compact/FIRCLSCompactUnwind.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
#define GET_BITS_WITH_MASK(value, mask) ((value & mask) >> (mask == 0 ? 0 : __builtin_ctz(mask)))

typedef struct {
const void* unwindInfo;
const void* ehFrame;
const void *unwindInfo;
const void *ehFrame;
uintptr_t loadAddress;

struct unwind_info_section_header unwindHeader;
Expand All @@ -51,18 +51,18 @@ typedef struct {

} FIRCLSCompactUnwindResult;

bool FIRCLSCompactUnwindInit(FIRCLSCompactUnwindContext* context,
const void* unwindInfo,
const void* ehFrame,
bool FIRCLSCompactUnwindInit(FIRCLSCompactUnwindContext *context,
const void *unwindInfo,
const void *ehFrame,
uintptr_t loadAddress);
void* FIRCLSCompactUnwindGetIndexData(FIRCLSCompactUnwindContext* context);
void* FIRCLSCompactUnwindGetSecondLevelData(FIRCLSCompactUnwindContext* context);
bool FIRCLSCompactUnwindFindFirstLevelIndex(FIRCLSCompactUnwindContext* context,
void *FIRCLSCompactUnwindGetIndexData(FIRCLSCompactUnwindContext *context);
void *FIRCLSCompactUnwindGetSecondLevelData(FIRCLSCompactUnwindContext *context);
bool FIRCLSCompactUnwindFindFirstLevelIndex(FIRCLSCompactUnwindContext *context,
uintptr_t pc,
uint32_t* index);
uint32_t *index);

bool FIRCLSCompactUnwindDwarfFrame(FIRCLSCompactUnwindContext* context,
bool FIRCLSCompactUnwindDwarfFrame(FIRCLSCompactUnwindContext *context,
uintptr_t dwarfOffset,
FIRCLSThreadContext* registers);
bool FIRCLSCompactUnwindLookupAndCompute(FIRCLSCompactUnwindContext* context,
FIRCLSThreadContext* registers);
FIRCLSThreadContext *registers);
bool FIRCLSCompactUnwindLookupAndCompute(FIRCLSCompactUnwindContext *context,
FIRCLSThreadContext *registers);
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
#include <mach-o/compact_unwind_encoding.h>
#pragma pack(pop)

bool FIRCLSCompactUnwindLookup(FIRCLSCompactUnwindContext* context,
bool FIRCLSCompactUnwindLookup(FIRCLSCompactUnwindContext *context,
uintptr_t pc,
FIRCLSCompactUnwindResult* result);
FIRCLSCompactUnwindResult *result);

bool FIRCLSCompactUnwindComputeRegisters(FIRCLSCompactUnwindContext* context,
FIRCLSCompactUnwindResult* result,
FIRCLSThreadContext* registers);
bool FIRCLSCompactUnwindComputeRegisters(FIRCLSCompactUnwindContext *context,
FIRCLSCompactUnwindResult *result,
FIRCLSThreadContext *registers);
26 changes: 13 additions & 13 deletions Crashlytics/Crashlytics/Unwind/Dwarf/FIRCLSDataParsing.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,20 @@
#endif

// basic data types
uint8_t FIRCLSParseUint8AndAdvance(const void** cursor);
uint16_t FIRCLSParseUint16AndAdvance(const void** cursor);
int16_t FIRCLSParseInt16AndAdvance(const void** cursor);
uint32_t FIRCLSParseUint32AndAdvance(const void** cursor);
int32_t FIRCLSParseInt32AndAdvance(const void** cursor);
uint64_t FIRCLSParseUint64AndAdvance(const void** cursor);
int64_t FIRCLSParseInt64AndAdvance(const void** cursor);
uintptr_t FIRCLSParsePointerAndAdvance(const void** cursor);
uint64_t FIRCLSParseULEB128AndAdvance(const void** cursor);
int64_t FIRCLSParseLEB128AndAdvance(const void** cursor);
const char* FIRCLSParseStringAndAdvance(const void** cursor);
uint8_t FIRCLSParseUint8AndAdvance(const void **cursor);
uint16_t FIRCLSParseUint16AndAdvance(const void **cursor);
int16_t FIRCLSParseInt16AndAdvance(const void **cursor);
uint32_t FIRCLSParseUint32AndAdvance(const void **cursor);
int32_t FIRCLSParseInt32AndAdvance(const void **cursor);
uint64_t FIRCLSParseUint64AndAdvance(const void **cursor);
int64_t FIRCLSParseInt64AndAdvance(const void **cursor);
uintptr_t FIRCLSParsePointerAndAdvance(const void **cursor);
uint64_t FIRCLSParseULEB128AndAdvance(const void **cursor);
int64_t FIRCLSParseLEB128AndAdvance(const void **cursor);
const char *FIRCLSParseStringAndAdvance(const void **cursor);

// FDE/CIE-specifc structures
uint64_t FIRCLSParseRecordLengthAndAdvance(const void** cursor);
uintptr_t FIRCLSParseAddressWithEncodingAndAdvance(const void** cursor, uint8_t encoding);
uint64_t FIRCLSParseRecordLengthAndAdvance(const void **cursor);
uintptr_t FIRCLSParseAddressWithEncodingAndAdvance(const void **cursor, uint8_t encoding);

#endif
62 changes: 31 additions & 31 deletions Crashlytics/Crashlytics/Unwind/Dwarf/FIRCLSDwarfUnwind.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@
#pragma mark Structures
typedef struct {
uint32_t length;
const void* data;
const void *data;
} DWARFInstructions;

typedef struct {
uint64_t length;
uint8_t version;
uintptr_t ehData; // 8 bytes for 64-bit architectures, 4 bytes for 32
const char* augmentation;
const char *augmentation;
uint8_t pointerEncoding;
uint8_t lsdaEncoding;
uint8_t personalityEncoding;
Expand Down Expand Up @@ -77,7 +77,7 @@ typedef struct {
typedef struct {
uint64_t cfaRegister;
int64_t cfaRegisterOffset;
const void* cfaExpression;
const void *cfaExpression;
uint32_t spArgSize;

FIRCLSDwarfRegister registers[CLS_DWARF_MAX_REGISTER_NUM + 1];
Expand All @@ -86,51 +86,51 @@ typedef struct {
__BEGIN_DECLS

#pragma mark - Parsing
bool FIRCLSDwarfParseCIERecord(DWARFCIERecord* cie, const void* ptr);
bool FIRCLSDwarfParseFDERecord(DWARFFDERecord* fdeRecord,
bool FIRCLSDwarfParseCIERecord(DWARFCIERecord *cie, const void *ptr);
bool FIRCLSDwarfParseFDERecord(DWARFFDERecord *fdeRecord,
bool parseCIE,
DWARFCIERecord* cieRecord,
const void* ptr);
bool FIRCLSDwarfParseCFIFromFDERecord(FIRCLSDwarfCFIRecord* record, const void* ptr);
bool FIRCLSDwarfParseCFIFromFDERecordOffset(FIRCLSDwarfCFIRecord* record,
const void* ehFrame,
DWARFCIERecord *cieRecord,
const void *ptr);
bool FIRCLSDwarfParseCFIFromFDERecord(FIRCLSDwarfCFIRecord *record, const void *ptr);
bool FIRCLSDwarfParseCFIFromFDERecordOffset(FIRCLSDwarfCFIRecord *record,
const void *ehFrame,
uintptr_t fdeOffset);

#pragma mark - Properties
bool FIRCLSDwarfCIEIsValid(DWARFCIERecord* cie);
bool FIRCLSDwarfCIEHasAugmentationData(DWARFCIERecord* cie);
bool FIRCLSDwarfCIEIsValid(DWARFCIERecord *cie);
bool FIRCLSDwarfCIEHasAugmentationData(DWARFCIERecord *cie);

#pragma mark - Execution
bool FIRCLSDwarfInstructionsEnumerate(DWARFInstructions* instructions,
DWARFCIERecord* cieRecord,
FIRCLSDwarfState* state,
bool FIRCLSDwarfInstructionsEnumerate(DWARFInstructions *instructions,
DWARFCIERecord *cieRecord,
FIRCLSDwarfState *state,
intptr_t pcOffset);
bool FIRCLSDwarfUnwindComputeRegisters(FIRCLSDwarfCFIRecord* record,
FIRCLSThreadContext* registers);
bool FIRCLSDwarfUnwindAssignRegisters(const FIRCLSDwarfState* state,
const FIRCLSThreadContext* registers,
bool FIRCLSDwarfUnwindComputeRegisters(FIRCLSDwarfCFIRecord *record,
FIRCLSThreadContext *registers);
bool FIRCLSDwarfUnwindAssignRegisters(const FIRCLSDwarfState *state,
const FIRCLSThreadContext *registers,
uintptr_t cfaRegister,
FIRCLSThreadContext* outputRegisters);
FIRCLSThreadContext *outputRegisters);

#pragma mark - Register Operations
bool FIRCLSDwarfCompareRegisters(const FIRCLSThreadContext* a,
const FIRCLSThreadContext* b,
bool FIRCLSDwarfCompareRegisters(const FIRCLSThreadContext *a,
const FIRCLSThreadContext *b,
uint64_t registerNum);

bool FIRCLSDwarfGetCFA(FIRCLSDwarfState* state,
const FIRCLSThreadContext* registers,
uintptr_t* cfa);
uintptr_t FIRCLSDwarfGetSavedRegister(const FIRCLSThreadContext* registers,
bool FIRCLSDwarfGetCFA(FIRCLSDwarfState *state,
const FIRCLSThreadContext *registers,
uintptr_t *cfa);
uintptr_t FIRCLSDwarfGetSavedRegister(const FIRCLSThreadContext *registers,
uintptr_t cfaRegister,
FIRCLSDwarfRegister dRegister);

#if DEBUG
#pragma mark - Debugging
void FIRCLSCFIRecordShow(FIRCLSDwarfCFIRecord* record);
void FIRCLSCIERecordShow(DWARFCIERecord* record);
void FIRCLSFDERecordShow(DWARFFDERecord* record, DWARFCIERecord* cie);
void FIRCLSDwarfPointerEncodingShow(const char* leadString, uint8_t encoding);
void FIRCLSDwarfInstructionsShow(DWARFInstructions* instructions, DWARFCIERecord* cie);
void FIRCLSCFIRecordShow(FIRCLSDwarfCFIRecord *record);
void FIRCLSCIERecordShow(DWARFCIERecord *record);
void FIRCLSFDERecordShow(DWARFFDERecord *record, DWARFCIERecord *cie);
void FIRCLSDwarfPointerEncodingShow(const char *leadString, uint8_t encoding);
void FIRCLSDwarfInstructionsShow(DWARFInstructions *instructions, DWARFCIERecord *cie);
#endif

__END_DECLS
Expand Down
Loading
Loading