febdccc
diff -up frysk-0.4/frysk-core/frysk/scopes/Scope.java.skipdecl frysk-0.4/frysk-core/frysk/scopes/Scope.java
febdccc
--- frysk-0.4/frysk-core/frysk/scopes/Scope.java.skipdecl	2010-03-30 14:04:28.000000000 -0400
febdccc
+++ frysk-0.4/frysk-core/frysk/scopes/Scope.java	2010-03-30 14:02:55.000000000 -0400
febdccc
@@ -48,6 +48,7 @@ import lib.dwfl.DwarfDie;
febdccc
 import frysk.debuginfo.DebugInfoFrame;
febdccc
 import frysk.debuginfo.TypeFactory;
febdccc
 import frysk.value.ObjectDeclaration;
febdccc
+import lib.dwfl.DwAt;
febdccc
 
febdccc
 /**
febdccc
  * A class to represent a Scope.
febdccc
@@ -215,14 +216,24 @@ public class Scope
febdccc
   public ObjectDeclaration getDeclaredObjectByName(String name){
febdccc
       
febdccc
       ObjectDeclaration objectDeclaration = null;
febdccc
+      ObjectDeclaration declaration = null;
febdccc
       
febdccc
       Iterator iterator = this.getObjectDeclarations().iterator();
febdccc
       while (iterator.hasNext()) {
febdccc
 	objectDeclaration = (ObjectDeclaration) iterator.next();
febdccc
 	if(objectDeclaration.getName().equals(name)){
febdccc
+	    if (objectDeclaration instanceof Variable
febdccc
+		&& ((Variable)objectDeclaration).getVariableDie().getAttrBoolean(DwAt.DECLARATION)) {
febdccc
+		// If it is only a declaration keep searching;
febdccc
+		// hopefully there's also a definition.
febdccc
+		declaration = objectDeclaration;
febdccc
+		continue;
febdccc
+	    }
febdccc
 	    return objectDeclaration;
febdccc
 	}
febdccc
       }
febdccc
+      if (declaration != null)
febdccc
+	  return declaration;
febdccc
       
febdccc
       iterator = this.getEnums().iterator();
febdccc
       while (iterator.hasNext()) {