Switch the tests to the new hand-generated CFE data.

This commit is contained in:
Landon Fuller 2013-03-12 19:09:51 -04:00
Родитель a0eae6dc4c
Коммит 8b35546082
7 изменённых файлов: 20 добавлений и 81 удалений

Просмотреть файл

@ -1,6 +1,7 @@
DEVELOPER?= $(shell xcode-select -print-path)
PLATFORMS?= $(DEVELOPER)/Platforms/
CFLAGS?= -Os -std=c99
LDFLAGS?= -dynamiclib
DEVICE_SDK?= iPhoneOS6.1
DEVICE_PLATFORM?= $(PLATFORMS)/iPhoneOS.platform
@ -20,9 +21,9 @@ MAC_ROOT?= $(MAC_PLATFORM)/Developer/SDKs/$(MAC_SDK).sdk
MAC_CC?= $(shell xcrun -sdk `echo ${MAC_SDK} | tr '[A-Z]' '[a-z]'` -f clang)
MAC_CFLAGS?= -arch x86_64 -arch i386 -isysroot "$(MAC_ROOT)" -mmacosx-version-min=10.6 -gdwarf-2 $(CFLAGS)
IOS_OBJS= example-ios.o
SIM_OBJS= example-sim.o
MAC_OBJS= example-macosx.o
IOS_OBJS= test-ios.o
SIM_OBJS= test-sim.o
MAC_OBJS= test-macosx.o
PRODUCTS= $(IOS_PRODUCT) $(MAC_PRODUCT) $(SIM_PRODUCT)
IOS_PRODUCT= test.ios
@ -31,23 +32,23 @@ MAC_PRODUCT= test.macosx
all: $(PRODUCTS)
example-sim.o: example.S
test-sim.o: test.c
$(SIM_CC) $(SIM_CFLAGS) -c $< -o $@
example-ios.o: example.S
test-ios.o: test.c
$(DEVICE_CC) $(DEVICE_CFLAGS) -c $< -o $@
example-macosx.o: example.S
test-macosx.o: test.c
$(MAC_CC) $(MAC_CFLAGS) -c $< -o $@
$(MAC_PRODUCT): $(MAC_OBJS)
$(MAC_CC) $(MAC_CFLAGS) $+ -o $@
$(MAC_CC) $(LDFLAGS) $(MAC_CFLAGS) $+ -o $@
$(IOS_PRODUCT): $(IOS_OBJS)
$(DEVICE_CC) $(DEVICE_CFLAGS) $+ -o $@
$(DEVICE_CC) $(LDFLAGS) $(DEVICE_CFLAGS) $+ -o $@
$(SIM_PRODUCT): $(SIM_OBJS)
$(SIM_CC) $(SIM_CFLAGS) $+ -o $@
$(SIM_CC) $(LDFLAGS) $(SIM_CFLAGS) $+ -o $@
clean-objs:
rm -f $(IOS_OBJS) $(MAC_OBJS) $(SIM_OBJS)

Просмотреть файл

@ -1,57 +0,0 @@
#if defined(__x86_64__)
// This triggers common encoding handling with _main
.globl _main_common
_main_common:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset %rbp, -16
movq %rsp, %rbp
.cfi_def_cfa_register %rbp
movl $5, %eax
popq %rbp
ret
.cfi_endproc
// This hack forces the use of a common encoding
// by preventing the use of an entry range that includes
// both _main_common and _main
.globl _main_noncommon
_main_noncommon:
.cfi_startproc
.cfi_def_cfa_offset 32
nop
ret
.cfi_endproc
.globl _main
_main:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset %rbp, -16
movq %rsp, %rbp
.cfi_def_cfa_register %rbp
movl $5, %eax
popq %rbp
ret
.cfi_endproc
#elif defined(__i386__)
.globl _main
_main:
.cfi_startproc
// TODO
movl $5, %eax
ret
.cfi_endproc
#elif defined(__arm__)
.align 4
.arm
.globl _main
_main:
// TODO
mov r0, #5
pop {pc}
#endif

Просмотреть файл

@ -15,7 +15,7 @@ struct unwind_sect_regular_page {
struct unwind_sect {
struct unwind_info_section_header hdr;
struct unwind_info_section_header_index_entry entries[2];
struct unwind_info_section_header_index_entry entries[3];
struct unwind_sect_regular_page regular_page_1;
@ -30,12 +30,16 @@ struct unwind_sect data __attribute__((section("__TEXT,__unwind_info"))) = {
.personalityArraySectionOffset = 0,
.personalityArrayCount = 0,
.indexSectionOffset = offsetof(struct unwind_sect, entries),
.indexCount = 2 // all tools treat this as indexCount - 1
.indexCount = 3 // all tools treat this as indexCount - 1
},
.entries = {
{
.functionOffset = 0,
.secondLevelPagesSectionOffset = offsetof(struct unwind_sect, regular_page_1)
},
{
.functionOffset = 1,
.secondLevelPagesSectionOffset = offsetof(struct unwind_sect, compressed_page_1)
},
{ } // empty/ignored entry

Двоичный файл не отображается.

Двоичный файл не отображается.

Двоичный файл не отображается.

Просмотреть файл

@ -46,6 +46,9 @@
#error Unsupported target
#endif
/** The base PC value hard coded in our test CFE data */
#define BASE_PC 1
/**
* @internal
*
@ -196,20 +199,8 @@
err = plcrash_async_cfe_reader_init(&reader, &mobj, cputype);
STAssertEquals(err, PLCRASH_ESUCCESS, @"Failed to initialize CFE reader");
/* Find the binary symbol address of the main symbol */
pl_vm_address_t mainPC;
err = plcrash_async_macho_find_symbol_by_name(&_image, "_main", &mainPC);
STAssertEquals(PLCRASH_ESUCCESS, err, @"Failed to locate main symbol");
// TODO - the address supplied must be relative to the base address of the on-disk
// LC_SEGMENT's vmaddr. We need to consider how to best express this cleanly via the
// API, but in the meantime, we can adjust it manually.
mainPC -= _image.vmaddr_slide;
mainPC -= _image.text_vmaddr;
/* Perform a smoke test lookup */
err = plcrash_async_cfe_reader_find_pc(&reader, mainPC);
err = plcrash_async_cfe_reader_find_pc(&reader, BASE_PC);
STAssertEquals(PLCRASH_ESUCCESS, err, @"Failed to locate CFE entry for main");
/* Clean up */