Commit de55342c authored by Mihai Herda's avatar Mihai Herda
Browse files

Fixed bug that was sometimes preventing files to be saved.

parent 9107d8de
...@@ -289,7 +289,8 @@ public class DebugControl { ...@@ -289,7 +289,8 @@ public class DebugControl {
* @throws DIbuggerLogicException * @throws DIbuggerLogicException
*/ */
public void createWatchExpression(int id, String expr) throws DIbuggerLogicException { public void createWatchExpression(int id, String expr) throws DIbuggerLogicException {
while (list_watchExpressions.size() - 1 < id) { System.out.println("Add watch expression: "+id+" "+expr);
while (list_watchExpressions.size() - 1 < id) {
list_watchExpressions.add(null); list_watchExpressions.add(null);
} }
list_watchExpressions.set(id, new WatchExpression(expr)); list_watchExpressions.set(id, new WatchExpression(expr));
...@@ -307,7 +308,8 @@ public class DebugControl { ...@@ -307,7 +308,8 @@ public class DebugControl {
* @throws DIbuggerLogicException * @throws DIbuggerLogicException
*/ */
public void changeWatchExpression(int id, String expr, List<ScopeTuple> scopes) throws DIbuggerLogicException { public void changeWatchExpression(int id, String expr, List<ScopeTuple> scopes) throws DIbuggerLogicException {
if (id < list_watchExpressions.size()) { //System.out.println("Change watch expression: "+id+" to "+expr);
if (id < list_watchExpressions.size()) {
WatchExpression e = list_watchExpressions.get(id); WatchExpression e = list_watchExpressions.get(id);
if (e != null) { if (e != null) {
if (scopes != null) { if (scopes != null) {
...@@ -326,6 +328,7 @@ public class DebugControl { ...@@ -326,6 +328,7 @@ public class DebugControl {
* the id of the watch expression * the id of the watch expression
*/ */
public void deleteWatchExpression(int id) { public void deleteWatchExpression(int id) {
System.out.println("Remove watch expression: "+id);
if (id == list_watchExpressions.size() - 1) { if (id == list_watchExpressions.size() - 1) {
list_watchExpressions.remove(id); list_watchExpressions.remove(id);
} else { } else {
...@@ -581,9 +584,13 @@ public class DebugControl { ...@@ -581,9 +584,13 @@ public class DebugControl {
*/ */
public List<Integer> getWEScopeBegin(int expressionID) { public List<Integer> getWEScopeBegin(int expressionID) {
List<Integer> l = new ArrayList<Integer>(); List<Integer> l = new ArrayList<Integer>();
for (ScopeTuple it : list_watchExpressions.get(expressionID).getScopes()) { System.out.println("Get Expression: "+expressionID);
l.add(it.getStartLine()); System.out.println("From: "+list_watchExpressions);
} if(list_watchExpressions.get(expressionID)!=null) {
for (ScopeTuple it : list_watchExpressions.get(expressionID).getScopes()) {
l.add(it.getStartLine());
}
}
if (l.size() == 0) { if (l.size() == 0) {
for (int i = 0; i < numPrograms; ++i) { for (int i = 0; i < numPrograms; ++i) {
l.add(1); l.add(1);
...@@ -601,9 +608,11 @@ public class DebugControl { ...@@ -601,9 +608,11 @@ public class DebugControl {
*/ */
public List<Integer> getWEScopeEnd(int expressionID) { public List<Integer> getWEScopeEnd(int expressionID) {
List<Integer> l = new ArrayList<Integer>(); List<Integer> l = new ArrayList<Integer>();
for (ScopeTuple it : list_watchExpressions.get(expressionID).getScopes()) { if(list_watchExpressions.get(expressionID)!=null) {
l.add(it.getEndLine()); for (ScopeTuple it : list_watchExpressions.get(expressionID).getScopes()) {
} l.add(it.getEndLine());
}
}
if (l.size() == 0) { if (l.size() == 0) {
for (int i = 0; i < numPrograms; ++i) { for (int i = 0; i < numPrograms; ++i) {
l.add(list_programInput.get(i).getText().split("\n").length); l.add(list_programInput.get(i).getText().split("\n").length);
...@@ -664,9 +673,11 @@ public class DebugControl { ...@@ -664,9 +673,11 @@ public class DebugControl {
*/ */
public List<Integer> getCBScopeBegin(int expressionID) { public List<Integer> getCBScopeBegin(int expressionID) {
List<Integer> l = new ArrayList<Integer>(); List<Integer> l = new ArrayList<Integer>();
for (ScopeTuple it : list_condBreakpoints.get(expressionID).getScopes()) { if(list_condBreakpoints.get(expressionID)!=null) {
l.add(it.getStartLine()); for (ScopeTuple it : list_condBreakpoints.get(expressionID).getScopes()) {
} l.add(it.getStartLine());
}
}
if (l.size() == 0) { if (l.size() == 0) {
for (int i = 0; i < numPrograms; ++i) { for (int i = 0; i < numPrograms; ++i) {
l.add(1); l.add(1);
...@@ -685,9 +696,11 @@ public class DebugControl { ...@@ -685,9 +696,11 @@ public class DebugControl {
*/ */
public List<Integer> getCBScopeEnd(int expressionID) { public List<Integer> getCBScopeEnd(int expressionID) {
List<Integer> l = new ArrayList<Integer>(); List<Integer> l = new ArrayList<Integer>();
for (ScopeTuple it : list_condBreakpoints.get(expressionID).getScopes()) { if(list_condBreakpoints.get(expressionID)!=null) {
l.add(it.getEndLine()); for (ScopeTuple it : list_condBreakpoints.get(expressionID).getScopes()) {
} l.add(it.getEndLine());
}
}
if (l.size() == 0) { if (l.size() == 0) {
for (int i = 0; i < numPrograms; ++i) { for (int i = 0; i < numPrograms; ++i) {
l.add(list_programInput.get(i).getText().split("\n").length); l.add(list_programInput.get(i).getText().split("\n").length);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment