Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Support -Xbootclasspath/a and /p for dvmProcessOptions in dalvik/vm/I…

…nit.c

Change-Id: I5549031ae6d6414797a22421e6bf62d1be08ac9a
  • Loading branch information...
commit 60cc993e5afb3327482b172cc7e54c469b231741 1 parent aa63a6a
@evans14641 evans14641 authored
Showing with 33 additions and 5 deletions.
  1. +33 −5 vm/Init.c
View
38 vm/Init.c
@@ -725,11 +725,39 @@ static int dvmProcessOptions(int argc, const char* const argv[],
free(gDvm.bootClassPathStr);
gDvm.bootClassPathStr = strdup(path);
- /*
- * TODO: support -Xbootclasspath/a and /p, which append or
- * prepend to the default bootclasspath. We set the default
- * path earlier.
- */
+ } else if (strncmp(argv[i], "-Xbootclasspath/a:",
+ sizeof("-Xbootclasspath/a:")-1) == 0) {
+ const char* appPath = argv[i] + sizeof("-Xbootclasspath/a:")-1;
+
+ if (*(appPath) == '\0') {
+ dvmFprintf(stderr, "Missing appending bootclasspath path list\n");
+ return -1;
+ }
+ char* allPath;
+
+ if (asprintf(&allPath, "%s:%s", gDvm.bootClassPathStr, appPath) < 0) {
+ dvmFprintf(stderr, "Can't append to bootclasspath path list\n");
+ return -1;
+ }
+ free(gDvm.bootClassPathStr);
+ gDvm.bootClassPathStr = allPath;
+
+ } else if (strncmp(argv[i], "-Xbootclasspath/p:",
+ sizeof("-Xbootclasspath/p:")-1) == 0) {
+ const char* prePath = argv[i] + sizeof("-Xbootclasspath/p:")-1;
+
+ if (*(prePath) == '\0') {
+ dvmFprintf(stderr, "Missing prepending bootclasspath path list\n");
+ return -1;
+ }
+ char* allPath;
+
+ if (asprintf(&allPath, "%s:%s", prePath, gDvm.bootClassPathStr) < 0) {
+ dvmFprintf(stderr, "Can't prepend to bootclasspath path list\n");
+ return -1;
+ }
+ free(gDvm.bootClassPathStr);
+ gDvm.bootClassPathStr = allPath;
} else if (strncmp(argv[i], "-D", 2) == 0) {
/* set property */
Please sign in to comment.
Something went wrong with that request. Please try again.