Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add functional tests #72

Merged
merged 145 commits into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from 142 commits
Commits
Show all changes
145 commits
Select commit Hold shift + click to select a range
2ad4f9a
Move getGoblintRunProcess().getProcess() to GoblintServer as isAlive()
karoliineh Jan 11, 2024
f767b0f
Move abortAnalysis() to GoblintServer
karoliineh Jan 12, 2024
e2a99c3
Add equals and hash to AnalyzeParams
karoliineh Jan 12, 2024
30d64ca
Extract goblint conf filewatcher to separate class and move refreshGo…
karoliineh Jan 12, 2024
b1136f1
Add junit, mockito and maven-surefire to pom dependencies
karoliineh Jan 12, 2024
b7d55d5
Write test for aborting analysis
karoliineh Jan 12, 2024
69e208e
pom update
anetz02 Jan 12, 2024
01a5699
Merge remote-tracking branch 'origin/refactor-for-testing'
anetz02 Jan 12, 2024
fc08f2b
preAnalyze tests
AnetteTaivere Feb 5, 2024
eb645b7
Remove duplicated junit dependencies from pom
karoliineh Feb 5, 2024
4d3a46f
Fix surefire plugin error by adding junit dependency
karoliineh Feb 5, 2024
7155fde
Remove unused imports
karoliineh Feb 5, 2024
d9c0e83
Add ability to check for logging messages
karoliineh Feb 5, 2024
c1194cf
Format code
karoliineh Feb 5, 2024
dc49ee2
Fix preAnalyseTest
karoliineh Feb 5, 2024
8aed17a
Delete mistakenly committed adb example
karoliineh Feb 5, 2024
94417f3
Check for logging messages and fix `preAnalyseTest` (#1)
karoliineh Feb 12, 2024
24cfc0f
Analysis test changes
AnetteTaivere Feb 12, 2024
1a47a5b
Merge remote-tracking branch 'anette/master' into analysisTests
karoliineh Feb 12, 2024
03b5d7c
Complete incomplete future after test and do not use non-completed fu…
karoliineh Feb 12, 2024
6efbce6
Complete analyzeFailed test
karoliineh Feb 12, 2024
941741d
Fix preAnalyseEmpty test
karoliineh Feb 12, 2024
f8b3e8b
Check for analysis finished in preAnalyseNull test
karoliineh Feb 12, 2024
3bf8747
Test preAnalysis with a command that completes successfully
karoliineh Feb 12, 2024
a386f8b
Complete preAnalyseError test
karoliineh Feb 12, 2024
7d9a842
Fix processListener bug and refactor
karoliineh Feb 12, 2024
ea26a6a
Remove unwanted logging message
karoliineh Feb 12, 2024
04b695b
Merge pull request #2 from AnetteTaivere/analysisTests
AnetteTaivere Feb 13, 2024
0b4e87c
refactoring tests
AnetteTaivere Feb 13, 2024
fbec48c
added comments
AnetteTaivere Feb 13, 2024
e01c525
created abortAnalysisFails test
AnetteTaivere Feb 13, 2024
5cd7a28
Remove unnecessary space and comments that do not apply
karoliineh Feb 14, 2024
7e8d245
Move files and analysisConsumer to global variables
karoliineh Feb 14, 2024
211f4f9
Extract method for mocking that GoblintServer is alive
karoliineh Feb 14, 2024
f4a3b90
JavaDoc
karoliineh Feb 14, 2024
ad3452d
Merge pull request #3 from AnetteTaivere/analysisTests
karoliineh Feb 14, 2024
ccbcf6e
Remove duplicated checks for preAnalyzeCommand
karoliineh Feb 14, 2024
6aaa45d
Merge branch 'analysisTests' into anette-master
karoliineh Feb 14, 2024
45c9a11
Add GobPieConfiguration constructor and builder for all fields
karoliineh Feb 14, 2024
7c83d03
Add equals, hashCode and toStrong to GobPieConfiguration
karoliineh Feb 14, 2024
e65a59a
Complete correct GobPieConf test
karoliineh Feb 14, 2024
bb6e2d2
Add resources folder
karoliineh Feb 14, 2024
3ac7137
added test files, erased static from logger in GobPieConfReader, adde…
AnetteTaivere Feb 19, 2024
fe9beeb
added file, extra field test
AnetteTaivere Feb 19, 2024
abe900f
Made wrong json syntax test
AnetteTaivere Feb 19, 2024
58b2430
test without GoblintConf field
AnetteTaivere Feb 19, 2024
ed1923e
test for default values
AnetteTaivere Feb 19, 2024
7ab526b
Update src/main/java/gobpie/GobPieConfReader.java
AnetteTaivere Feb 21, 2024
5e6d2e8
Update src/test/java/GobPieConfTest.java
AnetteTaivere Feb 21, 2024
c2d7712
Complete testGobPieConfigurationFileMissingInRoot
karoliineh Feb 21, 2024
dd3a117
Complete testGobPieConfigurationWithoutGoblintConfField
karoliineh Feb 21, 2024
d693e25
Add testGobPieConfigurationWithoutGoblintConfField2
karoliineh Feb 21, 2024
c22b46d
Reorder tests
karoliineh Feb 21, 2024
79438cb
Make tempDir private
karoliineh Feb 21, 2024
48676c4
Add sketchy thread sleep hack
karoliineh Feb 21, 2024
9bb9f1d
Rename resources and delete unused
karoliineh Feb 21, 2024
462d1a1
Refactor tests
AnetteTaivere Mar 1, 2024
7168726
Added comments to the tests
AnetteTaivere Mar 1, 2024
30370d2
Deleted temporary random files
AnetteTaivere Mar 1, 2024
37bd7e3
Last conf test fix
AnetteTaivere Mar 5, 2024
f0ab60a
Change comments (* --> **)
AnetteTaivere Mar 5, 2024
f1c60de
Change 2 test description
AnetteTaivere Mar 5, 2024
adc0c57
Configuration with extra field test failed
AnetteTaivere Mar 5, 2024
06eb74a
Add TypeAdapterFactory for validating Gobpie configuration
karoliineh Mar 6, 2024
317a0cc
Merge pull request #5 from AnetteTaivere/gobpie-json-extra-field
AnetteTaivere Mar 6, 2024
fb116d3
Merge pull request #4 from AnetteTaivere/GobPieConfTests
karoliineh Mar 7, 2024
6372cca
Tried to get mock server up
AnetteTaivere Mar 7, 2024
00a6f5c
Reformat
AnetteTaivere Mar 7, 2024
cd822dd
Revert "Reformat"
karoliineh Mar 8, 2024
6dcaf00
Revert "Tried to get mock server up"
karoliineh Mar 8, 2024
13a51cb
Add equals, hashcode and toString methods to GoblintMessagesAnalysisR…
karoliineh Mar 8, 2024
51e63e7
Add testConvertMessagesFromJson
karoliineh Mar 8, 2024
1508b46
Add messagesResponse.json to resources
karoliineh Mar 8, 2024
2f37b22
Add sourcefileURL to GoblintPosition equals and hashcode
karoliineh Mar 8, 2024
91c08c3
Tried convert function from json
AnetteTaivere Mar 11, 2024
20d7159
made test checkGoblintVersionFailed
AnetteTaivere Mar 11, 2024
fead628
Tried to make correct checkGoblintVerion test
AnetteTaivere Mar 11, 2024
3b206be
Added adjustments to function test
AnetteTaivere Mar 11, 2024
7dd5f14
changes in function test
AnetteTaivere Mar 12, 2024
43eaf86
pushed changes that were made in 12.03 meeting
AnetteTaivere Mar 13, 2024
ad9e267
Corrected json function test
AnetteTaivere Mar 13, 2024
3d33c9e
Remove goblintRunCommand field and move its initialization out of con…
karoliineh Mar 13, 2024
af29b1c
Make constructGoblintRunCommand public and complete testStartGoblintS…
karoliineh Mar 13, 2024
bd6a518
Add testStartGoblintServerFailed
karoliineh Mar 13, 2024
a28e87b
Remove goblintExecutable and abstractDebugging from gobpieTest7.json
karoliineh Mar 13, 2024
de86ae5
Merge branch 'goblintServer' of github.com:AnetteTaivere/GobPie_ into…
karoliineh Mar 13, 2024
50fb115
Comment out testConvertFunctionsFromJson for now
karoliineh Mar 13, 2024
28fc3bf
commentent failing test out
AnetteTaivere Mar 15, 2024
fcb6e1b
added comments to dependecies
AnetteTaivere Mar 15, 2024
26f1b15
updated jupiter test dependency
AnetteTaivere Mar 15, 2024
5a2e757
Bugfix: do not explode warnings when group_loc is null
karoliineh Mar 15, 2024
7b7ca94
Merge pull request #8 from AnetteTaivere/explode-bugfix
karoliineh Mar 15, 2024
9f039b9
fixed explode test and added comments
AnetteTaivere Mar 19, 2024
8b59912
added comments
AnetteTaivere Mar 19, 2024
420df80
Tried doing server stopped test
AnetteTaivere Mar 19, 2024
1cd6399
Merge pull request #6 from AnetteTaivere/jsonTests
karoliineh Mar 22, 2024
36241d9
Merge branch 'master' of github.com:AnetteTaivere/GobPie_
karoliineh Mar 22, 2024
4def740
Merge branch 'master' into goblintServer
karoliineh Mar 22, 2024
644a25e
Generalize readGoblintMessagesResponseJson
karoliineh Mar 25, 2024
fee32ce
Refactor function names
karoliineh Mar 25, 2024
99fbf02
Add test to cover converting Piece
karoliineh Mar 25, 2024
9b7b342
Cover GoblintConfWatcher
karoliineh Mar 25, 2024
aea07c9
Move classes related to MagpieServer to magpiebridge package
karoliineh Mar 28, 2024
bfe63de
Move ShowCFGCommand to magpiebridge package
karoliineh Mar 28, 2024
a87c626
Move MessageConsumer and MessageProducer to jsonrpc package
karoliineh Mar 28, 2024
7d583f5
Merge pull request #9 from AnetteTaivere/restructure
karoliineh Mar 28, 2024
c09a789
Merge branch 'master' into goblintServer
karoliineh Mar 28, 2024
026646d
Remove unnecessary comments and debugging stuff
karoliineh Apr 3, 2024
9ae1f23
Restore installGobPie.sh execution permission
karoliineh Apr 3, 2024
b670e58
Configure maven tests not so show sout messages from tests
karoliineh Apr 3, 2024
4ea9dd0
Configure tests not to show OpenJDK 64-Bit Server VM warning
karoliineh Apr 3, 2024
23a07cf
Cleanup GoblitServer tests
karoliineh Apr 3, 2024
9a09e3d
Complete testCheckGoblintVersion
karoliineh Apr 3, 2024
e01c27b
Merge pull request #7 from AnetteTaivere/goblintServerTests
karoliineh Apr 3, 2024
b0adc75
Remove unused methods
karoliineh Apr 3, 2024
3fe053a
Add Jacoco and coverage github workflow to push it to Coveralls (#10)
karoliineh Apr 4, 2024
4993995
Cover 2 more branches in GoblintConfWatcher
karoliineh Apr 4, 2024
ff526a2
Simplify tags toString methods
karoliineh Apr 4, 2024
79bb810
Improve branch coverage in GoblintMessagesResult
karoliineh Apr 4, 2024
b97883a
removed jupiter engine dependency
AnetteTaivere May 6, 2024
ea0a9e6
Revert "removed jupiter engine dependency"
karoliineh May 8, 2024
60b433e
Refactor
karoliineh May 8, 2024
4a66bc3
A failed attempt on using records
karoliineh May 8, 2024
1bdbec7
Hack record with non-primitive booleans
karoliineh May 8, 2024
25fc205
Remove getters from GobPieConfiguration
karoliineh May 8, 2024
b5370d2
Optimize imports
karoliineh May 8, 2024
bbe19ec
Make `GoblintAnalysisResult` a record and add tests for Goblint respo…
karoliineh May 9, 2024
9977cdf
Cover calling analysis with `incrementalAnalysis` set to `false`
karoliineh May 9, 2024
90aaf5a
Make `GoblintFunctionsResult` a record
karoliineh May 9, 2024
84e9f4f
Remove unused getter `getType`
karoliineh May 9, 2024
70cffd4
Convert `GoblintARGResult` and `GoblintCFGResult` classes to records
karoliineh May 10, 2024
3dcb59b
Convert `GoblintCFGLookupResult` class to record
karoliineh May 10, 2024
fd2c64e
Convert `GoblintVarinfo` class to record
karoliineh May 10, 2024
cd2227f
Convert `GoblintLocation` class to record
karoliineh May 10, 2024
be7edca
Remove unused field `startByte`
karoliineh May 10, 2024
fa27f4f
refactor: `.size() == 0` -> `isEmpty()`
karoliineh May 10, 2024
7a1890d
Remove unused import
karoliineh May 10, 2024
fa38aeb
Merge pull request #11 from AnetteTaivere/increase-coverage
AnetteTaivere May 11, 2024
d951514
wrote comments
AnetteTaivere Jun 4, 2024
3ec92ef
added more comments
AnetteTaivere Jun 5, 2024
f9dd036
Delete src/main/java/gobpie/http-client.private.env.json
karoliineh Jun 26, 2024
47905c1
Delete gobpie-0.0.4.vsix:Zone.Identifier
karoliineh Jun 26, 2024
0c3ac9c
Merge branch 'master' into master
karoliineh Jun 26, 2024
42324c1
ArrayUtils -> Collections
karoliineh Jun 26, 2024
986be03
Merge branch 'master' into master
karoliineh Jun 26, 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
36 changes: 36 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: coverage

on:
pull_request:
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'adopt'
cache: maven

- name: Set up Node.js 18
uses: actions/setup-node@v3
with:
node-version: '18.x'

- name: Build with Maven
run: mvn install

- name: Create Jacoco report
run: mvn test jacoco:report

- name: Coveralls
uses: coverallsapp/[email protected]
with:
base-path: src/main/java
file: target/site/jacoco/jacoco.xml
95 changes: 95 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,54 @@
<version>0.0.4-SNAPSHOT</version>
<dependencies>

<!-- https://mvnrepository.com/artifact/ch.qos.logback/logback-classic -->
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.3.14</version>
<scope>test</scope>
</dependency>

<!-- https://mvnrepository.com/artifact/io.github.hakky54/logcaptor -->
<dependency>
<groupId>io.github.hakky54</groupId>
<artifactId>logcaptor</artifactId>
<version>2.9.2</version>
<scope>test</scope>
</dependency>

<!-- https://mvnrepository.com/artifact/org.mockito/mockito-core -->
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>5.8.0</version>
<scope>test</scope>
</dependency>

<!-- https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.10.2</version>
<scope>test</scope>
</dependency>

<!-- https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-engine -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.10.0</version>
<scope>test</scope>
</dependency>

<!-- https://mvnrepository.com/artifact/uk.org.webcompere/system-stubs-jupiter -->
<dependency>
<groupId>uk.org.webcompere</groupId>
<artifactId>system-stubs-jupiter</artifactId>
<version>2.1.6</version>
<scope>test</scope>
</dependency>

<!-- lsp4j DAP -->
<dependency>
<groupId>org.eclipse.lsp4j</groupId>
Expand Down Expand Up @@ -132,6 +180,53 @@
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.2.5</version>
<configuration>
<consoleOutputReporter>
<disable>true</disable>
</consoleOutputReporter>
</configuration>
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.10.0</version>
</dependency>
</dependencies>
</plugin>

<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.12</version>
<configuration>
<excludes>
<exclude>**/abstractdebugging/*</exclude>
<exclude>**/HTTPserver/*</exclude>
<exclude>**/api/jsonrpc/*</exclude>
<exclude>**/magpiebridge/*</exclude>
</excludes>
</configuration>
<executions>
<execution>
<id>prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>default-report</id>
<phase>prepare-package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
4 changes: 2 additions & 2 deletions src/main/java/HTTPserver/GobPieHttpHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,9 @@ private String getCFG(String funName) {
try {
String cfg;
if (funName.equals("<arg>")) {
cfg = goblintService.arg_dot().get().getArg();
cfg = goblintService.arg_dot().get().arg();
} else {
cfg = goblintService.cfg_dot(params).get().getCfg();
cfg = goblintService.cfg_dot(params).get().cfg();
}
return cfg2svg(cfg);
} catch (ExecutionException | InterruptedException e) {
Expand Down
29 changes: 22 additions & 7 deletions src/main/java/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,29 @@
import abstractdebugging.AbstractDebuggingServerLauncher;
import abstractdebugging.ResultsService;
import analysis.GoblintAnalysis;
import analysis.ShowCFGCommand;
import api.GoblintService;
import api.GoblintServiceLauncher;
import api.messages.params.Params;
import goblintserver.GoblintConfWatcher;
import goblintserver.GoblintServer;
import gobpie.GobPieConfReader;
import gobpie.GobPieConfiguration;
import gobpie.GobPieException;
import magpiebridge.GoblintLanguageExtensionHandler;
import magpiebridge.GoblintMagpieServer;
import magpiebridge.GoblintServerConfiguration;
import magpiebridge.ShowCFGCommand;
import magpiebridge.core.MagpieServer;
import magpiebridge.core.ServerAnalysis;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.eclipse.lsp4j.MessageParams;
import org.eclipse.lsp4j.MessageType;
import org.eclipse.lsp4j.jsonrpc.messages.Either;
import util.FileWatcher;

import java.io.File;
import java.nio.file.Path;

public class Main {

Expand All @@ -40,14 +47,17 @@ public static void main(String... args) {
// Connect GoblintService and read configuration
GoblintService goblintService = connectGoblintService(magpieServer, gobpieConfiguration, goblintServer);

// Create file watcher for Goblint configuration
GoblintConfWatcher goblintConfWatcher = getGoblintConfWatcher(magpieServer, goblintService, gobpieConfiguration);

// Add analysis
addAnalysis(magpieServer, gobpieConfiguration, goblintServer, goblintService);
addAnalysis(magpieServer, gobpieConfiguration, goblintServer, goblintService, goblintConfWatcher);

// Launch magpieServer
magpieServer.configurationDone();
log.info("MagpieBridge server launched.");

if (args.length > 0 && gobpieConfiguration.enableAbstractDebugging()) {
if (args.length > 0 && gobpieConfiguration.abstractDebugging()) {
// Launch abstract debugging server
String socketAddress = args[0];
launchAbstractDebuggingServer(socketAddress, goblintService);
Expand Down Expand Up @@ -90,7 +100,7 @@ private static GoblintMagpieServer createMagpieServer() {
*
* @throws GobPieException if running the server start command fails
*/
private static GoblintServer startGoblintServer(MagpieServer magpieServer, GobPieConfiguration gobpieConfiguration) {
public static GoblintServer startGoblintServer(MagpieServer magpieServer, GobPieConfiguration gobpieConfiguration) {
GoblintServer goblintServer = new GoblintServer(magpieServer, gobpieConfiguration);
if (log.isDebugEnabled()) {
log.debug("Goblint version info:\n" + goblintServer.checkGoblintVersion());
Expand All @@ -111,7 +121,7 @@ private static GoblintService connectGoblintService(MagpieServer magpieServer, G
GoblintService goblintService = launcher.connect(goblintServer.getGoblintSocket());

// Read Goblint configurations
goblintService.read_config(new Params(new File(gobpieConfiguration.getGoblintConf()).getAbsolutePath()))
goblintService.read_config(new Params(new File(gobpieConfiguration.goblintConf()).getAbsolutePath()))
.exceptionally(ex -> {
String msg = "Goblint was unable to successfully read the configuration: " + ex.getMessage();
magpieServer.forwardMessageToClient(new MessageParams(MessageType.Warning, msg));
Expand All @@ -123,19 +133,24 @@ private static GoblintService connectGoblintService(MagpieServer magpieServer, G
return goblintService;
}

private static GoblintConfWatcher getGoblintConfWatcher(GoblintMagpieServer magpieServer, GoblintService goblintService, GobPieConfiguration gobpieConfiguration) {
FileWatcher fileWatcher = new FileWatcher(Path.of(gobpieConfiguration.goblintConf()));
return new GoblintConfWatcher(magpieServer, goblintService, gobpieConfiguration, fileWatcher);
}


/**
* Method for creating and adding Goblint analysis to MagpieBridge server.
* <p>
* Creates the GoblintAnalysis classes.
*/
private static void addAnalysis(MagpieServer magpieServer, GobPieConfiguration gobpieConfiguration,
GoblintServer goblintServer, GoblintService goblintService) {
GoblintServer goblintServer, GoblintService goblintService, GoblintConfWatcher goblintConfWatcher) {
// define language
String language = "c";

// add analysis to the MagpieServer
ServerAnalysis serverAnalysis = new GoblintAnalysis(magpieServer, goblintServer, goblintService, gobpieConfiguration);
ServerAnalysis serverAnalysis = new GoblintAnalysis(magpieServer, goblintServer, goblintService, gobpieConfiguration, goblintConfWatcher);
magpieServer.addAnalysis(Either.forLeft(serverAnalysis), language);

// add HTTP server for showing CFGs, only if the option is specified in the configuration
Expand Down
54 changes: 27 additions & 27 deletions src/main/java/abstractdebugging/AbstractDebuggingServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public CompletableFuture<SetBreakpointsResponse> setBreakpoints(SetBreakpointsAr
continue;
}

var targetLocation = new GoblintLocation(goblintSourcePath, breakpoint.getLine(), breakpoint.getColumn() == null ? 0 : breakpoint.getColumn());
var targetLocation = new GoblintLocation(goblintSourcePath, breakpoint.getLine(), breakpoint.getColumn() == null ? 0 : breakpoint.getColumn(), null, null);
CFGNodeInfo cfgNode;
try {
cfgNode = resultsService.lookupCFGNode(targetLocation);
Expand All @@ -152,8 +152,8 @@ public CompletableFuture<SetBreakpointsResponse> setBreakpoints(SetBreakpointsAr
continue;
}
breakpointStatus.setSource(args.getSource());
breakpointStatus.setLine(cfgNode.location().getLine());
breakpointStatus.setColumn(cfgNode.location().getColumn());
breakpointStatus.setLine(cfgNode.location().line());
breakpointStatus.setColumn(cfgNode.location().column());

ConditionalExpression condition;
if (breakpoint.getCondition() == null) {
Expand Down Expand Up @@ -193,11 +193,11 @@ public CompletableFuture<SetBreakpointsResponse> setBreakpoints(SetBreakpointsAr

int startIndex;
for (startIndex = 0; startIndex < breakpoints.size(); startIndex++) {
if (breakpoints.get(startIndex).cfgNode().location().getFile().equals(goblintSourcePath)) {
if (breakpoints.get(startIndex).cfgNode().location().file().equals(goblintSourcePath)) {
break;
}
}
breakpoints.removeIf(b -> b.cfgNode().location().getFile().equals(goblintSourcePath));
breakpoints.removeIf(b -> b.cfgNode().location().file().equals(goblintSourcePath));
breakpoints.addAll(startIndex, newBreakpoints);

var response = new SetBreakpointsResponse();
Expand Down Expand Up @@ -428,10 +428,10 @@ private StepInTarget target(int id, String label, GoblintLocation location) {
var target = new StepInTarget();
target.setId(id);
target.setLabel(label);
target.setLine(location.getLine());
target.setColumn(location.getColumn());
target.setEndLine(location.getEndLine());
target.setEndColumn(location.getEndColumn());
target.setLine(location.line());
target.setColumn(location.column());
target.setEndLine(location.endLine());
target.setEndColumn(location.endColumn());
return target;
}

Expand Down Expand Up @@ -713,7 +713,7 @@ private void runToNextBreakpoint(int direction) {
String stopReason;
GoblintLocation targetLocation;
List<NodeInfo> targetNodes;
if (breakpoints.size() == 0) {
if (breakpoints.isEmpty()) {
stopReason = "entry";
targetLocation = null;
targetNodes = resultsService.lookupNodes(LookupParams.entryPoint());
Expand Down Expand Up @@ -975,13 +975,13 @@ public CompletableFuture<StackTraceResponse> stackTrace(StackTraceArguments args
if (frame.getNode() != null) {
stackFrame.setName((frame.isAmbiguousFrame() ? "? " : "") + (frame.getLocalThreadIndex() != currentThreadId ? "^" : "") + frame.getNode().function() + " " + frame.getNode().nodeId());
var location = frame.getNode().location();
stackFrame.setLine(location.getLine());
stackFrame.setColumn(location.getColumn());
stackFrame.setEndLine(location.getEndLine());
stackFrame.setEndColumn(location.getEndColumn());
stackFrame.setLine(location.line());
stackFrame.setColumn(location.column());
stackFrame.setEndLine(location.endLine());
stackFrame.setEndColumn(location.endColumn());
var source = new Source();
source.setName(location.getFile());
source.setPath(new File(location.getFile()).getAbsolutePath());
source.setName(location.file());
source.setPath(new File(location.file()).getAbsolutePath());
stackFrame.setSource(source);
} else {
stackFrame.setName("No matching path");
Expand Down Expand Up @@ -1011,8 +1011,8 @@ public CompletableFuture<ScopesResponse> scopes(ScopesArguments args) {
JsonObject state = resultsService.lookupState(currentNode.nodeId());
JsonElement globalState = resultsService.lookupGlobalState();
Map<String, GoblintVarinfo> varinfos = resultsService.getVarinfos().stream()
.filter(v -> (v.getFunction() == null || v.getFunction().equals(currentNode.function())) && !"function".equals(v.getRole()))
.collect(Collectors.toMap(GoblintVarinfo::getName, v -> v));
.filter(v -> (v.function() == null || v.function().equals(currentNode.function())) && !"function".equals(v.role()))
.collect(Collectors.toMap(GoblintVarinfo::name, v -> v));

List<Variable> localVariables = new ArrayList<>();
List<Variable> globalVariables = new ArrayList<>();
Expand Down Expand Up @@ -1043,29 +1043,29 @@ public CompletableFuture<ScopesResponse> scopes(ScopesArguments args) {

// Add variables.
for (var varinfo : varinfos.values()) {
if (varinfo.getOriginalName() == null || (varinfo.getFunction() == null && STD_VARIABLES.contains(varinfo.getOriginalName()))) {
if (varinfo.original_name() == null || (varinfo.function() == null && STD_VARIABLES.contains(varinfo.original_name()))) {
// Hide synthetic variables because they are impossible to interpret without looking at the CFG.
// Hide global built-in and standard library variables because they are generally irrelevant and not used in the analysis.
continue;
}

String name = varinfo.getName().equals(varinfo.getOriginalName())
? varinfo.getName()
: varinfo.getOriginalName() + " (" + varinfo.getName() + ")";
JsonElement value = domainValues.get(varinfo.getName());
String name = varinfo.name().equals(varinfo.original_name())
? varinfo.name()
: varinfo.original_name() + " (" + varinfo.name() + ")";
JsonElement value = domainValues.get(varinfo.name());
if (value == null) {
if (varinfo.getFunction() != null) {
if (varinfo.function() != null) {
// Skip local variables that are not present in base domain, because this generally means we are on a special ARG node where local variables are not tracked.
continue;
}
// If domain does not contain variable value use Goblint to evaluate the value.
// This generally happens for global variables in multithreaded mode.
value = resultsService.evaluateExpression(currentNode.nodeId(), varinfo.getName());
value = resultsService.evaluateExpression(currentNode.nodeId(), varinfo.name());
}

List<Variable> scope = varinfo.getFunction() == null ? globalVariables : localVariables;
List<Variable> scope = varinfo.function() == null ? globalVariables : localVariables;

scope.add(domainValueToVariable(name, varinfo.getType(), value));
scope.add(domainValueToVariable(name, varinfo.type(), value));
}

List<Variable> rawVariables = new ArrayList<>();
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/abstractdebugging/ResultsService.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ public List<NodeInfo> lookupNodes(LookupParams params) {
// That looks strange, so we patch it to be only the end of the last line of the function.
// TODO: Maybe it would be better to adjust location when returning stack so the node info retains the original location
return nodeInfo.withLocation(new GoblintLocation(
nodeInfo.location().getFile(),
nodeInfo.location().getEndLine(), nodeInfo.location().getEndColumn(),
nodeInfo.location().getEndLine(), nodeInfo.location().getEndColumn()
nodeInfo.location().file(),
nodeInfo.location().endLine(), nodeInfo.location().endColumn(),
nodeInfo.location().endLine(), nodeInfo.location().endColumn()
));
} else {
return nodeInfo;
Expand Down
Loading