Merge tag 'xdc-A75' into xdcore-A-dr

(sasha) - fix for ECL470756
diff --git a/README b/README
index 5ee546a..1fedc3a 100644
--- a/README
+++ b/README
@@ -1,4 +1,4 @@
-             xdc-A71 (corevers:16.0.2.0; B:150,G:180,R:170)
+             xdc-A75 (corevers:16.0.2.0; B:150,G:180,R:170)
 
                        eXpanDed C Tools (XDCtools)
 
@@ -19,12 +19,20 @@
 	cd ~xlibrary/.ssh
 	cp -f config-dr config
 
+    o fetch the latest changes from the Eclipse git server, but do it from
+      a SUSE 11 host because SUSE 10 has an old version of ssh
+	cd xdc.git
+	git fetch
+
     o Build this tree from Linux using standard SM-MAKE
     
         # clone the tree and merge/review user content
         ggentree xdc.git/
         cd xdc-A??
 
+	# unzip build.zip from the last released tree
+	unzip ../xdc-A??/build.zip
+
         # make sure the user email and name are your eclipse credentials 
         # before making any changes that need to be pushed to eclipse
         cat config-dr >> ./.git/config
@@ -72,16 +80,8 @@
 
 CHANGES
 
-xdc.cfg
-	added environment variable, XDCTOOLS_GMAKE, to allow user to set the
-        name of the GNU 3.81 compatible command name to use (but only if 
-        gmake is not found)
-
-	filter MAKFFLAGS to eliminate GNU make jobserver warnings when using 
-	xdc --jobs=4 to build executables that trigger the use of SourceDir
-	to create user-supplied makefiles to build libraries.
-
 MRS
 
-ECL465257 - xdc.cfg.SourceDir should support locating "make" along the path
-ECL465351 - parallel builds of packages that use SourceDir generate make
+ECL470756	xdc.useModule of a metaonly interface triggers bogus "$used is
+		sealed" error
+
diff --git a/ident.c b/ident.c
index 8619ea4..f3159ce 100644
--- a/ident.c
+++ b/ident.c
@@ -2,7 +2,7 @@
  *  ======== ident.c ========
  */
 
-#define _VERS_ "@(#)*** xdc-A71"
+#define _VERS_ "@(#)*** xdc-A75"
 
 static char __NAME[] = _NAME_;
 static char __DATE[] = _DATE_;
diff --git a/src/packages/xdc/cfg/Main.xs b/src/packages/xdc/cfg/Main.xs
index d477d31..18c7725 100644
--- a/src/packages/xdc/cfg/Main.xs
+++ b/src/packages/xdc/cfg/Main.xs
@@ -1413,16 +1413,16 @@
     mod.$used = true;
 
     if (xdc.om.$$phase >= 4) {
-        print("WARNING: Can't call useModule('" + mod.$name 
+        print("WARNING: Can't call useModule('" + mod.$name
               + "') after all packages are closed (phase 4 or above)");
     }
 
     /* We need to know when the module was loaded for the first time; if it
-     * is loaded by the config script, it is a "top-level" module whose 
-     * entry points need to be "exported" (preserved as part of any partial 
-     * link).  Otherwise, the application may reference a function F that 
-     * is removed from the partial link, the object containing the F will 
-     * be linked with the partial link, and duplicate symbol errors may 
+     * is loaded by the config script, it is a "top-level" module whose
+     * entry points need to be "exported" (preserved as part of any partial
+     * link).  Otherwise, the application may reference a function F that
+     * is removed from the partial link, the object containing the F will
+     * be linked with the partial link, and duplicate symbol errors may
      * occur.
      */
     if (!('$$scope' in mod)) {
@@ -1448,7 +1448,7 @@
         mod.$$bind('$$cfgPhase', 1);
         return (mod);
     }
-    
+
     /* cfgPhase == -1 => calling module$use() */
     mod.$$bind('$$cfgPhase', -1);
     /* call module$use() */
@@ -1492,7 +1492,7 @@
     }
 
     /* xdc.om.$curpkg contains the name of the current package. We keep track
-     * of it to be able to record dependencies between packages in 
+     * of it to be able to record dependencies between packages in
      * xdc.loadPackage() function. We need to keep saving and retrieving
      * $curpkg here because calls to xdc.module end up calling xdc.loadPackage,
      * where dependencies are recorded, and the value of $curpkg could be
@@ -1504,7 +1504,7 @@
      *
      * Finally, when calling $$usemod, $curpkg is set to qname's package
      * because $$usemod may call qname.module$use, and there the current
-     * package must be 'qname'. 
+     * package must be 'qname'.
      *
      * The value of $curpkg is also changed in closePackages(), when calling
      * module$use for modules used in the user's script phase, and in
@@ -1525,12 +1525,12 @@
          * are not supported anymore or we increment the red version number up
          * from 170 and all older schemas are rebuilt.
          */
-        origVers = Packages.xdc.services.global.Vers.getXdcString(
-		unit.$package.packageBase + "/package/package.defs.h");
-        if (origVers > "xdc-a00" || origVers < "xdc-A66") {
-            unit.$unseal("$used");
-        }
-       if ("$used" in unit) {
+        if ("$used" in unit) {
+            origVers = Packages.xdc.services.global.Vers.getXdcString(
+                unit.$package.packageBase + "/package/package.defs.h");
+            if (origVers > "xdc-a00" || origVers < "xdc-A72") {
+                unit.$unseal("$used");
+            }
             unit.$used = true;
         }
         return (unit);
diff --git a/src/packages/xdc/rov/Model.xs b/src/packages/xdc/rov/Model.xs
index b1e21cb..36202f7 100644
--- a/src/packages/xdc/rov/Model.xs
+++ b/src/packages/xdc/rov/Model.xs
@@ -1,13 +1,13 @@
 /* --COPYRIGHT--,EPL
- *  Copyright (c) 2008 Texas Instruments and others.
+ *  Copyright (c) 2008-2015 Texas Instruments Incorporated
  *  All rights reserved. This program and the accompanying materials
  *  are made available under the terms of the Eclipse Public License v1.0
  *  which accompanies this distribution, and is available at
  *  http://www.eclipse.org/legal/epl-v10.html
- * 
+ *
  *  Contributors:
  *      Texas Instruments - initial implementation
- * 
+ *
  * --/COPYRIGHT--*/
 /*
  *  ======== Model.xs ========
@@ -17,11 +17,10 @@
  *  ======== start ========
  */
 function start(vers, executable, recap, sym, mem, callBack)
-{   
+{
     xdc.om.$$bind('$name', 'rov');
     xdc.global.Program = xdc.useModule('xdc.rov.Program');
-    Program.debugPrint("Beginning of Model.start");
-    
+
     /* Check Model compatibility. */
     if (vers != this.vers) {
         Program.debugPrint("Incompatible version of ROV Model. Model version " +
@@ -29,15 +28,15 @@
         throw (new Error("Incompatible version of ROV Model. Model version " +
                          this.vers + ", client version " + vers + "."));
     }
-    
+
     /* Store off the objects passed in */
     this.$private.sym = sym;
     this.$private.mem = mem;
     this.$private.callBack = callBack;
     this.$private.recap = recap;
-        
+
     xdc.useModule('xdc.rov.support.ScalarStructs');
-    
+
     /* Store off the list of all modules in the recap file */
     var mnames = [];
     for (var m in this.$private.recap.$modules) {
@@ -45,31 +44,43 @@
             mnames.push(m);
         }
     }
-    
+
     Program.$unseal('moduleNames');
     Program.moduleNames.$unseal();
     Program.moduleNames = mnames.sort();
     Program.moduleNames.$seal();
     Program.$seal('moduleNames');
-    
+
     Program.$$bind('build', this.$private.recap.build);
-        
+
     Program.$$bind('$modules', this.$private.recap.$modules);
 
     /* Read construct objects */
-    fetchConstructObjects(executable); 
+    var rovFile = executable.replace(/(\/Debug)|(\/Release)/, "");
+    rovFile = rovFile.replace(/.out$/, "");
+    var startTime = java.lang.System.currentTimeMillis();
+    fetchConstructObjects(executable);
+    if (java.lang.System.currentTimeMillis() - startTime > 30000) {
+        callBack.updateStartupProgress(90, "Parsing DWARF data was taking too "
+            + "long.\nTo speed up the ROV startup, with some loss of "
+            + "functionality , you can create a new empty file " + rovFile
+            + ".rov.json. For a detailed explanation of this feature, see "
+            + "http://rtsc.eclipse.org/docs-tip/Runtime_Object_Viewer"
+            + "#Retrieving_constructed_objects.");
+            java.lang.Thread.currentThread().sleep(10000);
+    }
 
     /* Notify the CallBack that we are about to start loading the packages. */
     callBack.updateStartupProgress(120, "Loading packages ...");
-    
+
     /* Indicates whether getModuleDesc has been called on all modules. */
     Program.$private.allModsRead = false;
-    
+
     Program.$$bind('loadModFailed', "Failed to load module");
-    
-    /* 
-     * Load all of the packages so the user gets this hit during 
-     * startup rather than on the first view. 
+
+    /*
+     * Load all of the packages so the user gets this hit during
+     * startup rather than on the first view.
      */
     for each (var mod in this.$private.recap.$modules) {
         /* 
@@ -431,7 +442,7 @@
             return (i);
         }
     }
-    
+
     return (-1);
 }
 
@@ -457,55 +468,17 @@
  *           "name": "sem",
  *        },
  *     ]
- * 
+ *
  *   The .rov.json should of the same name as the executable (.out) and
  *   can be in the same directory as, one directory level above or two directory
  *   levels above the executable.
  */
-function fetchConstructObjects(executable) 
+function fetchConstructObjects(executable)
 {
     var constructInstArr = [];
     var binaryParser = "";
     var ofReader = null;
 
-    /* Read from the object file */
-    try {
-        binaryParser = Program.build.target.binaryParser; 
-        if (binaryParser !== undefined) {
-
-            /* Parse the package name from the class name so we can load it. */
-            var parserPackage = 
-                binaryParser.substring(0, binaryParser.lastIndexOf('.'));
-    
-            /* Load the parser's package */
-            xdc.loadPackage(parserPackage);
-            
-            /* Get the parser class */
-            var binaryParserClass = Packages[binaryParser];
-            
-            /* Get the Global Variables */
-            ofReader = new binaryParserClass();
-            ofReader.parse(executable);
-            var varList = ofReader.getGlobalVariablesByType(".*_Struct$");
-            ofReader.close(); /* close file handle */
-
-            /* Run through the list and add only constructed objects */
-            for (var i = 0; i < varList.length; i++) {
-                var varObj = {};
-                varObj.name = varList[i].name;
-                varObj.type = varList[i].type;
-                constructInstArr[varObj.name] = varObj;    
-            }
-        }
-    }
-    catch (e) {
-        if (ofReader != null) {
-            ofReader.close();
-        }
-        Program.debugPrint("The binary parser '" + binaryParser + "' could not" 
-                           + " get global variables info from " + executable);
-    }
-
     /* Read from the .rov.json */
     try {
         var ePath = executable.replace(/\\/g, '/');
@@ -528,7 +501,7 @@
 
         if (constructFilePath != "") {
             var constructFile = File.open(constructFilePath, "r");
-        
+
             var constructText = "";
             var line;
             while ((line = constructFile.readLine()) != null) {
@@ -537,6 +510,11 @@
             constructFile.close();
 
             /* Convert json text to javascript object */
+            if (constructText.trim().length == 0) {
+                // empty file, just return to avoid an exception from eval
+                Program.$$bind('$constructInst', constructInstArr);
+                return;
+            }
             var constructInst2 = eval('(' + constructText + ')');
 
             /* Run through all the user specified construct objects */
@@ -547,12 +525,52 @@
                 /* Add it to an Array */
                 constructInstArr[varObj.name] = varObj;
             }
+            /* Add it to the Program instance for later use */
+            Program.$$bind('$constructInst', constructInstArr);
+            return;
         }
-    } 
-    catch(e) {
-        Program.debugPrint("Failed to load construct objects from: " + constructFilePath);
     }
-  
+    catch(e) {
+        Program.debugPrint("Cannot open " + fName + ". " + e.toString());
+    }
+
+    /* Read from the object file */
+    try {
+        binaryParser = Program.build.target.binaryParser; 
+        if (binaryParser !== undefined) {
+
+            /* Parse the package name from the class name so we can load it. */
+            var parserPackage =
+                binaryParser.substring(0, binaryParser.lastIndexOf('.'));
+
+            /* Load the parser's package */
+            xdc.loadPackage(parserPackage);
+
+            /* Get the parser class */
+            var binaryParserClass = Packages[binaryParser];
+
+            /* Get the Global Variables */
+            ofReader = new binaryParserClass();
+            ofReader.parse(executable);
+            var varList = ofReader.getGlobalVariablesByType(".*_Struct$");
+            ofReader.close(); /* close file handle */
+
+            /* Run through the list and add only constructed objects */
+            for (var i = 0; i < varList.length; i++) {
+                var varObj = {};
+                varObj.name = varList[i].name;
+                varObj.type = varList[i].type;
+                constructInstArr[varObj.name] = varObj;
+            }
+        }
+    }
+    catch (e) {
+        if (ofReader != null) {
+            ofReader.close();
+        }
+        Program.debugPrint("The binary parser '" + binaryParser + "' could not"
+                           + " get global variables info from " + executable);
+    }
     /* Add it to the Program instance for later use */
     Program.$$bind('$constructInst', constructInstArr);
 }
diff --git a/src/packages/xdc/rov/Program.xs b/src/packages/xdc/rov/Program.xs
index 8fa3f49..c6c7648 100644
--- a/src/packages/xdc/rov/Program.xs
+++ b/src/packages/xdc/rov/Program.xs
@@ -671,7 +671,7 @@
 {
     /* Get the module from cache or useModule */
     var modDesc = this.getModuleDesc(modName);
-    
+
     /* Verify the module supports the requested tab. */
     if (!modSupportsTab(modName, tabName)) {
         throw (new Error("Module does not support the requested view level"));
@@ -682,20 +682,31 @@
         /* TODO: Before returning check for erros and throw exception if found. */
         return (modDesc.viewMap[tabName]);
     }
-    
+
     var viewInitFunc = getViewInitFunc(modDesc, tabName);
-        
-    /* 
+
+    /*
      * If the view code throws an exception, let it propogate up and be
      * displayed to the user. This means the user won't see any partial data
      * if there is any, but there's no other logical place to display the
      * exception message.
      */
     var treeTableView = viewInitFunc.call(modDesc.userPrivate);
-    
+
     /* Add the view to the module's viewMap. */
     modDesc.viewMap[tabName] = treeTableView;
     
+    if (!("$status" in treeTableView)) {
+        return (treeTableView);
+    }
+
+    for (var p in treeTableView.$status) {
+        if (treeTableView.$status[p]) {
+            /* Record the status in the status table for reference. */
+            addStatusEntry(modName, tabName, "N/A", p, treeTableView.$status[p]);
+        }
+    }
+
     /* TODO - check for any errors and throw exception. */
     /*
     if (error) {
@@ -714,7 +725,7 @@
 {
     /* Get the module from cache or useModule */
     var modDesc = this.getModuleDesc(modName);
-    
+
     /* Verify the module supports the requested tab. */
     if (!modSupportsTab(modName, tabName)) {
         throw (new Error("Module does not support the requested view level"));
@@ -725,31 +736,42 @@
         /* TODO: Before returning check for erros and throw exception if found. */
         return (modDesc.viewMap[tabName]);
     }
-    
+
     var viewInitFunc = getViewInitFunc(modDesc, tabName);
-        
-    /* 
+
+    /*
      * If the view code throws an exception, let it propogate up and be
      * displayed to the user. This means the user won't see any partial data
      * if there is any, but there's no other logical place to display the
      * exception message.
      */
     var treeView = viewInitFunc.call(modDesc.userPrivate);
-    
+
     /* Add the view to the module's viewMap. */
     modDesc.viewMap[tabName] = treeView;
-    
+ 
+    if (!("$status" in treeView)) {
+        return (treeView);
+    }
+
+    for (var p in treeView.$status) {
+        if (treeView.$status[p]) {
+            /* Record the status in the status table for reference. */
+            addStatusEntry(modName, tabName, "N/A", p, treeView.$status[p]);
+        }
+    }
+
     /* TODO - check for any errors and throw exception. */
     /*
     if (error) {
-        throw (new Error("ROV detected errors in scan of '" + tabName + 
+        throw (new Error("ROV detected errors in scan of '" + tabName +
                          "' tab for module " + modName + "."));
     }
     */
     return (treeView);
 }
 
-/* 
+/*
  *  ======== modSupportsTab ========
  *  Returns true if the module supports the given tab.
  */
@@ -760,11 +782,11 @@
     if (mod.viewInfo == null) {
         return (false);
     }
-    
+
     return (tabName in mod.viewInfo.viewMap);
 }
 
-/* 
+/*
  *  ======== getViewInitFunc ========
  *  Retrieves the function associated with the specified tabName for the
  *  specified mod.
diff --git a/src/packages/xdc/services/intern/gen/Config.java b/src/packages/xdc/services/intern/gen/Config.java
index 0e8446b..b873ee2 100644
--- a/src/packages/xdc/services/intern/gen/Config.java
+++ b/src/packages/xdc/services/intern/gen/Config.java
@@ -189,7 +189,8 @@
                 Value.Obj interj = (Value.Obj)(intarr.getv(j));
                 if (interj.has("$used", null) && interj.geti("$used") != 0) {
                     Unit iu = unitSpec(interj);
-                    if (iu != null && baseset.add(iu.getQualName())) {
+                    if (!iu.isMeta() && iu != null
+                        && baseset.add(iu.getQualName())) {
                         intmap.put(iu.getQualName(), iu);
                         genInclude(interj);
                     }
diff --git a/src/packages/xdc/services/intern/gen/JClass.java b/src/packages/xdc/services/intern/gen/JClass.java
index 7aa334f..b0a745b 100644
--- a/src/packages/xdc/services/intern/gen/JClass.java
+++ b/src/packages/xdc/services/intern/gen/JClass.java
@@ -1795,10 +1795,12 @@
             glob.out.printf("%tvo.seal(null);\n");
             /* An exception is made for '$used' so that an interface can be
              * used if an app is including the header file for that interface.
+             * We also have to leave it unsealed for metaonly interfaces in
+             * case users call useModule on them too.
              */
-            if (unit.getSuper() != null && !unit.isMeta()) {
-                glob.out.printf("%tvo.unseal(\"$used\");\n");
-            }
+            glob.out.printf("%tif (vo.getProto().lookupFld(\"$used\") != null) {%+\n");
+            glob.out.printf("%tvo.unseal(\"$used\");\n");
+            glob.out.printf("%-%t}\n");
         }
     }
 }