[PATCH] egltrace/android: Fix tracing Zygote processes (v2)
Alexander Monakov
amonakov at ispras.ru
Mon Jun 17 09:36:06 PDT 2013
The root cause of the problem was a bug in the implementation of
getZygoteProcessName. When the wrap.$procname approach is used, reading
/proc/cmdline produces "$procname\0/system/bin\0--application\0"... (with
embedded zero characters).
Fixed by simply not supplying length argument to the truncate call, which will
truncate to strlen(). The same bug is also present in getProcessName.
Alexander
diff --git a/common/os_posix.cpp b/common/os_posix.cpp
index 7ddd895..e2e16bd 100644
--- a/common/os_posix.cpp
+++ b/common/os_posix.cpp
@@ -74,7 +74,6 @@ getProcessName(void)
*buf = 0;
return path;
}
- len = strlen(buf);
#else
ssize_t len;
len = readlink("/proc/self/exe", buf, size - 1);
@@ -92,7 +91,7 @@ getProcessName(void)
return path;
}
#endif
- path.truncate(len);
+ path.truncate();
return path;
}
diff --git a/wrappers/trace.cpp b/wrappers/trace.cpp
index d79b11b..33b5cf1 100644
--- a/wrappers/trace.cpp
+++ b/wrappers/trace.cpp
@@ -70,7 +70,7 @@ getZygoteProcessName(void)
assert(fd >= 0);
len = read(fd, buf, size - 1);
close(fd);
- path.truncate(len);
+ path.truncate();
return path;
}
More information about the apitrace
mailing list