aboutsummaryrefslogtreecommitdiff
path: root/src/tools/mac/crash_report/on_demand_symbol_supplier.mm
diff options
context:
space:
mode:
authordmaclach <dmaclach@4c0a9323-5329-0410-9bdc-e9ce6186880e>2010-07-19 20:43:49 +0000
committerdmaclach <dmaclach@4c0a9323-5329-0410-9bdc-e9ce6186880e>2010-07-19 20:43:49 +0000
commit4ac61acb3a7dad6ce722fe07564be8ec92713228 (patch)
treefb71c49eb2aa7ca1f1867854ad9871c84504bc46 /src/tools/mac/crash_report/on_demand_symbol_supplier.mm
parentBreakpad Linux/Mac symbol dumper: Share duplicate strings that arise in DWARF... (diff)
downloadbreakpad-4ac61acb3a7dad6ce722fe07564be8ec92713228.tar.xz
Clean up build for 64 bit.
Fix up some broken mac projects. Consolidate project settings in xcconfig files. http://breakpad.appspot.com/130001 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@627 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src/tools/mac/crash_report/on_demand_symbol_supplier.mm')
-rw-r--r--src/tools/mac/crash_report/on_demand_symbol_supplier.mm39
1 files changed, 25 insertions, 14 deletions
diff --git a/src/tools/mac/crash_report/on_demand_symbol_supplier.mm b/src/tools/mac/crash_report/on_demand_symbol_supplier.mm
index 4123a27c..0f37686f 100644
--- a/src/tools/mac/crash_report/on_demand_symbol_supplier.mm
+++ b/src/tools/mac/crash_report/on_demand_symbol_supplier.mm
@@ -53,7 +53,7 @@ OnDemandSymbolSupplier::OnDemandSymbolSupplier(const string &search_dir,
const string &symbol_search_dir)
: search_dir_(search_dir) {
NSFileManager *mgr = [NSFileManager defaultManager];
- int length = symbol_search_dir.length();
+ size_t length = symbol_search_dir.length();
if (length) {
// Load all sym files in symbol_search_dir into our module_file_map
// A symbol file always starts with a line like this:
@@ -149,7 +149,7 @@ OnDemandSymbolSupplier::GetSymbolFile(const CodeModule *module,
if (s == FOUND) {
- ifstream in(symbol_file->c_str());
+ std::ifstream in(symbol_file->c_str());
getline(in, *symbol_data, std::string::traits_type::to_char_type(
std::string::traits_type::eof()));
in.close();
@@ -174,14 +174,14 @@ string OnDemandSymbolSupplier::GetLocalModulePath(const CodeModule *module) {
// search string and stop if a file (not dir) is found or all components
// have been appended
NSArray *pathComponents = [modulePath componentsSeparatedByString:@"/"];
- int count = [pathComponents count];
+ size_t count = [pathComponents count];
NSMutableString *path = [NSMutableString string];
- for (int i = 0; i < count; ++i) {
+ for (size_t i = 0; i < count; ++i) {
[path setString:searchDir];
- for (int j = 0; j < i + 1; ++j) {
- int idx = count - 1 - i + j;
+ for (size_t j = 0; j < i + 1; ++j) {
+ size_t idx = count - 1 - i + j;
[path appendFormat:@"/%@", [pathComponents objectAtIndex:idx]];
}
@@ -214,7 +214,7 @@ static float GetFileModificationTime(const char *path) {
struct stat file_stat;
if (stat(path, &file_stat) == 0)
result = (float)file_stat.st_mtimespec.tv_sec +
- (float)file_stat.st_mtimespec.tv_nsec / 1.0e9;
+ (float)file_stat.st_mtimespec.tv_nsec / 1.0e9f;
return result;
}
@@ -236,7 +236,7 @@ bool OnDemandSymbolSupplier::GenerateSymbolFile(const CodeModule *module,
if ([[NSFileManager defaultManager] fileExistsAtPath:symbol_path]) {
// Check if the module file is newer than the saved symbols
float cache_time =
- GetFileModificationTime([symbol_path fileSystemRepresentation]);
+ GetFileModificationTime([symbol_path fileSystemRepresentation]);
float module_time =
GetFileModificationTime(module_path.c_str());
@@ -248,15 +248,26 @@ bool OnDemandSymbolSupplier::GenerateSymbolFile(const CodeModule *module,
NSString *module_str = [[NSFileManager defaultManager]
stringWithFileSystemRepresentation:module_path.c_str()
length:module_path.length()];
- DumpSymbols *dump = [[DumpSymbols alloc] initWithContentsOfFile:module_str];
- const char *archStr = system_info->cpu.c_str();
- if ([dump setArchitecture:[NSString stringWithUTF8String:archStr]]) {
- [dump writeSymbolFile:symbol_path];
+ DumpSymbols dump;
+ if (dump.Read(module_str)) {
+ if (dump.SetArchitecture(system_info->cpu)) {
+ FILE *file = fopen([symbol_path fileSystemRepresentation],"w");
+ if (file) {
+ dump.WriteSymbolFile(file);
+ fclose(file);
+ } else {
+ printf("Unable to open %s (%d)\n", name.c_str(), errno);
+ result = false;
+ }
+ } else {
+ printf("Architecture %s not available for %s\n",
+ system_info->cpu.c_str(), name.c_str());
+ result = false;
+ }
} else {
- printf("Architecture %s not available for %s\n", archStr, name.c_str());
+ printf("Unable to open %s\n", [module_str UTF8String]);
result = false;
}
- [dump release];
}
// Add the mapping