summaryrefslogtreecommitdiffstats
path: root/third_party/mach_override
diff options
context:
space:
mode:
authorrsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-18 22:37:26 +0000
committerrsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-18 22:37:26 +0000
commit1316dd30020cfdf32eb7e26f64595e25aa09746e (patch)
treefef4b16784be0482ab1d93faf6d55dda226b1fae /third_party/mach_override
parentb2862f008ae2032b3b44e0ef9999dd589059b227 (diff)
downloadchromium_src-1316dd30020cfdf32eb7e26f64595e25aa09746e.zip
chromium_src-1316dd30020cfdf32eb7e26f64595e25aa09746e.tar.gz
chromium_src-1316dd30020cfdf32eb7e26f64595e25aa09746e.tar.bz2
Patch mach_override to not use printf() for errors, but fprintf(stderr, ...).
BUG=none TEST=Layout tests go green. Review URL: http://codereview.chromium.org/7655052 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@97379 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'third_party/mach_override')
-rw-r--r--third_party/mach_override/README.chromium2
-rw-r--r--third_party/mach_override/mach_override.c10
2 files changed, 7 insertions, 5 deletions
diff --git a/third_party/mach_override/README.chromium b/third_party/mach_override/README.chromium
index 75a9938..fad7a93 100644
--- a/third_party/mach_override/README.chromium
+++ b/third_party/mach_override/README.chromium
@@ -21,3 +21,5 @@ Local Modifications:
Added the instructions to |possibleInstructions| for the very short
malloc_error_break() on 10.5 so that it can be overriden on that platform.
+
+Print errors using fprintf() to stderr, rather than printf() to stdout.
diff --git a/third_party/mach_override/mach_override.c b/third_party/mach_override/mach_override.c
index 2d12e43..3920026 100644
--- a/third_party/mach_override/mach_override.c
+++ b/third_party/mach_override/mach_override.c
@@ -193,7 +193,7 @@ mach_override_ptr(
overridePossible = false;
}
if (!overridePossible) err = err_cannot_override;
- if (err) printf("err = %x %d\n", err, __LINE__);
+ if (err) fprintf(stderr, "err = %x %s:%d\n", err, __FILE__, __LINE__);
#endif
// Make the original function implementation writable.
@@ -206,13 +206,13 @@ mach_override_ptr(
(vm_address_t) originalFunctionPtr, 8, false,
(VM_PROT_DEFAULT | VM_PROT_COPY) );
}
- if (err) printf("err = %x %d\n", err, __LINE__);
+ if (err) fprintf(stderr, "err = %x %s:%d\n", err, __FILE__, __LINE__);
// Allocate and target the escape island to the overriding function.
BranchIsland *escapeIsland = NULL;
if( !err )
err = allocateBranchIsland( &escapeIsland, kAllocateHigh, originalFunctionAddress );
- if (err) printf("err = %x %d\n", err, __LINE__);
+ if (err) fprintf(stderr, "err = %x %s:%d\n", err, __FILE__, __LINE__);
#if defined(__ppc__) || defined(__POWERPC__)
@@ -226,12 +226,12 @@ mach_override_ptr(
branchAbsoluteInstruction = 0x48000002 | escapeIslandAddress;
}
#elif defined(__i386__) || defined(__x86_64__)
- if (err) printf("err = %x %d\n", err, __LINE__);
+ if (err) fprintf(stderr, "err = %x %s:%d\n", err, __FILE__, __LINE__);
if( !err )
err = setBranchIslandTarget_i386( escapeIsland, overrideFunctionAddress, 0 );
- if (err) printf("err = %x %d\n", err, __LINE__);
+ if (err) fprintf(stderr, "err = %x %s:%d\n", err, __FILE__, __LINE__);
// Build the jump relative instruction to the escape island
#endif