diff options
author | Mathias Agopian <mathias@google.com> | 2011-09-06 17:24:05 -0700 |
---|---|---|
committer | Mathias Agopian <mathias@google.com> | 2011-09-06 18:06:04 -0700 |
commit | ecfe091af3e3e5d7165fe64a5f9c84c4576a6c06 (patch) | |
tree | 2090cfb846ede4286711d79b33fb2cb3dbcd89de | |
parent | 113c69b1ba5925c37019ed1e4bf1232a78b41ded (diff) | |
download | frameworks_native-ecfe091af3e3e5d7165fe64a5f9c84c4576a6c06.zip frameworks_native-ecfe091af3e3e5d7165fe64a5f9c84c4576a6c06.tar.gz frameworks_native-ecfe091af3e3e5d7165fe64a5f9c84c4576a6c06.tar.bz2 |
add an option to EGL to dump stack traces on errors
enable by setting debug.egl.callstack to 1
Change-Id: I7fad9ce71b4c4c5ece97d4f9d139348eab742a3c
-rw-r--r-- | opengl/libs/EGL/egl.cpp | 11 | ||||
-rw-r--r-- | opengl/libs/EGL/egl_tls.cpp | 11 |
2 files changed, 18 insertions, 4 deletions
diff --git a/opengl/libs/EGL/egl.cpp b/opengl/libs/EGL/egl.cpp index ca62908..1e43195 100644 --- a/opengl/libs/EGL/egl.cpp +++ b/opengl/libs/EGL/egl.cpp @@ -148,10 +148,13 @@ static int gl_no_context() { if (egl_tls_t::logNoContextCall()) { LOGE("call to OpenGL ES API with no current context " "(logged once per thread)"); - LOGE("call stack before error:"); - CallStack stack; - stack.update(); - stack.dump(); + char value[PROPERTY_VALUE_MAX]; + property_get("debug.egl.callstack", value, "0"); + if (atoi(value)) { + CallStack stack; + stack.update(); + stack.dump(); + } } return 0; } diff --git a/opengl/libs/EGL/egl_tls.cpp b/opengl/libs/EGL/egl_tls.cpp index 961a61e..f3c8d2c 100644 --- a/opengl/libs/EGL/egl_tls.cpp +++ b/opengl/libs/EGL/egl_tls.cpp @@ -14,9 +14,13 @@ ** limitations under the License. */ +#include <stdlib.h> #include <pthread.h> #include <cutils/log.h> +#include <cutils/properties.h> + +#include <utils/CallStack.h> #include <EGL/egl.h> @@ -69,6 +73,13 @@ void egl_tls_t::setErrorEtcImpl(const char* caller, int line, EGLint error) { if (tls->error != error) { LOGE("%s:%d error %x (%s)", caller, line, error, egl_strerror(error)); tls->error = error; + char value[PROPERTY_VALUE_MAX]; + property_get("debug.egl.callstack", value, "0"); + if (atoi(value)) { + CallStack stack; + stack.update(); + stack.dump(); + } } } |