diff options
author | nealsid <nealsid@4c0a9323-5329-0410-9bdc-e9ce6186880e> | 2008-05-05 18:20:04 +0000 |
---|---|---|
committer | nealsid <nealsid@4c0a9323-5329-0410-9bdc-e9ce6186880e> | 2008-05-05 18:20:04 +0000 |
commit | 47df365bf8ecaa31da752f2e61fc8257238544b2 (patch) | |
tree | 3ef9ebeb19c2e3ff96052a322a7836fd86f2812e /src/client/mac/handler | |
parent | Style changes (diff) | |
download | breakpad-47df365bf8ecaa31da752f2e61fc8257238544b2.tar.xz |
Issue 261/262: 64-bit bug fix when iterating through load commands of a 64-bit binary, and added new test case for ReadImageInfoForTask
git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@266 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src/client/mac/handler')
4 files changed, 21 insertions, 140 deletions
diff --git a/src/client/mac/handler/dynamic_images.cc b/src/client/mac/handler/dynamic_images.cc index 1019fe22..9f5e0fc9 100644 --- a/src/client/mac/handler/dynamic_images.cc +++ b/src/client/mac/handler/dynamic_images.cc @@ -210,7 +210,11 @@ void DynamicImage::CalculateMemoryInfo() { reinterpret_cast<const struct load_command *>(header + 1); for (unsigned int i = 0; cmd && (i < header->ncmds); ++i) { +#ifdef __LP64__ + if (cmd->cmd == LC_SEGMENT_64) { +#else if (cmd->cmd == LC_SEGMENT) { +#endif const breakpad_mach_segment_command *seg = reinterpret_cast<const breakpad_mach_segment_command *>(cmd); diff --git a/src/client/mac/handler/minidump_test.xcodeproj/project.pbxproj b/src/client/mac/handler/minidump_test.xcodeproj/project.pbxproj index 5b9b7d25..f855b4ff 100644 --- a/src/client/mac/handler/minidump_test.xcodeproj/project.pbxproj +++ b/src/client/mac/handler/minidump_test.xcodeproj/project.pbxproj @@ -391,7 +391,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "# Run the unit tests in this test bundle.\n\"${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests\"\n# Run gcov on the framework getting tested\nif [ \"${CONFIGURATION}\" = 'Coverage' ];\nthen\n FRAMEWORK_NAME=minidump_tests\n FRAMEWORK_OBJ_DIR=${OBJROOT}/${PROJECT_NAME}.build/${CONFIGURATION}/${FRAMEWORK_NAME}.build/Objects-normal/${NATIVE_ARCH_ACTUAL}\n mkdir -p coverage\n pushd coverage\n echo find ${OBJROOT} -name *.gcda -exec gcov -o ${FRAMEWORK_OBJ_DIR} {} \\;\n find ${OBJROOT} -name *.gcda -exec gcov -o ${FRAMEWORK_OBJ_DIR} {} \\;\n popd\nfi "; + shellScript = "# Run the unit tests in this test bundle.\n\"${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests\"\n# Run gcov on the framework getting tested\nif [ \"${CONFIGURATION}\" = 'Coverage' ];\nthen\n FRAMEWORK_NAME=minidump_tests64\n FRAMEWORK_OBJ_DIR=${OBJROOT}/${PROJECT_NAME}.build/${CONFIGURATION}/${FRAMEWORK_NAME}.build/Objects-normal/${NATIVE_ARCH_ACTUAL}\n mkdir -p coverage\n pushd coverage\n echo find ${OBJROOT} -name *.gcda -exec gcov -o ${FRAMEWORK_OBJ_DIR} {} \\;\n find ${OBJROOT} -name *.gcda -exec gcov -o ${FRAMEWORK_OBJ_DIR} {} \\;\n popd\nfi "; }; F9AE5B310DBFDBA300505983 /* ShellScript */ = { isa = PBXShellScriptBuildPhase; @@ -610,107 +610,6 @@ }; name = Release; }; - F996CB8C0DB40AE30089CCC8 /* Coverage */ = { - isa = XCBuildConfiguration; - buildSettings = { - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - OTHER_LDFLAGS = "-lcrypto"; - PREBINDING = NO; - SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk; - }; - name = Coverage; - }; - F996CB8D0DB40AE30089CCC8 /* Coverage */ = { - isa = XCBuildConfiguration; - buildSettings = { - COPY_PHASE_STRIP = NO; - GCC_CW_ASM_SYNTAX = NO; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = YES; - GCC_ENABLE_PASCAL_STRINGS = NO; - GCC_MODEL_TUNING = G5; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_THREADSAFE_STATICS = NO; - INSTALL_PATH = "$(HOME)/bin"; - PRODUCT_NAME = generator_test; - USER_HEADER_SEARCH_PATHS = "../../../** $(inherited)"; - ZERO_LINK = NO; - }; - name = Coverage; - }; - F996CB8E0DB40AE30089CCC8 /* Coverage */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = "$(NATIVE_ARCH)"; - COPY_PHASE_STRIP = NO; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = YES; - GCC_GENERATE_DEBUGGING_SYMBOLS = YES; - GCC_MODEL_TUNING = G5; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - INSTALL_PATH = "$(HOME)/bin"; - OTHER_CFLAGS = "-Wall"; - PREBINDING = NO; - PRODUCT_NAME = handler_test; - USER_HEADER_SEARCH_PATHS = "../../.. $(inherited)"; - ZERO_LINK = NO; - }; - name = Coverage; - }; - F996CB8F0DB40AE30089CCC8 /* Coverage */ = { - isa = XCBuildConfiguration; - buildSettings = { - COPY_PHASE_STRIP = NO; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = YES; - GCC_GENERATE_DEBUGGING_SYMBOLS = YES; - GCC_MODEL_TUNING = G5; - GCC_OPTIMIZATION_LEVEL = 0; - INSTALL_PATH = "$(HOME)/bin"; - PREBINDING = NO; - PRODUCT_NAME = unit_test; - USER_HEADER_SEARCH_PATHS = "../../../** $(inherited)"; - ZERO_LINK = NO; - }; - name = Coverage; - }; - F996CB900DB40AE30089CCC8 /* Coverage */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = ( - "$(NATIVE_ARCH_64_BIT)", - ppc64, - ); - COPY_PHASE_STRIP = NO; - FRAMEWORK_SEARCH_PATHS = "$(DEVELOPER_LIBRARY_DIR)/Frameworks"; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = NO; - GCC_GENERATE_TEST_COVERAGE_FILES = YES; - GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = YES; - GCC_MODEL_TUNING = G5; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Headers/Carbon.h"; - INFOPLIST_FILE = "minidump_tests64-Info.plist"; - INSTALL_PATH = "$(USER_LIBRARY_DIR)/Bundles"; - MACOSX_DEPLOYMENT_TARGET = 10.5; - OTHER_LDFLAGS = ( - "-framework", - Carbon, - "-framework", - CPlusTest, - "-lgcov", - ); - PREBINDING = NO; - PRODUCT_NAME = minidump_tests64; - SDKROOT = /Developer/SDKs/MacOSX10.5.sdk; - USER_HEADER_SEARCH_PATHS = "../../../**"; - WRAPPER_EXTENSION = cptest; - }; - name = Coverage; - }; F9AE19C40DB04A9500C98454 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -778,10 +677,7 @@ F9AE5B350DBFDBA300505983 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = ( - "$(NATIVE_ARCH)", - ppc, - ); + ARCHS = "$(NATIVE_ARCH)"; COPY_PHASE_STRIP = NO; FRAMEWORK_SEARCH_PATHS = "$(DEVELOPER_LIBRARY_DIR)/Frameworks"; GCC_DYNAMIC_NO_PIC = NO; @@ -805,33 +701,6 @@ }; name = Debug; }; - F9AE5B360DBFDBA300505983 /* Coverage */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = ( - "$(NATIVE_ARCH)", - ppc, - ); - FRAMEWORK_SEARCH_PATHS = "$(DEVELOPER_LIBRARY_DIR)/Frameworks"; - GCC_ENABLE_FIX_AND_CONTINUE = NO; - GCC_MODEL_TUNING = G5; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Headers/Carbon.h"; - INFOPLIST_FILE = "minidump_tests32-Info.plist"; - INSTALL_PATH = "$(USER_LIBRARY_DIR)/Bundles"; - OTHER_LDFLAGS = ( - "-framework", - Carbon, - "-framework", - CPlusTest, - ); - PREBINDING = NO; - PRODUCT_NAME = minidump_tests32; - USER_HEADER_SEARCH_PATHS = "../../../**"; - WRAPPER_EXTENSION = cptest; - }; - name = Coverage; - }; F9AE5B370DBFDBA300505983 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { @@ -869,7 +738,6 @@ isa = XCConfigurationList; buildConfigurations = ( 1DEB923208733DC60010E9CD /* Debug */, - F996CB8D0DB40AE30089CCC8 /* Coverage */, 1DEB923308733DC60010E9CD /* Release */, ); defaultConfigurationIsVisible = 0; @@ -879,7 +747,6 @@ isa = XCConfigurationList; buildConfigurations = ( 1DEB923608733DC60010E9CD /* Debug */, - F996CB8C0DB40AE30089CCC8 /* Coverage */, 1DEB923708733DC60010E9CD /* Release */, ); defaultConfigurationIsVisible = 0; @@ -889,7 +756,6 @@ isa = XCConfigurationList; buildConfigurations = ( 9B7CA8510B12984300CD3A1D /* Debug */, - F996CB8F0DB40AE30089CCC8 /* Coverage */, 9B7CA8520B12984300CD3A1D /* Release */, ); defaultConfigurationIsVisible = 0; @@ -899,7 +765,6 @@ isa = XCConfigurationList; buildConfigurations = ( 9BD82AA70B0026BF0055103E /* Debug */, - F996CB8E0DB40AE30089CCC8 /* Coverage */, 9BD82AA80B0026BF0055103E /* Release */, ); defaultConfigurationIsVisible = 0; @@ -909,7 +774,6 @@ isa = XCConfigurationList; buildConfigurations = ( F9AE19C40DB04A9500C98454 /* Debug */, - F996CB900DB40AE30089CCC8 /* Coverage */, F9AE19C50DB04A9500C98454 /* Release */, ); defaultConfigurationIsVisible = 0; @@ -919,7 +783,6 @@ isa = XCConfigurationList; buildConfigurations = ( F9AE5B350DBFDBA300505983 /* Debug */, - F9AE5B360DBFDBA300505983 /* Coverage */, F9AE5B370DBFDBA300505983 /* Release */, ); defaultConfigurationIsVisible = 0; diff --git a/src/client/mac/handler/testcases/DynamicImagesTests.cc b/src/client/mac/handler/testcases/DynamicImagesTests.cc index 1ddb79c4..cb76eb10 100644 --- a/src/client/mac/handler/testcases/DynamicImagesTests.cc +++ b/src/client/mac/handler/testcases/DynamicImagesTests.cc @@ -39,12 +39,13 @@ DynamicImagesTests test2(TEST_INVOCATION(DynamicImagesTests, ReadTaskMemoryTest)); +DynamicImagesTests test3(TEST_INVOCATION(DynamicImagesTests, + ReadLibrariesFromLocalTaskTest)); DynamicImagesTests::DynamicImagesTests(TestInvocation *invocation) : TestCase(invocation) { } - DynamicImagesTests::~DynamicImagesTests() { } @@ -70,3 +71,15 @@ void DynamicImagesTests::ReadTaskMemoryTest() { free(buf); } + +void DynamicImagesTests::ReadLibrariesFromLocalTaskTest() { + + mach_port_t me = mach_task_self(); + google_breakpad::DynamicImages *d = new google_breakpad::DynamicImages(me); + + fprintf(stderr,"Local task image count: %d\n", d->GetImageCount()); + + d->TestPrint(); + + CPTAssert(d->GetImageCount() > 0); +} diff --git a/src/client/mac/handler/testcases/DynamicImagesTests.h b/src/client/mac/handler/testcases/DynamicImagesTests.h index aeb20efe..e1e79993 100644 --- a/src/client/mac/handler/testcases/DynamicImagesTests.h +++ b/src/client/mac/handler/testcases/DynamicImagesTests.h @@ -46,6 +46,7 @@ class DynamicImagesTests : public TestCase { virtual ~DynamicImagesTests(); void ReadTaskMemoryTest(); + void ReadLibrariesFromLocalTaskTest(); }; #endif /* _CLIENT_MAC_HANDLER_TESTCASES_DYNAMICIMAGESTESTS_H__ */ |