Add .rs.info versionInfo parser to the cpu_ref driver
This is used by lldb to check for a versioning mismatch between the
frontent and backend, but is not used by libRS. However, libRS should
not fail in its presence, so this CL enables the runtime to skip this
section if it is present.
This field is not checked for by the compatibility lib.
Test: aosp_x86_64-eng (emulator)
- libbcc/tests
- RsTest (32-bit, 64-bit)
- cts -m RenderscriptTest
- rs/lldb (required various other pending CLs)
Change-Id: I3056dd08e7e14ff1094ead60756fd568131bcf4d
Signed-off-by: Luke Drummond <luke.drummond@codeplay.com>
diff --git a/cpu_ref/rsCpuExecutable.cpp b/cpu_ref/rsCpuExecutable.cpp
index 400a465..ad45eba 100644
--- a/cpu_ref/rsCpuExecutable.cpp
+++ b/cpu_ref/rsCpuExecutable.cpp
@@ -272,6 +272,7 @@
#define PRAGMA_STR "pragmaCount: "
#define THREADABLE_STR "isThreadable: "
#define CHECKSUM_STR "buildChecksum: "
+#define VERSIONINFO_STR "versionInfo: "
// Copy up to a newline or size chars from str -> s, updating str
// Returns s when successful and nullptr when '\0' is finally reached.
@@ -666,6 +667,26 @@
goto error;
}
+ {
+ // Parse the version info string, but ignore its contents as it's only
+ // used by the debugger
+ size_t nLines = 0;
+ if (strgets(line, MAXLINE, &rsInfo) != nullptr) {
+ if (sscanf(line, VERSIONINFO_STR "%zu", &nLines) != 1) {
+ ALOGE("invalid versionInfo count");
+ goto error;
+ } else {
+ // skip the versionInfo packet as libRs doesn't use it
+ while (nLines--) {
+ if (strgets(line, MAXLINE, &rsInfo) == nullptr)
+ goto error;
+ }
+ }
+ } else {
+ ALOGE(".rs.info is missing versionInfo section");
+ }
+ }
+
#endif // RS_COMPATIBILITY_LIB
// Read in information about mutable global variables provided by bcc's