Add debug.
Change-Id: Ib4cd484edbe3b0be68530de68caa4124bbfa4e46
diff --git a/lib/bcc/bcc.cpp b/lib/bcc/bcc.cpp
index 054c995..2f33c51 100644
--- a/lib/bcc/bcc.cpp
+++ b/lib/bcc/bcc.cpp
@@ -70,8 +70,14 @@
extern "C" int bccLoadBinary(BCCscript *script) {
int result = script->compiler.loadCacheFile();
- if (result)
+
+#if defined(USE_DISASSEMBLER_FILE)
+ LOGI("[LoadBinary] result=%d", result);
+#endif
+ if (result) {
script->setError(BCC_INVALID_OPERATION);
+ }
+
return result;
}
@@ -100,6 +106,9 @@
int trimmedLength = maxLength < messageLength ? maxLength : messageLength;
memcpy(infoLog, message, trimmedLength);
infoLog[trimmedLength] = 0;
+#if defined(USE_DISASSEMBLER_FILE)
+ LOGI("[GetScriptInfoLog] %s", infoLog);
+#endif
}
}
@@ -107,10 +116,14 @@
const BCCchar *name,
BCCvoid **address) {
void *value = script->compiler.lookup(name);
- if (value)
+ if (value) {
*address = value;
- else
+#if defined(USE_DISASSEMBLER_FILE)
+ LOGI("[GetScriptLabel] %s @ 0x%x", name, value);
+#endif
+ } else {
script->setError(BCC_INVALID_VALUE);
+ }
}
extern "C" void bccGetExportVars(BCCscript *script,
@@ -118,6 +131,17 @@
BCCsizei maxVarCount,
BCCvoid **vars) {
script->compiler.getExportVars(actualVarCount, maxVarCount, vars);
+
+#if defined(USE_DISASSEMBLER_FILE)
+ int i;
+ if (actualVarCount) {
+ LOGI("[ExportVars] #=%d:", *actualVarCount);
+ } else {
+ for (i = 0; i < maxVarCount; i++) {
+ LOGI("[ExportVars] #%d=0x%x", i, vars[i]);
+ }
+ }
+#endif
}
extern "C" void bccGetExportFuncs(BCCscript *script,
@@ -125,6 +149,17 @@
BCCsizei maxFuncCount,
BCCvoid **funcs) {
script->compiler.getExportFuncs(actualFuncCount, maxFuncCount, funcs);
+
+#if defined(USE_DISASSEMBLER_FILE)
+ int i;
+ if (actualFuncCount) {
+ LOGI("[ExportFunc] #=%d:", *actualFuncCount);
+ } else {
+ for (i = 0; i < maxFuncCount; i++) {
+ LOGI("[ExportFunc] #%d=0x%x", i, funcs[i]);
+ }
+ }
+#endif
}
extern "C" void bccGetPragmas(BCCscript *script,
@@ -132,6 +167,14 @@
BCCsizei maxStringCount,
BCCchar **strings) {
script->compiler.getPragmas(actualStringCount, maxStringCount, strings);
+
+#if defined(USE_DISASSEMBLER_FILE)
+ int i;
+ LOGI("[Pragma] #=%d:", *actualStringCount);
+ for (i = 0; i < *actualStringCount; i++) {
+ LOGI(" %s", strings[i]);
+ }
+#endif
}
extern "C" void bccGetFunctions(BCCscript *script,