Index: trunk/org.modelica.mdt.debug.core/src/org/modelica/mdt/debug/core/breakpoints/MDTLineBreakpoint.java
===================================================================
--- trunk/org.modelica.mdt.debug.core/src/org/modelica/mdt/debug/core/breakpoints/MDTLineBreakpoint.java	(revision 1883)
+++ trunk/org.modelica.mdt.debug.core/src/org/modelica/mdt/debug/core/breakpoints/MDTLineBreakpoint.java	(revision 1884)
@@ -210,5 +210,5 @@
 		CommandFactory factory = miSession.getCommandFactory();
 		MIBreakDelete breakDeleteCmd = factory.createMIBreakDelete(new int[]{getBreakPointNumber()});
-		miSession.postCommand(breakDeleteCmd, -1, null);
+		miSession.postCommand(breakDeleteCmd, null);
 		/*
 		 * Adeel 2011-09-16 20:58
@@ -238,5 +238,5 @@
 		CommandFactory factory = miSession.getCommandFactory();
 		MIBreakEnable breakEnableCmd = factory.createMIBreakEnable(new int[]{getBreakPointNumber()});
-		miSession.postCommand(breakEnableCmd, -1, null);
+		miSession.postCommand(breakEnableCmd, null);
 	}
 	
@@ -255,5 +255,5 @@
 		CommandFactory factory = miSession.getCommandFactory();
 		MIBreakAfter breakAfterCmd = factory.createMIBreakAfter(getBreakPointNumber(), getHitCount());
-		miSession.postCommand(breakAfterCmd, -1, null);
+		miSession.postCommand(breakAfterCmd, null);
 	}
 	
@@ -276,5 +276,5 @@
 		CommandFactory factory = miSession.getCommandFactory();
 		MIBreakCondition breakConditionCmd = factory.createMIBreakCondition(getBreakPointNumber(), timeCondition);
-		miSession.postCommand(breakConditionCmd, -1, null);
+		miSession.postCommand(breakConditionCmd, null);
 	}
 	
@@ -325,5 +325,5 @@
 		CommandFactory factory = miSession.getCommandFactory();
 		MIBreakDisable breakDisableCmd = factory.createMIBreakDisable(new int[]{getBreakPointNumber()});
-		miSession.postCommand(breakDisableCmd, -1, null);
+		miSession.postCommand(breakDisableCmd, null);
 	}
     
Index: trunk/org.modelica.mdt.debug.core/src/org/modelica/mdt/debug/gdb/core/mi/GDBInferior.java
===================================================================
--- trunk/org.modelica.mdt.debug.core/src/org/modelica/mdt/debug/gdb/core/mi/GDBInferior.java	(revision 1883)
+++ trunk/org.modelica.mdt.debug.core/src/org/modelica/mdt/debug/gdb/core/mi/GDBInferior.java	(revision 1884)
@@ -199,5 +199,5 @@
 					CommandFactory factory = session.getCommandFactory();
 					CLIExecAbort execAbortCmd = factory.createCLIExecAbort();
-					session.postCommand(execAbortCmd, -1, null);
+					session.postCommand(execAbortCmd, null);
 					// do not wait for the answer.
 					//abort.getMIInfo();
Index: trunk/org.modelica.mdt.debug.core/src/org/modelica/mdt/debug/gdb/core/mi/MISession.java
===================================================================
--- trunk/org.modelica.mdt.debug.core/src/org/modelica/mdt/debug/gdb/core/mi/MISession.java	(revision 1883)
+++ trunk/org.modelica.mdt.debug.core/src/org/modelica/mdt/debug/gdb/core/mi/MISession.java	(revision 1884)
@@ -418,13 +418,4 @@
 	 */
 	public void postCommand(Command cmd, GDBStackFrame gdbStackFrame) throws MIException {
-		postCommand(cmd, fCommandTimeout, gdbStackFrame);
-	}
-
-	/**
-	 * Sends a command to gdb, and wait(timeout) for a response.
-	 * if timeout < 0 the wait will be skipped.
-	 * 
-	 */
-	public void postCommand(Command cmd, long timeout, GDBStackFrame gdbStackFrame) throws MIException {
 		synchronized (fLock) {
 			// Test if we are in a sane state.
@@ -464,8 +455,4 @@
 			fTxQueue.addCommand(cmd);
 
-			// do not wait around the answer.
-//			if (timeout < 0) {
-//				return;
-//			}
 			// Wait for the response or timeout
 			synchronized (cmd) {
@@ -474,5 +461,5 @@
 				while (cmd.getMIOutput() == null) {
 					try {
-						cmd.wait(timeout);
+						cmd.wait(fCommandTimeout);
 						if (cmd.getMIOutput() == null) {
 							throw new MIException(MDTDebugCorePlugin.getResourceString("MISession.postCommand.Target_not_responding"));
@@ -509,5 +496,5 @@
 		MIGDBExit gdbExitCmd = fMICommandFactory.createMIGDBExit();
 		try {
-			postCommand(gdbExitCmd, 2000, null);
+			postCommand(gdbExitCmd, null);
 		} catch (MIException e) {
 			//ignore any exception at this point.
Index: trunk/org.modelica.mdt.debug.core/src/org/modelica/mdt/debug/gdb/core/mi/SessionProcess.java
===================================================================
--- trunk/org.modelica.mdt.debug.core/src/org/modelica/mdt/debug/gdb/core/mi/SessionProcess.java	(revision 1883)
+++ trunk/org.modelica.mdt.debug.core/src/org/modelica/mdt/debug/gdb/core/mi/SessionProcess.java	(revision 1884)
@@ -123,5 +123,5 @@
 					try {
 						// Do not wait around for the answer.
-						session.postCommand(cmd, -1, null);
+						session.postCommand(cmd, null);
 					} catch (MIException e) {
 						throw new IOException(e.getMessage());
Index: trunk/org.modelica.mdt.debug.core/src/org/modelica/mdt/debug/gdb/core/mi/command/CommandFactory.java
===================================================================
--- trunk/org.modelica.mdt.debug.core/src/org/modelica/mdt/debug/gdb/core/mi/command/CommandFactory.java	(revision 1883)
+++ trunk/org.modelica.mdt.debug.core/src/org/modelica/mdt/debug/gdb/core/mi/command/CommandFactory.java	(revision 1884)
@@ -312,6 +312,11 @@
 	 * @return MIDataEvaluateExpression
 	 */
-	public MIDataEvaluateExpression createMIGetTypeOfAny(String expression) {
-		return new MIDataEvaluateExpression("(char*)getTypeOfAny(" + expression + ")");
+	public MIDataEvaluateExpression createMIGetTypeOfAny(String expression, boolean inRecord) {
+		if (inRecord) {
+			return new MIDataEvaluateExpression("(char*)getTypeOfAny(" + expression + ", 1)");
+		} else {
+			return new MIDataEvaluateExpression("(char*)getTypeOfAny(" + expression + ", 0)");
+		}
+		
 	}
 	
Index: trunk/org.modelica.mdt.debug.core/src/org/modelica/mdt/debug/gdb/core/model/GDBDebugTarget.java
===================================================================
--- trunk/org.modelica.mdt.debug.core/src/org/modelica/mdt/debug/gdb/core/model/GDBDebugTarget.java	(revision 1883)
+++ trunk/org.modelica.mdt.debug.core/src/org/modelica/mdt/debug/gdb/core/model/GDBDebugTarget.java	(revision 1884)
@@ -61,4 +61,5 @@
 import org.modelica.mdt.debug.gdb.core.mi.command.CommandFactory;
 import org.modelica.mdt.debug.gdb.core.mi.command.MICommand;
+import org.modelica.mdt.debug.gdb.core.mi.command.MIDataEvaluateExpression;
 import org.modelica.mdt.debug.gdb.core.mi.command.MIExecFinish;
 import org.modelica.mdt.debug.gdb.core.mi.event.MIBreakpointHitEvent;
@@ -546,4 +547,7 @@
 		MIEvent miEvent = (MIEvent)event;
 		try {
+			if (miEvent instanceof MIStoppedEvent) {
+				changeStdStreamBuffer(miEvent);
+			}
 			if (miEvent instanceof MIInferiorExitEvent || miEvent instanceof MIGDBExitEvent) {
 				handleExitEvent(miEvent);
@@ -575,4 +579,15 @@
 			// TODO Auto-generated catch block
 			MDTDebugCorePlugin.log(null, e);
+		}
+	}
+	
+	private void changeStdStreamBuffer(MIEvent miEvent) throws MIException, CoreException {
+		// TODO Auto-generated method stub
+		if (((GDBThread)getThread()).isStdStreamBuffer()) {
+			CommandFactory factory = fMISession.getCommandFactory();
+			MIDataEvaluateExpression changeStdStreamBufferCmd = factory.createMIChangeStdStreamBuffer();
+			fMISession.postCommand(changeStdStreamBufferCmd, null);
+			((GDBThread)getThread()).setStdStreamBuffer(true);
+			// we don't care about the result of this command.
 		}
 	}
Index: trunk/org.modelica.mdt.debug.core/src/org/modelica/mdt/debug/gdb/core/model/thread/GDBThread.java
===================================================================
--- trunk/org.modelica.mdt.debug.core/src/org/modelica/mdt/debug/gdb/core/model/thread/GDBThread.java	(revision 1883)
+++ trunk/org.modelica.mdt.debug.core/src/org/modelica/mdt/debug/gdb/core/model/thread/GDBThread.java	(revision 1884)
@@ -55,5 +55,4 @@
 import org.modelica.mdt.debug.gdb.core.mi.command.MIBreakEnable;
 import org.modelica.mdt.debug.gdb.core.mi.command.MIBreakInsert;
-import org.modelica.mdt.debug.gdb.core.mi.command.MIDataEvaluateExpression;
 import org.modelica.mdt.debug.gdb.core.mi.command.MIExecContinue;
 import org.modelica.mdt.debug.gdb.core.mi.command.MIExecFinish;
@@ -121,4 +120,5 @@
 	 */
 	private int fCatchOMCBreakpoint = 0;
+	private boolean fStdStreamBuffer = false;
 	/**
 	 * Constructs a new thread for the given target
@@ -542,8 +542,5 @@
 							MDTDebugCorePlugin.getResourceString("GDBThread.start.ExecRun.NoAnswer"), null));
 				}
-				// if run is ok then change the stdout buffer policy
-				MIDataEvaluateExpression changeStdStreamBufferCmd = factory.createMIChangeStdStreamBuffer();
-				// we don't care about the time and output of this command
-				miSession.postCommand(changeStdStreamBufferCmd, -1, null);
+				setStdStreamBuffer(false);
 				// Insert a breakpoint to catch longjmp/MMC_THROW
 				insertCatchOMCBreakpoint();
@@ -999,3 +996,11 @@
 		miSession.postCommand(breakDeleteCmd, null);
 	}
+
+	public boolean isStdStreamBuffer() {
+		return fStdStreamBuffer;
+	}
+
+	public void setStdStreamBuffer(boolean stdStreamBuffer) {
+		this.fStdStreamBuffer = stdStreamBuffer;
+	}
 }
Index: trunk/org.modelica.mdt.debug.core/src/org/modelica/mdt/debug/gdb/core/model/value/GDBOptionValue.java
===================================================================
--- trunk/org.modelica.mdt.debug.core/src/org/modelica/mdt/debug/gdb/core/model/value/GDBOptionValue.java	(revision 1883)
+++ trunk/org.modelica.mdt.debug.core/src/org/modelica/mdt/debug/gdb/core/model/value/GDBOptionValue.java	(revision 1884)
@@ -142,5 +142,5 @@
 		// TODO Auto-generated method stub
 		// get the record element type
-		String referenceType = TypeHelper.getModelicaMetaType(variable.getVoidPointer(), getGDBVariable().getGDBStackFrame());
+		String referenceType = TypeHelper.getModelicaMetaType(variable.getVoidPointer(), getGDBVariable().getGDBStackFrame(), false);
 		// based on the modelica type create the specific variable.
 		VariableHelper.createVariable(getGDBVariable().getGDBStackFrame(), variable.getName(),
Index: trunk/org.modelica.mdt.debug.core/src/org/modelica/mdt/debug/gdb/core/model/value/GDBRecordValue.java
===================================================================
--- trunk/org.modelica.mdt.debug.core/src/org/modelica/mdt/debug/gdb/core/model/value/GDBRecordValue.java	(revision 1883)
+++ trunk/org.modelica.mdt.debug.core/src/org/modelica/mdt/debug/gdb/core/model/value/GDBRecordValue.java	(revision 1884)
@@ -142,5 +142,5 @@
 		// TODO Auto-generated method stub
 		// get the record element type
-		String referenceType = TypeHelper.getModelicaMetaType(variable.getVoidPointer(), getGDBVariable().getGDBStackFrame());
+		String referenceType = TypeHelper.getModelicaMetaType(variable.getVoidPointer(), getGDBVariable().getGDBStackFrame(), true);
 		// based on the modelica type create the specific variable.
 		VariableHelper.createVariable(getGDBVariable().getGDBStackFrame(), variable.getName(),
Index: trunk/org.modelica.mdt.debug.core/src/org/modelica/mdt/debug/gdb/core/model/value/GDBTupleValue.java
===================================================================
--- trunk/org.modelica.mdt.debug.core/src/org/modelica/mdt/debug/gdb/core/model/value/GDBTupleValue.java	(revision 1883)
+++ trunk/org.modelica.mdt.debug.core/src/org/modelica/mdt/debug/gdb/core/model/value/GDBTupleValue.java	(revision 1884)
@@ -149,5 +149,5 @@
 		// TODO Auto-generated method stub
 		// get the record element type
-		String referenceType = TypeHelper.getModelicaMetaType(variable.getVoidPointer(), getGDBVariable().getGDBStackFrame());
+		String referenceType = TypeHelper.getModelicaMetaType(variable.getVoidPointer(), getGDBVariable().getGDBStackFrame(), false);
 		// based on the modelica type create the specific variable.
 		VariableHelper.createVariable(getGDBVariable().getGDBStackFrame(), variable.getName(),
Index: trunk/org.modelica.mdt.debug.core/src/org/modelica/mdt/debug/gdb/core/model/variable/GDBVariable.java
===================================================================
--- trunk/org.modelica.mdt.debug.core/src/org/modelica/mdt/debug/gdb/core/model/variable/GDBVariable.java	(revision 1883)
+++ trunk/org.modelica.mdt.debug.core/src/org/modelica/mdt/debug/gdb/core/model/variable/GDBVariable.java	(revision 1884)
@@ -174,5 +174,6 @@
 		
 		setOldReferenceTypeName(fReferenceTypeName);
-		return TypeHelper.getModelicaType(getOriginalName(), getType(), getGDBStackFrame());
+		return fReferenceTypeName;
+		//return TypeHelper.getModelicaType(getOriginalName(), getType(), getGDBStackFrame());
 	}
 	
Index: trunk/org.modelica.mdt.debug.core/src/org/modelica/mdt/debug/gdb/helper/TypeHelper.java
===================================================================
--- trunk/org.modelica.mdt.debug.core/src/org/modelica/mdt/debug/gdb/helper/TypeHelper.java	(revision 1883)
+++ trunk/org.modelica.mdt.debug.core/src/org/modelica/mdt/debug/gdb/helper/TypeHelper.java	(revision 1884)
@@ -48,5 +48,5 @@
 	public static String getModelicaType(String variableName, String variableType, GDBStackFrame gdbStackFrame) {
 		if (variableType.equals(GDBHelper.MODELICA_METATYPE) || variableType.equals(GDBHelper.MODELICA_STRING)) {
-			return getModelicaMetaType(variableName, gdbStackFrame);
+			return getModelicaMetaType(variableName, gdbStackFrame, false);
 		} else if (variableType.equals(GDBHelper.MODELICA_BOOLEAN)) {
 			return GDBHelper.BOOLEAN;
@@ -61,9 +61,9 @@
 	}
 	
-	public static String getModelicaMetaType(String variableName, GDBStackFrame gdbStackFrame) {
+	public static String getModelicaMetaType(String variableName, GDBStackFrame gdbStackFrame, Boolean inRecord) {
 		GDBDebugTarget gdbDebugTarget = gdbStackFrame.getGDBDebugTarget();
 		MISession miSession = gdbDebugTarget.getMISession();
 		CommandFactory factory = miSession.getCommandFactory();
-		MIDataEvaluateExpression getTypeOfAnyCmd = factory.createMIGetTypeOfAny(variableName);
+		MIDataEvaluateExpression getTypeOfAnyCmd = factory.createMIGetTypeOfAny(variableName, inRecord);
 		MIDataEvaluateExpressionInfo getTypeOfAnyInfo;
 		try {
