Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1588)

Side by Side Diff: client/mac/crash_generation/Inspector.mm

Issue 87013: Make breakpad compile against 10.5 SDK (Closed) Base URL: http://google-breakpad.googlecode.com/svn/trunk/src/
Patch Set: '' Created 11 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | client/mac/sender/crash_report_sender.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2007, Google Inc. 1 // Copyright (c) 2007, Google Inc.
2 // All rights reserved. 2 // All rights reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // met:
7 // 7 //
8 // * Redistributions of source code must retain the above copyright 8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer. 9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above 10 // * Redistributions in binary form must reproduce the above
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 const char *dump_dir, 153 const char *dump_dir,
154 const char *minidump_id) { 154 const char *minidump_id) {
155 155
156 assert(config_file_ == -1); 156 assert(config_file_ == -1);
157 157
158 // Open and write out configuration file preamble 158 // Open and write out configuration file preamble
159 strlcpy(config_file_path_, "/tmp/Config-XXXXXX", 159 strlcpy(config_file_path_, "/tmp/Config-XXXXXX",
160 sizeof(config_file_path_)); 160 sizeof(config_file_path_));
161 config_file_ = mkstemp(config_file_path_); 161 config_file_ = mkstemp(config_file_path_);
162 162
163 if (config_file_ == -1) 163 if (config_file_ == -1) {
164 DEBUGLOG(stderr,
165 "mkstemp(config_file_path_) == -1 (%s)\n",
166 strerror(errno));
164 return; 167 return;
168 }
169 else {
170 DEBUGLOG(stderr, "Writing config file to (%s)\n", config_file_path_);
171 }
165 172
166 has_created_file_ = true; 173 has_created_file_ = true;
167 174
168 // Add the minidump dir 175 // Add the minidump dir
169 AppendConfigString(kReporterMinidumpDirectoryKey, dump_dir); 176 AppendConfigString(kReporterMinidumpDirectoryKey, dump_dir);
170 AppendConfigString(kReporterMinidumpIDKey, minidump_id); 177 AppendConfigString(kReporterMinidumpIDKey, minidump_id);
171 178
172 // Write out the configuration parameters 179 // Write out the configuration parameters
173 BOOL result = YES; 180 BOOL result = YES;
174 const SimpleStringDictionary &dictionary = *configurationParameters; 181 const SimpleStringDictionary &dictionary = *configurationParameters;
175 182
176 const KeyValueEntry *entry = NULL; 183 const KeyValueEntry *entry = NULL;
177 SimpleStringDictionaryIterator iter(dictionary); 184 SimpleStringDictionaryIterator iter(dictionary);
178 185
179 while ((entry = iter.Next())) { 186 while ((entry = iter.Next())) {
187 DEBUGLOG(stderr,
188 "config: (%s) -> (%s)\n",
189 entry->GetKey(),
190 entry->GetValue());
180 result = AppendConfigString(entry->GetKey(), entry->GetValue()); 191 result = AppendConfigString(entry->GetKey(), entry->GetValue());
181 192
182 if (!result) 193 if (!result)
183 break; 194 break;
184 } 195 }
185 196
186 close(config_file_); 197 close(config_file_);
187 config_file_ = -1; 198 config_file_ = -1;
188 } 199 }
189 200
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 } 328 }
318 } 329 }
319 330
320 return result; 331 return result;
321 } 332 }
322 333
323 //============================================================================= 334 //=============================================================================
324 bool Inspector::InspectTask() { 335 bool Inspector::InspectTask() {
325 // keep the task quiet while we're looking at it 336 // keep the task quiet while we're looking at it
326 task_suspend(remote_task_); 337 task_suspend(remote_task_);
338 DEBUGLOG(stderr, "Suspsended Remote task\n");
327 339
328 NSString *minidumpDir; 340 NSString *minidumpDir;
329 341
330 const char *minidumpDirectory = 342 const char *minidumpDirectory =
331 config_params_.GetValueForKey(BREAKPAD_DUMP_DIRECTORY); 343 config_params_.GetValueForKey(BREAKPAD_DUMP_DIRECTORY);
332 344
333 // If the client app has not specified a minidump directory, 345 // If the client app has not specified a minidump directory,
334 // use a default of Library/<kDefaultLibrarySubdirectory>/<Product Name> 346 // use a default of Library/<kDefaultLibrarySubdirectory>/<Product Name>
335 if (0 == strlen(minidumpDirectory)) { 347 if (0 == strlen(minidumpDirectory)) {
336 NSArray *libraryDirectories = 348 NSArray *libraryDirectories =
337 NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, 349 NSSearchPathForDirectoriesInDomains(NSLibraryDirectory,
338 NSUserDomainMask, 350 NSUserDomainMask,
339 YES); 351 YES);
340 352
341 NSString *applicationSupportDirectory = 353 NSString *applicationSupportDirectory =
342 [libraryDirectories objectAtIndex:0]; 354 [libraryDirectories objectAtIndex:0];
343 355
344 minidumpDir = 356 minidumpDir =
345 [NSString stringWithFormat:@"%@/%s/%s", 357 [NSString stringWithFormat:@"%@/%s/%s",
346 applicationSupportDirectory, 358 applicationSupportDirectory,
347 kDefaultLibrarySubdirectory, 359 kDefaultLibrarySubdirectory,
348 config_params_.GetValueForKey(BREAKPAD_PRODUCT)]; 360 config_params_.GetValueForKey(BREAKPAD_PRODUCT)];
349 } else { 361 } else {
350 minidumpDir = [[NSString stringWithUTF8String:minidumpDirectory] 362 minidumpDir = [[NSString stringWithUTF8String:minidumpDirectory]
351 stringByExpandingTildeInPath]; 363 stringByExpandingTildeInPath];
352 } 364 }
365 DEBUGLOG(stderr,
366 "Writing minidump to directory (%s)\n",
367 [minidumpDir UTF8String]);
353 368
354 MinidumpLocation minidumpLocation(minidumpDir); 369 MinidumpLocation minidumpLocation(minidumpDir);
355 370
356 config_file_.WriteFile( &config_params_, 371 config_file_.WriteFile( &config_params_,
357 minidumpLocation.GetPath(), 372 minidumpLocation.GetPath(),
358 minidumpLocation.GetID()); 373 minidumpLocation.GetID());
359 374
360 375
361 MinidumpGenerator generator(remote_task_, handler_thread_); 376 MinidumpGenerator generator(remote_task_, handler_thread_);
362 377
363 if (exception_type_ && exception_code_) { 378 if (exception_type_ && exception_code_) {
364 generator.SetExceptionInformation(exception_type_, 379 generator.SetExceptionInformation(exception_type_,
365 exception_code_, 380 exception_code_,
366 crashing_thread_); 381 crashing_thread_);
367 } 382 }
368 383
369 NSString *minidumpPath = [NSString stringWithFormat:@"%s/%s.dmp", 384 NSString *minidumpPath = [NSString stringWithFormat:@"%s/%s.dmp",
370 minidumpLocation.GetPath(), minidumpLocation.GetID()]; 385 minidumpLocation.GetPath(), minidumpLocation.GetID()];
386 DEBUGLOG(stderr,
387 "minidump path (%s)\n",
388 [minidumpPath UTF8String]);
389
371 390
372 bool result = generator.Write([minidumpPath fileSystemRepresentation]); 391 bool result = generator.Write([minidumpPath fileSystemRepresentation]);
373 392
374 DEBUGLOG(stderr, "Inspector: finished writing minidump file: %s\n", 393 DEBUGLOG(stderr, "Wrote minidump - %s\n", result ? "OK" : "FAILED");
375 [minidumpPath fileSystemRepresentation]);
376 394
377 // let the task continue 395 // let the task continue
378 task_resume(remote_task_); 396 task_resume(remote_task_);
397 DEBUGLOG(stderr, "Resumed remote task\n");
379 398
380 return result; 399 return result;
381 } 400 }
382 401
383 //============================================================================= 402 //=============================================================================
384 // The crashed task needs to be told that the inspection has finished. 403 // The crashed task needs to be told that the inspection has finished.
385 // It will wait on a mach port (with timeout) until we send acknowledgement. 404 // It will wait on a mach port (with timeout) until we send acknowledgement.
386 kern_return_t Inspector::SendAcknowledgement() { 405 kern_return_t Inspector::SendAcknowledgement() {
387 if (ack_port_ != MACH_PORT_DEAD) { 406 if (ack_port_ != MACH_PORT_DEAD) {
388 MachPortSender sender(ack_port_); 407 MachPortSender sender(ack_port_);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 break; 467 break;
449 } else { 468 } else {
450 // child has finished 469 // child has finished
451 break; 470 break;
452 } 471 }
453 } 472 }
454 } 473 }
455 474
456 } // namespace google_breakpad 475 } // namespace google_breakpad
457 476
OLDNEW
« no previous file with comments | « no previous file | client/mac/sender/crash_report_sender.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698