Skip to content
Browse files

Small fix.

svn path=/trunk/debugger/; revision=120918
  • Loading branch information...
1 parent 673e296 commit af1da2e8bbd1ec3e0bcef34883e0e56bad95c93c Martin Baulig committed Dec 5, 2008
Showing with 11 additions and 2 deletions.
  1. +11 −2 frontend/Expression.cs
View
13 frontend/Expression.cs
@@ -1524,6 +1524,7 @@ protected long DoEvaluate (ScriptingContext context, long lvalue, long rvalue)
private long GetValue (ScriptingContext context, Expression expr)
{
object val = expr.Evaluate (context);
+ again:
if (val is int)
return (long) (int) val;
else if (val is uint)
@@ -1535,8 +1536,14 @@ private long GetValue (ScriptingContext context, Expression expr)
else if (val is TargetPointerObject) {
TargetPointerObject pobj = (TargetPointerObject) val;
return pobj.GetAddress (context.CurrentThread).Address;
- } else
- throw new ScriptingException ("Cannot evaluate expression `{0}'", expr);
+ } else if (val is TargetFundamentalObject) {
+ TargetFundamentalObject fobj = (TargetFundamentalObject) val;
+ val = fobj.GetObject (context.CurrentThread);
+ if (!(val is TargetFundamentalObject))
+ goto again;
+ }
+
+ throw new ScriptingException ("Cannot evaluate expression `{0}'", expr.Name);
}
protected override object DoEvaluate (ScriptingContext context)
@@ -1547,6 +1554,8 @@ protected override object DoEvaluate (ScriptingContext context)
try {
long retval = DoEvaluate (context, lvalue, rvalue);
return new NumberExpression (retval);
+ } catch (DivideByZeroException) {
+ throw new ScriptingException ("DivisionByZero");
} catch {
throw new ScriptingException ("Cannot evaluate expression `{0}'", Name);
}

0 comments on commit af1da2e

Please sign in to comment.
Something went wrong with that request. Please try again.