Check-in [747fc8a67f]

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

Overview
Comment:Make the CPU registers print out a bit nicer.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 747fc8a67f1d498f51f31563f69fc87a6931adc6
User & Date: stephanie.gawroriski 2019-11-03 11:52:10
Context
2019-11-03
12:22
Stack slices together in frames for easier debugging; Make debug slices only handled when debugging is enabled; Do not perform breakpoint if not debugging. check-in: 7047d001f4 user: stephanie.gawroriski tags: trunk
11:52
Make the CPU registers print out a bit nicer. check-in: 747fc8a67f user: stephanie.gawroriski tags: trunk
11:42
Printing of base execution slices. check-in: a0f2f0263a user: stephanie.gawroriski tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to runt/libs/summercoat-vm/cc/squirreljme/vm/summercoat/ExecutionSlice.java.

103
104
105
106
107
108
109





110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131



132








133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182

183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
		// Print CPU operation state
		__ps.printf("$$$$$$$$ @%08x (%s/%s)%n", trace.address(),
			NativeInstruction.mnemonic(op),
			InstructionMnemonics.toString(trace.byteCodeInstruction()));
		
		// Print normal trace info
		__ps.printf("  - InFrm: %s%n", trace.toString());





		
		// Print CPU registers
		__ps.print("  - CPU+g:[");
		boolean didstar = false;
		for (int i = 0, n = cpuregs.length, lastval = -1; i < n; i++)
		{
			// Put local registers on a new line
			if (i == NativeCode.LOCAL_REGISTER_BASE)
			{
				__ps.printf("]%n  - CPU+l:[");
				lastval = -1;
			}
			
			// Start the arguments as well
			else if (i == NativeCode.ARGUMENT_REGISTER_BASE)
			{
				__ps.printf("]%n  - CPU+a:[");
				lastval = -1;
			}
			
			// Use comma here
			else if (i > 0 && !didstar)



				__ps.print(", ");








			
			// Known register name?
			String knownreg = null;
			switch (i)
			{
				case NativeCode.ZERO_REGISTER:
					knownreg = "zero";
					break;
				
				case NativeCode.RETURN_REGISTER:
					knownreg = "return1";
					break;
				
				case NativeCode.RETURN_REGISTER + 1:
					knownreg = "return2";
					break;
				
				case NativeCode.EXCEPTION_REGISTER:
					knownreg = "exception";
					break;
				
				case NativeCode.STATIC_FIELD_REGISTER:
					knownreg = "sfieldptr";
					break;
				
				case NativeCode.THREAD_REGISTER:
					knownreg = "thread";
					break;
				
				case NativeCode.POOL_REGISTER:
					knownreg = "pool";
					break;
				
				case NativeCode.NEXT_POOL_REGISTER:
					knownreg = "nextpool";
					break;
				
				case NativeCode.ARGUMENT_REGISTER_BASE:
					knownreg = "a0/this";
					break;
			}
			
			// Show a value
			int val = cpuregs[i];
			if (i == 0 || val != 0 || val != lastval)
			{
				// Print out
				__ps.printf("%s=%xh", (knownreg != null ? knownreg :
				String.format("r%d", i)), cpuregs[i]);
				

				// Never do a star!
				didstar = false;
			}
			
			// Zero value and last was zero as well
			else
			{
				__ps.print("*");
				
				didstar = true;
			}
			
			// Used to skip blanks
			lastval = val;
		}
		__ps.println("]");
		
		// Print call arguments, if any
		if (callargs != null)
		{
			__ps.print("  - CallA: (");







>
>
>
>
>



|
|





|






|


|
|
>
>
>
|
>
>
>
>
>
>
>
>






|



|



|



|



|



|



|



|



|





<
|
|
|
|
|
>
|
<
<
<
<
<
<
<
<
<
<
<
<
<







103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192

193
194
195
196
197
198
199













200
201
202
203
204
205
206
		// Print CPU operation state
		__ps.printf("$$$$$$$$ @%08x (%s/%s)%n", trace.address(),
			NativeInstruction.mnemonic(op),
			InstructionMnemonics.toString(trace.byteCodeInstruction()));
		
		// Print normal trace info
		__ps.printf("  - InFrm: %s%n", trace.toString());
		
		// Do not print the large number of final registers that are zero
		int maxregister = cpuregs.length - 1;
		while (maxregister > 0 && cpuregs[maxregister] == 0)
			maxregister--;
		
		// Print CPU registers
		__ps.print("  - CPU+g:[");
		int didonline = 0;
		for (int i = 0; i <= maxregister; i++)
		{
			// Put local registers on a new line
			if (i == NativeCode.LOCAL_REGISTER_BASE)
			{
				__ps.printf("]%n  - CPU+l:[");
				didonline = 0;
			}
			
			// Start the arguments as well
			else if (i == NativeCode.ARGUMENT_REGISTER_BASE)
			{
				__ps.printf("]%n  - CPU+a:[");
				didonline = 0;
			}
			
			// Other formatting
			else if (i > 0)
			{
				// Comma these
				if (didonline < 6)
					__ps.print(", ");
					
				// Reset count
				else
				{
					__ps.printf("%n  -   ...:.");
					didonline = 0;
				}
			}
			
			// Known register name?
			String knownreg = null;
			switch (i)
			{
				case NativeCode.ZERO_REGISTER:
					knownreg = "zer";
					break;
				
				case NativeCode.RETURN_REGISTER:
					knownreg = "rv1";
					break;
				
				case NativeCode.RETURN_REGISTER + 1:
					knownreg = "rv2";
					break;
				
				case NativeCode.EXCEPTION_REGISTER:
					knownreg = "exc";
					break;
				
				case NativeCode.STATIC_FIELD_REGISTER:
					knownreg = "sfp";
					break;
				
				case NativeCode.THREAD_REGISTER:
					knownreg = "thr";
					break;
				
				case NativeCode.POOL_REGISTER:
					knownreg = "cpl";
					break;
				
				case NativeCode.NEXT_POOL_REGISTER:
					knownreg = "npl";
					break;
				
				case NativeCode.ARGUMENT_REGISTER_BASE:
					knownreg = "a0t";
					break;
			}
			
			// Show a value
			int val = cpuregs[i];

			
			// Print out
			__ps.printf("%3s=%8xh", (knownreg != null ? knownreg :
			String.format("r%02d", i)), cpuregs[i]);
			
			// Count line up
			didonline++;













		}
		__ps.println("]");
		
		// Print call arguments, if any
		if (callargs != null)
		{
			__ps.print("  - CallA: (");