Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
ProofScriptParser
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
24
Issues
24
List
Boards
Labels
Service Desk
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sarah.grebing
ProofScriptParser
Commits
6d63218c
Commit
6d63218c
authored
Oct 31, 2017
by
Alexander Weigl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add function for post mortem debugging
parent
014a9c1a
Pipeline
#15052
failed with stage
in 1 minute and 58 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
2 deletions
+50
-2
rt/src/main/java/edu/kit/iti/formal/psdbg/interpreter/dbg/PTreeNode.java
...a/edu/kit/iti/formal/psdbg/interpreter/dbg/PTreeNode.java
+14
-1
rt/src/main/java/edu/kit/iti/formal/psdbg/interpreter/dbg/ProofTreeManager.java
...it/iti/formal/psdbg/interpreter/dbg/ProofTreeManager.java
+36
-1
No files found.
rt/src/main/java/edu/kit/iti/formal/psdbg/interpreter/dbg/PTreeNode.java
View file @
6d63218c
...
...
@@ -51,6 +51,8 @@ public class PTreeNode<T> {
@Nullable
private
PTreeNode
<
T
>
stepReturn
;
private
int
order
;
public
void
connectStepOver
(
PTreeNode
<
T
>
jumpOverTo
)
{
setStepOver
(
jumpOverTo
);
jumpOverTo
.
setStepInvOver
(
this
);
...
...
@@ -68,7 +70,8 @@ public class PTreeNode<T> {
public
List
<
PTreeNode
<
T
>>
getContextNodes
()
{
List
<
PTreeNode
<
T
>>
contextNodes
=
new
ArrayList
<>(
context
.
length
);
PTreeNode
<
T
>
cur
=
this
;
outer
:
do
{
outer:
do
{
// add the current node, and every node that can be reached by an inverse into pointer.
contextNodes
.
add
(
cur
);
...
...
@@ -96,4 +99,14 @@ public class PTreeNode<T> {
public
String
toString
()
{
return
getSingleRepresentation
();
}
/**
* Calculate a span of bytes of the syntactical representation.
* @return
*/
int
getSyntaxWidth
()
{
return
getStatement
().
getRuleContext
().
stop
.
getStopIndex
()
-
getStatement
().
getRuleContext
().
start
.
getStartIndex
();
}
}
\ No newline at end of file
rt/src/main/java/edu/kit/iti/formal/psdbg/interpreter/dbg/ProofTreeManager.java
View file @
6d63218c
...
...
@@ -11,7 +11,9 @@ import org.apache.logging.log4j.Logger;
import
javax.annotation.Nonnull
;
import
javax.annotation.Nullable
;
import
java.util.*
;
import
java.util.concurrent.atomic.AtomicInteger
;
import
java.util.function.Consumer
;
import
java.util.stream.Collectors
;
/**
* Class controlling and maintaining proof tree structure for debugger
...
...
@@ -21,6 +23,7 @@ import java.util.function.Consumer;
*/
public
class
ProofTreeManager
<
T
>
{
private
static
final
Logger
LOGGER
=
LogManager
.
getLogger
(
ProofTreeManager
.
class
);
@Getter
private
final
List
<
Consumer
<
PTreeNode
<
T
>>>
statePointerListener
=
new
ArrayList
<>(
2
);
...
...
@@ -35,10 +38,19 @@ public class ProofTreeManager<T> {
@Setter
@Nullable
private
final
MutableValueGraph
<
ControlFlowNode
,
ControlFlowTypes
>
controlFlowGraph
;
@Getter
private
final
Set
<
PTreeNode
<
T
>>
nodes
=
new
HashSet
<>();
@Getter
@Setter
private
boolean
suppressStatePointerListener
=
false
;
/**
* Counting the receive order of {@link PTreeNode}
*/
@Getter
@Setter
private
AtomicInteger
counter
=
new
AtomicInteger
();
/**
* Pointer to current selected state in graph
*/
...
...
@@ -58,6 +70,7 @@ public class ProofTreeManager<T> {
* @param node
*/
public
void
receiveNode
(
@Nonnull
PTreeNode
<
T
>
node
)
{
node
.
setOrder
(
counter
.
incrementAndGet
());
LOGGER
.
info
(
"Tree received new node: {}"
,
node
);
//we got a deeper in the AST
int
ctxLength
=
node
.
getContext
().
length
;
...
...
@@ -68,7 +81,7 @@ public class ProofTreeManager<T> {
pushContext
();
intoCurrentContext
(
node
);
// step into happens
assert
statePointer
!=
null
:
"We are in a sub context, so where had to be a statePointer!"
;
assert
statePointer
!=
null
:
"We are in a sub context, so where had to be a statePointer!"
;
statePointer
.
connectStepInto
(
node
);
}
...
...
@@ -160,4 +173,26 @@ public class ProofTreeManager<T> {
statePointerListener
.
forEach
(
l
->
l
.
accept
(
statePointer
));
}
public
List
<
PTreeNode
<
T
>>
getNarrowNodesToTextPosition
(
int
textPosition
)
{
synchronized
(
nodes
)
{
List
<
PTreeNode
<
T
>>
candidates
=
nodes
.
stream
()
// filter by the context
.
filter
(
n
->
n
.
getStatement
().
getRuleContext
().
start
.
getStartIndex
()
<=
textPosition
&&
textPosition
<=
n
.
getStatement
().
getRuleContext
().
stop
.
getStopIndex
())
.
collect
(
Collectors
.
toList
());
Comparator
<
PTreeNode
<
T
>>
widthCmp
=
Comparator
.
comparingInt
(
PTreeNode:
:
getSyntaxWidth
);
Comparator
<
PTreeNode
<
T
>>
orderCmp
=
Comparator
.
comparingInt
(
PTreeNode:
:
getOrder
);
candidates
.
sort
((
o1
,
o2
)
->
{
int
cmp
=
widthCmp
.
compare
(
o1
,
o2
);
if
(
cmp
==
0
)
return
orderCmp
.
compare
(
o1
,
o2
);
return
cmp
;
});
return
candidates
;
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment