summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMattias Petersson <mattias.petersson@sonyericsson.com>2012-06-05 10:43:01 +0200
committerJohan Redestig <johan.redestig@sonymobile.com>2012-06-05 10:43:01 +0200
commit8c9441fdbb1ac31c3eca2fb047629476daaa6490 (patch)
treeaf609ce438a4f085cc7180c86ce416ac1e97d7db
parent07901d5e8d0be0130d92b626f0b92d177ba8f460 (diff)
downloaddalvik-8c9441fdbb1ac31c3eca2fb047629476daaa6490.tar.gz
Fixing a crash when doing lock profiling
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
-rw-r--r--vm/Sync.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/vm/Sync.cpp b/vm/Sync.cpp
index 80cc6af58..eea5116a2 100644
--- a/vm/Sync.cpp
+++ b/vm/Sync.cpp
@@ -276,6 +276,11 @@ static void logContentionEvent(Thread *self, u4 waitMs, u4 samplePercent,
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;