Fix warnings in tests

This commit is contained in:
Ivan Matkov
2022-09-20 16:53:03 +02:00
parent f75053824c
commit 5cbcda0fa3
3 changed files with 5 additions and 15 deletions

View File

@@ -829,7 +829,7 @@
STAssertEquals(PLCRASH_ESUCCESS, plcrash_async_cfe_entry_init(&entry, CPU_TYPE_ARM64, encoding), @"Failed to initialize CFE entry");
/* Initialize default thread state */
plcrash_greg_t stack_addr = &stackframe[4]; // fp
plcrash_greg_t stack_addr = (plcrash_greg_t) &stackframe[4]; // fp
STAssertEquals(plcrash_async_thread_state_init(&ts, CPU_TYPE_ARM64), PLCRASH_ESUCCESS, @"Failed to initialize thread state");
plcrash_async_thread_state_set_reg(&ts, PLCRASH_REG_FP, stack_addr);
@@ -892,7 +892,7 @@
/* Initialize default thread state */
STAssertEquals(plcrash_async_thread_state_init(&ts, CPU_TYPE_ARM64), PLCRASH_ESUCCESS, @"Failed to initialize thread state");
plcrash_async_thread_state_set_reg(&ts, PLCRASH_REG_SP, &stackframe);
plcrash_async_thread_state_set_reg(&ts, PLCRASH_REG_SP, (plcrash_greg_t) &stackframe);
plcrash_async_thread_state_set_reg(&ts, PLCRASH_ARM64_LR, 2);
/* Apply */

View File

@@ -105,15 +105,7 @@ using namespace plcrash::async;
/* Determine the address size */
const plcrash_async_byteorder_t *byteorder = plcrash_async_macho_byteorder(&_image);
cpu_type_t cputype = byteorder->swap32(_image.header.cputype);
uint8_t address_size;
if (cputype & CPU_ARCH_ABI64) {
_m64 = true;
address_size = 8;
} else {
_m64 = false;
address_size = 4;
}
_m64 = cputype & CPU_ARCH_ABI64;
/* Initialize eh/debug readers */
err = _eh_reader.init(&_eh_frame, byteorder, _m64, false);

View File

@@ -52,10 +52,9 @@
- (void) testExceptionPortStatesForTask {
plcrash_mach_exception_port_set_t states;
NSError *error;
kern_return_t kr;
/* Fetch the current ports */
kr = task_get_exception_ports(mach_task_self(), EXC_MASK_ALL_SAFE, states.masks, &states.count, states.ports, states.behaviors, states.flavors);
task_get_exception_ports(mach_task_self(), EXC_MASK_ALL_SAFE, states.masks, &states.count, states.ports, states.behaviors, states.flavors);
PLCrashMachExceptionPortSet *objStates = [PLCrashMachExceptionPort exceptionPortsForTask: mach_task_self() mask: EXC_MASK_ALL_SAFE error: &error];
STAssertNotNil(objStates, @"Failed to fetch port state: %@", error);
@@ -80,10 +79,9 @@
- (void) testExceptionPortStatesForThread {
plcrash_mach_exception_port_set_t states;
NSError *error;
kern_return_t kr;
/* Fetch the current ports */
kr = thread_get_exception_ports(pl_mach_thread_self(), EXC_MASK_ALL_SAFE, states.masks, &states.count, states.ports, states.behaviors, states.flavors);
thread_get_exception_ports(pl_mach_thread_self(), EXC_MASK_ALL_SAFE, states.masks, &states.count, states.ports, states.behaviors, states.flavors);
PLCrashMachExceptionPortSet *objStates = [PLCrashMachExceptionPort exceptionPortsForThread: pl_mach_thread_self() mask: EXC_MASK_ALL_SAFE error: &error];
STAssertNotNil(objStates, @"Failed to fetch port state: %@", error);