This is a fix for a crash that can happen when logging Contention
events. This logging is performed when lock profiling is enabled.
This is by default enabled on userdebug builds. The crash happened
when a thread was being destroyed. When a thread is being
destroyed it is normal that the frame depth is zero, and thus the
current frame is null. logContentionEvent() requires that the
current frame is not null, or it will crash.
The fix is to check if the current frame is null.
Change-Id: I4c2b9ad94b663398645497fdffa1ec6f7ea86a51
size_t len;
int fd;
+ /* When a thread is being destroyed it is normal that the frame depth is zero */
+ if (self->interpSave.curFrame == NULL) {
+ return;
+ }
+
saveArea = SAVEAREA_FROM_FP(self->interpSave.curFrame);
meth = saveArea->method;
cp = eventBuffer;