Change-Id: I9b69a23b308fe851ed49722c0da3953433b3f5b8
---
vm/Ddm.h | 3 +++
vm/Thread.cpp | 8 +++++++-
vm/Thread.h | 7 +++++++
3 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/vm/Ddm.h b/vm/Ddm.h
index f8c22ee..fe2fe75 100644
--- a/vm/Ddm.h
+++ b/vm/Ddm.h
@@ -19,6 +19,9 @@
#ifndef DALVIK_DDM_H_
#define DALVIK_DDM_H_
+#include <stdbool.h>
+#include "Thread.h"
+
/*
* Handle a packet full of DDM goodness.
*
diff --git a/vm/Thread.cpp b/vm/Thread.cpp
index 1ebfca7..057d751 100644
--- a/vm/Thread.cpp
+++ b/vm/Thread.cpp
@@ -1179,11 +1179,17 @@ static bool createFakeRunFrame(Thread* thread)
/*
* Helper function to set the name of the current thread
*/
-static void setThreadName(const char *threadName)
+void setThreadName(const char *threadName)
{
int hasAt = 0;
int hasDot = 0;
const char *s = threadName;
+
+ if (s == NULL) {
+ ALOGW("Unable to set the name of current thread to NULL");
+ return;
+ }
+
while (*s) {
if (*s == '.') hasDot = 1;
else if (*s == '@') hasAt = 1;
diff --git a/vm/Thread.h b/vm/Thread.h
index 19bd49c..3eb1099 100644
--- a/vm/Thread.h
+++ b/vm/Thread.h
@@ -608,4 +608,11 @@ void dvmDumpAllThreadsEx(const DebugOutputTarget* target,
bool grabLock);
*/
void dvmNukeThread(Thread* thread);
+/*
+ * Sets the threads name as pointed to by threadName in task_struct->comm.
+ * Note this field has a limited width, and larger values will be truncated
+ * to this width starting from the end.
+ */
+void setThreadName(const char *threadName);
+
#endif // DALVIK_THREAD_H_
--
1.7.9.5
--
This message was distributed to subscribers of the seandroid-list mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe seandroid-list" without quotes as the message.