public void messageArrived()

in debugger/src/main/java/flash/tools/debugger/concrete/DManager.java [1080:2086]


	public void messageArrived(DMessage msg, DProtocol which) {
		/*
		 * at this point we just open up a big switch statement and walk through
		 * all possible cases
		 */
		int type = msg.getType();
		// System.out.println("manager msg = "+DMessage.inTypeName(type));
		int inIsolateId = getInIsolate() != null ? getInIsolate().getId()
				: Isolate.DEFAULT_ID;
		if (inIsolateId != Isolate.DEFAULT_ID) {
			msg.setTargetIsolate(inIsolateId);
		}
		switch (type) {
		case DMessage.InVersion: {
			long ver = msg.getDWord();
			m_playerVersion = (int) ver;

			// Newer players will send another byte, which is the pointer size
			// that is used by the player (in bytes).
			int pointerSize;
			if (msg.getRemaining() >= 1)
				pointerSize = msg.getByte();
			else
				pointerSize = 4;
			DMessage.setSizeofPtr(pointerSize);
			break;
		}

		case DMessage.InErrorExecLimit: {
			handleFaultEvent(new RecursionLimitFault(msg.getTargetIsolate()));
			break;
		}

		case DMessage.InErrorWith: {
			handleFaultEvent(new InvalidWithFault(msg.getTargetIsolate()));
			break;
		}

		case DMessage.InErrorProtoLimit: {
			handleFaultEvent(new ProtoLimitFault(msg.getTargetIsolate()));
			break;
		}

		case DMessage.InErrorURLOpen: {
//			String url = msg.getString();
//			handleFaultEvent(new InvalidURLFault(url, msg.getTargetIsolate()));
			break;
		}

		case DMessage.InErrorTarget: {
//			String name = msg.getString();
//			handleFaultEvent(new InvalidTargetFault(name, msg.getTargetIsolate()));
			break;
		}

		case DMessage.InErrorException: {
			long offset = msg.getDWord();
			// As of FP9, the player will also send the "toString()" message
			// of the exception. But for backward compatibility with older
			// players, we won't assume that that is there.
			String exceptionMessage;
			boolean willExceptionBeCaught = false;
			Value thrown = null;
			if (msg.getRemaining() > 0) {
				exceptionMessage = msg.getString();
				if (msg.getRemaining() > 0) {
					if (msg.getByte() != 0) {
						willExceptionBeCaught = (msg.getByte() != 0 ? true
								: false);
						msg.getPtr();
						DVariable thrownVar = extractVariable(msg);
						thrown = thrownVar.getValue();
					}
				}
			} else {
				exceptionMessage = ""; //$NON-NLS-1$
			}
			ExceptionFault exceptionFault = new ExceptionFault(
					exceptionMessage, willExceptionBeCaught, thrown, msg.getTargetIsolate());
			exceptionFault.isolateId = msg.getTargetIsolate();
			handleFaultEvent(exceptionFault);
			break;
		}

		case DMessage.InErrorStackUnderflow: {
//			long offset = msg.getDWord();
			handleFaultEvent(new StackUnderFlowFault(msg.getTargetIsolate()));
			break;
		}

		case DMessage.InErrorZeroDivide: {
//			long offset = msg.getDWord();
			handleFaultEvent(new DivideByZeroFault(msg.getTargetIsolate()));
			break;
		}

		case DMessage.InErrorScriptStuck: {
			handleFaultEvent(new ScriptTimeoutFault(msg.getTargetIsolate()));
			break;
		}

		case DMessage.InErrorConsole: {
			String s = msg.getString();
			handleFaultEvent(new ConsoleErrorFault(s, msg.getTargetIsolate()));
			break;
		}

		case DMessage.InTrace: {
			String text = msg.getString();
			addEvent(new TraceEvent(text));
			break;
		}

		case DMessage.InSquelch: {
			long state = msg.getDWord();
			m_squelchEnabled = (state != 0) ? true : false;
			break;
		}

		case DMessage.InParam: {
			String name = msg.getString();
			String value = msg.getString();

			// here's where we get movie = URL and password which I'm not sure
			// what to do with?
			// System.out.println(name+"="+value);
			m_parms.put(name, value);

			// if string is a "movie", then this is a URL
			if (name.startsWith("movie")) //$NON-NLS-1$
				m_uri = convertToURI(value);
			break;
		}

		case DMessage.InPlaceObject: {
			long objId = msg.getPtr();
			String path = msg.getString();
			// m_bag.placeObject((int)objId, path);
			break;
		}

		case DMessage.InSetProperty: {
			long objId = msg.getPtr();
			int item = msg.getWord();
			String value = msg.getString();
			break;
		}

		case DMessage.InNewObject: {
			long objId = msg.getPtr();
			break;
		}

		case DMessage.InRemoveObject: {
			long objId = msg.getPtr();
			// m_bag.removeObject((int)objId);
			break;
		}

		case DMessage.InSetVariable: {
			long objId = msg.getPtr();
			String name = msg.getString();
			int dType = msg.getWord();
			int flags = (int) msg.getDWord();
			String value = msg.getString();

			// m_bag.createVariable((int)objId, name, dType, flags, value);
			break;
		}

		case DMessage.InDeleteVariable: {
			long objId = msg.getPtr();
			String name = msg.getString();
			// m_bag.deleteVariable((int)objId, name);
			break;
		}

		case DMessage.InScript: {
			int module = (int) msg.getDWord();
			int bitmap = (int) msg.getDWord();
			String name = msg.getString(); // in "basepath;package;filename"
											// format
			String text = msg.getString();
			int swfIndex = -1;
			int isolateIndex = -1;

			/* new in flash player 9: player tells us what swf this is for */
			if (msg.getRemaining() >= 4)
				swfIndex = (int) msg.getDWord();

			isolateIndex = msg.getTargetIsolate();
			getOrCreateIsolate(isolateIndex);
			if (putSource(swfIndex, module, bitmap, name, text,
					isolateIndex)) {
				// have we changed the list since last query
				if (!m_sourceListModified)
					addEvent(new FileListModifiedEvent());

				m_sourceListModified = true; 
			}
			break;
		}

		case DMessage.InRemoveScript: {
			long module = msg.getDWord();
			int isolateId = msg.getTargetIsolate();
			Map<Integer, DModule> source = getIsolateState(isolateId).m_source;
			synchronized (source) {
				if (removeSource((int) module, isolateId)) {
					// have we changed the list since last query
					if (!m_sourceListModified)
						addEvent(new FileListModifiedEvent());

					m_sourceListModified = true; /* current source list is stale */
				}
			}
			break;
		}

		case DMessage.InAskBreakpoints: {
			// the player has just loaded a swf and we know the player
			// has halted, waiting for us to continue. The only caveat
			// is that it looks like it still does a number of things in
			// the background which take a few seconds to complete.
			int targetIsolate = msg.getTargetIsolate();
			DSuspendInfo iSusInfo = getIsolateState(targetIsolate).m_suspendInfo;
			if (iSusInfo == null) {
				iSusInfo = new DSuspendInfo(SuspendReason.ScriptLoaded, 0,
						0, 0, 0);
			}
			break;
		}

		case DMessage.InBreakAt: {
			long bp = 0, wideLine = 0, wideModule = 0;
			if (!m_wideLines) {
				bp = msg.getDWord();
			}
			else {
				wideModule = msg.getDWord();
				wideLine = msg.getDWord();
			}
			long id = msg.getPtr();
			String stack = msg.getString();
			int targetIsolate = msg.getTargetIsolate();

			int module = DLocation.decodeFile(bp);
			int line = DLocation.decodeLine(bp);
			if (m_wideLines) {
				module = (int)wideModule;
				line = (int)wideLine;
			}
			addEvent(new BreakEvent(module, line, targetIsolate));
			break;
		}

		case DMessage.InContinue: {
			/* we are running again so trash all our variable contents */
			continuing(msg.getTargetIsolate());
			break;
		}

		case DMessage.InSetLocalVariables: {
//			long objId = msg.getPtr();
			// m_bag.markObjectLocal((int)objId, true);
			break;
		}

		case DMessage.InSetBreakpoint: {
			long count = msg.getDWord();
			int targetIsolate = msg.getTargetIsolate();
			while (count-- > 0) {
				long bp = 0, moduleNumber = 0, lineNumber = 0;
				if (!m_wideLines) {
					bp = msg.getDWord();
				}
				else {
					moduleNumber = msg.getDWord();
					lineNumber = msg.getDWord();
				}

				int fileId = DLocation.decodeFile(bp);
				int line = DLocation.decodeLine(bp);
				if (m_wideLines) {
					fileId = (int)moduleNumber;
					line = (int)lineNumber;
				}

				DModule file = null;
				file = getSource(fileId, targetIsolate);

				DLocation l = new DLocation(file, line, targetIsolate);

				if (file != null) {
					addBreakpoint((int) bp, l, targetIsolate);
				}
			}
			break;
		}

		case DMessage.InNumScript: {
			/* lets us know how many scripts there are */
			int num = (int) msg.getDWord();
			int targetIsolate = msg.getTargetIsolate();
			DSwfInfo swf;

			/*
			 * New as of flash player 9: another dword indicating which swf this
			 * is for. That means we don't have to guess whether this is for an
			 * old SWF which has just had some more modules loaded, or for a new
			 * SWF!
			 */
			if (msg.getRemaining() >= 4) {
				int swfIndex = (int) msg.getDWord();
				swf = getOrCreateSwfInfo(swfIndex, targetIsolate);
				getIsolateState(targetIsolate).m_lastSwfInfo = swf;
			} else {
				/*
				 * This is not flash player 9 (or it is an early build of fp9).
				 * 
				 * We use this message as a trigger that a new swf has been
				 * loaded, so make sure we are ready to accept the scripts.
				 */
				swf = getActiveSwfInfo(targetIsolate);
			}

			// It is NOT an error for the player to have sent us a new,
			// different sourceExpectedCount from whatever we had before!
			// In fact, this happens all the time, whenever a SWF has more
			// than one ABC.
			swf.setSourceExpectedCount(num);
			break;
		}

		case DMessage.InRemoveBreakpoint: {
			long count = msg.getDWord();
			int isolateId = msg.getTargetIsolate();
			while (count-- > 0) {
				long bp = msg.getDWord();
				removeBreakpoint((int) bp, isolateId);
			}
			break;

		}

		case DMessage.InBreakAtExt: {
			long bp = 0, wideLine = 0, wideModule = 0;
			if (!m_wideLines) {
				bp = msg.getDWord();
			}
			else {
				wideModule = msg.getDWord();
				wideLine = msg.getDWord();
			}
			long num = msg.getDWord();

			int targetIsolate = msg.getTargetIsolate();
			// System.out.println(msg.getInTypeName()+",bp="+(bp&0xffff)+":"+(bp>>16));
			/* we have stack info to store away */
			clearFrames(targetIsolate); // just in case
			int depth = 0;

			while (num-- > 0) {
				long bpi = 0, wideLinei= 0, wideModulei = 0;
				if (!m_wideLines) {
					bpi = msg.getDWord();
				}
				else {
					wideModulei = msg.getDWord();
					wideLinei = msg.getDWord();
				}
				long id = msg.getPtr();
				String stack = msg.getString();
				int module = DLocation.decodeFile(bpi);
				int line = DLocation.decodeLine(bpi);
				if (m_wideLines) {
					module = (int)wideModulei;
					line = (int)wideLinei;
				}
				DModule m = null;
				m = getSource(module, targetIsolate);
				DStackContext c = new DStackContext(module, line, m, id, stack,
						depth, targetIsolate);
				// If addFrame() returns false, that means it chose to ignore
				// this
				// frame, so we do NOT want to increment our depth for the next
				// time through the loop. If it returns true, then we do want
				// to.
				if (addFrame(c, targetIsolate))
					++depth;
				// System.out.println("   this="+id+",@"+(bpi&0xffff)+":"+(bpi>>16)+",stack="+stack);
			}
			mapOldFramesToNew(targetIsolate);
			if (targetIsolate != Isolate.DEFAULT_ID) {
				// ask for isolate id if it is present
				appendIsolateInfoToFrame(targetIsolate);

			}
			break;

		}

		case DMessage.InFrame: {
			// For InFrame the first element is really our frame id
			DValue frame = null;
			DVariable child = null;
			ArrayList<DVariable> v = new ArrayList<DVariable>();
			ArrayList<DVariable> registers = new ArrayList<DVariable>();
			int targetIsolate = msg.getTargetIsolate();
			int depth = (int) msg.getDWord(); // depth of frame

			// make sure we have a valid depth
			if (depth > -1) {
				// first thing is number of registers
				int num = (int) msg.getDWord();
				for (int i = 0; i < num; i++)
					registers.add(extractRegister(msg, i + 1));
			}

			int currentArg = -1;
			boolean gettingScopeChain = false;

			// then our frame itself
			while (msg.getRemaining() > 0) {
				long frameId = msg.getPtr();

				if (frame == null) {
					frame = getOrCreateValue(frameId, targetIsolate);
					extractVariable(msg); // put the rest of the info in the
											// trash
				} else {
					child = extractVariable(msg);
					if (currentArg == -1
							&& child.getName().equals(ARGUMENTS_MARKER)) {
						currentArg = 0;
						gettingScopeChain = false;
					} else if (child.getName().equals(SCOPE_CHAIN_MARKER)) {
						currentArg = -1;
						gettingScopeChain = true;
					} else if (currentArg >= 0) {
						// work around a compiler bug: If the variable's name is
						// "undefined",
						// then change its name to "_argN", where "N" is the
						// argument index,
						// e.g. _arg1, _arg2, etc.
						++currentArg;
						if (child.getName().equals("undefined")) //$NON-NLS-1$
							child.setName("_arg" + currentArg); //$NON-NLS-1$
					}

					// All args and locals get added as "children" of
					// the frame; but scope chain entries do not.
					if (!gettingScopeChain)
						addVariableMember(frameId, child, targetIsolate);

					// Everything gets added to the ordered list of
					// variables that came in.
					v.add(child);
				}
			}

			// let's transfer our newly gained knowledge into the stack context
			if (depth == 0)
				populateRootNode(frame, v, targetIsolate);
			else
				populateFrame(depth, v, targetIsolate);

			break;
		}

		case DMessage.InOption: {
			String s = msg.getString();
			String v = msg.getString();
			m_options.put(s, v);
			break;
		}

		case DMessage.InGetVariable: {
			// For InGetVariable the first element is the original entity we
			// requested
			DValue parent = null;
			DVariable child = null;
			String definingClass = null;
			int level = 0;
			int targetIsolate = msg.getTargetIsolate();
			int highestLevelWithMembers = -1;
			List<String> classes = new ArrayList<String>();

			while (msg.getRemaining() > 0) {
				long parentId = msg.getPtr();

				// build or get parent node
				if (parent == null) {
					String name = msg.getString();

					// pull the contents of the node which normally are disposed
					// of except if we did a 0,name call
					getIsolateState(targetIsolate).m_lastInGetVariable = extractVariable(msg, name); 

					parent = getOrCreateValue(parentId, targetIsolate);
				} else {
					// extract the child and add it to the parent.
					child = extractVariable(msg);
					if (showMember(child)) {
						if (child.isAttributeSet(VariableAttribute.IS_DYNAMIC)) {
							// Dynamic attributes always come in marked as a
							// member of
							// class "Object"; but to the user, it makes more
							// sense to
							// consider them as members of the topmost class.
							if (classes.size() > 0) {
								child.setDefiningClass(0, classes.get(0));
								highestLevelWithMembers = Math.max(
										highestLevelWithMembers, 0);
							}
						} else {
							child.setDefiningClass(level, definingClass);
							if (definingClass != null) {
								highestLevelWithMembers = Math.max(
										highestLevelWithMembers, level);
							}
						}
						addVariableMember(parent.getId(), child, targetIsolate);
					} else {
						if (isTraits(child)) {
							definingClass = child.getQualifiedName();
							level = classes.size();

							// If the traits name end with "$", then it
							// represents a class object --
							// in other words, the variables inside it are
							// static variables of that
							// class. In that case, we need to juggle the
							// information. For example,
							// if we are told that a variable is a member of
							// "MyClass$", we actually
							// store it into the information for "MyClass".
							if (definingClass.endsWith("$")) { //$NON-NLS-1$
								String classWithoutDollar = definingClass
										.substring(0,
												definingClass.length() - 1);
								int indexOfClass = classes
										.indexOf(classWithoutDollar);
								if (indexOfClass != -1) {
									level = indexOfClass;
									definingClass = classWithoutDollar;
								}
							}

							// It wasn't static -- so, add this class to the end
							// of the list of classes
							if (level == classes.size()) {
								classes.add(definingClass);
							}
						}
					}
				}
			}

			if (parent != null && parent.getClassHierarchy(true) == null) {
				parent.setClassHierarchy(
						classes.toArray(new String[classes.size()]),
						highestLevelWithMembers + 1);
			}

			break;
		}

		case DMessage.InWatch: // for AS2; sends 16-bit ID field
		case DMessage.InWatch2: // for AS3; sends 32-bit ID field
		{
			// This message is sent whenever a watchpoint is added
			// modified or removed.
			//
			// For an addition, flags will be non-zero and
			// success will be true.
			//
			// For a modification flags will be non-zero.
			// and oldFlags will be non-zero and success
			// will be true. Additionally oldFlags will not
			// be equal to flags.
			//
			// For a removal flags will be zero. oldFlags
			// will be non-zero.
			//
			// flags identifies the type of watchpoint added,
			// see WatchKind.
			//
			// success indicates whether the operation was successful
			//
			// request. It will be associated with the watchpoint.
			int success = msg.getWord();
			int oldFlags = msg.getWord();
			int oldTag = msg.getWord();
			int flags = msg.getWord();
			int tag = msg.getWord();
			// for AS2, the ID came in above as a Word. For AS3, the above value
			// is
			// bogus, and it has been sent again as a DWord.
			long id = ((type == DMessage.InWatch2) ? msg.getPtr() : msg
					.getWord());
			String name = msg.getString();
			int targetIsolate = msg.getTargetIsolate();

			if (success != 0) {
				if (flags == 0) {
					removeWatchpoint(oldTag, targetIsolate);
				} else {
					// modification or addition is the same to us
					// a new watch is created and added into the table
					// while any old entry if it exists is removed.
					removeWatchpoint(oldTag, targetIsolate);
					DWatch w = new DWatch(id, name, flags, tag, targetIsolate);
					addWatchpoint(w, targetIsolate);
				}
			}
			break;
		}

		case DMessage.InGetSwf: {
			// we only house the swf temporarily, PlayerSession then
			// pieces it back into swfinfo record. Also, we don't
			// send any extra data in the message so that we need not
			// copy the bytes.
			m_swf = msg.getData();
			break;
		}

		case DMessage.InGetSwd: {
			// we only house the swd temporarily, PlayerSession then
			// pieces it back into swfinfo record.
			m_swd = msg.getData();
			break;
		}

		case DMessage.InBreakReason: {
			// the id map 1-1 with out SuspendReason interface constants
			int suspendReason = msg.getWord();
			int suspendPlayer = msg.getWord(); // item index of player
			int breakOffset = (int) msg.getDWord(); // current script offset
			int prevBreakOffset = (int) msg.getDWord(); // prev script offset
			int nextBreakOffset = (int) msg.getDWord(); // next script offset
			int targetIsolate = msg.getTargetIsolate();

			getIsolateState(targetIsolate).m_suspendInfo = new DSuspendInfo(
					suspendReason, suspendPlayer, breakOffset,
					prevBreakOffset, nextBreakOffset);

			// augment the current frame with this information. It
			// should work ok since we only get this message after a
			// InBreakAtExt message
			try {
				DStackContext c = getFrame(0, targetIsolate);
				c.setOffset(breakOffset);
				c.setSwfIndex(suspendPlayer);
			} catch (Exception e) {
				if (Trace.error) {
					Trace.trace("Oh my god, gag me with a spoon...getFrame(0) call failed"); //$NON-NLS-1$
					e.printStackTrace();
				}
			}
			break;
		}

			// obtain raw action script byte codes
		case DMessage.InGetActions: {
			int item = msg.getWord();
			int rsvd = msg.getWord();
			int at = (int) msg.getDWord();
			int len = (int) msg.getDWord();
			int i = 0;

			m_actions = (len <= 0) ? null : new byte[len];
			while (len-- > 0)
				m_actions[i++] = (byte) msg.getByte();

			break;
		}

			// obtain data about a SWF
		case DMessage.InSwfInfo: {
			int count = msg.getWord();
			int targetIsolate = msg.getTargetIsolate();
			for (int i = 0; i < count; i++) {
				long index = msg.getDWord();
				long id = msg.getPtr();

				// get it
				DSwfInfo info = null;

				info = getOrCreateSwfInfo((int) index, targetIsolate);
				getIsolateState(targetIsolate).m_lastSwfInfo = info;

				// remember which was last seen

				if (id != 0) {
					boolean debugComing = (msg.getByte() == 0) ? false : true;
					byte vmVersion = (byte) msg.getByte(); // AS vm version
															// number (1 = avm+,
															// 0 == avm-)
					int rsvd1 = msg.getWord();

					long swfSize = msg.getDWord();
					long swdSize = msg.getDWord();
					long scriptCount = msg.getDWord();
					long offsetCount = msg.getDWord();
					long breakpointCount = msg.getDWord();

					long port = msg.getDWord();
					String path = msg.getString();
					String url = msg.getString();
					String host = msg.getString();
					Map<Long, Integer> local2global = new HashMap<Long, Integer>();
					int minId = Integer.MAX_VALUE;
					int maxId = Integer.MIN_VALUE;
					// now we read in the swd debugging map (which provides
					// local to global mappings of the script ids
					/* anirudhs: Parsing this is only necessary if we are in
					   AVM1. (See PlayerSession::run(), there is a vmVersion 
					   check before calling parseSwfSwd(). */ 
					if (swdSize > 0) {
						long num = msg.getDWord();
						for (int j = 0; j < num; j++) {
							if (msg.getRemaining() < DMessage.getSizeofPtr()) {
								/* The SWD debugging map sent out by 
								 * AVM2 often runs short usually in 64-bit
								 * debug player. We can stop with what we know
								 * and move on.
								 */
								break;
							}
							long local = msg.getPtr();
							int global = (int) msg.getDWord();
							local2global.put(local, global);
							minId = (global < minId) ? global : minId;
							maxId = (global > maxId) ? global : maxId;
						}
					}
					// If its a new record then the swf size would have been
					// unknown at creation time
					boolean justCreated = (info.getSwfSize() == 0);

					// if we are a avm+ engine then we don't wait for the swd to
					// load
					if (vmVersion > 0) {
						debugComing = false;
						info.setVmVersion(vmVersion);
						info.setPopulated(); // added by mmorearty on 9/5/05 for
												// RSL debugging
					}

					// update this swfinfo with the lastest data
					info.freshen(id, path, url, host, port, debugComing,
							swfSize, swdSize, breakpointCount, offsetCount,
							scriptCount, local2global, minId, maxId);
					// now tie any scripts that have been loaded into this
					// swfinfo object
					tieScriptsToSwf(info, targetIsolate);

					// notify if its newly created
					if (justCreated)
						addEvent(new SwfLoadedEvent(id, (int) index, path, url,
								host, port, swfSize, targetIsolate));
				} else {
					// note our state before marking it
					boolean alreadyUnloaded = info.isUnloaded();

					// clear it out
					info.setUnloaded();

					// notify if this information is new.
					if (!alreadyUnloaded)
						addEvent(new SwfUnloadedEvent(info.getId(),
								info.getPath(), (int) index, targetIsolate));
				}
				// System.out.println("[SWFLOAD] Loaded "+path+", size="+swfSize+", scripts="+scriptCount);
			}
			break;
		}

			// obtain the constant pool of some player
		case DMessage.InConstantPool: {
			int item = msg.getWord();
			int count = (int) msg.getDWord();

			String[] pool = new String[count];
			for (int i = 0; i < count; i++) {
				long id = msg.getPtr();
				DVariable var = extractVariable(msg);

				// we only need the contents of the variable
				pool[i] = var.getValue().getValueAsString();
			}
			m_lastConstantPool = pool;
			break;
		}

			// obtain one or more function name line number mappings.
		case DMessage.InGetFncNames: {
			long id = msg.getDWord(); // module id
			long count = msg.getDWord(); // number of entries

			// get the DModule
			DModule m = getSource((int) id, msg.getTargetIsolate());
			if (m != null) {
				for (int i = 0; i < count; i++) {
					int offset = (int) msg.getDWord();
					int firstLine = (int) msg.getDWord();
					int lastLine = (int) msg.getDWord();
					String name = msg.getString();

					// now add the entries
					m.addLineFunctionInfo(offset, firstLine, lastLine, name);
				}
			}
			break;
		}

		case DMessage.InCallFunction:
		case DMessage.InBinaryOp: {
			// For InCallFunction the first element is the original function we
			// requested
			DValue parent = null;
			int targetIsolate = msg.getTargetIsolate();
			DVariable child = null;
			String definingClass = null;
			int level = 0;
			int highestLevelWithMembers = -1;
			List<String> classes = new ArrayList<String>();

			if (type == DMessage.InBinaryOp)
				msg.getDWord(); // id

			while (msg.getRemaining() > 0) {
				long parentId = msg.getPtr();

				// build or get parent node
				if (parent == null) {
					String name = msg.getString();

					// pull the contents of the node which normally are disposed
					// of except if we did a 0,name call
					DVariable var = extractVariable(msg, name);
					if (type == DMessage.InCallFunction) {
						getIsolateState(targetIsolate).m_lastInCallFunction = var;
					}
					else {
						getIsolateState(targetIsolate).m_lastInBinaryOp = var;
					}

					parent = getOrCreateValue(parentId, targetIsolate);
				} else {
					// extract the child and add it to the parent.
					child = extractVariable(msg);
					if (showMember(child)) {
						if (child.isAttributeSet(VariableAttribute.IS_DYNAMIC)) {
							// Dynamic attributes always come in marked as a
							// member of
							// class "Object"; but to the user, it makes more
							// sense to
							// consider them as members of the topmost class.
							if (classes.size() > 0) {
								child.setDefiningClass(0, classes.get(0));
								highestLevelWithMembers = Math.max(
										highestLevelWithMembers, 0);
							}
						} else {
							child.setDefiningClass(level, definingClass);
							if (definingClass != null) {
								highestLevelWithMembers = Math.max(
										highestLevelWithMembers, level);
							}
						}
						addVariableMember(parent.getId(), child, targetIsolate);
					} else {
						if (isTraits(child)) {
							definingClass = child.getQualifiedName();
							level = classes.size();

							// If the traits name end with "$", then it
							// represents a class object --
							// in other words, the variables inside it are
							// static variables of that
							// class. In that case, we need to juggle the
							// information. For example,
							// if we are told that a variable is a member of
							// "MyClass$", we actually
							// store it into the information for "MyClass".
							if (definingClass.endsWith("$")) { //$NON-NLS-1$
								String classWithoutDollar = definingClass
										.substring(0,
												definingClass.length() - 1);
								int indexOfClass = classes
										.indexOf(classWithoutDollar);
								if (indexOfClass != -1) {
									level = indexOfClass;
									definingClass = classWithoutDollar;
								}
							}

							// It wasn't static -- so, add this class to the end
							// of the list of classes
							if (level == classes.size()) {
								classes.add(definingClass);
							}
						}
					}
				}
			}

			if (parent != null && parent.getClassHierarchy(true) == null) {
				parent.setClassHierarchy(
						classes.toArray(new String[classes.size()]),
						highestLevelWithMembers + 1);
			}

			break;
		}

		case DMessage.InIsolateCreate: {
			long id = msg.getDWord();
			isolateCreate((int) id);

			break;
		}

		case DMessage.InIsolateExit: {
			long id = msg.getDWord();
			// Implementation dependency on runtime in case id mechanism is
			// changed:
			// Typecast id into an int.
			DIsolate isolate = removeIsolate((int) id);
			addEvent(new IsolateExitEvent(isolate));

			break;
		}

		case DMessage.InIsolateEnumerate: {
			// clearIsolates();
			//
			// long lenIsolate = msg.getDWord();
			//
			// for ( int i = 0; i < lenIsolate; i++) {
			// long id = msg.getDWord();
			// addIsolate(new DIsolate(id));
			// }

			break;
		}

		case DMessage.InSetActiveIsolate: {
			long id = msg.getDWord();

			boolean success = msg.getByte() != 0 ? true : false;

			/** Ignore inset since we don't wait
			 * for response anymore.
			 */
//			synchronized (m_activeIsolateLock) {
//				if (success) {
//					int at = findIsolate((int) id);
//					if (at > -1)
//						setActiveIsolate(getIsolate(at));
//				} else {
//					setActiveIsolate(null);
//				}
//			}

			break;
		}

		case DMessage.InIsolate: {
			long id = msg.getDWord();
			synchronized (m_inIsolateLock) {
				int at = findIsolate((int) id);
				if (at != -1)
					setInIsolate(getIsolate(at));
				else {
					if (id != Isolate.DEFAULT_ID) {
						setInIsolate(isolateCreate((int) id));
					} else
						setInIsolate(null);
				}
			}
			break;
		}
		
		case DMessage.InSetExceptionBreakpoint: {

			int result = msg.getWord();
			String exceptionBP = msg.getString();
			int remaining = msg.getRemaining();
			break;
		}

		case DMessage.InRemoveExceptionBreakpoint: {
			int result = msg.getWord();
			String exceptionBP = msg.getString();
			int remaining = msg.getRemaining();
			break;
		}

		default: {
			break;
		}
		}
	}