Merge change 24061 into eclair
* changes:
Added a hack that makes the SD card world-writable when the sampling profiler is turned out. I'll remove this once egnor has the drop box in system_server working.
diff --git a/libacc/acc.cpp b/libacc/acc.cpp
index c52b992..b8ff29d 100644
--- a/libacc/acc.cpp
+++ b/libacc/acc.cpp
@@ -13,20 +13,20 @@
#include <ctype.h>
#include <errno.h>
+#include <limits.h>
#include <stdarg.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
+
#include <cutils/hashmap.h>
#if defined(__i386__)
#include <sys/mman.h>
#endif
-#if defined(__arm__)
-#include <unistd.h>
-#endif
#if defined(__arm__)
#define DEFAULT_ARM_CODEGEN
@@ -58,6 +58,17 @@
#define ENABLE_ARM_DISASSEMBLY
// #define PROVIDE_TRACE_CODEGEN
+// Uncomment to save input to a text file in DEBUG_DUMP_PATTERN
+// #define DEBUG_SAVE_INPUT_TO_FILE
+
+#ifdef DEBUG_SAVE_INPUT_TO_FILE
+#ifdef ARM_USE_VFP
+#define DEBUG_DUMP_PATTERN "/data/misc/acc_dump/%d.c"
+#else
+#define DEBUG_DUMP_PATTERN "/tmp/acc_dump/%d.c"
+#endif
+#endif
+
#define assert(b) assertImpl(b, __LINE__)
namespace acc {
@@ -1537,21 +1548,27 @@
#endif
}
} else {
- assert (r0Tag == TY_DOUBLE);
- if (destTag == TY_INT) {
+ if (r0Tag == TY_DOUBLE) {
+ if (destTag == TY_INT) {
#ifdef ARM_USE_VFP
- o4(0xEEFD7BC7); // ftosizd s15, d7
- o4(0xEE170A90); // fmrs r0, s15
+ o4(0xEEFD7BC7); // ftosizd s15, d7
+ o4(0xEE170A90); // fmrs r0, s15
#else
- callRuntime((void*) runtime_double_to_int);
+ callRuntime((void*) runtime_double_to_int);
#endif
+ } else {
+ if(destTag == TY_FLOAT) {
+#ifdef ARM_USE_VFP
+ o4(0xEEF77BC7); // fcvtsd s15, d7
+#else
+ callRuntime((void*) runtime_double_to_float);
+#endif
+ } else {
+ incompatibleTypes(pR0Type, pType);
+ }
+ }
} else {
- assert(destTag == TY_FLOAT);
-#ifdef ARM_USE_VFP
- o4(0xEEF77BC7); // fcvtsd s15, d7
-#else
- callRuntime((void*) runtime_double_to_float);
-#endif
+ incompatibleTypes(pR0Type, pType);
}
}
}
@@ -2021,6 +2038,10 @@
return false;
}
+ void incompatibleTypes(Type* pR0Type, Type* pType) {
+ error("Incompatible types old: %d new: %d", pR0Type->tag, pType->tag);
+ }
+
size_t rotateRight(size_t n, size_t rotate) {
return (n >> rotate) | (n << (32 - rotate));
}
@@ -5327,6 +5348,16 @@
mLocals.add(pDecl);
}
+ bool checkUndeclaredStruct(Type* pBaseType) {
+ if (pBaseType->tag == TY_STRUCT && pBaseType->length < 0) {
+ String temp;
+ decodeToken(temp, pBaseType->structTag, false);
+ error("Undeclared struct %s", temp.getUnwrapped());
+ return true;
+ }
+ return false;
+ }
+
void localDeclarations(Type* pBaseType) {
intptr_t a;
@@ -5339,6 +5370,9 @@
if (!pDecl->id) {
break;
}
+ if (checkUndeclaredStruct(pDecl)) {
+ break;
+ }
int variableAddress = 0;
addLocalSymbol(pDecl);
size_t alignment = pGen->alignmentOf(pDecl);
@@ -5436,6 +5470,11 @@
continue;
}
+ if (checkUndeclaredStruct(pDecl)) {
+ skip(';');
+ continue;
+ }
+
if (! isDefined(pDecl->id)) {
addGlobalSymbol(pDecl);
}
@@ -5895,6 +5934,29 @@
dest += len;
}
text[totalLength] = '\0';
+
+#ifdef DEBUG_SAVE_INPUT_TO_FILE
+ LOGD("Saving input to file...");
+ int counter;
+ char path[PATH_MAX];
+ for (counter = 0; counter < 4096; counter++) {
+ sprintf(path, DEBUG_DUMP_PATTERN, counter);
+ if(access(path, F_OK) != 0) {
+ break;
+ }
+ }
+ if (counter < 4096) {
+ LOGD("Saving input to file %s", path);
+ FILE* fd = fopen(path, "w");
+ if (fd) {
+ fwrite(text, totalLength, 1, fd);
+ fclose(fd);
+ LOGD("Saved input to file %s", path);
+ } else {
+ LOGD("Could not save. errno: %d", errno);
+ }
+ }
+#endif
}
extern "C"
diff --git a/rootdir/init.rc b/rootdir/init.rc
index 7d9869f..5d0c8b5 100644
--- a/rootdir/init.rc
+++ b/rootdir/init.rc
@@ -70,26 +70,24 @@
# storing dumps on platforms which do not have a dedicated dump partition.
mkdir /data/dontpanic
- chmod 0770 /data/dontpanic
+ chown root system /data/dontpanic
+ chmod 0750 /data/dontpanic
# Collect apanic data, free resources and re-arm trigger
copy /proc/apanic_console /data/dontpanic/apanic_console
chown root system /data/dontpanic/apanic_console
- # STOPSHIP!
- chmod 0664 /data/dontpanic/apanic_console
+ chmod 0640 /data/dontpanic/apanic_console
copy /proc/apanic_threads /data/dontpanic/apanic_threads
chown root system /data/dontpanic/apanic_threads
- # STOPSHIP!
- chmod 0664 /data/dontpanic/apanic_threads
+ chmod 0640 /data/dontpanic/apanic_threads
write /proc/apanic_console 1
# Collect ramconsole data
copy /proc/last_kmsg /data/dontpanic/last_kmsg
chown root system /data/dontpanic/last_kmsg
- # STOPSHIP!
- chmod 0664 /data/dontpanic/last_kmsg
+ chmod 0640 /data/dontpanic/last_kmsg
# Same reason as /data above
mount yaffs2 mtd@cache /cache nosuid nodev