comm.script/FSHELL_AUTOSTART now launches terminalkeyboardcons on platforms that support tracecore.
authorTom Sutcliffe <thomas.sutcliffe@accenture.com>
Tue, 31 Aug 2010 18:33:37 +0100
changeset 49 b33ec37addee
parent 48 a45c6889feae
child 50 db96d73779bc
comm.script/FSHELL_AUTOSTART now launches terminalkeyboardcons on platforms that support tracecore. Also fixed crash in kerninfo when viewing verbose info for a thread that has not yet been resumed.
commands/variant/variant.cif
commands/variant/variant.cpp
core/group/comm.script
documentation/change_history.pod
libraries/ltkutils/src/proxyallocatorhelper.cpp
--- a/commands/variant/variant.cif	Tue Aug 31 12:11:19 2010 +0100
+++ b/commands/variant/variant.cif	Tue Aug 31 18:33:37 2010 +0100
@@ -20,7 +20,7 @@
 
 If the device matches the given command line options, KErrNone is returned. If not, KErrNotSupported is returned. Note that the command will not print any error message in the case of the variant not being supported, so that it doesn't make script output untidy. If an error message is required, use the C<--verbose> option.
 
-In addition there are two special variants understood by all implementations of this command: C<wins> and C<target> for WINS[CW] emulator and non-emulator platforms respectively.
+In addition there are some other special variant names supported, that are derived at compile time from the platform.mmh macros and similar: run the tool with no arguments to see the full list.
 
 Example usage:
 
@@ -28,6 +28,8 @@
     variant wins && do-something-emulator-specific
     variant h4 h6 && do-something-for-h4-and-h6
 
+If no arguments are specified, all the supported and understood variants are listed.
+
 ==option uint u uid multiple
 
 Test whether the device matches any of the specified machine UIDs.
@@ -38,7 +40,7 @@
 
 ==option bool l list
 
-List the variant names that this command understands. Note this is all of them, not just the ones that match the current platform.
+Has no effect, kept for compatability.
 
 ==argument string variantname optional multiple
 
--- a/commands/variant/variant.cpp	Tue Aug 31 12:11:19 2010 +0100
+++ b/commands/variant/variant.cpp	Tue Aug 31 18:33:37 2010 +0100
@@ -12,6 +12,7 @@
 
 #include <hal.h>
 #include "variant.h"
+#include <fshell/common.mmh>
 #include <fshell/descriptorutils.h>
 
 //
@@ -71,27 +72,52 @@
 	};
 const TInt KMachineIdVariantCount = sizeof(KMachineIdVariants) / sizeof(TVariant);
 
+// This is a list of things configured in or out at compile time based on the platform.mmh macros and similar
+const LtkUtils::SLitC KOtherSupportedVariants[] =
+	{
+#ifdef __WINS__
+	DESC("wins"),
+#else
+	DESC("target"),
+#endif
+#ifdef FSHELL_TRACECORE_SUPPORT
+	DESC("tracecore-support"),
+#endif
+	};
+const TInt KOtherSupportedVariantsCount = sizeof(KOtherSupportedVariants) / sizeof(LtkUtils::SLitC);
+
 void CCmdVariant::DoRunL()
 	{
-	if (iList)
+	TInt localMachineUid = GetMachineUidL();
+
+	if (iMachineId.Count() == 0 && iVariant.Count() == 0)
 		{
-		Printf(_L("Supported variants: "));
+		Printf(_L("Variant names understood by this command: "));
 		for (TInt i = 0; i < KMachineIdVariantCount; i++)
 			{
 			Printf(_L("%S, "), &KMachineIdVariants[i].iName);
 			}
-		// Finally add the ones which don't appear in KMachineIdVariants
-		Write(_L("wins, target\r\n"));
+		// Finally add the ones which can appear in KOtherSupportedVariants
+		Printf(_L("wins, target, tracecore-support\r\n"));
+
+		Printf(_L("Variant names supported by this device: "));
+		for (TInt i = 0; i < KMachineIdVariantCount; i++)
+			{
+			if (localMachineUid == KMachineIdVariants[i].iUid)
+				{
+				Printf(_L("%S, "), &KMachineIdVariants[i].iName);
+				}
+			}
+		for (TInt i = 0; i < KOtherSupportedVariantsCount; i++)
+			{
+			if (i > 0) Printf(_L(", "));
+			Printf(KOtherSupportedVariants[i]());
+			}
+		Printf(_L("\r\n"));
 		Complete(KErrNone);
 		return;
 		}
 
-	if (iMachineId.Count() == 0 && iVariant.Count() == 0)
-		{
-		LeaveIfErr(KErrArgument, _L("You must specify at least one <variantname> argument or --uid option"));
-		}
-
-	TInt localMachineUid = GetMachineUidL();
 	TBool match = EFalse;
 	if (iMachineId.Count())
 		{
@@ -116,11 +142,14 @@
 					match = ETrue;
 					}
 				}
-#ifdef __WINS__
-			if (iVariant[i]->CompareF(_L("wins")) == 0) match = ETrue;
-#else
-			if (iVariant[i]->CompareF(_L("target")) == 0) match = ETrue;
-#endif
+			
+			for (TInt j = 0; match == EFalse && j < KOtherSupportedVariantsCount; j++)
+				{
+				if (iVariant[i]->CompareF(KOtherSupportedVariants[j]) == 0)
+					{
+					match = ETrue;
+					}
+				}
 			}
 		}
 
--- a/core/group/comm.script	Tue Aug 31 12:11:19 2010 +0100
+++ b/core/group/comm.script	Tue Aug 31 18:33:37 2010 +0100
@@ -11,6 +11,8 @@
 # Accenture - Initial contribution
 #
 
+variant wins && error -5 "comm.script is not supported on the emulator"
+
 # NaviEngine, port next to VGA
 variant naviengine && export ARGS "--console vt100busdevcons --console-title pdd=euart1,ldd=ecomm,port=1,rate=115200"
 
@@ -31,6 +33,11 @@
 
 # Add new variants here
 
+
+# Only try terminal keyboard if there hasn't been a better match for the hardware (and tracecore is supported)
+# Therefore, this rule should stay near the bottom of the file
+var ARGS not-defined && variant tracecore-support && export ARGS "--console terminalkeyboardcons --console-size 120,40" 
+
 # And finally, start fshell with the given configuration
 var ARGS defined || error -5 "Variant not recognised, can't open serial connection"
 fshell $ARGS &
\ No newline at end of file
--- a/documentation/change_history.pod	Tue Aug 31 12:11:19 2010 +0100
+++ b/documentation/change_history.pod	Tue Aug 31 18:33:37 2010 +0100
@@ -24,7 +24,7 @@
 
 =item *
 
-Added L<terminal keyboard|terminalkeyboardcons> console, for platforms that support Terminal Keyboard and Trace Core.
+Added L<terminal keyboard|terminalkeyboardcons> console, for platforms that support Terminal Keyboard and Trace Core. On such platforms comm.script (and thus -DFSHELL_AUTOSTART) will use it if there is no better match for the hardware platform.
 
 =item *
 
--- a/libraries/ltkutils/src/proxyallocatorhelper.cpp	Tue Aug 31 12:11:19 2010 +0100
+++ b/libraries/ltkutils/src/proxyallocatorhelper.cpp	Tue Aug 31 18:33:37 2010 +0100
@@ -31,12 +31,20 @@
 #ifdef FSHELL_MEMORY_ACCESS_SUPPORT
 	TUint8* allocatorAddress;
 	TInt err = iMemoryAccess->GetAllocatorAddress(iThreadId, allocatorAddress);
-	if (!err)
+	if (err == KErrNone)
 		{
-		iAllocatorAddress = (TLinAddr)allocatorAddress;
-		TInt udeb = EuserIsUdeb();
-		if (udeb < 0) return udeb; // error
-		err = IdentifyAllocatorType(udeb);
+		if (allocatorAddress == NULL)
+			{
+			// If the thread has not yet been resumed it's valid for it not to have an allocator yet
+			err = KErrNotReady;
+			}
+		else
+			{
+			iAllocatorAddress = (TLinAddr)allocatorAddress;
+			TInt udeb = EuserIsUdeb();
+			if (udeb < 0) return udeb; // error
+			err = IdentifyAllocatorType(udeb);
+			}
 		}
 	return err;
 #else