Check-in [21f1d5cbaa]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Implement CallTraceElement.traceRaw().
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 21f1d5cbaa5469524a24f77041abf9837bd6669d
User & Date: stephanie.gawroriski 2019-06-16 23:05:03
Context
2019-06-16
23:19
Implement trace resolution. check-in: aa105a6809 user: stephanie.gawroriski tags: trunk
23:05
Implement CallTraceElement.traceRaw(). check-in: 21f1d5cbaa user: stephanie.gawroriski tags: trunk
23:01
Base for new way to do call traces via the system call interface. check-in: 335466fed4 user: stephanie.gawroriski tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/debug/CallTraceElement.java.

   611    611   	{
   612    612   		// Get the call height, ignore if not supported!
   613    613   		int callheight = Assembly.sysCallPV(SystemCallIndex.CALL_STACK_HEIGHT);
   614    614   		if (callheight <= 0 || Assembly.sysCallPV(SystemCallIndex.ERROR_GET,
   615    615   			SystemCallIndex.CALL_STACK_HEIGHT) != SystemCallError.NO_ERROR)
   616    616   			return new int[0];
   617    617   		
   618         -		throw new todo.TODO();
          618  +		// Get the call parameters
          619  +		int[] rv = new int[callheight * CallStackItem.NUM_ITEMS];
          620  +		for (int z = 0, base = 0; z < callheight; z++,
          621  +			base += CallStackItem.NUM_ITEMS)
          622  +			for (int i = 0; i < CallStackItem.NUM_ITEMS; i++)
          623  +			{
          624  +				// Get parameter
          625  +				int vx = Assembly.sysCallPV(SystemCallIndex.CALL_STACK_ITEM,
          626  +					z, i);
          627  +				
          628  +				// Nullify unknown or invalid parameters
          629  +				if (Assembly.sysCallPV(SystemCallIndex.ERROR_GET) !=
          630  +					SystemCallError.NO_ERROR)
          631  +					vx = 0;
          632  +				
          633  +				// Fill in
          634  +				rv[base + i] = vx;
          635  +			}
          636  +		
          637  +		// Return the raw parameters
          638  +		return rv;
   619    639   	}
   620    640   	
   621    641   	/**
   622    642   	 * Resolves the specified call trace into call trace elements.
   623    643   	 *
   624    644   	 * @param __trace The trace to resolve.
   625    645   	 * @return The resolved trace.
................................................................................
   628    648   	 */
   629    649   	public static final CallTraceElement[] traceResolve(int[] __trace)
   630    650   		throws NullPointerException
   631    651   	{
   632    652   		if (__trace == null)
   633    653   			throw new NullPointerException("NARG");
   634    654   		
          655  +		// Get the call height
          656  +		int callheight = __trace.length / CallStackItem.NUM_ITEMS;
          657  +		
   635    658   		throw new todo.TODO();
   636    659   	}
   637    660   }
   638    661