Check-in [b07a6f34f7]

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

Overview
Comment:Correct CallTraceElement.traceRaw() not filling frame details properly; Improvements in SpringCoat's frame trace.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:b07a6f34f75178c133f1f9d01d812ff18c0da7a4
User & Date: stephanie.gawroriski 2019-06-17 11:43:30
Context
2019-06-17
11:45
Sort Java SE system calls. check-in: f10006fd39 user: stephanie.gawroriski tags: trunk
11:43
Correct CallTraceElement.traceRaw() not filling frame details properly; Improvements in SpringCoat's frame trace. check-in: b07a6f34f7 user: stephanie.gawroriski tags: trunk
07:03
Backup developer notes. check-in: 15cd423edf user: squirreljme tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

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

600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
...
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
	{
		// Get the call height, ignore if not supported!
		int callheight = Assembly.sysCallPV(SystemCallIndex.CALL_STACK_HEIGHT);
		if (callheight <= 0 || Assembly.sysCallPV(SystemCallIndex.ERROR_GET,
			SystemCallIndex.CALL_STACK_HEIGHT) != SystemCallError.NO_ERROR)
			return new int[0];
		
		// Cut call height down to remove this method's frame
		callheight--;
		
		// Get the call parameters
		int[] rv = new int[callheight * CallStackItem.NUM_ITEMS];
		for (int z = 0, base = 0; z < callheight; z++,
			base += CallStackItem.NUM_ITEMS)
			for (int i = 0; i < CallStackItem.NUM_ITEMS; i++)
................................................................................
		// Process all the items
		CallTraceElement[] rv = new CallTraceElement[callheight];
		for (int z = 0, base = 0; z < callheight; z++,
			base += CallStackItem.NUM_ITEMS)
		{
			// Load class name
			int xcl = Assembly.sysCallV(SystemCallIndex.LOAD_STRING,
				__trace[CallStackItem.CLASS_NAME]);
			String scl = ((xcl == 0 || Assembly.sysCallV(
				SystemCallIndex.ERROR_GET, SystemCallIndex.LOAD_STRING) !=
				SystemCallError.NO_ERROR) ?
				(String)null : (String)Assembly.pointerToObject(xcl));
				
			// Load method name
			int xmn = Assembly.sysCallV(SystemCallIndex.LOAD_STRING,
				__trace[CallStackItem.METHOD_NAME]);
			String smn = ((xmn == 0 || Assembly.sysCallV(
				SystemCallIndex.ERROR_GET, SystemCallIndex.LOAD_STRING) !=
				SystemCallError.NO_ERROR) ?
				(String)null : (String)Assembly.pointerToObject(xmn));
			
			// Load method type
			int xmt = Assembly.sysCallV(SystemCallIndex.LOAD_STRING,
				__trace[CallStackItem.METHOD_NAME]);
			String smt = ((xmt == 0 || Assembly.sysCallV(
				SystemCallIndex.ERROR_GET, SystemCallIndex.LOAD_STRING) !=
				SystemCallError.NO_ERROR) ?
				(String)null : (String)Assembly.pointerToObject(xmt));
			
			// Load source file
			int xsf = Assembly.sysCallV(SystemCallIndex.LOAD_STRING,
				__trace[CallStackItem.SOURCE_FILE]);
			String ssf = ((xsf == 0 || Assembly.sysCallV(
				SystemCallIndex.ERROR_GET, SystemCallIndex.LOAD_STRING) !=
				SystemCallError.NO_ERROR) ?
				(String)null : (String)Assembly.pointerToObject(xsf));
			
			// The PC address
			int pcaddr = __trace[CallStackItem.PC_ADDRESS];
			
			// Build elements
			rv[z] = new CallTraceElement(
				scl,
				smn,
				smt,
				(pcaddr == 0 ? -1 : pcaddr),
				ssf,
				__trace[CallStackItem.SOURCE_LINE],
				__trace[CallStackItem.JAVA_OPERATION],
				__trace[CallStackItem.JAVA_PC_ADDRESS]);
		}
		
		// Use the resolved form
		return rv;
	}
}








|







 







|







|







|







|






|








|
|
|







600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
...
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
	{
		// Get the call height, ignore if not supported!
		int callheight = Assembly.sysCallPV(SystemCallIndex.CALL_STACK_HEIGHT);
		if (callheight <= 0 || Assembly.sysCallPV(SystemCallIndex.ERROR_GET,
			SystemCallIndex.CALL_STACK_HEIGHT) != SystemCallError.NO_ERROR)
			return new int[0];
		
		// Remove the top-most frame because it will be this method
		callheight--;
		
		// Get the call parameters
		int[] rv = new int[callheight * CallStackItem.NUM_ITEMS];
		for (int z = 0, base = 0; z < callheight; z++,
			base += CallStackItem.NUM_ITEMS)
			for (int i = 0; i < CallStackItem.NUM_ITEMS; i++)
................................................................................
		// Process all the items
		CallTraceElement[] rv = new CallTraceElement[callheight];
		for (int z = 0, base = 0; z < callheight; z++,
			base += CallStackItem.NUM_ITEMS)
		{
			// Load class name
			int xcl = Assembly.sysCallV(SystemCallIndex.LOAD_STRING,
				__trace[base + CallStackItem.CLASS_NAME]);
			String scl = ((xcl == 0 || Assembly.sysCallV(
				SystemCallIndex.ERROR_GET, SystemCallIndex.LOAD_STRING) !=
				SystemCallError.NO_ERROR) ?
				(String)null : (String)Assembly.pointerToObject(xcl));
				
			// Load method name
			int xmn = Assembly.sysCallV(SystemCallIndex.LOAD_STRING,
				__trace[base + CallStackItem.METHOD_NAME]);
			String smn = ((xmn == 0 || Assembly.sysCallV(
				SystemCallIndex.ERROR_GET, SystemCallIndex.LOAD_STRING) !=
				SystemCallError.NO_ERROR) ?
				(String)null : (String)Assembly.pointerToObject(xmn));
			
			// Load method type
			int xmt = Assembly.sysCallV(SystemCallIndex.LOAD_STRING,
				__trace[base + CallStackItem.METHOD_NAME]);
			String smt = ((xmt == 0 || Assembly.sysCallV(
				SystemCallIndex.ERROR_GET, SystemCallIndex.LOAD_STRING) !=
				SystemCallError.NO_ERROR) ?
				(String)null : (String)Assembly.pointerToObject(xmt));
			
			// Load source file
			int xsf = Assembly.sysCallV(SystemCallIndex.LOAD_STRING,
				__trace[base + CallStackItem.SOURCE_FILE]);
			String ssf = ((xsf == 0 || Assembly.sysCallV(
				SystemCallIndex.ERROR_GET, SystemCallIndex.LOAD_STRING) !=
				SystemCallError.NO_ERROR) ?
				(String)null : (String)Assembly.pointerToObject(xsf));
			
			// The PC address
			int pcaddr = __trace[base + CallStackItem.PC_ADDRESS];
			
			// Build elements
			rv[z] = new CallTraceElement(
				scl,
				smn,
				smt,
				(pcaddr == 0 ? -1 : pcaddr),
				ssf,
				__trace[base + CallStackItem.SOURCE_LINE],
				__trace[base + CallStackItem.JAVA_OPERATION],
				__trace[base + CallStackItem.JAVA_PC_ADDRESS]);
		}
		
		// Use the resolved form
		return rv;
	}
}

Changes to runt/libs/springcoat-vm/cc/squirreljme/vm/springcoat/SpringThreadWorker.java.

4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
				
				// Returns the given call stack item
			case SystemCallIndex.CALL_STACK_ITEM:
				{
					// Need to get all the stack frames first
					SpringThread.Frame[] frames = this.thread.frames();
					int numframes = frames.length;
					int curf = (numframes - 1) - __args[0];
					
					// Out of range item
					if (curf < 0 || curf >= numframes)
					{
						rv = -1;
						err = SystemCallError.VALUE_OUT_OF_RANGE;
					}







|







4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
				
				// Returns the given call stack item
			case SystemCallIndex.CALL_STACK_ITEM:
				{
					// Need to get all the stack frames first
					SpringThread.Frame[] frames = this.thread.frames();
					int numframes = frames.length;
					int curf = (numframes - __args[0]) - 1;
					
					// Out of range item
					if (curf < 0 || curf >= numframes)
					{
						rv = -1;
						err = SystemCallError.VALUE_OUT_OF_RANGE;
					}