diff options
author | fjhenigman@chromium.org <fjhenigman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-17 21:11:54 +0000 |
---|---|---|
committer | fjhenigman@chromium.org <fjhenigman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-17 21:11:54 +0000 |
commit | 99b73c36bfe37307cb5a1aabcc4ea3a32ddd54aa (patch) | |
tree | c6f1143266d5c6dae898ec6fd4965f37dd1c4148 /third_party | |
parent | 155601d4ba957496202457d8c53fa45a3f7c425d (diff) | |
download | chromium_src-99b73c36bfe37307cb5a1aabcc4ea3a32ddd54aa.zip chromium_src-99b73c36bfe37307cb5a1aabcc4ea3a32ddd54aa.tar.gz chromium_src-99b73c36bfe37307cb5a1aabcc4ea3a32ddd54aa.tar.bz2 |
Add __android_log_assert.
Called from android logging macro used in mesa.
BUG=358029
Review URL: https://codereview.chromium.org/321353002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@277862 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'third_party')
-rw-r--r-- | third_party/hwcplus/src/hwcplus_util.c | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/third_party/hwcplus/src/hwcplus_util.c b/third_party/hwcplus/src/hwcplus_util.c index 57c4519..1c7873a 100644 --- a/third_party/hwcplus/src/hwcplus_util.c +++ b/third_party/hwcplus/src/hwcplus_util.c @@ -6,8 +6,9 @@ #include <stdio.h> #include <string.h> -#include <hardware/hardware.h> +#include <android/log.h> #include <cutils/properties.h> +#include <hardware/hardware.h> #define LOG_BUF_SIZE 1024 @@ -64,6 +65,33 @@ int __android_log_print(int prio, const char* tag, const char* fmt, ...) { return __android_log_write(prio, tag, buf); } +void __android_log_assert(const char* cond, + const char* tag, + const char* fmt, + ...) { + char buf[LOG_BUF_SIZE]; + + if (fmt) { + va_list ap; + va_start(ap, fmt); + vsnprintf(buf, LOG_BUF_SIZE, fmt, ap); + va_end(ap); + } else { + /* Msg not provided, log condition. N.B. Do not use cond directly as + * format string as it could contain spurious '%' syntax (e.g. + * "%d" in "blocks%devs == 0"). + */ + if (cond) + snprintf(buf, LOG_BUF_SIZE, "Assertion failed: %s", cond); + else + snprintf(buf, LOG_BUF_SIZE, "Unspecified assertion failed"); + } + + __android_log_write(ANDROID_LOG_FATAL, tag, buf); + + __builtin_trap(); /* trap so we have a chance to debug the situation */ +} + int property_get(const char* key, char* value, const char* default_value) { printf("property_get %s\n", key); const char* r = default_value; @@ -72,4 +100,3 @@ int property_get(const char* key, char* value, const char* default_value) { strncpy(value, r, PROPERTY_VALUE_MAX); return strlen(r); } - |