mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2024-12-14 04:00:30 +00:00
parent
cbfd83c2ba
commit
12b8a0393f
@ -141,7 +141,7 @@ dependencies {
|
||||
extraModsCompileOnly fg.deobf("com.blamejared.crafttweaker:CraftTweaker-1.16.5:7.1.0.313")
|
||||
extraModsCompileOnly fg.deobf("commoble.morered:morered-1.16.5:2.1.1.0")
|
||||
|
||||
shade 'org.squiddev:Cobalt:0.5.5'
|
||||
shade 'org.squiddev:Cobalt:0.5.7'
|
||||
|
||||
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0'
|
||||
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.7.0'
|
||||
|
@ -625,6 +625,15 @@ final class ComputerExecutor
|
||||
}
|
||||
}
|
||||
|
||||
void printState( StringBuilder out )
|
||||
{
|
||||
out.append( "Enqueued command: " ).append( command ).append( '\n' );
|
||||
out.append( "Enqueued events: " ).append( eventQueue.size() ).append( '\n' );
|
||||
|
||||
ILuaMachine machine = this.machine;
|
||||
if( machine != null ) machine.printExecutionState( out );
|
||||
}
|
||||
|
||||
private void displayFailure( String message, String extra )
|
||||
{
|
||||
Terminal terminal = computer.getTerminal();
|
||||
|
@ -575,18 +575,22 @@ public final class ComputerThread
|
||||
StringBuilder builder = new StringBuilder()
|
||||
.append( "Terminating computer #" ).append( executor.getComputer().getID() )
|
||||
.append( " due to timeout (running for " ).append( time * 1e-9 )
|
||||
.append( " seconds). This is NOT a bug, but may mean a computer is misbehaving. " )
|
||||
.append( " seconds). This is NOT a bug, but may mean a computer is misbehaving.\n" )
|
||||
.append( "Thread " )
|
||||
.append( owner.getName() )
|
||||
.append( " is currently " )
|
||||
.append( owner.getState() );
|
||||
.append( owner.getState() )
|
||||
.append( '\n' );
|
||||
Object blocking = LockSupport.getBlocker( owner );
|
||||
if( blocking != null ) builder.append( "\n on " ).append( blocking );
|
||||
if( blocking != null ) builder.append( " on " ).append( blocking ).append( '\n' );
|
||||
|
||||
for( StackTraceElement element : owner.getStackTrace() )
|
||||
{
|
||||
builder.append( "\n at " ).append( element );
|
||||
builder.append( " at " ).append( element ).append( '\n' );
|
||||
}
|
||||
|
||||
executor.printState( builder );
|
||||
|
||||
ComputerCraft.log.warn( builder.toString() );
|
||||
}
|
||||
}
|
||||
|
@ -214,6 +214,20 @@ public class CobaltLuaMachine implements ILuaMachine
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void printExecutionState( StringBuilder out )
|
||||
{
|
||||
LuaState state = this.state;
|
||||
if( state == null )
|
||||
{
|
||||
out.append( "CobaltLuaMachine is terminated\n" );
|
||||
}
|
||||
else
|
||||
{
|
||||
state.printExecutionState( out );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close()
|
||||
{
|
||||
|
@ -61,6 +61,15 @@ public interface ILuaMachine
|
||||
*/
|
||||
MachineResult handleEvent( @Nullable String eventName, @Nullable Object[] arguments );
|
||||
|
||||
/**
|
||||
* Print some information about the internal execution state.
|
||||
* <p>
|
||||
* This function is purely intended for debugging, its output should not be relied on in any way.
|
||||
*
|
||||
* @param out The buffer to write to.
|
||||
*/
|
||||
void printExecutionState( StringBuilder out );
|
||||
|
||||
/**
|
||||
* Close the Lua machine, aborting any running functions and deleting the internal state.
|
||||
*/
|
||||
|
@ -211,6 +211,11 @@ public class FakeComputerManager
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void printExecutionState( StringBuilder out )
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user