2023-11-19 02:12:44 +03:00
|
|
|
|
package Visual_DVM_2021.Passes.All;
|
2024-10-11 00:00:30 +03:00
|
|
|
|
import Common.Visual.UI_;
|
2024-10-07 00:58:29 +03:00
|
|
|
|
import _VisualDVM.Global;
|
2024-10-10 23:57:36 +03:00
|
|
|
|
import Common.Passes.PassState;
|
2024-10-09 22:01:19 +03:00
|
|
|
|
import _VisualDVM.Visual.Controls.PassControl;
|
2024-10-09 22:21:57 +03:00
|
|
|
|
import _VisualDVM.ProjectData.Files.DBProjectFile;
|
2024-10-09 23:37:58 +03:00
|
|
|
|
import Visual_DVM_2021.Passes.PassCode;
|
2023-11-19 02:12:44 +03:00
|
|
|
|
import Visual_DVM_2021.Passes.SilentSapforPass;
|
2023-09-17 22:13:42 +03:00
|
|
|
|
public class SPF_GetGCovInfo extends SilentSapforPass {
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public String getIconPath() {
|
|
|
|
|
|
return "/icons/NotPick.png";
|
|
|
|
|
|
}
|
|
|
|
|
|
protected String getDoneIconPath() {
|
|
|
|
|
|
return "/icons/Pick.png";
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
2024-10-13 23:55:03 +03:00
|
|
|
|
public boolean hasStats() {
|
2023-09-17 22:13:42 +03:00
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
|
|
|
protected boolean canStart(Object... args) throws Exception {
|
2024-10-11 00:00:30 +03:00
|
|
|
|
if (UI_.Question("Все анализы будут сброшены.Продолжить")) {
|
2023-09-17 22:13:42 +03:00
|
|
|
|
SPF_ParseFilesWithOrder.silent = true;
|
2024-10-13 23:55:03 +03:00
|
|
|
|
return super.canStart(args) && Global.mainModule.getPass(PassCode.GCOV).Do()&& Global.mainModule.getPass(PassCode.SPF_ParseFilesWithOrder).Do();
|
2023-09-17 22:13:42 +03:00
|
|
|
|
}
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
|
|
|
protected void performFinish() throws Exception {
|
|
|
|
|
|
SPF_ParseFilesWithOrder.silent = false;
|
|
|
|
|
|
super.performFinish();
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
|
|
|
protected void performPreparation() throws Exception {
|
|
|
|
|
|
sapfor.cd(target.Home);
|
|
|
|
|
|
target.CleanInterruptFile();
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
|
|
|
protected void body() throws Exception {
|
|
|
|
|
|
sapfor.RunAnalysis(
|
|
|
|
|
|
getSapforPassName(),
|
|
|
|
|
|
-Global.messagesServer.getPort(),
|
|
|
|
|
|
Global.packSapforSettings(),
|
|
|
|
|
|
target.getProjFile().getAbsolutePath());
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
|
|
|
protected void performDone() throws Exception {
|
|
|
|
|
|
if (!sapfor.getResult().isEmpty())
|
|
|
|
|
|
unpack(sapfor.getResult());
|
|
|
|
|
|
}
|
|
|
|
|
|
protected void unpack(String packed) throws Exception {
|
|
|
|
|
|
String[] byFiles = packed.split("@");
|
|
|
|
|
|
for (int z = 0; z < byFiles.length; ++z) {
|
|
|
|
|
|
DBProjectFile cur = target.db.files.get((byFiles[z++]).replace("/", "\\"));
|
|
|
|
|
|
String[] inFile = byFiles[z].split(" ");
|
|
|
|
|
|
for (int k = 0; k < (inFile.length / 2) * 2; k += 2) {
|
|
|
|
|
|
int line = Integer.parseInt(inFile[k]);
|
|
|
|
|
|
long execution = Long.parseLong(inFile[k + 1]);
|
|
|
|
|
|
if (line > 0) {
|
|
|
|
|
|
int v_line = line - 1;
|
|
|
|
|
|
if (!cur.gcov_info.line_info.containsKey(v_line)) {
|
|
|
|
|
|
cur.gcov_info.add_line(v_line,
|
|
|
|
|
|
(execution >= 0) ? execution : 0);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
//завешение настроек.
|
|
|
|
|
|
cur.gcov_info.setup();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void Reset() {
|
|
|
|
|
|
if (state == PassState.Done) {
|
|
|
|
|
|
state = PassState.Inactive;
|
|
|
|
|
|
for (PassControl control: controls)
|
|
|
|
|
|
control.setIcon(getIconPath());
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
|
|
|
protected void showDone() throws Exception {
|
2024-10-13 22:08:13 +03:00
|
|
|
|
if (Global.mainModule.HasFile())
|
|
|
|
|
|
Global.mainModule.getFile().form.ShowGCOV();
|
2023-09-17 22:13:42 +03:00
|
|
|
|
for (PassControl control: controls)
|
|
|
|
|
|
control.setIcon(getDoneIconPath());
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
|
|
|
protected void FocusResult() {
|
2024-10-13 22:08:13 +03:00
|
|
|
|
if (Global.mainModule.HasFile())
|
|
|
|
|
|
Global.mainModule.getFile().form.FocusGCOVLog();
|
2023-09-17 22:13:42 +03:00
|
|
|
|
}
|
|
|
|
|
|
}
|