Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
73a9257
Add basic object identification
Gabau Jan 21, 2024
6725d0b
Finalise first stage
Gabau Jan 22, 2024
799d2b8
Add basic recording
Gabau Jan 23, 2024
f5185db
Implement object recording
Gabau Jan 23, 2024
27814c2
Finish recording storage
Gabau Jan 24, 2024
68e3b57
Implement and test replay parsing logic
Gabau Jan 25, 2024
a235f2a
Remove lambda
Gabau Jan 25, 2024
7d2c840
Add initial replay agent
Gabau Jan 28, 2024
d3dda05
Add reccord and replay to ui
Gabau Jan 30, 2024
e13fa6b
Write initial replay code
Gabau Jan 31, 2024
16a95af
Partial refactor of object id
Gabau Feb 2, 2024
43711c1
Change output format for shared variables
Gabau Feb 3, 2024
7d32c21
Remove unused class
Gabau Feb 3, 2024
d45972a
Fix import
Gabau Feb 3, 2024
6e90e32
Fix shared variable output
Gabau Feb 3, 2024
ac75d94
Fix I/O bugs
Gabau Feb 3, 2024
c6da652
Fix singleton to handle
Gabau Feb 3, 2024
a98ef45
Working replay using only objects
Gabau Feb 6, 2024
21a7aab
UI + Switch to non blocking scheduling
Gabau Feb 6, 2024
30a864e
Fix wrong key
Gabau Feb 8, 2024
45875d2
Minor partial refactor
Gabau Feb 15, 2024
12f6521
Add instrumentation for static and arrays
Gabau Feb 21, 2024
24799cf
Update static recording
Gabau Feb 26, 2024
0fa351a
Fix minor bugs
Gabau Feb 26, 2024
c33874d
Fix array indexing storage
Gabau Feb 27, 2024
5ff11d5
Event tracking bug fix
Gabau Feb 27, 2024
f8a02e9
Update lock scheduling manipulation
Gabau Mar 1, 2024
08829dc
Switch back to lax replay
Gabau Mar 5, 2024
c217fbb
Handle faulty stack
Gabau Mar 7, 2024
4cec394
Add threadId to trace in trace agent instead
Gabau Mar 19, 2024
606a686
Add utility features
Gabau Mar 28, 2024
37fd488
Move concurrent node to microbat
Gabau Mar 30, 2024
876f494
Fix mnor bugs
Gabau Mar 31, 2024
624a36d
Fix equals for multi threaded programs
Gabau Apr 1, 2024
62cb9bf
Add process error to return
Gabau Apr 1, 2024
4cc0373
Fix issues with timeout thread and add lock tracking
Gabau Apr 2, 2024
cc82b1e
Add id to osgi exports
Gabau Apr 3, 2024
06d59f9
Fix inner thread id
Gabau Apr 4, 2024
f1bf153
Fix problems with record and replay
Gabau Apr 4, 2024
5088d9b
Add timeout to preferences
Gabau Apr 4, 2024
f048a6d
Fix exit program handling for test runner with threads
Gabau Apr 4, 2024
bff4065
Add thread start control deps
Gabau Apr 5, 2024
f608ed6
Fix wrong active
Gabau Apr 5, 2024
9890824
Fix record and replay regressions
Gabau Apr 5, 2024
9766d3d
Add replay modes to ui
Gabau Apr 6, 2024
b5215d9
Fix thread id handling
Gabau Apr 6, 2024
3a08e20
Add conc node
Gabau Apr 6, 2024
188d886
Remove unused condition
Gabau Apr 6, 2024
58728c8
Add force junit3Or4 to test runner
Gabau Apr 7, 2024
5ec121f
Fix lax + add other modes to replay experiment
Gabau Apr 7, 2024
f034dd4
Setup replay experiment
Gabau Apr 8, 2024
182f8d8
Fix missing check
Gabau Apr 8, 2024
d03518d
Fix missing info
Gabau Apr 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions microbat/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ Export-Package: microbat;uses:="org.osgi.framework,org.eclipse.jface.resource,or
org.eclipse.core.commands,
microbat.model.trace",
microbat.handler.xml,
microbat.instrumentation.instr.aggreplay.shared,
microbat.instrumentation.model.id,
microbat.instrumentation.output,
microbat.model;uses:="microbat.model.variable,microbat.model.value,microbat.model.trace",
microbat.model.trace;
Expand Down
Binary file modified microbat/lib/instrumentator.jar
Binary file not shown.
29 changes: 29 additions & 0 deletions microbat/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,22 @@
id="microbat.command.RestoreTrace"
name="Restore Trace">
</command>
<command
defaultHandler="microbat.handler.ConcurrentRecordHandler"
id="microbat.command.conc.record"
name="Concurrent Record">
</command>
<command
defaultHandler="microbat.handler.ConcurrentReplayHandler"
id="microbat.command.conc.replay"
name="Concurrent Replay">
</command>
<command
defaultHandler="microbat.handler.ReplayExperimentHandler"
description="Need to run record before running the experiment"
id="microbat.command.replayExperiment"
name="Run replay experiment">
</command>
</extension>
<extension
point="org.eclipse.ui.menus">
Expand Down Expand Up @@ -194,6 +210,19 @@
label="Restore Trace"
style="push">
</command>
<menu
label="Concurrent Programs">
<command
commandId="microbat.command.conc.record"
label="Record"
style="push">
</command>
<command
commandId="microbat.command.conc.replay"
label="Replay"
style="push">
</command>
</menu>
</menu>
</menuContribution>
<menuContribution
Expand Down
33 changes: 33 additions & 0 deletions microbat/src/main/microbat/agent/AggrePlaySharedVarRunner.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package microbat.agent;

import java.util.Collection;

import microbat.instrumentation.AgentConstants;
import microbat.instrumentation.AgentParams;
import sav.common.core.SavException;
import sav.common.core.utils.CollectionBuilder;
import sav.strategies.vm.AgentVmRunner;
import sav.strategies.vm.VMConfiguration;

public class AggrePlaySharedVarRunner extends AgentVmRunner implements Runnable {
private static final String STORAGE_FILE = "shared_var.txt";

public AggrePlaySharedVarRunner(String agentJar, VMConfiguration vmConfig) {
super(agentJar, AgentConstants.AGENT_OPTION_SEPARATOR, AgentConstants.AGENT_PARAMS_SEPARATOR);
}

private void setUpParams() {
super.addAgentParam(AgentParams.OPT_SHARED_DETECTION, true);
super.addAgentParam(AgentParams.OPT_DUMP_FILE, STORAGE_FILE);
}

@Override
public void run() {
try {
super.startAndWaitUntilStop(getProgramArgs());
} catch (SavException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
84 changes: 84 additions & 0 deletions microbat/src/main/microbat/agent/AggrePlayTraceAgentRunner.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
package microbat.agent;

import java.util.List;

import microbat.instrumentation.AgentConstants;
import microbat.instrumentation.AgentParams;
import microbat.util.Settings;
import sav.common.core.SavException;
import sav.common.core.utils.CollectionBuilder;
import sav.common.core.utils.SingleTimer;
import sav.common.core.utils.StringUtils;
import sav.strategies.vm.AgentVmRunner;
import sav.strategies.vm.VMConfiguration;
import sav.strategies.vm.VMRunner;

/**
* Runner used to abstract the running of the aggre play trace agent
* @author Gabau
*
*/
public class AggrePlayTraceAgentRunner extends AgentVmRunner implements Runnable {

private boolean enableSettingHeapSize = true;
private VMConfiguration configuration;
private static final String VARIABLE_DUMP_FILEPATH= "shared_var.info";
private static final String RECORDING_DUMP_PATH = "recording.info";
public AggrePlayTraceAgentRunner(String agentJar, VMConfiguration vmConfig) {
super(agentJar, AgentConstants.AGENT_OPTION_SEPARATOR, AgentConstants.AGENT_PARAMS_SEPARATOR);
this.configuration = vmConfig;
}

private void setUp() {
this.configuration.setDebug(Settings.isRunWtihDebugMode);
this.configuration.setPort(9000);
}

@Override
protected void buildVmOption(CollectionBuilder<String, ?> builder,
VMConfiguration config) {
builder.appendIf("-Xmx30g", enableSettingHeapSize);
// builder.appendIf("-Xmn10g", enableSettingHeapSize);
builder.appendIf("-XX:+UseG1GC", enableSettingHeapSize);
super.buildVmOption(builder, config);
}

private void runSharedVarDetector() throws SavException {
super.addAgentParam(AgentParams.OPT_SHARED_DETECTION, true);
super.addAgentParam(AgentParams.OPT_DUMP_FILE, VARIABLE_DUMP_FILEPATH);
super.startAndWaitUntilStop(getProgramArgs());
}

/**
* Method used for running the individual concurrent modes.
* @param mode
* @param concDumpFile The path to the conc dump
* @param dumpFile The dump file
* @throws SavException
*/
public void concReplay(String mode, String concDumpFile, String dumpFile) throws SavException {
setUp();
addAgentParam(mode, true);
addAgentParam(AgentParams.OPT_CONC_RECORD_DUMP, concDumpFile);
addAgentParam(AgentParams.OPT_DUMP_FILE, dumpFile);
super.startAndWaitUntilStop(this.configuration);
removeAgentParam(mode);
}

/**
* Run's the three stages of the record and replay
*/
@Override
public void run() {
SingleTimer.start("Aggr");
try {
runSharedVarDetector();
} catch (SavException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}


}

}
7 changes: 7 additions & 0 deletions microbat/src/main/microbat/agent/ExecTraceFileReader.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package microbat.agent;

import java.util.ArrayList;
import java.util.List;
import java.util.Optional;

import microbat.codeanalysis.runtime.PreCheckInformation;
Expand All @@ -11,14 +12,20 @@
public class ExecTraceFileReader {
private String msg;
private Trace trace;
private List<Trace> allTraces;

public Trace read(String execTraceFile) {
RunningInfo info = RunningInfo.readFromFile(execTraceFile);
this.trace = info.getMainTrace();
this.msg = info.getProgramMsg();
this.allTraces = info.getTraceList();
return trace;
}

public List<Trace> getAllTraces() {
return this.allTraces;
}

public PreCheckInformation readPrecheck(String precheckFile) {
PrecheckInfo info = PrecheckInfo.readFromFile(precheckFile);
PreCheckInformation result = new PreCheckInformation(info.getThreadNum(), info.getStepTotal(), info.isOverLong(),
Expand Down
36 changes: 35 additions & 1 deletion microbat/src/main/microbat/agent/TraceAgentRunner.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import microbat.model.trace.Trace;
import microbat.preference.DatabasePreference;
import microbat.trace.Reader;
import microbat.util.MicroBatUtil;
import sav.common.core.SavException;
import sav.common.core.SavRtException;
import sav.common.core.utils.CollectionBuilder;
Expand All @@ -42,6 +43,10 @@ public class TraceAgentRunner extends AgentVmRunner {

private List<Trace> traces;

public void stopRunning() {
super.stop();
}

public TraceAgentRunner(String agentJar, VMConfiguration vmConfig) {
super(agentJar, AgentConstants.AGENT_OPTION_SEPARATOR, AgentConstants.AGENT_PARAMS_SEPARATOR);
this.setConfig(vmConfig);
Expand All @@ -54,6 +59,31 @@ protected void buildVmOption(CollectionBuilder<String, ?> builder, VMConfigurati
builder.appendIf("-XX:+UseG1GC", enableSettingHeapSize);
super.buildVmOption(builder, config);
}

public boolean sharedDetection() throws SavException {
addAgentParam(AgentParams.OPT_SHARED_DETECTION, true);
super.startAndWaitUntilStop(getConfig());
removeAgentParam(AgentParams.OPT_SHARED_DETECTION);
return true;
}

/**
* Method used for running the individual concurrent modes.
* @param mode
* @param concDumpFile The path to the conc dump
* @param dumpFile The dump file
* @throws SavException
*/
public void concReplay(String mode, String concDumpFile, String dumpFile) throws SavException {
addAgentParam(mode, true);
addAgentParam(AgentParams.OPT_CONC_RECORD_DUMP, concDumpFile);
addAgentParam(AgentParams.OPT_DUMP_FILE, dumpFile);
super.startAndWaitUntilStop(getConfig());
removeAgentParam(mode);
removeAgentParam(AgentParams.OPT_DUMP_FILE);
removeAgentParam(AgentParams.OPT_CONC_RECORD_DUMP);
}


public boolean precheck(String filePath) throws SavException {
isPrecheckMode = true;
Expand Down Expand Up @@ -279,8 +309,12 @@ private void updateTestResult(String msg) {
unknownTestResult = true;
return;
}
isTestSuccessful = MicroBatUtil.checkTestResult(msg);
int sIdx = msg.indexOf(";");
isTestSuccessful = Boolean.valueOf(msg.substring(0, sIdx));
if (sIdx < 0 || msg.length() < sIdx) {
unknownTestResult = true;
return;
}
testFailureMessage = msg.substring(sIdx + 1, msg.length());
}

Expand Down
Loading