add an option to EGL to dump stack traces on errors

enable by setting debug.egl.callstack to 1

Change-Id: I7fad9ce71b4c4c5ece97d4f9d139348eab742a3c
This commit is contained in:
Mathias Agopian 2011-09-06 17:24:05 -07:00
parent 113c69b1ba
commit ecfe091af3
2 changed files with 18 additions and 4 deletions

View File

@ -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;
}

View File

@ -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();
}
}
}