++
фикс падения при поиске зависимостей
This commit is contained in:
@@ -3,7 +3,7 @@ import Common.Utils.Vector_;
|
||||
|
||||
import java.util.Vector;
|
||||
public class Constants {
|
||||
public static final int version = 1243;
|
||||
public static final int version = 1244;
|
||||
public static final int planner_version = 24;
|
||||
public static final int testingMaxKernels = 64;
|
||||
//--
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
package _VisualDVM.Passes.All;
|
||||
import Common.Passes.PassState;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Visual.Controls.PassControl;
|
||||
import Common.Visual.UI;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.Passes.PassCode;
|
||||
import _VisualDVM.Passes.Sapfor.SilentSapforPass;
|
||||
import _VisualDVM.ProjectData.Files.DBProjectFile;
|
||||
import _VisualDVM.ProjectData.SapforData.GCOV.FileGCOVJson;
|
||||
import _VisualDVM.ProjectData.SapforData.GCOV.GCOVJson;
|
||||
import _VisualDVM.ProjectData.SapforData.GCOV.LineGCOVJson;
|
||||
public class SPF_GetGCovInfo extends SilentSapforPass {
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
@@ -50,24 +54,44 @@ public class SPF_GetGCovInfo extends SilentSapforPass {
|
||||
unpack(sapfor.getResult());
|
||||
}
|
||||
protected void unpack(String packed) throws Exception {
|
||||
GCOVJson allJson = Utils_.gson.fromJson(packed, GCOVJson.class);
|
||||
for (FileGCOVJson fileJson: allJson.allGCOV){
|
||||
fileJson.file = Utils_.toW(fileJson.file);
|
||||
//--
|
||||
DBProjectFile projectFile = target.db.files.get(fileJson.file);
|
||||
for (LineGCOVJson lineJson: fileJson.lines){
|
||||
if (lineJson.line > 0) {
|
||||
int v_line = lineJson.line - 1;
|
||||
if (!projectFile.gcov_info.line_info.containsKey(v_line)) {
|
||||
projectFile.gcov_info.add_line(v_line,
|
||||
(lineJson.execution >= 0) ? lineJson.execution : 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
//завешение настроек.
|
||||
projectFile.gcov_info.setup();
|
||||
}
|
||||
/*
|
||||
String[] byFiles = packed.split("@");
|
||||
for (int z = 0; z < byFiles.length; ++z) {
|
||||
DBProjectFile cur = target.db.files.get((byFiles[z++]).replace("/", "\\"));
|
||||
DBProjectFile projectFile = 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,
|
||||
if (!projectFile.gcov_info.line_info.containsKey(v_line)) {
|
||||
projectFile.gcov_info.add_line(v_line,
|
||||
(execution >= 0) ? execution : 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
//завешение настроек.
|
||||
cur.gcov_info.setup();
|
||||
projectFile.gcov_info.setup();
|
||||
}
|
||||
*/
|
||||
}
|
||||
@Override
|
||||
public void Reset() {
|
||||
|
||||
@@ -38,26 +38,38 @@ public class SPF_GetIncludeDependencies extends SapforAnalysis {
|
||||
IncludesJson includesJson = Utils_.gson.fromJson(packed, IncludesJson.class);
|
||||
update_current = false;
|
||||
for (FileIncludesJson fileIncludesJson : includesJson.allIncludes) {
|
||||
//-
|
||||
fileIncludesJson.file = Utils_.toW(fileIncludesJson.file);
|
||||
//--
|
||||
FileInfo fileInfo = new FileInfo(fileIncludesJson.file);
|
||||
//---
|
||||
DBProjectFile file = target.db.files.get(fileIncludesJson.file);
|
||||
System.out.println("addicted file = "+Utils_.Brackets(fileIncludesJson.file));
|
||||
System.out.println("found dependencies :"+fileIncludesJson.includes.size());
|
||||
for (Include include : fileIncludesJson.includes) {
|
||||
//--
|
||||
include.dependencyFileName = Utils_.toW(include.dependencyFileName);
|
||||
//--
|
||||
fileInfo.dependencies.add(include);
|
||||
if (!target.allIncludes.contains(include.file))
|
||||
target.allIncludes.add(include.file);
|
||||
//- определение типов языков инклудов по файлу куда они цепляютс.
|
||||
if (!file.dependencies.contains(include.dependencyFileName)) {
|
||||
file.dependencies.add(include.dependencyFileName);
|
||||
//---
|
||||
DBProjectFile include_file = target.db.files.get(include.dependencyFileName);
|
||||
include_file.UpdateType(FileType.header);
|
||||
if (include_file.languageName == LanguageName.n)
|
||||
include_file.UpdateLanguage(file.languageName);
|
||||
if (include_file.style == LanguageStyle.none)
|
||||
include_file.UpdateStyle(file.style);
|
||||
if (Global.mainModule.HasFile() && Global.mainModule.getFile().name.equals(include_file.name))
|
||||
update_current = true;
|
||||
if (target.db.files.containsKey(include.dependencyFileName)){
|
||||
//- определение типов языков инклудов по файлу куда они цепляютс.
|
||||
if (!file.dependencies.contains(include.dependencyFileName)) {
|
||||
file.dependencies.add(include.dependencyFileName);
|
||||
//---
|
||||
DBProjectFile include_file = target.db.files.get(include.dependencyFileName);
|
||||
include_file.UpdateType(FileType.header);
|
||||
if (include_file.languageName == LanguageName.n)
|
||||
include_file.UpdateLanguage(file.languageName);
|
||||
if (include_file.style == LanguageStyle.none)
|
||||
include_file.UpdateStyle(file.style);
|
||||
if (Global.mainModule.HasFile() && Global.mainModule.getFile().name.equals(include_file.name))
|
||||
update_current = true;
|
||||
}
|
||||
|
||||
}else {
|
||||
System.out.println(Utils_.Brackets(include.dependencyFileName)+" не существует!");
|
||||
}
|
||||
}
|
||||
//----
|
||||
|
||||
11
src/_VisualDVM/ProjectData/SapforData/GCOV/FileGCOVJson.java
Normal file
11
src/_VisualDVM/ProjectData/SapforData/GCOV/FileGCOVJson.java
Normal file
@@ -0,0 +1,11 @@
|
||||
package _VisualDVM.ProjectData.SapforData.GCOV;
|
||||
import com.google.gson.annotations.Expose;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
public class FileGCOVJson {
|
||||
@Expose
|
||||
public String file; //имя файла.
|
||||
@Expose
|
||||
public List<LineGCOVJson> lines = new Vector<>();
|
||||
}
|
||||
9
src/_VisualDVM/ProjectData/SapforData/GCOV/GCOVJson.java
Normal file
9
src/_VisualDVM/ProjectData/SapforData/GCOV/GCOVJson.java
Normal file
@@ -0,0 +1,9 @@
|
||||
package _VisualDVM.ProjectData.SapforData.GCOV;
|
||||
import com.google.gson.annotations.Expose;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
public class GCOVJson {
|
||||
@Expose
|
||||
public List<FileGCOVJson> allGCOV= new Vector<>();
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package _VisualDVM.ProjectData.SapforData.GCOV;
|
||||
import com.google.gson.annotations.Expose;
|
||||
public class LineGCOVJson {
|
||||
@Expose
|
||||
public int line; //строка
|
||||
@Expose
|
||||
public long execution; //число выполнений
|
||||
}
|
||||
Reference in New Issue
Block a user