Remove usage of gDebugLog and DEBUGLOG from Mac and iOS client code.

The inconsistent and duplicated references to gDebugLog caused
problems building on iOS and the current logging implementation
had little utility because it was never activated in debug builds.



git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1257 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
altse@chromium.org 2013-12-12 19:58:00 +00:00
parent 88b8ac6182
commit b5e5d8bd30
5 changed files with 5 additions and 89 deletions

View file

@ -27,15 +27,6 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define VERBOSE 0
#if VERBOSE
static bool gDebugLog = true;
#else
static bool gDebugLog = false;
#endif
#define DEBUGLOG if (gDebugLog) fprintf
#define IGNORE_DEBUGGER "BREAKPAD_IGNORE_DEBUGGER" #define IGNORE_DEBUGGER "BREAKPAD_IGNORE_DEBUGGER"
#import "client/ios/Breakpad.h" #import "client/ios/Breakpad.h"
@ -289,7 +280,6 @@ bool Breakpad::Initialize(NSDictionary *parameters) {
// Check for debugger // Check for debugger
if (IsDebuggerActive()) { if (IsDebuggerActive()) {
DEBUGLOG(stderr, "Debugger is active: Not installing handler\n");
return true; return true;
} }
@ -368,17 +358,14 @@ bool Breakpad::ExtractParameters(NSDictionary *parameters) {
// The product, version, and URL are required values. // The product, version, and URL are required values.
if (![product length]) { if (![product length]) {
DEBUGLOG(stderr, "Missing required product key.\n");
return false; return false;
} }
if (![version length]) { if (![version length]) {
DEBUGLOG(stderr, "Missing required version key.\n");
return false; return false;
} }
if (![urlStr length]) { if (![urlStr length]) {
DEBUGLOG(stderr, "Missing required URL key.\n");
return false; return false;
} }
@ -530,8 +517,6 @@ NSDictionary *Breakpad::GenerateReport(NSDictionary *server_parameters) {
//============================================================================= //=============================================================================
bool Breakpad::HandleMinidump(const char *dump_dir, bool Breakpad::HandleMinidump(const char *dump_dir,
const char *minidump_id) { const char *minidump_id) {
DEBUGLOG(stderr, "Breakpad: a minidump has been created.\n");
config_file_.WriteFile(dump_dir, config_file_.WriteFile(dump_dir,
config_params_, config_params_,
dump_dir, dump_dir,

View file

@ -28,15 +28,7 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// //
#define VERBOSE 0
#if VERBOSE
static bool gDebugLog = true;
#else
static bool gDebugLog = false;
#endif
#define DEBUGLOG if (gDebugLog) fprintf
#define IGNORE_DEBUGGER "BREAKPAD_IGNORE_DEBUGGER" #define IGNORE_DEBUGGER "BREAKPAD_IGNORE_DEBUGGER"
#import "client/mac/Framework/Breakpad.h" #import "client/mac/Framework/Breakpad.h"
@ -311,7 +303,6 @@ NSString * GetResourcePath() {
// executable code, since that's how the Breakpad framework is built. // executable code, since that's how the Breakpad framework is built.
resourcePath = [bundlePath stringByAppendingPathComponent:@"Resources/"]; resourcePath = [bundlePath stringByAppendingPathComponent:@"Resources/"];
} else { } else {
DEBUGLOG(stderr, "Could not find GetResourcePath\n");
// fallback plan // fallback plan
NSBundle *bundle = NSBundle *bundle =
[NSBundle bundleWithIdentifier:@"com.Google.BreakpadFramework"]; [NSBundle bundleWithIdentifier:@"com.Google.BreakpadFramework"];
@ -330,7 +321,6 @@ bool Breakpad::Initialize(NSDictionary *parameters) {
// Check for debugger // Check for debugger
if (IsDebuggerActive()) { if (IsDebuggerActive()) {
DEBUGLOG(stderr, "Debugger is active: Not installing handler\n");
return true; return true;
} }
@ -505,7 +495,6 @@ bool Breakpad::ExtractParameters(NSDictionary *parameters) {
if (!inspectorPathString || !reporterPathString) { if (!inspectorPathString || !reporterPathString) {
resourcePath = GetResourcePath(); resourcePath = GetResourcePath();
if (!resourcePath) { if (!resourcePath) {
DEBUGLOG(stderr, "Could not get resource path\n");
return false; return false;
} }
} }
@ -518,7 +507,6 @@ bool Breakpad::ExtractParameters(NSDictionary *parameters) {
// Verify that there is an Inspector tool. // Verify that there is an Inspector tool.
if (![[NSFileManager defaultManager] fileExistsAtPath:inspectorPathString]) { if (![[NSFileManager defaultManager] fileExistsAtPath:inspectorPathString]) {
DEBUGLOG(stderr, "Cannot find Inspector tool\n");
return false; return false;
} }
@ -534,7 +522,6 @@ bool Breakpad::ExtractParameters(NSDictionary *parameters) {
// Verify that there is a Reporter application. // Verify that there is a Reporter application.
if (![[NSFileManager defaultManager] if (![[NSFileManager defaultManager]
fileExistsAtPath:reporterPathString]) { fileExistsAtPath:reporterPathString]) {
DEBUGLOG(stderr, "Cannot find Reporter tool\n");
return false; return false;
} }
@ -544,17 +531,14 @@ bool Breakpad::ExtractParameters(NSDictionary *parameters) {
// The product, version, and URL are required values. // The product, version, and URL are required values.
if (![product length]) { if (![product length]) {
DEBUGLOG(stderr, "Missing required product key.\n");
return false; return false;
} }
if (![version length]) { if (![version length]) {
DEBUGLOG(stderr, "Missing required version key.\n");
return false; return false;
} }
if (![urlStr length]) { if (![urlStr length]) {
DEBUGLOG(stderr, "Missing required URL key.\n");
return false; return false;
} }
@ -651,8 +635,6 @@ bool Breakpad::HandleException(int exception_type,
int exception_code, int exception_code,
int exception_subcode, int exception_subcode,
mach_port_t crashing_thread) { mach_port_t crashing_thread) {
DEBUGLOG(stderr, "Breakpad: an exception occurred\n");
if (filter_callback_) { if (filter_callback_) {
bool should_handle = filter_callback_(exception_type, bool should_handle = filter_callback_(exception_type,
exception_code, exception_code,

View file

@ -38,15 +38,6 @@
#import "client/apple/Framework/BreakpadDefines.h" #import "client/apple/Framework/BreakpadDefines.h"
#import "GTMDefines.h" #import "GTMDefines.h"
#define VERBOSE 0
#if VERBOSE
bool gDebugLog = true;
#else
bool gDebugLog = false;
#endif
#define DEBUGLOG if (gDebugLog) fprintf
namespace google_breakpad { namespace google_breakpad {
@ -77,13 +68,10 @@ BOOL ConfigFile::AppendConfigData(const char *key,
assert(config_file_ != -1); assert(config_file_ != -1);
if (!key) { if (!key) {
DEBUGLOG(stderr, "Breakpad: Missing Key\n");
return NO; return NO;
} }
if (!data) { if (!data) {
DEBUGLOG(stderr, "Breakpad: Missing data for key: %s\n", key ? key :
"<Unknown Key>");
return NO; return NO;
} }
@ -147,14 +135,8 @@ void ConfigFile::WriteFile(const char* directory,
config_file_ = mkstemp(config_file_path_); config_file_ = mkstemp(config_file_path_);
if (config_file_ == -1) { if (config_file_ == -1) {
DEBUGLOG(stderr,
"mkstemp(config_file_path_) == -1 (%s)\n",
strerror(errno));
return; return;
} }
else {
DEBUGLOG(stderr, "Writing config file to (%s)\n", config_file_path_);
}
has_created_file_ = true; has_created_file_ = true;
@ -170,10 +152,6 @@ void ConfigFile::WriteFile(const char* directory,
SimpleStringDictionary::Iterator iter(dictionary); SimpleStringDictionary::Iterator iter(dictionary);
while ((entry = iter.Next())) { while ((entry = iter.Next())) {
DEBUGLOG(stderr,
"config: (%s) -> (%s)\n",
entry->key,
entry->value);
result = AppendConfigString(entry->key, entry->value); result = AppendConfigString(entry->key, entry->value);
if (!result) if (!result)

View file

@ -38,9 +38,6 @@
#import "client/mac/crash_generation/ConfigFile.h" #import "client/mac/crash_generation/ConfigFile.h"
#import "client/mac/handler/minidump_generator.h" #import "client/mac/handler/minidump_generator.h"
extern bool gDebugLog;
#define DEBUGLOG if (gDebugLog) fprintf
// Types of mach messsages (message IDs) // Types of mach messsages (message IDs)
enum { enum {
@ -87,7 +84,6 @@ class MinidumpLocation {
// Ensure that the path exists. Fallback to /tmp if unable to locate path. // Ensure that the path exists. Fallback to /tmp if unable to locate path.
assert(minidumpDir); assert(minidumpDir);
if (!EnsureDirectoryPathExists(minidumpDir)) { if (!EnsureDirectoryPathExists(minidumpDir)) {
DEBUGLOG(stderr, "Unable to create: %s\n", [minidumpDir UTF8String]);
minidumpDir = @"/tmp"; minidumpDir = @"/tmp";
} }

View file

@ -252,8 +252,6 @@ kern_return_t Inspector::ReadMessages() {
} }
} }
if (parameters_read != info.parameter_count) { if (parameters_read != info.parameter_count) {
DEBUGLOG(stderr, "Only read %d parameters instead of %d, aborting crash "
"dump generation.", parameters_read, info.parameter_count);
return KERN_FAILURE; return KERN_FAILURE;
} }
} }
@ -265,7 +263,6 @@ kern_return_t Inspector::ReadMessages() {
bool Inspector::InspectTask() { bool Inspector::InspectTask() {
// keep the task quiet while we're looking at it // keep the task quiet while we're looking at it
task_suspend(remote_task_); task_suspend(remote_task_);
DEBUGLOG(stderr, "Suspended Remote task\n");
NSString *minidumpDir; NSString *minidumpDir;
@ -282,11 +279,11 @@ bool Inspector::InspectTask() {
NSString *applicationSupportDirectory = NSString *applicationSupportDirectory =
[libraryDirectories objectAtIndex:0]; [libraryDirectories objectAtIndex:0];
NSString *library_subdirectory = [NSString NSString *library_subdirectory = [NSString
stringWithUTF8String:kDefaultLibrarySubdirectory]; stringWithUTF8String:kDefaultLibrarySubdirectory];
NSString *breakpad_product = [NSString NSString *breakpad_product = [NSString
stringWithUTF8String:config_params_.GetValueForKey(BREAKPAD_PRODUCT)]; stringWithUTF8String:config_params_.GetValueForKey(BREAKPAD_PRODUCT)];
NSArray *path_components = [NSArray NSArray *path_components = [NSArray
arrayWithObjects:applicationSupportDirectory, arrayWithObjects:applicationSupportDirectory,
library_subdirectory, library_subdirectory,
@ -298,9 +295,6 @@ bool Inspector::InspectTask() {
minidumpDir = [[NSString stringWithUTF8String:minidumpDirectory] minidumpDir = [[NSString stringWithUTF8String:minidumpDirectory]
stringByExpandingTildeInPath]; stringByExpandingTildeInPath];
} }
DEBUGLOG(stderr,
"Writing minidump to directory (%s)\n",
[minidumpDir UTF8String]);
MinidumpLocation minidumpLocation(minidumpDir); MinidumpLocation minidumpLocation(minidumpDir);
@ -314,13 +308,8 @@ bool Inspector::InspectTask() {
NSString *pathid_ns = [NSString NSString *pathid_ns = [NSString
stringWithUTF8String:minidumpLocation.GetID()]; stringWithUTF8String:minidumpLocation.GetID()];
NSString *minidumpPath = [path_ns stringByAppendingPathComponent:pathid_ns]; NSString *minidumpPath = [path_ns stringByAppendingPathComponent:pathid_ns];
minidumpPath = [minidumpPath minidumpPath = [minidumpPath
stringByAppendingPathExtension:@"dmp"]; stringByAppendingPathExtension:@"dmp"];
DEBUGLOG(stderr,
"minidump path (%s)\n",
[minidumpPath UTF8String]);
config_file_.WriteFile( 0, config_file_.WriteFile( 0,
&config_params_, &config_params_,
@ -340,15 +329,8 @@ bool Inspector::InspectTask() {
bool result = generator.Write([minidumpPath fileSystemRepresentation]); bool result = generator.Write([minidumpPath fileSystemRepresentation]);
if (result) {
DEBUGLOG(stderr, "Wrote minidump - OK\n");
} else {
DEBUGLOG(stderr, "Error writing minidump - errno=%s\n", strerror(errno));
}
// let the task continue // let the task continue
task_resume(remote_task_); task_resume(remote_task_);
DEBUGLOG(stderr, "Resumed remote task\n");
return result; return result;
} }
@ -361,9 +343,6 @@ kern_return_t Inspector::SendAcknowledgement() {
MachPortSender sender(ack_port_); MachPortSender sender(ack_port_);
MachSendMessage ack_message(kMsgType_InspectorAcknowledgement); MachSendMessage ack_message(kMsgType_InspectorAcknowledgement);
DEBUGLOG(stderr, "Inspector: trying to send acknowledgement to port %d\n",
ack_port_);
kern_return_t result = sender.SendMessage(ack_message, 2000); kern_return_t result = sender.SendMessage(ack_message, 2000);
#if VERBOSE #if VERBOSE
@ -373,7 +352,6 @@ kern_return_t Inspector::SendAcknowledgement() {
return result; return result;
} }
DEBUGLOG(stderr, "Inspector: port translation failure!\n");
return KERN_INVALID_NAME; return KERN_INVALID_NAME;
} }
@ -382,7 +360,6 @@ void Inspector::LaunchReporter(const char *inConfigFilePath) {
// Extract the path to the reporter executable. // Extract the path to the reporter executable.
const char *reporterExecutablePath = const char *reporterExecutablePath =
config_params_.GetValueForKey(BREAKPAD_REPORTER_EXE_LOCATION); config_params_.GetValueForKey(BREAKPAD_REPORTER_EXE_LOCATION);
DEBUGLOG(stderr, "reporter path = %s\n", reporterExecutablePath);
// Setup and launch the crash dump sender. // Setup and launch the crash dump sender.
const char *argv[3]; const char *argv[3];
@ -398,7 +375,6 @@ void Inspector::LaunchReporter(const char *inConfigFilePath) {
if (pid == 0) { if (pid == 0) {
execv(argv[0], (char * const *)argv); execv(argv[0], (char * const *)argv);
config_file_.Unlink(); // launch failed - get rid of config file config_file_.Unlink(); // launch failed - get rid of config file
DEBUGLOG(stderr, "Inspector: unable to launch reporter app\n");
_exit(1); _exit(1);
} }
@ -416,8 +392,7 @@ void Inspector::LaunchReporter(const char *inConfigFilePath) {
// The child has not yet finished. // The child has not yet finished.
sleep(1); sleep(1);
} else if (result == -1) { } else if (result == -1) {
DEBUGLOG(stderr, "Inspector: waitpid error (%d) waiting for reporter app\n", // error occurred.
errno);
break; break;
} else { } else {
// child has finished // child has finished