• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

goblint / GobPie / 10849225681

13 Sep 2024 12:36PM UTC coverage: 58.196%. First build
10849225681

Pull #75

github

web-flow
Merge b60d6ba24 into ce3a02340
Pull Request #75: Show value of lval in step into targets' options

123 of 237 branches covered (51.9%)

Branch coverage included in aggregate %.

0 of 2 new or added lines in 1 file covered. (0.0%)

406 of 672 relevant lines covered (60.42%)

2.74 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/main/java/api/messages/GoblintARGLookupResult.java
1
package api.messages;
2

3
import abstractdebugging.CFGEdgeInfo;
4
import abstractdebugging.FunctionCallEdgeInfo;
5
import abstractdebugging.NodeInfo;
6
import com.google.gson.JsonElement;
7
import com.google.gson.JsonObject;
8
import com.google.gson.annotations.SerializedName;
9

10
import java.util.List;
11

12
/**
13
 * @since 0.0.4
14
 */
15

16
public class GoblintARGLookupResult {
×
17

18
    private String node;
19
    private String cfg_node;
20
    private String context;
21
    private String path;
22
    private GoblintLocation location;
23
    private String function;
24

25
    private List<Edge> prev;
26
    private List<Edge> next;
27

28
    public static class Edge {
×
29
        private Properties edge;
30

31
        private String node;
32
        private String cfg_node;
33
        private String context;
34
        private String path;
35
        private GoblintLocation location;
36
        private String function;
37

38
        public static class Properties {
×
39
            private JsonObject cfg;
40
            private JsonObject inlined;
41

42
            @SerializedName("return")
43
            private FunctionCall ret;
44
            private FunctionCall entry;
45
            private FunctionCall thread;
46

47
            public static class FunctionCall {
×
48
                JsonElement function;
49
                List<JsonElement> args;
50
                JsonElement lval;
51
            }
52
        }
53
    }
54

55
    public NodeInfo toNodeInfo() {
56
        NodeInfo nodeInfo = new NodeInfo(node, cfg_node, context, path, location, function);
×
57
        mapEdges(prev, nodeInfo.incomingCFGEdges(), nodeInfo.incomingReturnEdges(), nodeInfo.incomingEntryEdges());
×
58
        mapEdges(next, nodeInfo.outgoingCFGEdges(), nodeInfo.outgoingReturnEdges(), nodeInfo.outgoingEntryEdges());
×
59
        return nodeInfo;
×
60
    }
61

62
    private static void mapEdges(List<Edge> edges, List<CFGEdgeInfo> cfgEdges, List<FunctionCallEdgeInfo> returnEdges, List<FunctionCallEdgeInfo> entryEdges) {
63
        for (var edge : edges) {
×
64
            if (edge.edge.cfg != null || edge.edge.inlined != null) {
×
65
                var properties = edge.edge.cfg != null ? edge.edge.cfg : edge.edge.inlined;
×
NEW
66
                var lval = properties.get("lval");
×
67
                CFGEdgeInfo edgeInfo = new CFGEdgeInfo(edge.node, edge.cfg_node, edge.context, edge.path,
×
NEW
68
                        properties.get("string").getAsString(), lval == null || lval.isJsonNull() ? null : lval.getAsString());
×
69
                cfgEdges.add(edgeInfo);
×
70
            } else if (edge.edge.ret != null) {
×
71
                var properties = edge.edge.ret;
×
72
                FunctionCallEdgeInfo edgeInfo = new FunctionCallEdgeInfo(edge.node, edge.cfg_node, edge.context, edge.path,
×
73
                        toPrettyString(properties.function), properties.args.stream().map(GoblintARGLookupResult::toPrettyString).toList(), false);
×
74
                returnEdges.add(edgeInfo);
×
75
            } else if (edge.edge.entry != null) {
×
76
                var properties = edge.edge.entry;
×
77
                FunctionCallEdgeInfo edgeInfo = new FunctionCallEdgeInfo(edge.node, edge.cfg_node, edge.context, edge.path,
×
78
                        toPrettyString(properties.function), properties.args.stream().map(GoblintARGLookupResult::toPrettyString).toList(), false);
×
79
                entryEdges.add(edgeInfo);
×
80
            } else if (edge.edge.thread != null) {
×
81
                var properties = edge.edge.thread;
×
82
                FunctionCallEdgeInfo edgeInfo = new FunctionCallEdgeInfo(edge.node, edge.cfg_node, edge.context, edge.path,
×
83
                        toPrettyString(properties.function), properties.args.stream().map(GoblintARGLookupResult::toPrettyString).toList(), true);
×
84
                entryEdges.add(edgeInfo);
×
85
            } else {
×
86
                throw new IllegalStateException("Unknown edge type: " + edge);
×
87
            }
88
        }
×
89
    }
×
90

91
    private static String toPrettyString(JsonElement value) {
92
        if (value.isJsonPrimitive()) {
×
93
            return value.getAsString();
×
94
        } else {
95
            return value.toString();
×
96
        }
97
    }
98

99
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc