public inbox for frysk-cvs@sourceware.org
help / color / mirror / Atom feed
* [SCM]  master: swagiaal: ObjectDeclarationSearchEngine.getObject() now returns a list.
@ 2008-05-15 17:58 swagiaal
  0 siblings, 0 replies; only message in thread
From: swagiaal @ 2008-05-15 17:58 UTC (permalink / raw)
  To: frysk-cvs

The branch, master has been updated
       via  81003a670512fe3159da26fbe8a316ab8c9d5fc5 (commit)
      from  68ecf35fae470a998e8d519094ab623822547b18 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email.

- Log -----------------------------------------------------------------
commit 81003a670512fe3159da26fbe8a316ab8c9d5fc5
Author: Sami Wagiaalla <swagiaal@redhat.com>
Date:   Thu May 15 13:46:15 2008 -0400

    swagiaal: ObjectDeclarationSearchEngine.getObject() now returns a list.
    
    frysk-core/frysk/debuginfo/ChangeLog
    +2008-05-15  Sami Wagiaalla  <swagiaal@redhat.com>
    +
    +	* ObjectDeclarationSearchEngine.java (getObject):
    +	Now returns a list.
    +	* TestObjectDeclarationSearchEngineTopDown.java: Updated.
    +
    
    frysk-core/frysk/hpd/ChangeLog
    +2008-05-15  Sami Wagiaalla  <swagiaal@redhat.com>
    +
    +	ObjectDeclarationSearchEngine.getObject() now returns a list.
    +	* BreakpointCommand.java: Updated.
    +	* ListCommand.java: Updated.
    +
    
    frysk-core/frysk/rt/ChangeLog
    +2008-05-15  Sami Wagiaalla  <swagiaal@redhat.com>
    +
    +	* FunctionBreakpoint.java: Added comment.
    +

-----------------------------------------------------------------------

Summary of changes:
 frysk-core/frysk/debuginfo/ChangeLog               |    6 ++
 .../debuginfo/ObjectDeclarationSearchEngine.java   |   48 ++++++-------
 .../TestObjectDeclarationSearchEngineTopDown.java  |   12 +--
 frysk-core/frysk/hpd/BreakpointCommand.java        |   79 +++++++++++++-------
 frysk-core/frysk/hpd/ChangeLog                     |    6 ++
 frysk-core/frysk/hpd/ListCommand.java              |   31 ++++----
 frysk-core/frysk/rt/ChangeLog                      |    4 +
 frysk-core/frysk/rt/FunctionBreakpoint.java        |    2 +
 8 files changed, 110 insertions(+), 78 deletions(-)

First 500 lines of diff:
diff --git a/frysk-core/frysk/debuginfo/ChangeLog b/frysk-core/frysk/debuginfo/ChangeLog
index c91a411..55f79d4 100644
--- a/frysk-core/frysk/debuginfo/ChangeLog
+++ b/frysk-core/frysk/debuginfo/ChangeLog
@@ -1,3 +1,9 @@
+2008-05-15  Sami Wagiaalla  <swagiaal@redhat.com>
+
+	* ObjectDeclarationSearchEngine.java (getObject): 
+	Now returns a list.
+	* TestObjectDeclarationSearchEngineTopDown.java: Updated.
+
 2008-05-14  Sami Wagiaalla  <swagiaal@redhat.com>
 
 	* TestObjectDeclarationSearchEngineTopDown.java
diff --git a/frysk-core/frysk/debuginfo/ObjectDeclarationSearchEngine.java b/frysk-core/frysk/debuginfo/ObjectDeclarationSearchEngine.java
index 71cf9fd..73833d1 100644
--- a/frysk-core/frysk/debuginfo/ObjectDeclarationSearchEngine.java
+++ b/frysk-core/frysk/debuginfo/ObjectDeclarationSearchEngine.java
@@ -97,9 +97,9 @@ public class ObjectDeclarationSearchEngine implements ExprSymTab{
      * [file#]name
      *    
      */
-    public ObjectDeclaration getObject(String name) {
+    public LinkedList getObject(String name) {
 	
-	ObjectDeclaration result = null;
+	LinkedList results = new LinkedList();
 	
 	DwarfDie cu;
 	String symbol;
@@ -113,42 +113,38 @@ public class ObjectDeclarationSearchEngine implements ExprSymTab{
 	if(names.length == 2){
 	    LinkedList cuDies = dwarf.getCUByName(names[0]);
 
-	    if(cuDies.size() == 0){
-		throw new ObjectDeclarationNotFoundException(names[0]);
-	    }else{
-		//XXX: modify this to use the entire list.
-		cu = (DwarfDie) cuDies.getFirst();
+	    Iterator iterator = cuDies.iterator();
+	    while (iterator.hasNext()) {
+		
+		cu = (DwarfDie) iterator.next();
+		    
+		symbol = names[1];
+		
+		Scope scope = ScopeFactory.theFactory.getScope(cu, typeFactory);
+		results.add(scope.getDeclaredObjectByNameRecursive(symbol));
 	    }
 	    
-	    symbol = names[1];
-	    
-	    Scope scope = ScopeFactory.theFactory.getScope(cu, typeFactory);
-	    result =  scope.getDeclaredObjectByNameRecursive(symbol);
 	}
 	
 	if (names.length == 1) {
 	    DwarfDie resultDie = DwarfDie.getDecl(dwarf, name);
 
-	    if (resultDie == null)
-		throw new ObjectDeclarationNotFoundException(name);
-
-	    try {
-		result = (ObjectDeclaration) ScopeFactory.theFactory.getScope(
-			resultDie, typeFactory);
-	    } catch (IllegalArgumentException e) {
+	    if (resultDie != null){
+		
 		try {
-		    result = new Variable(resultDie);
-		} catch (Exception e2) {
-		    throw new ObjectDeclarationNotFoundException(name);
+		    results.add((ObjectDeclaration) ScopeFactory.theFactory.getScope(
+			    resultDie, typeFactory));
+		} catch (IllegalArgumentException e) {
+		    try {
+			results.add(new Variable(resultDie));
+		    } catch (Exception e2) {
+			
+		    }
 		}
 	    }
 	}
 	
-	if (result == null) {
-	    throw new ObjectDeclarationNotFoundException(name);
-	}
-	
-	return result;
+	return results;
     }
  
     /**
diff --git a/frysk-core/frysk/debuginfo/TestObjectDeclarationSearchEngineTopDown.java b/frysk-core/frysk/debuginfo/TestObjectDeclarationSearchEngineTopDown.java
index 2c50104..1d42ea9 100644
--- a/frysk-core/frysk/debuginfo/TestObjectDeclarationSearchEngineTopDown.java
+++ b/frysk-core/frysk/debuginfo/TestObjectDeclarationSearchEngineTopDown.java
@@ -43,7 +43,6 @@ import java.io.File;
 
 import frysk.config.Prefix;
 import frysk.proc.Task;
-import frysk.scopes.Variable;
 import frysk.testbed.DaemonBlockedAtSignal;
 import frysk.testbed.TestLib;
 import frysk.testbed.TestfileTokenScanner;
@@ -103,7 +102,7 @@ public class TestObjectDeclarationSearchEngineTopDown extends TestLib {
 		.createVirtualStackTrace(task);
 	objectDeclarationSearchEngine = new ObjectDeclarationSearchEngine(frame);
 	ObjectDeclaration objectDeclaration = (ObjectDeclaration) objectDeclarationSearchEngine
-		.getObject(objectName);
+		.getObject(objectName).getFirst();
 
 	assertNotNull("Variable found", objectDeclaration);
 	assertTrue("Correct name", objectName.endsWith(objectDeclaration.getName()));
@@ -111,13 +110,8 @@ public class TestObjectDeclarationSearchEngineTopDown extends TestLib {
 		objectLine, objectDeclaration.getSourceLocation().getLine());
 
 	// Negative test:
-	try {
-	    objectDeclaration = (Variable) objectDeclarationSearchEngine
-		    .getObject("NOT" + objectName);
-	    assertTrue("Exception was not thrown", false);
-	} catch (ObjectDeclarationNotFoundException e) {
-	    // exception was thrown
-	}
+	assertTrue("Object was not found ", objectDeclarationSearchEngine.getObject("NOT" + objectName).size() == 0);
+	
     }
 
 }
diff --git a/frysk-core/frysk/hpd/BreakpointCommand.java b/frysk-core/frysk/hpd/BreakpointCommand.java
index dad847b..d6fcbc8 100644
--- a/frysk-core/frysk/hpd/BreakpointCommand.java
+++ b/frysk-core/frysk/hpd/BreakpointCommand.java
@@ -42,6 +42,7 @@ package frysk.hpd;
 import java.io.PrintWriter;
 import java.util.HashMap;
 import java.util.Iterator;
+import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
 
@@ -83,7 +84,7 @@ class BreakpointCommand extends ParameterizedCommand {
 
 	public void deletedFrom(Object observable) {
 	}
-
+ 
 	public abstract void updateHit(SourceBreakpoint bpt, Task task,
                                        long address);
     }
@@ -145,33 +146,57 @@ class BreakpointCommand extends ParameterizedCommand {
 		ObjectDeclarationSearchEngine declarationSearchEngine = new ObjectDeclarationSearchEngine(frame);
 		
 		if (declarationSearchEngine != null) {
-		    ObjectDeclaration die;
-		    try {
-			die = declarationSearchEngine.getObject(breakpt);
-		    } catch (RuntimeException e) {
-			// Symbol not yet visible.
-			die = null;
+		    
+		    LinkedList objects = declarationSearchEngine.getObject(breakpt);
+		    
+		    if(objects.size() > 0){
+		    Iterator iterator = objects.iterator();
+		    
+		    while (iterator.hasNext()) {			
+			ObjectDeclaration function = (ObjectDeclaration) iterator.next();
+			actionpoint = bpManager.addFunctionBreakpoint(breakpt, function);
+			actionpoint.addObserver(new CLIBreakpointObserver() {
+			    public void updateHit(final SourceBreakpoint bpt,
+				    Task task, final long address) {
+				// See comment in case above.
+				Manager.eventLoop.add(new Event() {
+				    public void execute() {
+					FunctionBreakpoint fbpt
+                                        = (FunctionBreakpoint) bpt;
+                                    outWriter.print("Breakpoint ");
+                                    outWriter.print(fbpt.getId());
+                                    outWriter.print(" ");
+                                    outWriter.print(fbpt.getName());
+                                    outWriter.print(" 0x");
+                                    outWriter.println(Long.toHexString(address));
+				    }
+				});
+			    }
+			});
+			bptMap.put(task, actionpoint);
 		    }
-		    actionpoint = bpManager.addFunctionBreakpoint(breakpt, die);
-		    actionpoint.addObserver(new CLIBreakpointObserver() {
-			public void updateHit(final SourceBreakpoint bpt,
-                                              Task task, final long address) {
-                            // See comment in case above.
-                            Manager.eventLoop.add(new Event() {
-                                    public void execute() {
-                                        FunctionBreakpoint fbpt
-                                            = (FunctionBreakpoint) bpt;
-                                        outWriter.print("Breakpoint ");
-                                        outWriter.print(fbpt.getId());
-                                        outWriter.print(" ");
-                                        outWriter.print(fbpt.getName());
-                                        outWriter.print(" 0x");
-                                        outWriter.println(Long.toHexString(address));
-                                    }
-                                });
-			}
-		    });
-		    bptMap.put(task, actionpoint);
+		    }else{
+		    actionpoint = bpManager.addFunctionBreakpoint(breakpt, null);
+			actionpoint.addObserver(new CLIBreakpointObserver() {
+			    public void updateHit(final SourceBreakpoint bpt,
+				    Task task, final long address) {
+				// See comment in case above.
+				Manager.eventLoop.add(new Event() {
+				    public void execute() {
+					FunctionBreakpoint fbpt
+                                        = (FunctionBreakpoint) bpt;
+                                    outWriter.print("Breakpoint ");
+                                    outWriter.print(fbpt.getId());
+                                    outWriter.print(" ");
+                                    outWriter.print(fbpt.getName());
+                                    outWriter.print(" 0x");
+                                    outWriter.println(Long.toHexString(address));
+				    }
+				});
+			    }
+			});
+			bptMap.put(task, actionpoint);
+		}
 		}
 	    }
 	}
diff --git a/frysk-core/frysk/hpd/ChangeLog b/frysk-core/frysk/hpd/ChangeLog
index f97cb00..4d0fd14 100644
--- a/frysk-core/frysk/hpd/ChangeLog
+++ b/frysk-core/frysk/hpd/ChangeLog
@@ -1,3 +1,9 @@
+2008-05-15  Sami Wagiaalla  <swagiaal@redhat.com>
+
+	ObjectDeclarationSearchEngine.getObject() now returns a list.
+	* BreakpointCommand.java: Updated.
+	* ListCommand.java: Updated.
+
 2008-05-15  Tim Moore  <timoore@redhat.com>
 
 	* DisassembleCommand.java (Options): New options class. Remove
diff --git a/frysk-core/frysk/hpd/ListCommand.java b/frysk-core/frysk/hpd/ListCommand.java
index 372bbf5..6844dd5 100644
--- a/frysk-core/frysk/hpd/ListCommand.java
+++ b/frysk-core/frysk/hpd/ListCommand.java
@@ -44,11 +44,11 @@ import java.io.FileReader;
 import java.io.IOException;
 import java.io.LineNumberReader;
 import java.util.Iterator;
+import java.util.LinkedList;
 import java.util.List;
 
 import lib.dwfl.DwflLine;
 import frysk.debuginfo.DebugInfoFrame;
-import frysk.debuginfo.ObjectDeclarationNotFoundException;
 import frysk.debuginfo.ObjectDeclarationSearchEngine;
 import frysk.dwfl.DwflCache;
 import frysk.proc.Task;
@@ -212,15 +212,13 @@ class ListCommand extends ParameterizedCommand {
 
 	ObjectDeclarationSearchEngine declarationSearchEngine = new ObjectDeclarationSearchEngine(frame);
 
-	try {
-	    function = (Function) declarationSearchEngine.getObject(cmdParm);
-	} catch (ObjectDeclarationNotFoundException e) {
-	    function  = null;
-	}catch (ClassCastException e) {
-	    function  = null;
-	}
+	LinkedList functions = declarationSearchEngine.getObject(cmdParm);
+	//XXX: should this use declarationSearchEngine.getObjectInScope(cmdParm)
 	
-	if (function != null ) {
+	if (functions.size() > 0) {
+	    try {
+		function = (Function) functions.getFirst();		
+	    
 	    DwflLine dwflLine = DwflCache.getDwfl(frame.getTask())
 		    .getSourceLine(frame.getAdjustedAddress());
 	    if (dwflLine != null) {
@@ -234,12 +232,13 @@ class ListCommand extends ParameterizedCommand {
 		file = function.getSourceLocation().getFile();
 	    }
 	    return (int) function.getSourceLocation().getLine();
-
-	} else {
-	    cli.addMessage("function " + cmdParm + " not found.",
-		    Message.TYPE_ERROR);
-	    return line;
-
-	}
+	    
+	    } catch (ClassCastException e) {
+		
+	    }
+	} 
+	
+	cli.addMessage("function " + cmdParm + " not found.", Message.TYPE_ERROR);
+	return line;
     }
 }
diff --git a/frysk-core/frysk/rt/ChangeLog b/frysk-core/frysk/rt/ChangeLog
index 4dbc66f..966dcae 100644
--- a/frysk-core/frysk/rt/ChangeLog
+++ b/frysk-core/frysk/rt/ChangeLog
@@ -1,3 +1,7 @@
+2008-05-15  Sami Wagiaalla  <swagiaal@redhat.com>
+
+	* FunctionBreakpoint.java: Added comment.
+
 2008-04-25  Petr Machata  <pmachata@redhat.com>
 
 	* FunctionBreakpoint.java: Use DwflDieBias instead of DwarfDie to
diff --git a/frysk-core/frysk/rt/FunctionBreakpoint.java b/frysk-core/frysk/rt/FunctionBreakpoint.java
index 0161cbe..00f8044 100644
--- a/frysk-core/frysk/rt/FunctionBreakpoint.java
+++ b/frysk-core/frysk/rt/FunctionBreakpoint.java
@@ -103,6 +103,8 @@ public class FunctionBreakpoint
 
 	}
 
+	//XXX: this code should be removed
+	// die is not used any more
 	if (die != null) {
 	    ArrayList entryAddrs = die.getEntryBreakpoints();
 	    ArrayList inlineDies = null;


hooks/post-receive
--
frysk system monitor/debugger


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-05-15 17:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-15 17:58 [SCM] master: swagiaal: ObjectDeclarationSearchEngine.getObject() now returns a list swagiaal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).