[Esbox-commits] r1920 - in branches/work_Fabricio: org.maemo.esbox.help/html/concepts org.maemo.esbox.help/html/images/flash org.maemo.esbox.help/html/images/profiling org.maemo.esbox.help/html/reference org.maemo.esbox.help/html/tasks org.maemo.esbox.launch.analysis org.maemo.esbox.launch.analysis/icons/full/obj16 org.maemo.esbox.launch.analysis/src/org/maemo/esbox/internal/analysis/launch org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/api/maemosdk/core/tools org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/maemosdk/ui/actions org.maemo.esbox.scratchbox.core/src/org/maemo/esbox/internal/api/scratchbox/core/execEnv org.maemo.esbox.scratchbox.core/src/org/maemo/esbox/internal/api/scratchbox/core/sdk org.maemo.esbox.scratchbox.core/src/org/maemo/esbox/scratchbox/core/sdk org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/core org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/launcher org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/scratchbox/sb1/sdk org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/core org.maemo.esbox.scratchbox.tests/src/org/maemo/esbox/scratchbox/tests org.maemo.esbox.scratchbox.tests/src/org/maemo/esbox/scratchbox/tests/commands

fabricioepa at garage.maemo.org fabricioepa at garage.maemo.org
Mon Aug 3 17:16:47 EEST 2009


Author: fabricioepa
Date: 2009-08-03 17:16:46 +0300 (Mon, 03 Aug 2009)
New Revision: 1920

Added:
   branches/work_Fabricio/org.maemo.esbox.help/html/images/profiling/ltrace-menu.png
   branches/work_Fabricio/org.maemo.esbox.help/html/images/profiling/ltrace-view.png
   branches/work_Fabricio/org.maemo.esbox.launch.analysis/icons/full/obj16/ltrace.gif
   branches/work_Fabricio/org.maemo.esbox.launch.analysis/src/org/maemo/esbox/internal/analysis/launch/ESboxCppLtraceLocalLaunchConfigurationTabGroup.java
   branches/work_Fabricio/org.maemo.esbox.launch.analysis/src/org/maemo/esbox/internal/analysis/launch/ESboxCppLtraceLocalLaunchShortcut.java
   branches/work_Fabricio/org.maemo.esbox.launch.analysis/src/org/maemo/esbox/internal/analysis/launch/ESboxCppLtraceRemoteLaunchConfigurationTabGroup.java
   branches/work_Fabricio/org.maemo.esbox.launch.analysis/src/org/maemo/esbox/internal/analysis/launch/ESboxCppLtraceRemoteLaunchShortcut.java
   branches/work_Fabricio/org.maemo.esbox.launch.analysis/src/org/maemo/esbox/internal/analysis/launch/ESboxPythonLtraceLocalLaunchConfigurationTabGroup.java
   branches/work_Fabricio/org.maemo.esbox.launch.analysis/src/org/maemo/esbox/internal/analysis/launch/ESboxPythonLtraceLocalLaunchShortcut.java
   branches/work_Fabricio/org.maemo.esbox.launch.analysis/src/org/maemo/esbox/internal/analysis/launch/ESboxPythonLtraceRemoteLaunchConfigurationTabGroup.java
   branches/work_Fabricio/org.maemo.esbox.launch.analysis/src/org/maemo/esbox/internal/analysis/launch/ESboxPythonLtraceRemoteLaunchShortcut.java
Modified:
   branches/work_Fabricio/org.maemo.esbox.help/html/concepts/ProfilingApplications.html
   branches/work_Fabricio/org.maemo.esbox.help/html/images/flash/wiz-flash-3.png
   branches/work_Fabricio/org.maemo.esbox.help/html/images/flash/wiz-flash-4.png
   branches/work_Fabricio/org.maemo.esbox.help/html/images/flash/wiz-flash-4b.png
   branches/work_Fabricio/org.maemo.esbox.help/html/images/flash/wiz-flash-5.png
   branches/work_Fabricio/org.maemo.esbox.help/html/images/flash/wiz-flash-sessions.png
   branches/work_Fabricio/org.maemo.esbox.help/html/reference/FAQ.html
   branches/work_Fabricio/org.maemo.esbox.help/html/tasks/ProfilingMaemoApplications.html
   branches/work_Fabricio/org.maemo.esbox.help/html/tasks/UsingVirtualMachines.html
   branches/work_Fabricio/org.maemo.esbox.launch.analysis/plugin.xml
   branches/work_Fabricio/org.maemo.esbox.launch.analysis/src/org/maemo/esbox/internal/analysis/launch/IESboxAnalysisLaunchConstants.java
   branches/work_Fabricio/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/api/maemosdk/core/tools/AfSbInitMaemoLauncherAdapter.java
   branches/work_Fabricio/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/api/maemosdk/core/tools/IMaemoLauncherAdapter.java
   branches/work_Fabricio/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/api/maemosdk/core/tools/MaemoScriptLauncher.java
   branches/work_Fabricio/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/api/maemosdk/core/tools/XLauncher.java
   branches/work_Fabricio/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/maemosdk/ui/actions/BaseEmulatorStartStopRestartControlAction.java
   branches/work_Fabricio/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/maemosdk/ui/actions/MaemoDropdownMenuAction.java
   branches/work_Fabricio/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/maemosdk/ui/actions/XDropdownMenuAction.java
   branches/work_Fabricio/org.maemo.esbox.scratchbox.core/src/org/maemo/esbox/internal/api/scratchbox/core/execEnv/MaemoExecutionEnvironmentHandler.java
   branches/work_Fabricio/org.maemo.esbox.scratchbox.core/src/org/maemo/esbox/internal/api/scratchbox/core/execEnv/X11ExecutionEnvironmentHandler.java
   branches/work_Fabricio/org.maemo.esbox.scratchbox.core/src/org/maemo/esbox/internal/api/scratchbox/core/sdk/AbstractScratchboxSDK.java
   branches/work_Fabricio/org.maemo.esbox.scratchbox.core/src/org/maemo/esbox/scratchbox/core/sdk/IScratchboxSDK.java
   branches/work_Fabricio/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/core/Scratchbox1SDK.java
   branches/work_Fabricio/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/launcher/Scratchbox1PrepareTargetProcessLaunchAdapter.java
   branches/work_Fabricio/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/launcher/Scratchbox1ProcessLauncher.java
   branches/work_Fabricio/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/scratchbox/sb1/sdk/IScratchbox1SDK.java
   branches/work_Fabricio/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/core/Scratchbox2SDK.java
   branches/work_Fabricio/org.maemo.esbox.scratchbox.tests/src/org/maemo/esbox/scratchbox/tests/TestSB1ProcessLauncher.java
   branches/work_Fabricio/org.maemo.esbox.scratchbox.tests/src/org/maemo/esbox/scratchbox/tests/commands/TestListCommands.java
   branches/work_Fabricio/org.maemo.esbox.scratchbox.tests/src/org/maemo/esbox/scratchbox/tests/commands/TestRemoveSb2Command.java
   branches/work_Fabricio/org.maemo.esbox.scratchbox.tests/src/org/maemo/esbox/scratchbox/tests/commands/TestScratchboxFacade.java
Log:
Merging  /trunk r1896:1918

Modified: branches/work_Fabricio/org.maemo.esbox.help/html/concepts/ProfilingApplications.html
===================================================================
--- branches/work_Fabricio/org.maemo.esbox.help/html/concepts/ProfilingApplications.html	2009-08-03 13:58:28 UTC (rev 1919)
+++ branches/work_Fabricio/org.maemo.esbox.help/html/concepts/ProfilingApplications.html	2009-08-03 14:16:46 UTC (rev 1920)
@@ -16,8 +16,9 @@
 By simply profiling an application, it becomes immediately apparent where the 
 overwhelming memory and CPU burdens exist, and allows you to quickly squash them.
 ESbox provides support for <a href="http://www.valgrind.org/">Valgrind</a> 
-memory profiler and <a href="http://oprofile.sourceforge.net/news/">OProfile</a> 
-system-wide profiler for both C/C++ and Python Projects.</p>
+memory profiler, <a href="http://oprofile.sourceforge.net/news/">OProfile</a> 
+system-wide profiler and <a href="http://www.ltrace.org">Ltrace</a> library call monitor
+ for both C/C++ and Python Projects.</p>
 
 <h3 class="style1">Valgrind</h3>
 <p>Valgrind is an Open Source suite of tools for debugging and profiling Linux programs. 
@@ -42,6 +43,15 @@
 of a wide variety of interesting statistics, which can also be used for basic 
 time-spent profiling. All code is profiled: hardware and software interrupt handlers, 
 kernel modules, the kernel, shared libraries, and applications.</p>
+
+
+
+<h3 class="style1">Ltrace</h3>
+<p>Ltrace is a debugging program which runs a specified command until it exits. 
+While the command is executing, ltrace intercepts and records the dynamic library calls 
+which are called by the executed process and the signals received by that process.</p>
+
+
 <h3>Related Topic</h3>
 <ul>
   <li><a href="../tasks/ProfilingMaemoApplications.html">Profiling Maemo Applications</a>  </li>

Modified: branches/work_Fabricio/org.maemo.esbox.help/html/images/flash/wiz-flash-3.png
===================================================================
(Binary files differ)

Modified: branches/work_Fabricio/org.maemo.esbox.help/html/images/flash/wiz-flash-4.png
===================================================================
(Binary files differ)

Modified: branches/work_Fabricio/org.maemo.esbox.help/html/images/flash/wiz-flash-4b.png
===================================================================
(Binary files differ)

Modified: branches/work_Fabricio/org.maemo.esbox.help/html/images/flash/wiz-flash-5.png
===================================================================
(Binary files differ)

Modified: branches/work_Fabricio/org.maemo.esbox.help/html/images/flash/wiz-flash-sessions.png
===================================================================
(Binary files differ)

Copied: branches/work_Fabricio/org.maemo.esbox.help/html/images/profiling/ltrace-menu.png (from rev 1919, trunk/org.maemo.esbox.help/html/images/profiling/ltrace-menu.png)
===================================================================
(Binary files differ)

Copied: branches/work_Fabricio/org.maemo.esbox.help/html/images/profiling/ltrace-view.png (from rev 1919, trunk/org.maemo.esbox.help/html/images/profiling/ltrace-view.png)
===================================================================
(Binary files differ)

Modified: branches/work_Fabricio/org.maemo.esbox.help/html/reference/FAQ.html
===================================================================
--- branches/work_Fabricio/org.maemo.esbox.help/html/reference/FAQ.html	2009-08-03 13:58:28 UTC (rev 1919)
+++ branches/work_Fabricio/org.maemo.esbox.help/html/reference/FAQ.html	2009-08-03 14:16:46 UTC (rev 1920)
@@ -239,7 +239,7 @@
 Samba sharing from the host to the VM.</p>
 <p>See the <a href="http://maemovmware.garage.maemo.org/">Maemo SDK virtual image page</a>
 for configured and supported images and the
-<a href="http://esbox.garage.maemo.org/2nd_edition/virtual_machines.html">ESbox virtual machine support documentation</a>.
+<a href="../tasks/virtual_machines.html">ESbox virtual machine documentation</a>.
 </div>
 <hr>
 <div id="ask" dir="LTR">

Modified: branches/work_Fabricio/org.maemo.esbox.help/html/tasks/ProfilingMaemoApplications.html
===================================================================
--- branches/work_Fabricio/org.maemo.esbox.help/html/tasks/ProfilingMaemoApplications.html	2009-08-03 13:58:28 UTC (rev 1919)
+++ branches/work_Fabricio/org.maemo.esbox.help/html/tasks/ProfilingMaemoApplications.html	2009-08-03 14:16:46 UTC (rev 1920)
@@ -32,9 +32,9 @@
   Profiling is one of the most important techniques available for programmers to discover problems
   in applications. By profiling an application, it becomes immediately apparent where the 
   overwhelming memory and CPU burdens exist, and allows you to quickly squash them. ESbox provides
-  support for <a href="http://www.valgrind.org/">Valgrind</a> memory profiler and 
-  <a href="http://oprofile.sourceforge.net/news/">OProfile</a> system-wide profiler for both C/C++
-  and Python Projects.
+  support for <a href="http://www.valgrind.org/">Valgrind</a> memory profiler, <a href="http://oprofile.sourceforge.net/news/">OProfile</a> 
+  system-wide profiler and <a href="http://www.ltrace.org">Ltrace</a> library call monitor 
+  for both C/C++ and Python Projects.
  </p>
 
  <h3>Using Valgrind</h3>
@@ -95,7 +95,33 @@
  <p>
   <img src="../images/profiling/oprofile-view.png">
  </p>
+ 
+  <h3>Using Ltrace</h3>
+ <p>
+  Ltrace is a debugging program which runs a specified command until it exits. 
+  While the command is executing, ltrace intercepts and records the dynamic library 
+  calls which are called by the executed process and the signals received by that process.
+ </p>
 
+ <p>
+  To run LTrace, right-click on the application (binary for C/C++ projects or the Python script
+  for Python projects) and select <strong>Profile As &gt; Local/Remote Ltrace Profiler</strong>. 
+ </p> 
+ 
+ <p>
+  <img src="../images/profiling/ltrace-menu.png">
+ </p>
+ 
+ <p>
+  After Ltrace starts, ESbox launches your application on the SDKTarget and
+  the result is shown in Ltrace view. All Library and System calls are shown
+  as a tree: parent nodes and child nodes for each new nested call.
+ </p>
+ 
+ <p>
+  <img src="../images/profiling/ltrace-view.png">
+ </p>
+
 </body>
 </html>
 

Modified: branches/work_Fabricio/org.maemo.esbox.help/html/tasks/UsingVirtualMachines.html
===================================================================
--- branches/work_Fabricio/org.maemo.esbox.help/html/tasks/UsingVirtualMachines.html	2009-08-03 13:58:28 UTC (rev 1919)
+++ branches/work_Fabricio/org.maemo.esbox.help/html/tasks/UsingVirtualMachines.html	2009-08-03 14:16:46 UTC (rev 1920)
@@ -479,6 +479,28 @@
 	</li>
 	<li>Shared folder configuration
 	<ul>
+		<li>If you cannot mount to shared folders published from Windows, and
+		you get the error <tt>"mount error 12 = cannot allocate memory"</tt>,
+		then this is a host issue.  You can fix this in your Windows registry.
+		<p>Edit the key 
+		<pre>
+		HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\LanmanServer\Parameters\IRPStackSize
+		</pre>
+		<p>
+		Define it as a DWORD value (if missing).  Set it to a value in
+		the decimal range 15 to 18.  (The documentation is unclear what this
+		value indicates, so it may require some experimentation.)
+		</p>
+		<p>The new setting will only be read when the sharing service
+		is restarted.  You may do this via 
+		<strong>Control Panel &gt; Administrative Tools &gt; Services &gt;
+		Server</strong> and restart, or if you've got more time to kill,
+		reboot your system.
+		</p>
+		<p>
+		Also see <a href="http://support.microsoft.com/default.aspx?scid=kb;en-us;177078">the Microsoft Knowledge Base article</a>
+		for more information.
+		</li>
 		<li>Be careful about the time synchronization configuration in the VM or the timezone
 		used in the VM image.
 		<p>

Copied: branches/work_Fabricio/org.maemo.esbox.launch.analysis/icons/full/obj16/ltrace.gif (from rev 1919, trunk/org.maemo.esbox.launch.analysis/icons/full/obj16/ltrace.gif)
===================================================================
(Binary files differ)

Modified: branches/work_Fabricio/org.maemo.esbox.launch.analysis/plugin.xml
===================================================================
--- branches/work_Fabricio/org.maemo.esbox.launch.analysis/plugin.xml	2009-08-03 13:58:28 UTC (rev 1919)
+++ branches/work_Fabricio/org.maemo.esbox.launch.analysis/plugin.xml	2009-08-03 14:16:46 UTC (rev 1920)
@@ -26,7 +26,26 @@
             sourceLocatorId="org.eclipse.cdt.debug.core.sourceLocator"
             sourcePathComputerId="org.eclipse.cdt.debug.core.sourcePathComputer">
       </launchConfigurationType>
-
+      
+	 <launchConfigurationType
+            delegate="org.maemo.mica.cpp.launch.analysis.ltrace.CppLtraceLocalLaunchDelegate"
+            id="org.maemo.esbox.analysis.launch.cpp.LtraceLocalLaunchType"
+            modes="profile"
+            name="Local Ltrace Profiler"
+            public="true"
+            sourceLocatorId="org.eclipse.cdt.debug.core.sourceLocator"
+            sourcePathComputerId="org.eclipse.cdt.debug.core.sourcePathComputer">
+      </launchConfigurationType>
+      
+	 <launchConfigurationType
+            delegate="org.maemo.mica.cpp.launch.analysis.ltrace.CppLtraceRemoteLaunchDelegate"
+            id="org.maemo.esbox.analysis.launch.cpp.LtraceRemoteLaunchType"
+            modes="profile"
+            name="Remote Ltrace Profiler"
+            public="true"
+            sourceLocatorId="org.eclipse.cdt.debug.core.sourceLocator"
+            sourcePathComputerId="org.eclipse.cdt.debug.core.sourcePathComputer">
+      </launchConfigurationType>
  	</extension>
     <extension
          point="org.eclipse.debug.ui.launchConfigurationTabGroups">
@@ -40,6 +59,18 @@
             id="valgrindLaunchTabGroup"
             type="org.maemo.esbox.analysis.launch.cpp.ValgrindLocalLaunchType">
       </launchConfigurationTabGroup>
+      
+     <launchConfigurationTabGroup
+            class="org.maemo.esbox.internal.analysis.launch.ESboxCppLtraceLocalLaunchConfigurationTabGroup"
+            id="ltraceLocalLaunchTabGroup"
+            type="org.maemo.esbox.analysis.launch.cpp.LtraceLocalLaunchType">
+      </launchConfigurationTabGroup>
+      
+     <launchConfigurationTabGroup
+            class="org.maemo.esbox.internal.analysis.launch.ESboxCppLtraceRemoteLaunchConfigurationTabGroup"
+            id="ltraceRemoteLaunchTabGroup"
+            type="org.maemo.esbox.analysis.launch.cpp.LtraceRemoteLaunchType">
+      </launchConfigurationTabGroup>
 	</extension>
 	
  	
@@ -55,7 +86,18 @@
             icon="icons/full/obj16/valgrind_local.gif"
             id="valgrindLaunchTypeImage">
       </launchConfigurationTypeImage>
- 		
+      
+      <launchConfigurationTypeImage
+            configTypeID="org.maemo.esbox.analysis.launch.cpp.LtraceLocalLaunchType"
+            icon="icons/full/obj16/ltrace.gif"
+            id="ltraceLocalLaunchTypeImage">
+      </launchConfigurationTypeImage>
+      
+      <launchConfigurationTypeImage
+            configTypeID="org.maemo.esbox.analysis.launch.cpp.LtraceRemoteLaunchType"
+            icon="icons/full/obj16/ltrace.gif"
+            id="ltraceRemoteLaunchTypeImage">
+      </launchConfigurationTypeImage>
  	</extension>
  	
    <extension
@@ -139,7 +181,94 @@
                id="org.maemo.esbox.analysis.launch.cpp.ValgrindLocalLaunchType">
          </configurationType>
       </shortcut>
+      
+      
+      <shortcut
+            class="org.maemo.esbox.internal.analysis.launch.ESboxCppLtraceLocalLaunchShortcut"
+            icon="icons/full/obj16/ltrace.gif"
+            id="maemoLtraceShortcut"
+            label="Local Ltrace Profiler"
+            modes="profile">
+         <contextualLaunch>
+            <enablement>
+               <with
+                     variable="selection">
+                  <count
+                        value="1">
+                  </count>
+                  <iterate>
+                   <and>
+	                     <test
+		                      forcePluginActivation="true"
+                              property="org.maemo.mica.common.hasNature"
+ 		                      value="org.maemo.esbox.cpp.project.cppNature"/>
+                        <test
+                              forcePluginActivation="true"
+                              property="org.maemo.mica.maemosdk.isEmulatorTarget"/>
+                       <test
+                          	  forcePluginActivation="true"
+                          	  property="org.maemo.mica.cpp.isCppLaunchable"/>
+
+                    </and> 
+                    </iterate>
+               </with></enablement>
+            <contextLabel
+                  label="Local Ltrace Profiler"
+                  mode="profile">
+            </contextLabel></contextualLaunch>
+         <configurationType
+               id="org.maemo.esbox.analysis.launch.cpp.LtraceLocalLaunchType">
+         </configurationType>
+      </shortcut>
+ 	 
+ 	 <shortcut
+            class="org.maemo.esbox.internal.analysis.launch.ESboxCppLtraceRemoteLaunchShortcut"
+            icon="icons/full/obj16/ltrace.gif"
+            id="maemoLtraceShortcut"
+            label="Remote Ltrace Profiler"
+            modes="profile">
+         <contextualLaunch>
+            <enablement>
+               <with
+                     variable="selection">
+                  <count
+                        value="1">
+                  </count>
+                  <iterate>
+                   <and>
+	                     <test
+		                      forcePluginActivation="true"
+                              property="org.maemo.mica.common.hasNature"
+ 		                      value="org.maemo.esbox.cpp.project.cppNature"/>
+
+                        <test
+                              forcePluginActivation="true"
+                              property="org.maemo.mica.maemosdk.isRemoteTarget"/>
+                              
+                        <test
+	                              forcePluginActivation="true"
+	                              property="org.maemo.mica.maemosdk.isARMELTarget"/>
+	                              
+                        <test
+                              forcePluginActivation="true"
+                              property="org.maemo.mica.maemosdk.isEmulatorTarget"/>
+                       <test
+                          	  forcePluginActivation="true"
+                          	  property="org.maemo.mica.cpp.isCppLaunchable"/>
+
+                    </and> 
+                    </iterate>
+               </with></enablement>
+            <contextLabel
+                  label="Remote Ltrace Profiler"
+                  mode="profile">
+            </contextLabel></contextualLaunch>
+         <configurationType
+               id="org.maemo.esbox.analysis.launch.cpp.LtraceRemoteLaunchType">
+         </configurationType>
+      </shortcut>
  	
+ 	
  	</extension>
  	
  	<!-- Python -->
@@ -161,6 +290,23 @@
             name="Local Valgrind Profiler (Python)"
             public="true">
       </launchConfigurationType>
+      
+       <launchConfigurationType
+            delegate="org.maemo.mica.python.launch.analysis.ltrace.PythonLtraceLocalLaunchDelegate"
+            id="org.maemo.esbox.analysis.launch.python.LtraceLocalLaunchType"
+            modes="profile"
+            name="Local Ltrace Profiler (Python)"
+            public="true">
+      </launchConfigurationType>
+      
+     <launchConfigurationType
+            delegate="org.maemo.mica.python.launch.analysis.ltrace.PythonLtraceRemoteLaunchDelegate"
+            id="org.maemo.esbox.analysis.launch.python.LtraceRemoteLaunchType"
+            modes="profile"
+            name="Remote Ltrace Profiler (Python)"
+            public="true">
+      </launchConfigurationType>
+      
 	</extension>
    <extension
          point="org.eclipse.debug.ui.launchConfigurationTypeImages">
@@ -174,7 +320,20 @@
             icon="icons/full/obj16/valgrind_local.gif"
             id="esboxPythonValgrindLaunchTypeImage">
       </launchConfigurationTypeImage>
+      
+     <launchConfigurationTypeImage
+            configTypeID="org.maemo.esbox.analysis.launch.python.LtraceLocalLaunchType"
+            icon="icons/full/obj16/ltrace.gif"
+            id="esboxPythonLtraceLocalLaunchTypeImage">
+      </launchConfigurationTypeImage>
+      
+     <launchConfigurationTypeImage
+            configTypeID="org.maemo.esbox.analysis.launch.python.LtraceRemoteLaunchType"
+            icon="icons/full/obj16/ltrace.gif"
+            id="esboxPythonLtraceRemoteLaunchTypeImage">
+      </launchConfigurationTypeImage>
 	</extension>
+	
     <extension
          point="org.eclipse.debug.ui.launchConfigurationTabGroups">
       <launchConfigurationTabGroup
@@ -187,6 +346,19 @@
             id="org.maemo.esbox.analysis.launch.python.ValgrindLocalLaunchTabGroup"
             type="org.maemo.esbox.analysis.launch.python.ValgrindLocalLaunchType">
       </launchConfigurationTabGroup>
+      
+     <launchConfigurationTabGroup
+            class="org.maemo.esbox.internal.analysis.launch.ESboxPythonLtraceLocalLaunchConfigurationTabGroup"
+            id="org.maemo.esbox.analysis.launch.python.LtraceLocalLaunchTabGroup"
+            type="org.maemo.esbox.analysis.launch.python.LtraceLocalLaunchType">
+      </launchConfigurationTabGroup>
+      
+      <launchConfigurationTabGroup
+            class="org.maemo.esbox.internal.analysis.launch.ESboxPythonLtraceRemoteLaunchConfigurationTabGroup"
+            id="org.maemo.esbox.analysis.launch.python.LtraceRemoteLaunchTabGroup"
+            type="org.maemo.esbox.analysis.launch.python.LtraceRemoteLaunchType">
+      </launchConfigurationTabGroup>
+      
 	</extension>
    <extension
          point="org.eclipse.debug.ui.launchShortcuts">
@@ -278,8 +450,102 @@
          <configurationType
                id="org.maemo.esbox.analysis.launch.python.OProfileRemoteLaunchType">
          </configurationType>
-    	        	
         </shortcut>
+        
+         <shortcut
+              class="org.maemo.esbox.internal.analysis.launch.ESboxPythonLtraceLocalLaunchShortcut"
+              icon="icons/full/obj16/ltrace.gif"
+              id="org.maemo.esbox.analysis.launch.python.LocalLtraceShortcut"
+              label="Local Ltrace Profiler (Python)"
+              modes="profile">
+        	<contextualLaunch>
+            	<enablement>
+               		<with
+                     	variable="selection">
+                  	<count
+                        value="1">
+                  	</count>
+                  	<iterate>
+                  		<and>
+	                     <test
+		                     	 forcePluginActivation="true"
+                              	 property="org.maemo.mica.common.hasNature"
+ 			                     value="org.maemo.esbox.python.project.pythonNature"/>
+		                    <test
+	                              forcePluginActivation="true"
+	                              property="org.maemo.mica.maemosdk.isEmulatorTarget"/>
+	                       <test
+	                          	forcePluginActivation="true"
+	                          	property="org.maemo.mica.python.isPythonLaunchable"/>
+
+	                     </and>
+                  	</iterate>
+               		</with>
+            	</enablement>
+            	<contextLabel
+                  label="Local Ltrace Python Profiler"
+                  mode="profile">
+            	</contextLabel>
+        	</contextualLaunch>
+ 			<!-- this maps the shortcut back to the launch configuration type,
+	         allowing the Run/Debug Settings UI in the Resource properties view 
+	         to show associated launch configs -->
+	         <configurationType
+	               id="org.maemo.esbox.analysis.launch.python.LtraceLocalLaunchType">
+	         </configurationType>        	
+        </shortcut>
+        
+        
+         <shortcut
+              class="org.maemo.esbox.internal.analysis.launch.ESboxPythonLtraceRemoteLaunchShortcut"
+              icon="icons/full/obj16/ltrace.gif"
+              id="org.maemo.esbox.analysis.launch.python.RemoteLtraceShortcut"
+              label="Remote Ltrace Profiler (Python)"
+              modes="profile">
+        	<contextualLaunch>
+            	<enablement>
+               		<with
+                     	variable="selection">
+                  	<count
+                        value="1">
+                  	</count>
+                  	<iterate>
+                  		<and>
+	                     <test
+		                     	 forcePluginActivation="true"
+                              	 property="org.maemo.mica.common.hasNature"
+ 			                     value="org.maemo.esbox.python.project.pythonNature"/>
+		                    <test
+	                              forcePluginActivation="true"
+	                              property="org.maemo.mica.maemosdk.isEmulatorTarget"/>
+	                       <test
+	                          	forcePluginActivation="true"
+	                          	property="org.maemo.mica.python.isPythonLaunchable"/>
+	                        
+	                        <test
+	                              forcePluginActivation="true"
+	                              property="org.maemo.mica.maemosdk.isRemoteTarget"/>
+	                        
+	                        <test
+	                              forcePluginActivation="true"
+	                              property="org.maemo.mica.maemosdk.isARMELTarget"/>
+
+	                     </and>
+                  	</iterate>
+               		</with>
+            	</enablement>
+            	<contextLabel
+                  label="Remote Ltrace Python Profiler"
+                  mode="profile">
+            	</contextLabel>
+        	</contextualLaunch>
+ 			<!-- this maps the shortcut back to the launch configuration type,
+	         allowing the Run/Debug Settings UI in the Resource properties view 
+	         to show associated launch configs -->
+	         <configurationType
+	               id="org.maemo.esbox.analysis.launch.python.LtraceRemoteLaunchType">
+	         </configurationType>        	
+        </shortcut>
 	</extension>	   
  	      
 </plugin>

Copied: branches/work_Fabricio/org.maemo.esbox.launch.analysis/src/org/maemo/esbox/internal/analysis/launch/ESboxCppLtraceLocalLaunchConfigurationTabGroup.java (from rev 1919, trunk/org.maemo.esbox.launch.analysis/src/org/maemo/esbox/internal/analysis/launch/ESboxCppLtraceLocalLaunchConfigurationTabGroup.java)
===================================================================
--- branches/work_Fabricio/org.maemo.esbox.launch.analysis/src/org/maemo/esbox/internal/analysis/launch/ESboxCppLtraceLocalLaunchConfigurationTabGroup.java	                        (rev 0)
+++ branches/work_Fabricio/org.maemo.esbox.launch.analysis/src/org/maemo/esbox/internal/analysis/launch/ESboxCppLtraceLocalLaunchConfigurationTabGroup.java	2009-08-03 14:16:46 UTC (rev 1920)
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Nokia Corporation
+ * 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:
+ *    Fabrício S Epaminondas (UFCG) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.analysis.launch;
+
+import org.maemo.mica.cpp.launch.analysis.ltrace.AbstractCppLtraceLocalLaunchConfigurationTabGroup;
+import org.maemo.mica.internal.api.cpp.launch.AbstractCppLaunchShortcut;
+
+/**
+ * @author Fabr�cio S Epaminondas (UFCG)
+ * 
+ */
+public class ESboxCppLtraceLocalLaunchConfigurationTabGroup extends
+		AbstractCppLtraceLocalLaunchConfigurationTabGroup {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.maemo.mica.cpp.launch.AbstractCppLaunchConfigurationTabGroup#
+	 * getLaunchShortcut()
+	 */
+	@Override
+	protected AbstractCppLaunchShortcut getLaunchShortcut() {
+		return new ESboxCppLtraceLocalLaunchShortcut();
+	}
+
+}

Copied: branches/work_Fabricio/org.maemo.esbox.launch.analysis/src/org/maemo/esbox/internal/analysis/launch/ESboxCppLtraceLocalLaunchShortcut.java (from rev 1919, trunk/org.maemo.esbox.launch.analysis/src/org/maemo/esbox/internal/analysis/launch/ESboxCppLtraceLocalLaunchShortcut.java)
===================================================================
--- branches/work_Fabricio/org.maemo.esbox.launch.analysis/src/org/maemo/esbox/internal/analysis/launch/ESboxCppLtraceLocalLaunchShortcut.java	                        (rev 0)
+++ branches/work_Fabricio/org.maemo.esbox.launch.analysis/src/org/maemo/esbox/internal/analysis/launch/ESboxCppLtraceLocalLaunchShortcut.java	2009-08-03 14:16:46 UTC (rev 1920)
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Nokia Corporation
+ * 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:
+ *    Fabrício S Epaminondas (UFCG) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.analysis.launch;
+
+import org.eclipse.debug.ui.ILaunchShortcut;
+import org.maemo.mica.cpp.launch.analysis.ltrace.AbstractCppLtraceLocalLaunchShortcut;
+
+/**
+ * @author Fabrício S Epaminondas (UFCG)
+ *
+ */
+public class ESboxCppLtraceLocalLaunchShortcut extends
+		AbstractCppLtraceLocalLaunchShortcut implements ILaunchShortcut {
+
+	public String getLaunchConfigurationType() {
+		return IESboxAnalysisLaunchConstants.CPP_LTRACE_LOCAL_LAUNCH_TYPE;
+	}
+
+}

Copied: branches/work_Fabricio/org.maemo.esbox.launch.analysis/src/org/maemo/esbox/internal/analysis/launch/ESboxCppLtraceRemoteLaunchConfigurationTabGroup.java (from rev 1919, trunk/org.maemo.esbox.launch.analysis/src/org/maemo/esbox/internal/analysis/launch/ESboxCppLtraceRemoteLaunchConfigurationTabGroup.java)
===================================================================
--- branches/work_Fabricio/org.maemo.esbox.launch.analysis/src/org/maemo/esbox/internal/analysis/launch/ESboxCppLtraceRemoteLaunchConfigurationTabGroup.java	                        (rev 0)
+++ branches/work_Fabricio/org.maemo.esbox.launch.analysis/src/org/maemo/esbox/internal/analysis/launch/ESboxCppLtraceRemoteLaunchConfigurationTabGroup.java	2009-08-03 14:16:46 UTC (rev 1920)
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Nokia Corporation
+ * 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:
+ *    Fabrício S Epaminondas (UFCG) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.analysis.launch;
+
+import org.maemo.mica.cpp.launch.analysis.ltrace.AbstractCppLtraceRemoteLaunchConfigurationTabGroup;
+import org.maemo.mica.internal.api.cpp.launch.AbstractCppLaunchShortcut;
+
+/**
+ * @author Fabrício S Epaminondas (UFCG)
+ *
+ */
+public class ESboxCppLtraceRemoteLaunchConfigurationTabGroup extends
+			AbstractCppLtraceRemoteLaunchConfigurationTabGroup{
+
+	/* (non-Javadoc)
+	 * @see org.maemo.mica.internal.api.cpp.launch.AbstractCppLaunchConfigurationTabGroup#getLaunchShortcut()
+	 */
+	@Override
+	protected AbstractCppLaunchShortcut getLaunchShortcut() {
+		return new ESboxCppLtraceRemoteLaunchShortcut();
+	}
+
+}

Copied: branches/work_Fabricio/org.maemo.esbox.launch.analysis/src/org/maemo/esbox/internal/analysis/launch/ESboxCppLtraceRemoteLaunchShortcut.java (from rev 1919, trunk/org.maemo.esbox.launch.analysis/src/org/maemo/esbox/internal/analysis/launch/ESboxCppLtraceRemoteLaunchShortcut.java)
===================================================================
--- branches/work_Fabricio/org.maemo.esbox.launch.analysis/src/org/maemo/esbox/internal/analysis/launch/ESboxCppLtraceRemoteLaunchShortcut.java	                        (rev 0)
+++ branches/work_Fabricio/org.maemo.esbox.launch.analysis/src/org/maemo/esbox/internal/analysis/launch/ESboxCppLtraceRemoteLaunchShortcut.java	2009-08-03 14:16:46 UTC (rev 1920)
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Nokia Corporation
+ * 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:
+ *    Fabrício S Epaminondas (UFCG) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.analysis.launch;
+
+import org.eclipse.debug.ui.ILaunchShortcut;
+import org.maemo.mica.cpp.launch.analysis.ltrace.AbstractCppLtraceRemoteLaunchShortcut;
+
+/**
+ * @author Fabrício S Epaminondas (UFCG)
+ *
+ */
+public class ESboxCppLtraceRemoteLaunchShortcut extends
+		AbstractCppLtraceRemoteLaunchShortcut implements ILaunchShortcut {
+	public String getLaunchConfigurationType() {
+		return IESboxAnalysisLaunchConstants.CPP_LTRACE_REMOTE_LAUNCH_TYPE;
+	}
+
+}

Copied: branches/work_Fabricio/org.maemo.esbox.launch.analysis/src/org/maemo/esbox/internal/analysis/launch/ESboxPythonLtraceLocalLaunchConfigurationTabGroup.java (from rev 1919, trunk/org.maemo.esbox.launch.analysis/src/org/maemo/esbox/internal/analysis/launch/ESboxPythonLtraceLocalLaunchConfigurationTabGroup.java)
===================================================================
--- branches/work_Fabricio/org.maemo.esbox.launch.analysis/src/org/maemo/esbox/internal/analysis/launch/ESboxPythonLtraceLocalLaunchConfigurationTabGroup.java	                        (rev 0)
+++ branches/work_Fabricio/org.maemo.esbox.launch.analysis/src/org/maemo/esbox/internal/analysis/launch/ESboxPythonLtraceLocalLaunchConfigurationTabGroup.java	2009-08-03 14:16:46 UTC (rev 1920)
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Nokia Corporation
+ * 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:
+ *     Fabrício S Epaminondas (UFCG) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.analysis.launch;
+
+import org.maemo.mica.python.launch.analysis.ltrace.AbstractPythonLtraceLocalLaunchConfigurationTabGroup;
+import org.maemo.mica.python.launch.analysis.ltrace.AbstractPythonLtraceLocalLaunchShortcut;
+
+/**
+ * @author  Fabrício S Epaminondas (UFCG)
+ *
+ */
+public class ESboxPythonLtraceLocalLaunchConfigurationTabGroup extends
+		AbstractPythonLtraceLocalLaunchConfigurationTabGroup {
+
+	/* (non-Javadoc)
+	 * @see org.maemo.mica.python.launch.analysis.ltrace.AbstractPythonLtraceLocalLaunchConfigurationTabGroup#getLaunchShortcut()
+	 */
+	@Override
+	protected AbstractPythonLtraceLocalLaunchShortcut getLaunchShortcut() {
+		return new ESboxPythonLtraceLocalLaunchShortcut();
+	}
+}

Copied: branches/work_Fabricio/org.maemo.esbox.launch.analysis/src/org/maemo/esbox/internal/analysis/launch/ESboxPythonLtraceLocalLaunchShortcut.java (from rev 1919, trunk/org.maemo.esbox.launch.analysis/src/org/maemo/esbox/internal/analysis/launch/ESboxPythonLtraceLocalLaunchShortcut.java)
===================================================================
--- branches/work_Fabricio/org.maemo.esbox.launch.analysis/src/org/maemo/esbox/internal/analysis/launch/ESboxPythonLtraceLocalLaunchShortcut.java	                        (rev 0)
+++ branches/work_Fabricio/org.maemo.esbox.launch.analysis/src/org/maemo/esbox/internal/analysis/launch/ESboxPythonLtraceLocalLaunchShortcut.java	2009-08-03 14:16:46 UTC (rev 1920)
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Nokia Corporation
+ * 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:
+ *    Fabrício S Epaminondas (UFCG) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.analysis.launch;
+
+import org.eclipse.debug.ui.ILaunchShortcut;
+import org.maemo.mica.python.launch.analysis.ltrace.AbstractPythonLtraceLocalLaunchShortcut;
+
+/**
+ * @author Fabrício S Epaminondas (UFCG)
+ *
+ */
+public class ESboxPythonLtraceLocalLaunchShortcut extends
+		AbstractPythonLtraceLocalLaunchShortcut implements ILaunchShortcut {
+
+	/* (non-Javadoc)
+	 * @see org.maemo.mica.common.launch.IMicaLaunchShortcut#getLaunchConfigurationType()
+	 */
+	public String getLaunchConfigurationType() {
+		return IESboxAnalysisLaunchConstants.PYTHON_LTRACE_LOCAL_LAUNCH_TYPE;
+	}
+
+}

Copied: branches/work_Fabricio/org.maemo.esbox.launch.analysis/src/org/maemo/esbox/internal/analysis/launch/ESboxPythonLtraceRemoteLaunchConfigurationTabGroup.java (from rev 1919, trunk/org.maemo.esbox.launch.analysis/src/org/maemo/esbox/internal/analysis/launch/ESboxPythonLtraceRemoteLaunchConfigurationTabGroup.java)
===================================================================
--- branches/work_Fabricio/org.maemo.esbox.launch.analysis/src/org/maemo/esbox/internal/analysis/launch/ESboxPythonLtraceRemoteLaunchConfigurationTabGroup.java	                        (rev 0)
+++ branches/work_Fabricio/org.maemo.esbox.launch.analysis/src/org/maemo/esbox/internal/analysis/launch/ESboxPythonLtraceRemoteLaunchConfigurationTabGroup.java	2009-08-03 14:16:46 UTC (rev 1920)
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Nokia Corporation
+ * 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:
+ *     Fabrício S Epaminondas (UFCG) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.analysis.launch;
+
+import org.maemo.mica.python.launch.analysis.ltrace.AbstractPythonLtraceRemoteLaunchConfigurationTabGroup;
+import org.maemo.mica.python.launch.analysis.ltrace.AbstractPythonLtraceRemoteLaunchShortcut;
+
+/**
+ * @author  Fabrício S Epaminondas (UFCG)
+ *
+ */
+public class ESboxPythonLtraceRemoteLaunchConfigurationTabGroup extends
+		AbstractPythonLtraceRemoteLaunchConfigurationTabGroup{
+
+	/* (non-Javadoc)
+	 * @see org.maemo.mica.python.launch.analysis.ltrace.AbstractPythonLtraceRemoteLaunchConfigurationTabGroup#getLaunchShortcut()
+	 */
+	@Override
+	protected AbstractPythonLtraceRemoteLaunchShortcut getLaunchShortcut() {
+		return new ESboxPythonLtraceRemoteLaunchShortcut();
+	}
+}

Copied: branches/work_Fabricio/org.maemo.esbox.launch.analysis/src/org/maemo/esbox/internal/analysis/launch/ESboxPythonLtraceRemoteLaunchShortcut.java (from rev 1919, trunk/org.maemo.esbox.launch.analysis/src/org/maemo/esbox/internal/analysis/launch/ESboxPythonLtraceRemoteLaunchShortcut.java)
===================================================================
--- branches/work_Fabricio/org.maemo.esbox.launch.analysis/src/org/maemo/esbox/internal/analysis/launch/ESboxPythonLtraceRemoteLaunchShortcut.java	                        (rev 0)
+++ branches/work_Fabricio/org.maemo.esbox.launch.analysis/src/org/maemo/esbox/internal/analysis/launch/ESboxPythonLtraceRemoteLaunchShortcut.java	2009-08-03 14:16:46 UTC (rev 1920)
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Nokia Corporation
+ * 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:
+ *    Fabrício S Epaminondas (UFCG) - initial API and implementation
+ *******************************************************************************/
+
+package org.maemo.esbox.internal.analysis.launch;
+
+import org.eclipse.debug.ui.ILaunchShortcut;
+import org.maemo.mica.python.launch.analysis.ltrace.AbstractPythonLtraceRemoteLaunchShortcut;
+
+/**
+ * @author Fabrício S Epaminondas (UFCG)
+ * 
+ */
+public class ESboxPythonLtraceRemoteLaunchShortcut extends
+		AbstractPythonLtraceRemoteLaunchShortcut implements ILaunchShortcut {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.maemo.mica.common.launch.IMicaLaunchShortcut#getLaunchConfigurationType
+	 * ()
+	 */
+	public String getLaunchConfigurationType() {
+		return IESboxAnalysisLaunchConstants.PYTHON_LTRACE_REMOTE_LAUNCH_TYPE;
+	}
+
+}

Modified: branches/work_Fabricio/org.maemo.esbox.launch.analysis/src/org/maemo/esbox/internal/analysis/launch/IESboxAnalysisLaunchConstants.java
===================================================================
--- branches/work_Fabricio/org.maemo.esbox.launch.analysis/src/org/maemo/esbox/internal/analysis/launch/IESboxAnalysisLaunchConstants.java	2009-08-03 13:58:28 UTC (rev 1919)
+++ branches/work_Fabricio/org.maemo.esbox.launch.analysis/src/org/maemo/esbox/internal/analysis/launch/IESboxAnalysisLaunchConstants.java	2009-08-03 14:16:46 UTC (rev 1920)
@@ -20,8 +20,11 @@
 
 	String CPP_OPROFILE_REMOTE_LAUNCH_TYPE = Activator.PLUGIN_ID + ".cpp.OProfileRemoteLaunchType";
 	String CPP_VALGRIND_LOCAL_LAUNCH_TYPE = Activator.PLUGIN_ID + ".cpp.ValgrindLocalLaunchType";
+	String CPP_LTRACE_LOCAL_LAUNCH_TYPE = Activator.PLUGIN_ID + ".cpp.LtraceLocalLaunchType";
+	String CPP_LTRACE_REMOTE_LAUNCH_TYPE = Activator.PLUGIN_ID + ".cpp.LtraceRemoteLaunchType";
 	
 	String PYTHON_OPROFILE_REMOTE_LAUNCH_TYPE = Activator.PLUGIN_ID + ".python.OProfileRemoteLaunchType";
 	String PYTHON_VALGRIND_LOCAL_LAUNCH_TYPE = Activator.PLUGIN_ID + ".python.ValgrindLocalLaunchType";
-
+	String PYTHON_LTRACE_LOCAL_LAUNCH_TYPE = Activator.PLUGIN_ID + ".python.LtraceLocalLaunchType";
+	String PYTHON_LTRACE_REMOTE_LAUNCH_TYPE = Activator.PLUGIN_ID + ".python.LtraceRemoteLaunchType";
 }

Modified: branches/work_Fabricio/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/api/maemosdk/core/tools/AfSbInitMaemoLauncherAdapter.java
===================================================================
--- branches/work_Fabricio/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/api/maemosdk/core/tools/AfSbInitMaemoLauncherAdapter.java	2009-08-03 13:58:28 UTC (rev 1919)
+++ branches/work_Fabricio/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/api/maemosdk/core/tools/AfSbInitMaemoLauncherAdapter.java	2009-08-03 14:16:46 UTC (rev 1920)
@@ -15,14 +15,21 @@
 import java.util.ArrayList;
 import java.util.List;
 
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.QualifiedName;
 import org.eclipse.core.runtime.Status;
 import org.eclipse.core.runtime.SubProgressMonitor;
 import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.dialogs.MessageDialog;
 import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
 import org.eclipse.ui.console.MessageConsole;
+import org.maemo.esbox.internal.maemosdk.core.Activator;
 import org.maemo.esbox.maemosdk.core.MaemoEnvironmentUtils;
 import org.maemo.esbox.maemosdk.core.MaemoPreferenceConstants;
 import org.maemo.mica.common.core.MicaException;
@@ -40,15 +47,22 @@
 import org.maemo.mica.common.core.process.ProcessLauncherUtils;
 import org.maemo.mica.common.core.process.StreamLineMonitorAdapter;
 import org.maemo.mica.common.core.sdk.ISDKTarget;
+import org.maemo.mica.maemosdk.core.IMaemoSDKTarget;
 
+import com.nokia.cpp.internal.api.utils.ui.WorkbenchUtils;
+
 /**
  * Launch the Maemo AF using the "af-sb-init.sh" script.
  * @author baranov
  *
  */
 public class AfSbInitMaemoLauncherAdapter implements IMaemoLauncherAdapter{
+	private static final QualifiedName WARN_ARMEL_TARGET_EXECUTION = new QualifiedName(
+			Activator.PLUGIN_ID, "WARN_ARMEL_TARGET_EXECUTION");
+
+	private static final String MAEMO_LAUNCHER_APP = "maemo-launcher";
+	private static final String HILDON_DESKTOP_APP = "hildon-desktop";
 	
-	private static final String MAEMO_LAUNCHER_APP = "maemo-launcher";
 	private final ISDKTarget target;
 	private final MaemoCommand command;
 	
@@ -60,6 +74,44 @@
 		this.command = new MaemoCommand(target);
 	}
 
+	private void warnIfArmelTarget(final Shell shell) {
+		final String msg = "You are launching an application under an emulated ARMEL target.\n\n"
+				+ "This is a one-time warning that the QEMU emulator has some limitations "
+				+ "in system call support, multithreading support, and instruction set emulation "
+				+ "which may trigger unexpected bugs in otherwise correct programs.\n\n"
+				+ "We recommend using an X86 target for normal development activities.";
+
+		if (target.getArchitecture().equals(
+				IMaemoSDKTarget.ARCHITECTURE_ARMEL)) {
+
+			Boolean oneTimeWarn = null;
+			IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
+			try {
+				oneTimeWarn = (Boolean) workspaceRoot
+						.getSessionProperty(WARN_ARMEL_TARGET_EXECUTION);
+			} catch (CoreException e1) {
+				Activator.getErrorLogger().logError(null, e1);
+			}
+			
+			if(oneTimeWarn != null && !oneTimeWarn.booleanValue())
+				return;
+
+			try {
+				workspaceRoot.setSessionProperty(WARN_ARMEL_TARGET_EXECUTION, Boolean.FALSE);
+			} catch (CoreException e1) {
+				Activator.getErrorLogger().logError(null, e1);
+			}
+			
+			Display.getDefault().asyncExec(new Runnable() {
+				public void run() {
+					MessageDialog.openWarning(shell, "Warning", msg);
+				}
+			});
+		}
+
+	}
+
+	
 	/* (non-Javadoc)
 	 * @see org.maemo.esbox.internal.api.maemosdk.core.tools.IMaemoLauncherAdapter#killMaemo()
 	 */
@@ -92,22 +144,18 @@
 	}
 
 	/* (non-Javadoc)
-	 * <p>
-	 * This kills maemo if X is not running, since maemo may be left hanging is
-	 * X is killed.
 	 * @see org.maemo.esbox.internal.api.maemosdk.core.tools.IMaemoLauncherAdapter#restartMaemo()
 	 */
 	public void restartMaemo(IProgressMonitor monitor) throws MicaException {
 		if (monitor == null)
 			monitor = new NullProgressMonitor();
 		monitor.beginTask("", 10);
-		if (!XLauncher.getInstance().isXServerStarted(target)) {
-			killMaemo();
-			XLauncher.getInstance().startXIfNeeded(target, new SubProgressMonitor(monitor, 1));
-			if (monitor.isCanceled())
-				return;
-		}
-		command.restartMaemoCommand(new SubProgressMonitor(monitor, 9));
+		
+		ensureCorrectXRunning(new SubProgressMonitor(monitor, 1));
+		if (monitor.isCanceled())
+			return;
+		command.performCommand(MaemoPreferenceConstants.MAEMO_RESTART_ACTION, 
+				new SubProgressMonitor(monitor, 9));
 		monitor.done();
 	}
 
@@ -117,21 +165,51 @@
 	public void startMaemo(IProgressMonitor monitor) throws MicaException {
 		if (monitor == null)
 			monitor = new NullProgressMonitor();
-		monitor.beginTask("", IProgressMonitor.UNKNOWN);
-		XLauncher.getInstance().startXIfNeeded(target, new SubProgressMonitor(monitor, 1));
+		monitor.beginTask("", 10);
+		
+		ensureCorrectXRunning(new SubProgressMonitor(monitor, 1));
 		if (monitor.isCanceled())
 			return;
-		if (XLauncher.getInstance().isXServerStarted(target)) {
-			command.startMaemoCommand(new SubProgressMonitor(monitor, 9));
-		}
+		
+		Shell shell = WorkbenchUtils.getSafeShell();
+		warnIfArmelTarget(shell);
+		
+		command.performCommand(MaemoPreferenceConstants.MAEMO_START_ACTION, 
+				new SubProgressMonitor(monitor, 9));
 		monitor.done();
 	}
 
+	/**
+	 * @param subProgressMonitor
+	 * @throws MicaException 
+	 */
+	private void ensureCorrectXRunning(IProgressMonitor monitor) throws MicaException {
+		if (!XLauncher.getInstance().isCorrectXServerRunning(target)) {
+			// usability: if X is not running, be sure any Maemo environment in that
+			// server is also killed, or else if the user tries to restart
+			// the Maemo AF, it will still appear to be running for a while
+			// until all the processes die from the X server socket timeout.
+			killMaemo();
+			XLauncher.getInstance().startXIfNeeded(target, monitor);
+		}
+	}
+
 	/* (non-Javadoc)
 	 * @see org.maemo.esbox.internal.api.maemosdk.core.tools.IMaemoLauncherAdapter#stopMaemo()
 	 */
 	public void stopMaemo(IProgressMonitor monitor) throws MicaException {
-		command.stopMaemoCommand(monitor);
+		if (monitor == null)
+			monitor = new NullProgressMonitor();
+		monitor.beginTask("", 10);
+		
+		command.performCommand(MaemoPreferenceConstants.MAEMO_STOP_ACTION, 
+				new SubProgressMonitor(monitor, 9));
+		try {
+			XLauncher.getInstance().stopX(target, new SubProgressMonitor(monitor, 1));
+		} catch (MicaException e) {
+			// ignore
+		}
+		monitor.done();
 	}
 	
 	/* (non-Javadoc)
@@ -152,7 +230,8 @@
 		List<IProcess> runningProcesses = machine.getProcessLister()
 				.getProcesses(
 						new ProcessFilterCmdLineRegexp(".*/"
-								+ MAEMO_LAUNCHER_APP + "\\s+.*"));
+								+ "(" + MAEMO_LAUNCHER_APP + 
+								"|" + HILDON_DESKTOP_APP + ")\\b"));
 		return runningProcesses;
 	}
 	
@@ -164,6 +243,11 @@
 			this.sdkTarget = sdkTarget;
 		}
 
+		public void performCommand(String command, IProgressMonitor monitor) throws MicaException {
+			List<String> params = getParamList(command);
+			performCommand(params, monitor);
+		}
+		
 		private void performCommand(List<String> params, final IProgressMonitor monitor) throws MicaException {
 			String maemoCommand = sdkTarget.getPreferenceValue(
 					MaemoPreferenceConstants.MAEMO_COMMAND);
@@ -247,23 +331,6 @@
 		}
 		
 
-		public void startMaemoCommand(IProgressMonitor monitor) throws MicaException {
-			List<String> params = getParamList(MaemoPreferenceConstants.MAEMO_START_ACTION);
-
-			performCommand(params, monitor);
-		}
-
-		public void stopMaemoCommand(IProgressMonitor monitor) throws MicaException {
-			List<String> params = getParamList(MaemoPreferenceConstants.MAEMO_STOP_ACTION);
-			performCommand(params, monitor);
-		}
-
-		public void restartMaemoCommand(IProgressMonitor monitor)
-				throws MicaException {
-			List<String> params = getParamList(MaemoPreferenceConstants.MAEMO_RESTART_ACTION);
-			performCommand(params, monitor);
-		}
-
 		private List<String> getParamList(String key) {
 			List<String> params = new ArrayList<String>();
 			params.add(sdkTarget.getPreferenceValue(key));

Modified: branches/work_Fabricio/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/api/maemosdk/core/tools/IMaemoLauncherAdapter.java
===================================================================
--- branches/work_Fabricio/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/api/maemosdk/core/tools/IMaemoLauncherAdapter.java	2009-08-03 13:58:28 UTC (rev 1919)
+++ branches/work_Fabricio/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/api/maemosdk/core/tools/IMaemoLauncherAdapter.java	2009-08-03 14:16:46 UTC (rev 1920)
@@ -15,7 +15,7 @@
 import org.maemo.mica.common.core.MicaException;
 
 /**
- * This adapter on ISDKTarget allows an SDK target to control how the maemo emulation 
+ * This adapter on ISDKTarget allows an SDK target to control how the Maemo emulation 
  * environment is controlled. 
  * @author baranov
  *
@@ -23,44 +23,51 @@
 public interface IMaemoLauncherAdapter {
 
 	/**
-	 * Start maemo if it's not running.  This runs asynchronously.
+	 * Start Maemo AF, and X if needed.  This runs asynchronously.
 	 * @param monitor
 	 * @param sdkTarget
 	 * 
 	 * @throws MicaException
 	 *             if already running or cannot be started
 	 */
-	public abstract void startMaemo(IProgressMonitor monitor) throws MicaException;
+	void startMaemo(IProgressMonitor monitor) throws MicaException;
 
 	/**
-	 * Stop maemo if it's running.  This runs asynchronously.
+	 * Stop Maemo AF and X.  This runs asynchronously.
 	 * @param monitor
 	 * @param sdkTarget
 	 * 
 	 * @throws MicaException
 	 *             if not running or cannot be stopped
 	 */
-	public abstract void stopMaemo(IProgressMonitor monitor) throws MicaException;
+	void stopMaemo(IProgressMonitor monitor) throws MicaException;
 
 	/**
-	 * Restart maemo.  This runs asynchronously.
+	 * Restart Maemo and X.  This runs asynchronously.
 	 * @param monitor
 	 * @param sdkTarget
 	 * 
 	 * @throws MicaException
 	 *             if cannot be restarted
 	 */
-	public abstract void restartMaemo(IProgressMonitor monitor)
+	void restartMaemo(IProgressMonitor monitor)
 			throws MicaException;
 
 	/**
-	 * Kill maemo by forcibly killing instances of the launcher left behind
+	 * Kill maemo by forcibly killing instances of the launcher left behind.
+	 * This is a lower-level operation that will not kill X. 
 	 * 
 	 * @param sdkTarget
 	 * @throws MicaException
 	 */
-	public abstract void killMaemo() throws MicaException;
+	void killMaemo() throws MicaException;
 
-	public abstract boolean isMaemoRunning() throws MicaException;
+	/**
+	 * Tell whether the Maemo AF is properly running: 
+	 * X is running and Maemo AF key processes are running.
+	 * @return
+	 * @throws MicaException if cannot detect
+	 */
+	boolean isMaemoRunning() throws MicaException;
 
 }
\ No newline at end of file

Modified: branches/work_Fabricio/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/api/maemosdk/core/tools/MaemoScriptLauncher.java
===================================================================
--- branches/work_Fabricio/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/api/maemosdk/core/tools/MaemoScriptLauncher.java	2009-08-03 13:58:28 UTC (rev 1919)
+++ branches/work_Fabricio/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/api/maemosdk/core/tools/MaemoScriptLauncher.java	2009-08-03 14:16:46 UTC (rev 1920)
@@ -13,31 +13,22 @@
 
 package org.maemo.esbox.internal.api.maemosdk.core.tools;
 
-import java.io.IOException;
-import java.util.List;
-import java.util.regex.Pattern;
-
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.SubProgressMonitor;
 import org.eclipse.core.runtime.jobs.Job;
 import org.maemo.esbox.internal.maemosdk.core.Activator;
 import org.maemo.mica.common.core.MicaException;
-import org.maemo.mica.common.core.machine.IMachine;
-import org.maemo.mica.common.core.machine.IProcess;
-import org.maemo.mica.common.core.machine.ProcessFilterCmdLineRegexp;
+import org.maemo.mica.common.core.preferences.CorePreferenceManager;
 import org.maemo.mica.common.core.sdk.ISDKTarget;
 
 /**
  */
 public class MaemoScriptLauncher {
 
-	private static MaemoScriptLauncher singleton = new MaemoScriptLauncher();
+	private static final MaemoScriptLauncher singleton = new MaemoScriptLauncher();
+	protected ISDKTarget previousTarget;
 
-	/**
-	 * Constructor
-	 */
 	private MaemoScriptLauncher() {
 	}
 
@@ -45,41 +36,6 @@
 		return singleton;
 	}
 
-	public boolean isXServerStarted(ISDKTarget sdkTarget) {
-		try {
-			return XLauncher.getInstance().isXServerStarted(sdkTarget);
-		} catch (MicaException e) {
-			Activator.getErrorLogger().logError("Failed to query X status", e);
-			return false;
-		}
-	}
-
-	/**
-	 * Method that starts X server.
-	 * @param monitor 
-	 */
-	public void startX(ISDKTarget sdkTarget, IProgressMonitor monitor) throws MicaException {
-		// use the synchronous version
-		XLauncher.getInstance().startXIfNeeded(sdkTarget, monitor);
-	}
-
-	/**
-	 * Method that stops X server.
-	 * @param monitor 
-	 */
-	public void stopX(ISDKTarget sdkTarget, IProgressMonitor monitor) throws MicaException {
-		if (sdkTarget != null) {
-			IMaemoLauncherAdapter launcher = (IMaemoLauncherAdapter)sdkTarget.getAdapter(IMaemoLauncherAdapter.class);
-			
-			if (launcher != null && launcher.isMaemoRunning()) {
-				// usability
-				//throw new MicaException("Maemo Application Framework is still running.  Stop Maemo first.");
-				launcher.stopMaemo(new SubProgressMonitor(monitor, IProgressMonitor.UNKNOWN));
-			}
-		}
-		XLauncher.getInstance().stopX(sdkTarget, monitor);
-	}
-
 	public boolean isMaemoStarted(ISDKTarget sdkTarget) {
 		IMaemoLauncherAdapter launcher = (IMaemoLauncherAdapter) sdkTarget
 				.getAdapter(IMaemoLauncherAdapter.class);
@@ -104,6 +60,7 @@
 		IMaemoLauncherAdapter launcher = (IMaemoLauncherAdapter) sdkTarget
 				.getAdapter(IMaemoLauncherAdapter.class);
 		if (launcher != null) {
+			previousTarget = null;
 			launcher.stopMaemo(monitor);
 		} else {
 			throw new MicaException("I do not know how to stop Maemo AF for " + sdkTarget.getDisplayName());
@@ -118,6 +75,7 @@
 		IMaemoLauncherAdapter launcher = (IMaemoLauncherAdapter) sdkTarget
 				.getAdapter(IMaemoLauncherAdapter.class);
 		if (launcher != null) {
+			previousTarget = sdkTarget;
 			launcher.startMaemo(monitor);
 		} else {
 			throw new MicaException("I do not know how to start Maemo AF for " + sdkTarget.getDisplayName());
@@ -125,58 +83,19 @@
 	}
 
 	/**
-	 * Restart X and Maemo if it is running.
-	 * <p>
-	 * This kills maemo if X is not running, since maemo may be left hanging is
-	 * X is killed.
+	 * Restart Maemo AF (starting if not yet started).
 	 * @param monitor 
 	 */
 	public void restartMaemo(ISDKTarget sdkTarget, IProgressMonitor monitor) throws MicaException {
 		IMaemoLauncherAdapter launcher = (IMaemoLauncherAdapter) sdkTarget
 				.getAdapter(IMaemoLauncherAdapter.class);
 		if (launcher != null) {
+			previousTarget = sdkTarget;
 			launcher.restartMaemo(monitor);
 		}
 	}
 
 	/**
-	 * Kill maemo.
-	 */
-	public void killMaemo(ISDKTarget target) throws MicaException {
-		IMaemoLauncherAdapter launcher = (IMaemoLauncherAdapter) target
-				.getAdapter(IMaemoLauncherAdapter.class);
-		if (launcher != null) {
-			launcher.killMaemo();
-		}
-	}
-
-	/**
-	 * Kill all instances of a given process
-	 * 
-	 * @param processName
-	 *            executable name
-	 * @param processLabel
-	 *            the user-visible name for the process
-	 */
-	public void killProcess(IMachine machine, String processName,
-			String processLabel) throws MicaException {
-		// resolve pure process name
-		int slashIndex = processName.lastIndexOf("/");
-		if(slashIndex != -1){
-			processName = processName.substring(slashIndex+1); 
-		}
-		List<IProcess> processes = machine.getProcessLister().getProcesses(
-				new ProcessFilterCmdLineRegexp(".*" + processName + ".*",Pattern.CASE_INSENSITIVE));
-		for (IProcess process : processes) {
-			try {
-				process.terminate();
-			} catch (IOException e) {
-				throw new MicaException("Error killing " + processName, e);
-			}
-		}
-	}
-
-	/**
 	 * Create a job to start Maemo.
 	 */
 	public Job createStartMaemoJob(final ISDKTarget target) {
@@ -239,7 +158,6 @@
 			protected IStatus run(IProgressMonitor monitor) {
 				try {
 					MaemoScriptLauncher.getInstance().stopMaemo(target, monitor);
-					MaemoScriptLauncher.getInstance().killMaemo(target);
 				} catch (MicaException e) {
 					Activator.getErrorLogger().showError(null, e);
 				}
@@ -272,13 +190,13 @@
 	/**
 	 * Create a job to stop X.
 	 */
-	public Job createStopXJob(final ISDKTarget target) {
+	public Job createStopXJob() {
 		Job job = new Job("Stopping X Server") {
 
 			@Override
 			protected IStatus run(IProgressMonitor monitor) {
 				try {
-					MaemoScriptLauncher.getInstance().stopX(target, monitor);
+					MaemoScriptLauncher.getInstance().stopX(monitor);
 				} catch (MicaException e) {
 					Activator.getErrorLogger().showError(null, e);
 				}
@@ -288,4 +206,28 @@
 	  };
 	  return job;
 	}
+
+	/**
+	 * @return
+	 */
+	public ISDKTarget getPreviousTarget() {
+		return previousTarget;
+	}
+
+	/**
+	 * Stop the X server.
+	 * @param monitor 
+	 */
+	public void stopX(IProgressMonitor monitor) throws MicaException {
+		XLauncher.getInstance().stopX(CorePreferenceManager.getInstance().getPreferenceProvider(), monitor);
+	}
+
+	/**
+	 * Start the X server for the target if it is not already running.
+	 * @param monitor 
+	 */
+	public void startX(ISDKTarget sdkTarget, IProgressMonitor monitor) throws MicaException {
+		XLauncher.getInstance().startXIfNeeded(sdkTarget, monitor);
+		previousTarget = sdkTarget;
+	}
 }

Modified: branches/work_Fabricio/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/api/maemosdk/core/tools/XLauncher.java
===================================================================
--- branches/work_Fabricio/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/api/maemosdk/core/tools/XLauncher.java	2009-08-03 13:58:28 UTC (rev 1919)
+++ branches/work_Fabricio/org.maemo.esbox.maemosdk.core/src/org/maemo/esbox/internal/api/maemosdk/core/tools/XLauncher.java	2009-08-03 14:16:46 UTC (rev 1920)
@@ -12,7 +12,17 @@
 
 package org.maemo.esbox.internal.api.maemosdk.core.tools;
 
-import org.eclipse.core.runtime.*;
+import java.io.IOException;
+import java.net.Socket;
+import java.text.MessageFormat;
+import java.util.List;
+import java.util.regex.Pattern;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.SubProgressMonitor;
 import org.eclipse.core.runtime.jobs.Job;
 import org.maemo.esbox.internal.maemosdk.core.Activator;
 import org.maemo.esbox.maemosdk.core.MaemoPreferenceConstants;
@@ -20,18 +30,21 @@
 import org.maemo.mica.common.core.Policy;
 import org.maemo.mica.common.core.env.IEnvironmentModifierBlock;
 import org.maemo.mica.common.core.machine.IMachine;
+import org.maemo.mica.common.core.machine.IProcess;
 import org.maemo.mica.common.core.machine.MachineRegistry;
 import org.maemo.mica.common.core.machine.MachineUtils;
+import org.maemo.mica.common.core.machine.ProcessFilterCmdLineRegexp;
 import org.maemo.mica.common.core.preferences.CorePreferenceManager;
 import org.maemo.mica.common.core.preferences.IPreferenceProvider;
-import org.maemo.mica.common.core.process.*;
+import org.maemo.mica.common.core.process.CommandLineArguments;
+import org.maemo.mica.common.core.process.IProcessLauncher;
+import org.maemo.mica.common.core.process.IProcessLauncherFactory;
+import org.maemo.mica.common.core.process.IProcessMonitor;
+import org.maemo.mica.common.core.process.ProcessLauncherParameters;
+import org.maemo.mica.common.core.process.ProcessLauncherUtils;
 import org.maemo.mica.common.core.sdk.ISDKTarget;
 import org.maemo.mica.maemosdk.core.IMaemoSDKPlatform;
 
-import java.net.Socket;
-import java.text.MessageFormat;
-import java.util.List;
-
 /**
  * This class maintains knowledge about whether the X server is running in the
  * host, and controls access to starting, stopping, and querying status.
@@ -131,14 +144,14 @@
 		}
 	}
 
-	private static XLauncher instance;
+	private static final XLauncher instance = new XLauncher();
 
 	private XLaunchingJob launchingXJob;
 
-	public synchronized static XLauncher getInstance() {
-		if (instance == null) {
-			instance = new XLauncher();
-		}
+	private List<String> previousCommandLine;
+	private String previousDisplay;
+
+	public static XLauncher getInstance() {
 		return instance;
 	}
 
@@ -189,11 +202,12 @@
 	}
 
 	/**
-	 * Test whether the X server is started by testing a connection to the
-	 * server.
+	 * Test whether the X server is started and is compatible with
+	 * the current settings.
 	 * 
 	 * @param prefProvider
-	 * @return
+	 * @return true if running
+	 * @throws MicaException if X server display variable is invalid
 	 */
 	public boolean isXServerStarted(IPreferenceProvider prefProvider)
 			throws MicaException {
@@ -203,7 +217,77 @@
 		return testXConnection(getDisplayValue(prefProvider));
 	}
 
-	/** Be nice and start X if needed before starting/restarting maemo 
+	/**
+	 * Test whether the X server is running with the same command line
+	 * as before.  
+	 * 
+	 * @param prefProvider
+	 * @return true if running
+	 * @throws MicaException if X server display variable is invalid
+	 */
+	public boolean isXServerCompatible(IPreferenceProvider prefProvider)
+			throws MicaException {
+		if (prefProvider == null)
+			prefProvider = CorePreferenceManager.getInstance().getPreferenceProvider();
+
+		// only test if we're making a server for the same display as before
+		String newDisplay = getDisplayValue(prefProvider);
+		if (previousDisplay != null && !newDisplay.equals(previousDisplay))
+			return true;
+		
+		List<String> newCommandLine = getDisplayXServerCommand(prefProvider);
+		if (previousCommandLine != null) {
+			// Check if processes match, but ignore full executable path and only check process names.  
+			return previousCommandLine.size() >= 1 && previousCommandLine.size() == newCommandLine.size() &&
+				newCommandLine.subList(1, newCommandLine.size()).equals(
+					previousCommandLine.subList(1, previousCommandLine.size()))
+					&& getSimpleProcessName(previousCommandLine.get(0)).equals(
+							getSimpleProcessName(newCommandLine.get(0)));
+		}
+		
+		// we didn't launch it....
+		if (!newCommandLine.isEmpty()) {
+			IProcess[] processes = getMatchingXProcesses(newCommandLine.get(0));
+			if (processes.length > 0) {
+				boolean realCmdLinesAvailable = false;
+				for (IProcess process : processes) {
+					List<String> processCmdLine = CommandLineArguments.createFromCommandLine(process.getCommandLine());
+					if (processCmdLine.size() > 1) {
+						realCmdLinesAvailable = true;
+						// note: the argv[0] executable may now have a path
+						if (processCmdLine.subList(1, processCmdLine.size()).equals(
+								newCommandLine.subList(1, newCommandLine.size()))) {
+							return true;
+						}
+					}
+				}
+				if (realCmdLinesAvailable) {
+					// no exact matches
+					return false;
+				}
+				// probably on Windows, so assume the X server is ours
+				return true;
+			}
+		}
+		
+		// no X server configured or no match
+		return false;
+	}
+
+	/**
+	 * Tell if the X server is running, and if it is, whether it's the
+	 * one we want to run.
+	 * @param prefProvider
+	 * @return flag true if server is running and compatible
+	 * @throws MicaException if bad settings
+	 */
+	public boolean isCorrectXServerRunning(IPreferenceProvider prefProvider) throws MicaException {
+		return isXServerStarted(prefProvider) && isXServerCompatible(prefProvider);
+	}
+	
+	/** 
+	 * Start X if it is not running, or if we know it was previously launched with
+	 * a different command line.
 	 * */
 	public void startXIfNeeded(IPreferenceProvider prefProvider, IProgressMonitor monitor)
 			throws MicaException {
@@ -214,8 +298,23 @@
 			monitor = new NullProgressMonitor();
 		
 		monitor.beginTask("", 3);
+		
+		// if already starting, wait...
 		waitForXLaunch(new SubProgressMonitor(monitor, 1));
-		if (!isXServerStarted(prefProvider)) {
+		
+		// start X if it's not running or if the arguments have changed
+		boolean serverStarted = isXServerStarted(prefProvider);
+		boolean serverCompatible = isXServerCompatible(prefProvider);
+		
+		if (!serverStarted || !serverCompatible) {
+			if (serverStarted && !serverCompatible) {
+				// stop an incompatible server
+				try {
+					stopX(prefProvider, new SubProgressMonitor(monitor, 0));
+				} catch (MicaException e) {
+					// ignore
+				}
+			}
 			startX(prefProvider, new SubProgressMonitor(monitor, 1));
 			waitForXLaunch(new SubProgressMonitor(monitor, 1));
 		}
@@ -270,12 +369,12 @@
 		
 		final IPreferenceProvider prefProvider = prefProvider_;
 		
-		String viewer = getDisplayXServerCommand(prefProvider);
+		List<String> cmdLine = getDisplayXServerCommand(prefProvider);
 		final String display = getDisplayValue(prefProvider);
+		
+		previousCommandLine = cmdLine;
+		previousDisplay = display;
 
-		List<String> cmdLine = CommandLineArguments
-				.createFromCommandLine(viewer);
-
 		if (cmdLine.size() > 0) {
 
 			IMachine localMachine = MachineRegistry.getInstance()
@@ -298,7 +397,7 @@
 			IProcessLauncher processLauncher = factory.createProcessLauncher(
 					params);
 			ProcessLauncherUtils.queueConsoleMonitor(processLauncher, 
-					true, null, "Starting X Server");
+					true, prefProvider instanceof ISDKTarget ? (ISDKTarget) prefProvider : null, "Starting X Server");
 			processLauncher.createProcess(null);
 			
 			IProcessMonitor procMon = processLauncher.createProcessMonitor();
@@ -310,11 +409,17 @@
 			}
 		} else {
 			Activator.getErrorLogger().logAndShowError(
-					"No X server configured in ESbox preferences", null);
+					"No X server configured in X Server preferences", null);
 		}
 
 	}
 
+	/**
+	 * Stop X synchronously.
+	 * @param prefProvider
+	 * @param monitor
+	 * @throws MicaException if server is not running or could not be killed.
+	 */
 	public void stopX(IPreferenceProvider prefProvider, IProgressMonitor monitor) throws MicaException {
 		if (prefProvider == null)
 			prefProvider = CorePreferenceManager.getInstance().getPreferenceProvider();
@@ -328,24 +433,45 @@
 			throw new MicaException(
 					"X Server was not started. Start X Server first");
 
-		String server = getDisplayXServerCommand(prefProvider);
+		List<String> cmdLine = getDisplayXServerCommand(prefProvider);
 
-		List<String> cmdLine = CommandLineArguments
-				.createFromCommandLine(server);
-
+		previousCommandLine = null;
+		previousDisplay = null;
+		
 		// find server to kill
-		if (cmdLine.size() > 0) {
-			IMachine localMachine = MachineRegistry.getInstance()
-					.getLocalMachine();
-			if (localMachine == null)
-				throw new MicaException("Cannot find local machine");
+		
+		if (cmdLine.isEmpty()) {
+			return;
+		}
 
-			MaemoScriptLauncher.getInstance().killProcess(localMachine,
-					cmdLine.get(0), "X Server");
+		String executable = getSimpleProcessName(cmdLine.get(0));
+		String diplay = getDisplayValue(prefProvider);
+		
+		IProcess[] processes = MachineRegistry.getInstance().getLocalMachine().
+			getProcessLister().getProcesses(new ProcessFilterCmdLineRegexp(
+					".*" + Pattern.quote(executable) + ".*\\s+" +
+					Pattern.quote(diplay) + "(?:\\s.*|$)", 
+					Pattern.CASE_INSENSITIVE )).toArray(new IProcess[]{});
+
+		if (processes.length <= 0) {
+			processes = getMatchingXProcesses(executable);
 		}
+	
+		for (IProcess process : processes) {
+			try {
+				process.terminate();
+			} catch (IOException e) {
+				throw new MicaException("Error killing " + executable, e);
+			}
+		}
 	}
 
-	private String getDisplayXServerCommand(IPreferenceProvider prefProvider) {
+	/**
+	 * Get the command line for launching the X server.
+	 * @param prefProvider
+	 * @return
+	 */
+	private List<String> getDisplayXServerCommand(IPreferenceProvider prefProvider) {
 		String command = prefProvider
 				.getPreferenceValue(MaemoPreferenceConstants.DISPLAY_X_COMMAND);
 
@@ -359,7 +485,8 @@
 		//Defining specific platform RESOLUTION.
 		command = command.replaceAll("\\$\\{RESOLUTION\\}",
 				getResolutionParameter(prefProvider));
-		return command;
+		
+		return CommandLineArguments.createFromCommandLine(command);
 	}
 	
 	/**
@@ -371,7 +498,7 @@
 	 *            {@link ISDKTarget} the default value is returned.
 	 * @return the value for variable {PLATFORM_PARAMETERS}.
 	 */
-	public String getPlatformParameters(IPreferenceProvider prefProvider) {
+	private String getPlatformParameters(IPreferenceProvider prefProvider) {
 		ISDKTarget sdkTarget = null;
 		if (prefProvider instanceof ISDKTarget)
 			sdkTarget = (ISDKTarget) prefProvider;
@@ -393,7 +520,7 @@
 	 *            {@link ISDKTarget} the default value is returned.
 	 * @return the value for variable {RESOLUTION}.
 	 */
-	public String getResolutionParameter(IPreferenceProvider prefProvider) {
+	private String getResolutionParameter(IPreferenceProvider prefProvider) {
 		ISDKTarget sdkTarget = null;
 		if (prefProvider instanceof ISDKTarget)
 			sdkTarget = (ISDKTarget) prefProvider;
@@ -413,4 +540,32 @@
 		else
 			return System.getenv("DISPLAY"); // get from system
 	}
+
+	/**
+	 * Get pure process name from process name string. 
+	 * Example '/bin/sh' returns 'sh' and 'sh' returns 'sh'.
+	 *
+	 * @param processName the process name
+	 * @return the pure process name
+	 */
+	private static String getSimpleProcessName(String processName) {
+		// resolve pure process name
+		int slashIndex = processName.lastIndexOf("/");
+		if(slashIndex != -1){
+			processName = processName.substring(slashIndex+1); 
+		}
+		return processName;
+	}
+	
+	/**
+	 * @param machine
+	 * @return
+	 */
+	private IProcess[] getMatchingXProcesses(String processName) {
+		List<IProcess> processes = MachineRegistry.getInstance().getLocalMachine().
+			getProcessLister().getProcesses(
+				new ProcessFilterCmdLineRegexp(".*" + Pattern.quote(getSimpleProcessName(processName)) + ".*",Pattern.CASE_INSENSITIVE));
+		return (IProcess[]) processes.toArray(new IProcess[processes.size()]);
+	}
+
 }
\ No newline at end of file

Modified: branches/work_Fabricio/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/maemosdk/ui/actions/BaseEmulatorStartStopRestartControlAction.java
===================================================================
--- branches/work_Fabricio/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/maemosdk/ui/actions/BaseEmulatorStartStopRestartControlAction.java	2009-08-03 13:58:28 UTC (rev 1919)
+++ branches/work_Fabricio/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/maemosdk/ui/actions/BaseEmulatorStartStopRestartControlAction.java	2009-08-03 14:16:46 UTC (rev 1920)
@@ -32,9 +32,14 @@
 import org.maemo.mica.common.core.sdk.ISDKTarget;
 import org.maemo.mica.common.project.core.ProjectManager;
 import org.maemo.mica.common.ui.dialogs.SelectSDKTargetDialog;
+import org.maemo.mica.internal.api.common.core.sdk.ISingleCurrentTargetOnlySDK;
 
 /**
- * Basic action for a toolbar menu action.
+ * Basic support for a toolbar menu action that supports Start/Stop
+ * (and possibly Restart) and lets the user select an ISDKTarget
+ * in which to perform the action.  The previously selected
+ * target -- or the currently active target for that target's SDK
+ * -- is used as a default if possible.
  * @author eswartz
  *
  */
@@ -49,7 +54,6 @@
 	protected abstract void startClicked();
 
 	protected IProject selectedProject;
-	protected ISDKTarget previousTarget;
 	
 	/**
 	 * 
@@ -80,7 +84,6 @@
 		mi.setImage(UIActivator.getImageDescriptor("./icons/full/etool16/start_co.gif").createImage());
 		mi.addListener(SWT.Selection, new Listener() {
 		      public void handleEvent(Event event) {
-		    	  previousTarget = null;
 		    	  startClicked();
 		      }
 
@@ -102,6 +105,8 @@
 		mi.addListener(SWT.Selection, new Listener() {
 		      public void handleEvent(Event event) {
 		    	  stopClicked();
+		    	  // ask next time
+		    	  //previousTarget = null;
 		      }
 		    });
 				
@@ -128,7 +133,7 @@
 		
 		IResource resource = WorkspaceUtils.getResourceFromSelection(selection);
 		
-		// XXX: don't ask for ISDKTarget here since it can hang
+		// don't ask for ISDKTarget here since it can hang (UI thread)
 		this.selectedProject = null;
 		if (resource != null && resource.getProject().isOpen()) {
 			this.selectedProject = resource.getProject();
@@ -137,15 +142,10 @@
 		action.setEnabled(true);
 	}
 	
-	protected ISDKTarget getSDKTarget(final String prompt) {
-		
-		// XXX FIXME: the previous target may be different
-		// if the environment was launched from MaemoExecutionEnvironmentAdapter
+	protected ISDKTarget getSDKTarget(final String prompt, ISDKTarget previousTarget) {
 		ISDKTarget sdkTarget = previousTarget;
 		
-		if (sdkTarget != null)
-			return sdkTarget;
-		
+		// figure out a viable target from the context
 		if (selectedProject != null) {
 			try {
 				ISDKTarget theSdkTarget = ProjectManager.getInstance().getSDKTarget(selectedProject);
@@ -169,8 +169,41 @@
 			
 		});
 		
-		previousTarget = selected[0];
+		if (selected[0] != null)
+			previousTarget = selected[0];
 		return selected[0];
 	}
 
+	/**
+	 * Get the ISDKTarget that is current, for the purpose of restarting
+	 * or stopping.  This might be the one we used when starting, or
+	 * the user may have manually switched targets and launched in
+	 * the meantime.  If we can't tell, ask.
+	 * @return ISDKTarget or <code>null</code> if we asked and the user canceled
+	 * or we cannot tell
+	 */
+	protected ISDKTarget getCurrentSDKTarget(ISDKTarget previousTarget) {
+		if (previousTarget != null) {
+			if (previousTarget.getSDK() instanceof ISingleCurrentTargetOnlySDK) {
+				try {
+					// the user may have switched targets in the meantime.
+					// If this is the kind of SDK where only one target
+					// is active at a time, use that one instead (Mica #4284)
+					String currentTargetName = ((ISingleCurrentTargetOnlySDK) previousTarget.getSDK()).getCurrentTarget();
+					if (currentTargetName != null) {
+						ISDKTarget currentTarget = previousTarget.getSDK().findSDKTarget(currentTargetName);
+						if (currentTarget != null) {
+							return currentTarget;
+						}
+					}
+				} catch (MicaException e) {
+					// can't be sure... fall through
+				}
+			}
+			return previousTarget;
+		}
+		
+		// ask
+		return getSDKTarget("Select the target under which to operate:", previousTarget);
+	}
 }
\ No newline at end of file

Modified: branches/work_Fabricio/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/maemosdk/ui/actions/MaemoDropdownMenuAction.java
===================================================================
--- branches/work_Fabricio/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/maemosdk/ui/actions/MaemoDropdownMenuAction.java	2009-08-03 13:58:28 UTC (rev 1919)
+++ branches/work_Fabricio/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/maemosdk/ui/actions/MaemoDropdownMenuAction.java	2009-08-03 14:16:46 UTC (rev 1920)
@@ -11,10 +11,12 @@
  *******************************************************************************/
 package org.maemo.esbox.internal.maemosdk.ui.actions;
 
+import org.eclipse.core.runtime.NullProgressMonitor;
 import org.eclipse.core.runtime.jobs.Job;
 import org.eclipse.jface.dialogs.MessageDialog;
 import org.maemo.esbox.internal.api.maemosdk.core.tools.IMaemoLauncherAdapter;
 import org.maemo.esbox.internal.api.maemosdk.core.tools.MaemoScriptLauncher;
+import org.maemo.mica.common.core.MicaException;
 import org.maemo.mica.common.core.sdk.ISDKTarget;
 
 /**
@@ -29,7 +31,8 @@
 public class MaemoDropdownMenuAction extends BaseEmulatorStartStopRestartControlAction {
 	
 	protected ISDKTarget getSDKTarget() {
-		return getSDKTarget("Select an SDK under which to run the Maemo Application Framework:");
+		return getSDKTarget("Select an SDK under which to run the Maemo Application Framework:",
+				MaemoScriptLauncher.getInstance().getPreviousTarget());
 	}
 	
 
@@ -39,10 +42,22 @@
 		if (target == null)
 			return;
 		if (MaemoScriptLauncher.getInstance().isMaemoStarted(target)) {
-			MessageDialog.openInformation(null, 
+			boolean restart = MessageDialog.openQuestion(null, 
 					"Maemo AF is running", 
-					"The Maemo Application Framework appears to be already running.\n\nIf you do not see it, you may need to restart it or wait for its startup to complete.");
-			return;
+					"The Maemo Application Framework appears to be already running.\n\nIf you do not see it, you may need to restart it or wait for its startup to complete.\n\nDo you want to restart it for " + target.getName() + "?");
+			if (!restart)
+				return;
+			
+			ISDKTarget killTarget = MaemoScriptLauncher.getInstance().getPreviousTarget();
+			if (killTarget == null)
+				killTarget = target;
+			
+			try {
+				MaemoScriptLauncher.getInstance().stopMaemo(killTarget,  
+						new NullProgressMonitor());
+			} catch (MicaException e) {
+				// ignore
+			}
 		}
 		Job job = MaemoScriptLauncher.getInstance().createStartMaemoJob(target);
 		job.schedule();
@@ -50,7 +65,7 @@
 	
 	@Override
 	protected void restartClicked() {
-		ISDKTarget target = getSDKTarget();
+		ISDKTarget target = getCurrentSDKTarget(MaemoScriptLauncher.getInstance().getPreviousTarget());
 		if (target == null)
 			return;
 		Job job = MaemoScriptLauncher.getInstance().createRestartMaemoJob(target);
@@ -59,7 +74,7 @@
 	
 	@Override
 	protected void stopClicked() {
-		ISDKTarget target = getSDKTarget();
+		ISDKTarget target = getCurrentSDKTarget(MaemoScriptLauncher.getInstance().getPreviousTarget());
 		if (target == null)
 			return;
 		Job job = MaemoScriptLauncher.getInstance().createStopMaemoJob(target);

Modified: branches/work_Fabricio/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/maemosdk/ui/actions/XDropdownMenuAction.java
===================================================================
--- branches/work_Fabricio/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/maemosdk/ui/actions/XDropdownMenuAction.java	2009-08-03 13:58:28 UTC (rev 1919)
+++ branches/work_Fabricio/org.maemo.esbox.maemosdk.ui/src/org/maemo/esbox/internal/maemosdk/ui/actions/XDropdownMenuAction.java	2009-08-03 14:16:46 UTC (rev 1920)
@@ -19,6 +19,8 @@
 import org.eclipse.jface.action.IAction;
 import org.eclipse.jface.dialogs.MessageDialog;
 import org.maemo.esbox.internal.api.maemosdk.core.tools.MaemoScriptLauncher;
+import org.maemo.esbox.internal.api.maemosdk.core.tools.XLauncher;
+import org.maemo.mica.common.core.MicaException;
 import org.maemo.mica.common.core.sdk.ISDKTarget;
 
 /**
@@ -32,7 +34,8 @@
 public class XDropdownMenuAction extends BaseEmulatorStartStopRestartControlAction {
 	
 	protected ISDKTarget getSDKTarget() {
-		return getSDKTarget("Select an SDK under which to run the X Server:");
+		return getSDKTarget("Select an SDK under which to run the X Server:",
+				MaemoScriptLauncher.getInstance().getPreviousTarget());
 	}
 
 	/* (non-Javadoc)
@@ -50,9 +53,13 @@
 		ISDKTarget target = getSDKTarget();
 		if (target == null)
 			return;
-		if (MaemoScriptLauncher.getInstance().isXServerStarted(target)) {
-			MessageDialog.openInformation(null, "X Running", "X is still running.  Terminate it first if necessary.");
-			return;
+		try {
+			if (XLauncher.getInstance().isCorrectXServerRunning(target)) {
+				MessageDialog.openInformation(null, "X Running", "X is still running.  Terminate it first if necessary.");
+				return;
+			}
+		} catch (MicaException e) {
+			// failed, so definitely not running
 		}
 			
 		Job job = MaemoScriptLauncher.getInstance().createStartXJob(target);
@@ -63,10 +70,7 @@
 	 * Stop X
 	 */
 	protected void stopClicked() {
-		ISDKTarget target = getSDKTarget();
-		if (target == null)
-			return;
-		Job job = MaemoScriptLauncher.getInstance().createStopXJob(target);
+		Job job = MaemoScriptLauncher.getInstance().createStopXJob();
 		job.schedule();
 	}
 

Modified: branches/work_Fabricio/org.maemo.esbox.scratchbox.core/src/org/maemo/esbox/internal/api/scratchbox/core/execEnv/MaemoExecutionEnvironmentHandler.java
===================================================================
--- branches/work_Fabricio/org.maemo.esbox.scratchbox.core/src/org/maemo/esbox/internal/api/scratchbox/core/execEnv/MaemoExecutionEnvironmentHandler.java	2009-08-03 13:58:28 UTC (rev 1919)
+++ branches/work_Fabricio/org.maemo.esbox.scratchbox.core/src/org/maemo/esbox/internal/api/scratchbox/core/execEnv/MaemoExecutionEnvironmentHandler.java	2009-08-03 14:16:46 UTC (rev 1920)
@@ -12,21 +12,20 @@
 package org.maemo.esbox.internal.api.scratchbox.core.execEnv;
 
 import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IWorkspaceRoot;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.QualifiedName;
 import org.eclipse.core.runtime.jobs.Job;
 import org.eclipse.jface.dialogs.MessageDialog;
 import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.Shell;
 import org.maemo.esbox.internal.api.maemosdk.core.tools.MaemoScriptLauncher;
+import org.maemo.esbox.internal.api.maemosdk.core.tools.XLauncher;
 import org.maemo.esbox.internal.scratchbox.core.Activator;
 import org.maemo.mica.common.core.MicaException;
 import org.maemo.mica.common.core.execEnv.IExecutionEnvironmentHandler;
 import org.maemo.mica.common.core.sdk.ISDKTarget;
 import org.maemo.mica.common.project.core.ProjectManager;
-import org.maemo.mica.maemosdk.core.IMaemoSDKTarget;
+import org.maemo.mica.internal.api.common.core.sdk.ISingleCurrentTargetOnlySDK;
 
 /**
  * Environment for Maemo applications
@@ -36,79 +35,60 @@
  */
 public class MaemoExecutionEnvironmentHandler implements
 		IExecutionEnvironmentHandler {
-	public static final QualifiedName WARN_ARMEL_TARGET_EXECUTION = new QualifiedName(
-			Activator.PLUGIN_ID, "WARN_ARMEL_TARGET_EXECUTION");
-
-	public void establishEnvironment(Shell shell, IProject project, 
+	
+	public void establishEnvironment(final Shell shell, IProject project, 
 			IProgressMonitor monitor)
 			throws CoreException {
 
-		shouldNotRunArmelTarget(shell, project);
-		// see if Maemo is running
-		runMaemoIfNeeded(shell, project, monitor);
-	}
-
-	private void shouldNotRunArmelTarget(final Shell shell, IProject project) {
-		final String msg = "You are launching an application under an emulated ARMEL target.\n\n"
-				+ "This is a one-time warning that the QEMU emulator has some limitations "
-				+ "in system call support, multithreading support, and instruction set emulation "
-				+ "which may trigger unexpected bugs in otherwise correct programs.\n\n"
-				+ "We recommend using an X86 target for normal development activities.";
-
-		ISDKTarget sdkTarget;
-		IWorkspaceRoot workspaceRoot = project.getWorkspace().getRoot();
-		Boolean oneTimeWarn = null;
+		final ISDKTarget sdkTarget;
 		try {
 			sdkTarget = ProjectManager.getInstance().getSDKTarget(project);
-			if (sdkTarget.getArchitecture().equals(
-					IMaemoSDKTarget.ARCHITECTURE_ARMEL)) {
-
-				try {
-					oneTimeWarn = (Boolean) workspaceRoot
-							.getSessionProperty(WARN_ARMEL_TARGET_EXECUTION);
-				} catch (CoreException e1) {
-					Activator.getErrorLogger().logError(null, e1);
+			
+			boolean wrongOneRunning = false;
+			ISDKTarget wrongTarget = null;
+			
+			// ensure that the previous target is actually active -- we may otherwise
+			// get a false positive when using a different SB1 target, which will just
+			// kill the emulator anyway.
+			if (sdkTarget.getSDK() instanceof ISingleCurrentTargetOnlySDK) {
+				String currentTarget = ((ISingleCurrentTargetOnlySDK)sdkTarget.getSDK()).getCurrentTarget();
+				if (!sdkTarget.getName().equals(
+						currentTarget)) {
+					wrongTarget = sdkTarget.getSDK().findSDKTarget(currentTarget);
+					wrongOneRunning = true;
 				}
-				
-				if(oneTimeWarn != null && !oneTimeWarn.booleanValue())
-					return;
-
-				try {
-					workspaceRoot.setSessionProperty(WARN_ARMEL_TARGET_EXECUTION, Boolean.FALSE);
-				} catch (CoreException e1) {
-					Activator.getErrorLogger().logError(null, e1);
-				}
-				
-				Display.getDefault().asyncExec(new Runnable() {
-					public void run() {
-						MessageDialog.openWarning(shell, "Warning", msg);
-					}
-				});
 			}
-		} catch (MicaException e) {
-			Activator.getErrorLogger().logAndShowError(
-					"Error valdating Maemo execution environment", e);
-			// don't fail the launch
-		}
-
-	}
-
-	private void runMaemoIfNeeded(final Shell shell, IProject project, IProgressMonitor monitor) {
-		final ISDKTarget sdkTarget;
-		try {
-			sdkTarget = ProjectManager.getInstance().getSDKTarget(project);
-			if (!MaemoScriptLauncher.getInstance().isMaemoStarted(sdkTarget) 
-					|| !MaemoScriptLauncher.getInstance().isXServerStarted(sdkTarget)) {
+			
+			// See if X is running and it's the one we want.  (If it's not running, 
+			// any Maemo AF will die soon too.)
+			boolean wrongXRunning = !XLauncher.getInstance().isCorrectXServerRunning(sdkTarget);
+			
+			if (wrongOneRunning
+					|| !MaemoScriptLauncher.getInstance().isMaemoStarted(sdkTarget) 
+					|| wrongXRunning) {
 				final boolean[] doLaunch = { false };
+				final String message = 
+					wrongOneRunning ? 
+						"The Maemo Application Framework is running for a different target.\n\nThis may or may not be valid for the new application.\n\nSwitch to the new target (" + sdkTarget.getName() + ")?"
+						: "The Maemo Application Framework does not seem to be running.\n\nLaunch it now?";
 				Display.getDefault().syncExec(new Runnable() {
 
 					public void run() {
-						doLaunch[0] = MessageDialog.openQuestion(shell, "Launch Maemo?",
-							"The Maemo Application Framework does not seem to be running.\n\nLaunch it now?");
+						doLaunch[0] = MessageDialog.openQuestion(shell, "Launch Maemo AF?",
+								message);
 					}
 					
 				});
 				if (doLaunch[0]) {
+					if (wrongOneRunning) {
+						Job stopJob = MaemoScriptLauncher.getInstance().createStopMaemoJob(wrongTarget);
+						stopJob.schedule();
+						try {
+							stopJob.join();
+						} catch (InterruptedException e) {
+						}
+					}
+					
 					Job job = MaemoScriptLauncher.getInstance().createStartMaemoJob(sdkTarget);
 					job.schedule();
 					

Modified: branches/work_Fabricio/org.maemo.esbox.scratchbox.core/src/org/maemo/esbox/internal/api/scratchbox/core/execEnv/X11ExecutionEnvironmentHandler.java
===================================================================
--- branches/work_Fabricio/org.maemo.esbox.scratchbox.core/src/org/maemo/esbox/internal/api/scratchbox/core/execEnv/X11ExecutionEnvironmentHandler.java	2009-08-03 13:58:28 UTC (rev 1919)
+++ branches/work_Fabricio/org.maemo.esbox.scratchbox.core/src/org/maemo/esbox/internal/api/scratchbox/core/execEnv/X11ExecutionEnvironmentHandler.java	2009-08-03 14:16:46 UTC (rev 1920)
@@ -18,6 +18,7 @@
 import org.eclipse.jface.dialogs.MessageDialog;
 import org.eclipse.swt.widgets.Shell;
 import org.maemo.esbox.internal.api.maemosdk.core.tools.MaemoScriptLauncher;
+import org.maemo.esbox.internal.api.maemosdk.core.tools.XLauncher;
 import org.maemo.esbox.internal.scratchbox.core.Activator;
 import org.maemo.mica.common.core.JobUtils;
 import org.maemo.mica.common.core.MicaException;
@@ -44,13 +45,19 @@
 		}
 
 		boolean serverRunning;
-		serverRunning = MaemoScriptLauncher.getInstance().isXServerStarted(sdkTarget);
+		try {
+			serverRunning = XLauncher.getInstance().isCorrectXServerRunning(sdkTarget);
+		} catch (MicaException e) {
+			Activator.getErrorLogger().logAndShowError(
+					"Cannot validate the X server connection", e);
+			return;
+		}
 		
 		if (!serverRunning) {
 
 			if (MessageDialog
 					.openQuestion(shell, "Launch X Server?",
-							"The X server is not running.  Would you like to launch it now?")) {
+							"The X server is not running or is running with different parameters.\n\nWould you like to launch it now?")) {
 				Job job = MaemoScriptLauncher.getInstance().createStartXJob(sdkTarget);
 				job.schedule();
 				JobUtils.waitForJob(job, monitor, "Waiting for startup...");

Modified: branches/work_Fabricio/org.maemo.esbox.scratchbox.core/src/org/maemo/esbox/internal/api/scratchbox/core/sdk/AbstractScratchboxSDK.java
===================================================================
--- branches/work_Fabricio/org.maemo.esbox.scratchbox.core/src/org/maemo/esbox/internal/api/scratchbox/core/sdk/AbstractScratchboxSDK.java	2009-08-03 13:58:28 UTC (rev 1919)
+++ branches/work_Fabricio/org.maemo.esbox.scratchbox.core/src/org/maemo/esbox/internal/api/scratchbox/core/sdk/AbstractScratchboxSDK.java	2009-08-03 14:16:46 UTC (rev 1920)
@@ -15,7 +15,6 @@
 import org.maemo.esbox.internal.api.scratchbox.core.commands.SDKCommandAbstractor;
 import org.maemo.esbox.internal.api.scratchbox.core.commands.sbrsh.*;
 import org.maemo.esbox.scratchbox.core.sdk.IScratchboxSDK;
-import org.maemo.esbox.scratchbox.core.sdk.IScratchboxSDKTarget;
 import org.maemo.mica.common.core.MicaException;
 import org.maemo.mica.common.core.env.IEnvironmentModifierBlock;
 import org.maemo.mica.common.core.filesystem.IFileSystemAccess;
@@ -151,17 +150,6 @@
 	 * (non-Javadoc)
 	 * 
 	 * @see
-	 * org.maemo.esbox.scratchbox.core.sdk.IScratchboxSDK#getCurrentSDKTarget()
-	 */
-	public IScratchboxSDKTarget getCurrentSDKTarget() throws MicaException {
-		String targetName = getCurrentTarget();
-		return (IScratchboxSDKTarget) this.findSDKTarget(targetName);
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see
 	 * org.maemo.esbox.scratchbox.core.sdk.IScratchboxSDK#configureSbrsh(java.
 	 * lang.String, java.lang.String, java.lang.String)
 	 */

Modified: branches/work_Fabricio/org.maemo.esbox.scratchbox.core/src/org/maemo/esbox/scratchbox/core/sdk/IScratchboxSDK.java
===================================================================
--- branches/work_Fabricio/org.maemo.esbox.scratchbox.core/src/org/maemo/esbox/scratchbox/core/sdk/IScratchboxSDK.java	2009-08-03 13:58:28 UTC (rev 1919)
+++ branches/work_Fabricio/org.maemo.esbox.scratchbox.core/src/org/maemo/esbox/scratchbox/core/sdk/IScratchboxSDK.java	2009-08-03 14:16:46 UTC (rev 1920)
@@ -61,25 +61,6 @@
 	public List<String> getTargets() throws MicaException;
 
 	/**
-	 * Return the current target name of the Scratchbox.
-	 * 
-	 * 
-	 * @return the current target of the Scratchbox.
-	 * @throws MicaException
-	 *             if some problem related to Scratchbox communication occurs.
-	 */
-	public String getCurrentTarget() throws MicaException;
-
-	/**
-	 * Return the current target of the Scratchbox.
-	 * 
-	 * @return the current target of Scratchbox.
-	 * @throws MicaException
-	 *             if some problem related to Scratchbox communication occurs.
-	 */
-	public IScratchboxSDKTarget getCurrentSDKTarget() throws MicaException;
-
-	/**
 	 * Create a new target for Scratchbox. An target must have a name, and the
 	 * compiler, devkits and cputransp must be available in Scratchbox.
 	 * 

Modified: branches/work_Fabricio/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/core/Scratchbox1SDK.java
===================================================================
--- branches/work_Fabricio/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/core/Scratchbox1SDK.java	2009-08-03 13:58:28 UTC (rev 1919)
+++ branches/work_Fabricio/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/core/Scratchbox1SDK.java	2009-08-03 14:16:46 UTC (rev 1920)
@@ -443,8 +443,11 @@
 		IScratchboxSDKTarget currentTarget = null;
 		
 		try {
-			currentTarget = getCurrentSDKTarget();
-		} catch (ScratchboxException e) {
+			String currentTargetName = getCurrentTarget();
+			if (currentTargetName != null) {
+				currentTarget = (IScratchboxSDKTarget) findSDKTarget(currentTargetName);
+			}
+		} catch (MicaException e) {
 			// there may be no target, which is fine
 		}
 		
@@ -457,18 +460,10 @@
 				// a target selection may succeed even if X and maemo are
 				// running... kill them first.
 				try {
-					launcher.killMaemo();
+					launcher.stopMaemo(new NullProgressMonitor());
 				} catch (MicaException e2) {
 					// ignore
 				}
-				
-				// We kill X too because some processes won't be killed by
-				// maemo-launcher.
-				try {
-					MaemoScriptLauncher.getInstance().stopX(currentTarget, new NullProgressMonitor());
-				} catch (MicaException e) {
-					// ignore
-				}
 			}
 		}
 		

Modified: branches/work_Fabricio/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/launcher/Scratchbox1PrepareTargetProcessLaunchAdapter.java
===================================================================
--- branches/work_Fabricio/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/launcher/Scratchbox1PrepareTargetProcessLaunchAdapter.java	2009-08-03 13:58:28 UTC (rev 1919)
+++ branches/work_Fabricio/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/launcher/Scratchbox1PrepareTargetProcessLaunchAdapter.java	2009-08-03 14:16:46 UTC (rev 1920)
@@ -15,7 +15,6 @@
 
 import org.eclipse.jface.dialogs.MessageDialog;
 import org.eclipse.swt.widgets.Display;
-import org.maemo.esbox.scratchbox.core.scratchbox.ScratchboxException;
 import org.maemo.esbox.scratchbox.sb1.sdk.IScratchbox1SDK;
 import org.maemo.mica.common.core.MicaException;
 import org.maemo.mica.common.core.WorkspaceUtils;
@@ -40,7 +39,7 @@
 		IScratchbox1SDK sdk = ((IScratchbox1SDK) sdkTarget.getSDK());
 		final String currentTarget = sdk.getCurrentTarget();
 		final String targetName = sdkTarget.getName();
-		if (currentTarget.equals(targetName)) {
+		if (targetName.equals(currentTarget)) {
 			return;
 		}
 
@@ -48,7 +47,7 @@
 		boolean failedToSwitch = false;
 		try {
 			sdk.selectTarget(targetName);
-		} catch (final ScratchboxException e) {
+		} catch (final MicaException e) {
 			// sb-conf: You must close your other Scratchbox sessions first
 			// or
 			// Note: Couldn't reselect the target. There are other Scratchbox
@@ -60,7 +59,7 @@
 			}
 		}
 
-		if (failedToSwitch || !sdk.getCurrentTarget().equals(targetName)) {
+		if (failedToSwitch || !targetName.equals(sdk.getCurrentTarget())) {
 			final boolean[] ret = { false };
 
 			if (!WorkspaceUtils.isJUnitRunning()) {

Modified: branches/work_Fabricio/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/launcher/Scratchbox1ProcessLauncher.java
===================================================================
--- branches/work_Fabricio/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/launcher/Scratchbox1ProcessLauncher.java	2009-08-03 13:58:28 UTC (rev 1919)
+++ branches/work_Fabricio/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/launcher/Scratchbox1ProcessLauncher.java	2009-08-03 14:16:46 UTC (rev 1920)
@@ -13,6 +13,7 @@
 import org.eclipse.core.filesystem.EFS;
 import org.eclipse.core.filesystem.IFileStore;
 import org.eclipse.core.runtime.*;
+import org.maemo.esbox.internal.scratchbox.sb1.Activator;
 import org.maemo.esbox.internal.scratchbox.sb1.core.SB1PreferenceConstants;
 import org.maemo.esbox.internal.scratchbox.sb1.core.Scratchbox1SDK;
 import org.maemo.esbox.internal.scratchbox.sb1.core.Scratchbox1SDKTarget;
@@ -39,15 +40,19 @@
 public class Scratchbox1ProcessLauncher extends AbstractSDKTargetProcessLauncher implements
 		IProcessLauncher {
 
+	private static int gRunScriptCounter;
+	
 	/**
 	 * The name of a file copied from the plugin to the sb environment
 	 * which we generate to wrap the program. 
 	 */
-	private static final String RUN_SCRIPT_NAME = "run.sh";
+	private static final String RUN_SCRIPT_NAME = "run";
 
 	private Scratchbox1SDKTarget sdkTarget;
 
 	private String runScriptContents;
+
+	private String runScriptName;
 	public Scratchbox1ProcessLauncher(Scratchbox1SDKTarget sdkTarget,
 			ProcessLauncherParameters params) {
 		super(params, sdkTarget);
@@ -73,7 +78,12 @@
 		
 		// it better not be null
 		substitutor.define("RUN_SCRIPT_DIRECTORY", targetRunScriptPath.toPortableString());
-		substitutor.define("RUN_SCRIPT", RUN_SCRIPT_NAME);
+		
+		// hack: for unit tests: we won't run #setupForLaunch() first
+		if (runScriptName == null) 
+			runScriptName = "run.sh";
+		
+		substitutor.define("RUN_SCRIPT", runScriptName);
 
 		// get the Scratchbox invocation pattern
 		String commandPattern = sdkTarget
@@ -122,8 +132,24 @@
 		
 		IPath runScriptLocation = getRunScriptLocation(sdkTarget);
 		
-		IFileStore store = sdkTarget.getMachine().getFileSystemAccess().getFileStore(
-				runScriptLocation.append(RUN_SCRIPT_NAME));
+		// make a unique run.sh script name, so we can run multiple programs simultaneously
+		runScriptName = RUN_SCRIPT_NAME + (gRunScriptCounter++) + ".sh";
+		
+		final IFileStore store = sdkTarget.getMachine().getFileSystemAccess().getFileStore(
+				runScriptLocation.append(runScriptName));
+
+		// remove the script when we're done
+		queueStreamMonitor(new StreamMonitorAdapter() {
+			@Override
+			public void processExited(int exitCode) {
+				try {
+					store.delete(0, null);
+				} catch (CoreException e) {
+					Activator.getErrorLogger().logError("Error removing  " + runScriptName, e);
+				}
+			}
+		});
+		
 		try {
 			store.getParent().mkdir(0, null);
 			

Modified: branches/work_Fabricio/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/scratchbox/sb1/sdk/IScratchbox1SDK.java
===================================================================
--- branches/work_Fabricio/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/scratchbox/sb1/sdk/IScratchbox1SDK.java	2009-08-03 13:58:28 UTC (rev 1919)
+++ branches/work_Fabricio/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/scratchbox/sb1/sdk/IScratchbox1SDK.java	2009-08-03 14:16:46 UTC (rev 1920)
@@ -14,12 +14,13 @@
 
 import org.maemo.esbox.scratchbox.core.sdk.IScratchboxSDK;
 import org.maemo.mica.common.core.MicaException;
+import org.maemo.mica.internal.api.common.core.sdk.ISingleCurrentTargetOnlySDK;
 
 /**
  * @author baranov
  * 
  */
-public interface IScratchbox1SDK extends IScratchboxSDK {
+public interface IScratchbox1SDK extends IScratchboxSDK, ISingleCurrentTargetOnlySDK {
 	public static final String NAME = "Scratchbox 1";
 
 	/**
@@ -41,17 +42,6 @@
 	public List<String> getSessions() throws MicaException;
 
 	/**
-	 * Select another available target as current Scratchbox target.
-	 * 
-	 * @param targetName
-	 *            the name of the new target.
-	 * @throws MicaException
-	 *             if the target to be selected does not exists or if some
-	 *             problem related to Scratchbox communication occurs.
-	 */
-	public void selectTarget(String targetName) throws MicaException;
-
-	/**
 	 * Kill an Scratchbox process.
 	 * 
 	 * @return true, if the is performed successfully.

Modified: branches/work_Fabricio/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/core/Scratchbox2SDK.java
===================================================================
--- branches/work_Fabricio/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/core/Scratchbox2SDK.java	2009-08-03 13:58:28 UTC (rev 1919)
+++ branches/work_Fabricio/org.maemo.esbox.scratchbox.sb2/src/org/maemo/esbox/internal/scratchbox/sb2/core/Scratchbox2SDK.java	2009-08-03 14:16:46 UTC (rev 1920)
@@ -201,15 +201,6 @@
 	/*
 	 * (non-Javadoc)
 	 * 
-	 * @see org.maemo.mica.maemosdk.core.sdk.IScratchboxSDK#getCurrentTarget()
-	 */
-	public String getCurrentTarget() throws MicaException {
-		return getMaemoSdkCommand().getDefaultRootstrap();
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
 	 * @see
 	 * org.maemo.mica.maemosdk.core.sdk.IScratchboxSDK#removeTarget(java.lang
 	 * .String)

Modified: branches/work_Fabricio/org.maemo.esbox.scratchbox.tests/src/org/maemo/esbox/scratchbox/tests/TestSB1ProcessLauncher.java
===================================================================
--- branches/work_Fabricio/org.maemo.esbox.scratchbox.tests/src/org/maemo/esbox/scratchbox/tests/TestSB1ProcessLauncher.java	2009-08-03 13:58:28 UTC (rev 1919)
+++ branches/work_Fabricio/org.maemo.esbox.scratchbox.tests/src/org/maemo/esbox/scratchbox/tests/TestSB1ProcessLauncher.java	2009-08-03 14:16:46 UTC (rev 1920)
@@ -26,7 +26,9 @@
 import org.maemo.mica.common.core.process.CommandLineArguments;
 import org.maemo.mica.common.core.process.IProcessLauncher;
 import org.maemo.mica.common.core.process.IProcessLauncherFactory;
+import org.maemo.mica.common.core.process.IProcessMonitor;
 import org.maemo.mica.common.core.process.ProcessLauncherParameters;
+import org.maemo.mica.common.core.process.StreamLineMonitorAdapter;
 import org.maemo.mica.common.core.process.ProcessLauncherUtils.LaunchResults;
 import org.maemo.mica.common.core.sdk.ISDK;
 import org.maemo.mica.common.core.sdk.ISDKProvider;
@@ -198,5 +200,46 @@
 			}
 		});
 	}
+	
+	@Test
+	public void testSimultaneousProcesses() throws Exception {
+		runOverTargets(new IRunner() {
+			
+			public void run(ISDKTarget target) throws Exception {
+				IProcessLauncher launcher = target.getProcessLauncherFactory().createProcessLauncher(
+						ProcessLauncherParameters.create("sh", "-c", "sleep 10; echo a b c d e f g h i j k l m n o p q r s t u v w x y z"));
+				
+				final String[] gotLine = { null };
+				StreamLineMonitorAdapter echoChecker = new StreamLineMonitorAdapter() {
+					public void handleLine(String line, boolean errorStream) throws InterruptedException {
+						gotLine[0] = line;
+					}
+				};
+				
+				// launch in background
+				launcher.queueStreamMonitor(echoChecker);
+				launcher.createProcess(null);
+				IProcessMonitor monitor = launcher.createProcessMonitor();
+				monitor.runNonBlocking();
+				
+				// now, launch something else
+				LaunchResults results = createAndLaunchStockProcessForScript(
+						target, null, "ls", null);
 
+				assertEquals(0, results.exitCode);
+				assertEquals("", results.stderr.toString());
+				assertTrue(results.toString().length() > 0);
+				
+				// now, wait for the other one to finish
+
+				monitor.waitForCompletion(null);
+				assertEquals(0, monitor.getExitValue());
+				
+				// if this doesn't match, it should be some random garbage
+				// from another process or a bash shell error
+				assertEquals("a b c d e f g h i j k l m n o p q r s t u v w x y z", gotLine[0]);
+			}
+		});
+	}
+
 }

Modified: branches/work_Fabricio/org.maemo.esbox.scratchbox.tests/src/org/maemo/esbox/scratchbox/tests/commands/TestListCommands.java
===================================================================
--- branches/work_Fabricio/org.maemo.esbox.scratchbox.tests/src/org/maemo/esbox/scratchbox/tests/commands/TestListCommands.java	2009-08-03 13:58:28 UTC (rev 1919)
+++ branches/work_Fabricio/org.maemo.esbox.scratchbox.tests/src/org/maemo/esbox/scratchbox/tests/commands/TestListCommands.java	2009-08-03 14:16:46 UTC (rev 1920)
@@ -17,14 +17,8 @@
 import org.maemo.esbox.internal.scratchbox.sb1.command.ListCompilersCommand;
 import org.maemo.esbox.internal.scratchbox.sb1.command.ListCputranspCommand;
 import org.maemo.esbox.internal.scratchbox.sb1.command.ListDevkitsCommand;
-import org.maemo.esbox.internal.scratchbox.sb1.command.ListSessionsCommand;
 import org.maemo.esbox.internal.scratchbox.sb1.command.ListTargetsCommand;
-import org.maemo.esbox.internal.scratchbox.sb1.core.Scratchbox1SDK;
-import org.maemo.esbox.scratchbox.core.sdk.ScratchboxSDKFacade;
 import org.maemo.mica.common.core.MicaException;
-import org.maemo.mica.common.core.process.IProcessLauncher;
-import org.maemo.mica.common.core.process.ProcessLauncherParameters;
-import org.maemo.mica.common.core.sdk.ISDKTarget;
 
 /**
  * Please, read file TESTS.txt for more instructions about test.
@@ -226,62 +220,6 @@
 	}
 
 	/**
-	 * This is a broken test because we do not run with PTYs, ever, so no interactive programs
-	 * (or sessions) will launch under scratchbox and stay alive long enough to detect.
-	 * @throws Exception
-	 */
-	public void __dont_testListSessionsCommand() throws Exception {
-		List<String> fakeParam = new ArrayList<String>();
-		fakeParam.add("param");
-
-		int numberOfSessions = 0;
-
-		ListSessionsCommand listSessionsCommand = new ListSessionsCommand(sb1Command);
-		List<String> sessions = null;
-
-		try {
-			listSessionsCommand.performCommand(fakeParam);
-			fail("Invalid number of param");
-		} catch (MicaException e) {
-			// expected
-		}
-
-		sessions = listSessionsCommand.performCommand(new ArrayList<String>());
-
-		// make sure anything here is a pid
-		for (String pid : sessions) {
-			Integer.parseInt(pid);
-		}
-
-		numberOfSessions = sessions.size();
-		
-		// launch a new session (without switching targets!)
-		ISDKTarget target = ScratchboxSDKFacade.getInstance().getScratchboxSDK(Scratchbox1SDK.class).get(0).getCurrentSDKTarget();
-		
-		Process process = null;
-		try {
-			IProcessLauncher launcher = target.getProcessLauncherFactory().createProcessLauncher(
-					ProcessLauncherParameters.create("/usr/bin/yes"));
-			process = launcher.createProcess(null);
-			
-			sessions = listSessionsCommand.performCommand(new ArrayList<String>());
-			
-			// this either launches 1 or 2 processes
-			assertTrue(numberOfSessions < sessions.size());
-	
-			// make sure anything here is a pid
-			for (String pid : sessions) {
-				Integer.parseInt(pid);
-			}
-		} finally {		
-			// kill the shell (exit, then send ctrl-d)
-			process.getOutputStream().write("exit\n004\004\004\004\004\004\004\004\004".getBytes());
-			process.destroy();
-		}
-		
-	}
-
-	/**
 	 * Test method for
 	 * {@link embedded.core.scratchbox.command.ListTargetsCommand#performCommand(java.util.List)}.
 	 */

Modified: branches/work_Fabricio/org.maemo.esbox.scratchbox.tests/src/org/maemo/esbox/scratchbox/tests/commands/TestRemoveSb2Command.java
===================================================================
--- branches/work_Fabricio/org.maemo.esbox.scratchbox.tests/src/org/maemo/esbox/scratchbox/tests/commands/TestRemoveSb2Command.java	2009-08-03 13:58:28 UTC (rev 1919)
+++ branches/work_Fabricio/org.maemo.esbox.scratchbox.tests/src/org/maemo/esbox/scratchbox/tests/commands/TestRemoveSb2Command.java	2009-08-03 14:16:46 UTC (rev 1920)
@@ -11,7 +11,9 @@
 package org.maemo.esbox.scratchbox.tests.commands;
 
 import org.eclipse.core.runtime.NullProgressMonitor;
+import org.maemo.esbox.internal.scratchbox.sb2.command.MaemoRootstrapCommand;
 import org.maemo.mica.common.core.MicaException;
+import org.maemo.mica.internal.api.common.core.sdk.BaseSDK;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -63,7 +65,8 @@
 		if (targets.contains(TARGET)) {
 			try {
 				maemoRootstrapCommand.remove(TARGET, new NullProgressMonitor());
-				
+				// the command does not communicate with the SDK so explicitly flush the cache
+				((BaseSDK) sb2Sdk).getCache().clear();
 				targets = sb2Sdk.getTargets();
 				assertFalse(targets.contains(TARGET));
 			} catch (MicaException e) {

Modified: branches/work_Fabricio/org.maemo.esbox.scratchbox.tests/src/org/maemo/esbox/scratchbox/tests/commands/TestScratchboxFacade.java
===================================================================
--- branches/work_Fabricio/org.maemo.esbox.scratchbox.tests/src/org/maemo/esbox/scratchbox/tests/commands/TestScratchboxFacade.java	2009-08-03 13:58:28 UTC (rev 1919)
+++ branches/work_Fabricio/org.maemo.esbox.scratchbox.tests/src/org/maemo/esbox/scratchbox/tests/commands/TestScratchboxFacade.java	2009-08-03 14:16:46 UTC (rev 1920)
@@ -24,9 +24,6 @@
 import org.maemo.esbox.scratchbox.core.sdk.ScratchboxSDKFacade;
 import org.maemo.esbox.scratchbox.sb1.sdk.IScratchbox1SDK;
 import org.maemo.mica.common.core.MicaException;
-import org.maemo.mica.common.core.process.IProcessLauncher;
-import org.maemo.mica.common.core.process.ProcessLauncherParameters;
-import org.maemo.mica.common.core.sdk.ISDKTarget;
 
 /**
  * Please, read file TESTS.txt for more instructions about test.
@@ -253,62 +250,11 @@
 
 	/**
 	 * Test method for
-	 * {@link org.maemo.esbox.common.core.scratchbox.ScratchboxFacade#getSessions()}.
+	 * {@link org.maemo.esbox.common.core.scratchbox.ScratchboxFacade#getDefaultTarget()}.
 	 * 
-	 * This is broken because PTY support is no longer wired up.  Thus, none of the
-	 * simple programs we launch via tests will run for long enough to be detected as a session.
 	 * @throws MicaException
 	 */
 	@Test
-	public void __dont__testGetSessions() throws Exception {
-		if (sdk == null) return;
-		int numberOfSessions = 0;
-
-		List<String> sessions = sdk.getSessions();
-
-		// make sure anything here is a pid
-		for (String pid : sessions) {
-			Integer.parseInt(pid);
-		}
-
-		numberOfSessions = sessions.size();
-		
-		// launch a new session (without switching targets!)
-		ISDKTarget target = ScratchboxSDKFacade.getInstance().getScratchboxSDK(Scratchbox1SDK.class).get(0).getCurrentSDKTarget();
-		Process process = null;
-		try {
-			IProcessLauncher launcher = target.getProcessLauncherFactory().createProcessLauncher(
-					ProcessLauncherParameters.create("bin/sh"));
-			process = launcher.createProcess(null);
-			
-			// wait for it to really start
-			Thread.sleep(5000);
-		
-			sessions = sdk.getSessions();// ScratchboxFacade.getInstance().getSessions(sdk);
-			
-			// this either launches 1 or 2 processes
-			assertTrue(numberOfSessions < sessions.size());
-	
-			// make sure anything here is a pid
-			for (String pid : sessions) {
-				Integer.parseInt(pid);
-			}
-		} catch (Exception e) {
-			fail("Exception: "+e.getMessage());
-		}finally {		
-			// kill the shell (exit, then send ctrl-d)
-			process.getOutputStream().write("exit\n004\004\004\004\004\004\004\004\004".getBytes());
-			process.destroy();
-		}
-	}
-
-	/**
-	 * Test method for
-	 * {@link org.maemo.esbox.common.core.scratchbox.ScratchboxFacade#getCurrentTarget()}.
-	 * 
-	 * @throws MicaException
-	 */
-	@Test
 	public void testGetCurrentTarget() throws MicaException {
 		if (sdk == null) return;
 		String currentTarget = sdk.getCurrentTarget();//ScratchboxFacade.getInstance().getCurrentTarget(sdk);



More information about the Esbox-commits mailing list