public inbox for frysk-cvs@sourceware.org
help / color / mirror / Atom feed
From: swagiaal@sourceware.org
To: frysk-cvs@sourceware.org
Subject: [SCM]  master: swagiaal: created and used InlinedSubroutine.
Date: Mon, 14 Apr 2008 17:46:00 -0000	[thread overview]
Message-ID: <20080414174653.13175.qmail@sourceware.org> (raw)

The branch, master has been updated
       via  701ccd302e772219f2031219afa5fdcf69f27618 (commit)
      from  59acb89f662cace8e7b3cb61f86c8c93f9b8cea1 (commit)

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

- Log -----------------------------------------------------------------
commit 701ccd302e772219f2031219afa5fdcf69f27618
Author: Sami Wagiaalla <swagiaal@redhat.com>
Date:   Mon Apr 14 13:06:22 2008 -0400

    swagiaal: created and used InlinedSubroutine.
    
    frysk-core/frysk/scopes/ChangeLog
    +2008-04-14  Sami Wagiaalla  <swagiaal@redhat.com>
    +
    +	* TestScopeFactory.java: test InlinedSubroutine.
    +	* ScopeFactory.java: Now handles InlinedSubroutine objects.
    +	* Subroutine.java: Updated javadoc.
    +	* InlinedSubroutine.java: New class.
    +

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

Summary of changes:
 frysk-core/frysk/scopes/ChangeLog              |    7 +++
 frysk-core/frysk/scopes/InlinedSubroutine.java |   51 ++++++++++++++++++++++++
 frysk-core/frysk/scopes/ScopeFactory.java      |    7 ++-
 frysk-core/frysk/scopes/Subroutine.java        |    6 +++
 frysk-core/frysk/scopes/TestScopeFactory.java  |   17 ++++++-
 5 files changed, 83 insertions(+), 5 deletions(-)
 create mode 100644 frysk-core/frysk/scopes/InlinedSubroutine.java

First 500 lines of diff:
diff --git a/frysk-core/frysk/scopes/ChangeLog b/frysk-core/frysk/scopes/ChangeLog
index 7f2db03..242f37d 100644
--- a/frysk-core/frysk/scopes/ChangeLog
+++ b/frysk-core/frysk/scopes/ChangeLog
@@ -1,3 +1,10 @@
+2008-04-14  Sami Wagiaalla  <swagiaal@redhat.com>
+
+	* TestScopeFactory.java: test InlinedSubroutine.
+	* ScopeFactory.java: Now handles InlinedSubroutine objects.
+	* Subroutine.java: Updated javadoc.
+	* InlinedSubroutine.java: New class.
+
 2008-04-10  Sami Wagiaalla  <swagiaal@redhat.com>
 
 	* NamedScope.java: New class.
diff --git a/frysk-core/frysk/scopes/InlinedSubroutine.java b/frysk-core/frysk/scopes/InlinedSubroutine.java
new file mode 100644
index 0000000..9a8b6eb
--- /dev/null
+++ b/frysk-core/frysk/scopes/InlinedSubroutine.java
@@ -0,0 +1,51 @@
+// This file is part of the program FRYSK.
+//
+// Copyright 2007, Red Hat Inc.
+//
+// FRYSK is free software; you can redistribute it and/or modify it
+// under the terms of the GNU General Public License as published by
+// the Free Software Foundation; version 2 of the License.
+//
+// FRYSK is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+// 
+// You should have received a copy of the GNU General Public License
+// along with FRYSK; if not, write to the Free Software Foundation,
+// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+// 
+// In addition, as a special exception, Red Hat, Inc. gives You the
+// additional right to link the code of FRYSK with code not covered
+// under the GNU General Public License ("Non-GPL Code") and to
+// distribute linked combinations including the two, subject to the
+// limitations in this paragraph. Non-GPL Code permitted under this
+// exception must only link to the code of FRYSK through those well
+// defined interfaces identified in the file named EXCEPTION found in
+// the source code files (the "Approved Interfaces"). The files of
+// Non-GPL Code may instantiate templates or use macros or inline
+// functions from the Approved Interfaces without causing the
+// resulting work to be covered by the GNU General Public
+// License. Only Red Hat, Inc. may make changes or additions to the
+// list of Approved Interfaces. You must obey the GNU General Public
+// License in all respects for all of the FRYSK code and other code
+// used in conjunction with FRYSK except the Non-GPL Code covered by
+// this exception. If you modify this file, you may extend this
+// exception to your version of the file, but you are not obligated to
+// do so. If you do not wish to provide this exception without
+// modification, you must delete this exception statement from your
+// version and license this file solely under the GPL without
+// exception.
+
+package frysk.scopes;
+
+import lib.dwfl.DwarfDie;
+import frysk.debuginfo.TypeFactory;
+
+public class InlinedSubroutine extends Subroutine{
+
+    public InlinedSubroutine(DwarfDie die, TypeFactory typeFactory) {
+	super(die, typeFactory);
+    }
+
+}
diff --git a/frysk-core/frysk/scopes/ScopeFactory.java b/frysk-core/frysk/scopes/ScopeFactory.java
index af3685f..723d3cd 100644
--- a/frysk-core/frysk/scopes/ScopeFactory.java
+++ b/frysk-core/frysk/scopes/ScopeFactory.java
@@ -78,8 +78,11 @@ public class ScopeFactory {
 	
 	case DwTag.INLINED_SUBROUTINE_:
 	case DwTag.SUBPROGRAM_:
-	    return new Subprogram(die, typeFactory);
-
+	    Subprogram subprogram = new Subprogram(die, typeFactory);
+	    if(subprogram.isInlined()){
+		return new InlinedSubroutine(die,typeFactory);
+	    }
+	    return subprogram;
 	case DwTag.LEXICAL_BLOCK_:
 	    return new LexicalBlock(die, typeFactory);
 	case DwTag.COMPILE_UNIT_:
diff --git a/frysk-core/frysk/scopes/Subroutine.java b/frysk-core/frysk/scopes/Subroutine.java
index e70a7f8..c8ffe78 100644
--- a/frysk-core/frysk/scopes/Subroutine.java
+++ b/frysk-core/frysk/scopes/Subroutine.java
@@ -90,6 +90,12 @@ public class Subroutine extends NamedScope {
 	return struct;
     }
 
+    /**
+     * returns true if:
+     * - this is a concrete instance of an inlined function
+     * - this is an abstrace instance of an inlinable function
+     * - a regular funciton which has been inlined by the compiler
+     */
     public boolean isInlined(){
 	DwTag dwTag = getDie().getTag();
 	long inlineAttribute = getDie().getAttrConstant(DwAt.INLINE);
diff --git a/frysk-core/frysk/scopes/TestScopeFactory.java b/frysk-core/frysk/scopes/TestScopeFactory.java
index 8453475..e03bfd5 100644
--- a/frysk-core/frysk/scopes/TestScopeFactory.java
+++ b/frysk-core/frysk/scopes/TestScopeFactory.java
@@ -67,18 +67,29 @@ public class TestScopeFactory
       Scope scope1 = ScopeFactory.theFactory.getScope(scopes[0], typeFactory);
       Scope scope2 = ScopeFactory.theFactory.getScope(scopes[1], typeFactory);
       Scope scope3 = ScopeFactory.theFactory.getScope(scopes[2], typeFactory);
-      
+
       Scope scope4 = ScopeFactory.theFactory.getScope(scopes[0], typeFactory);
       Scope scope5 = ScopeFactory.theFactory.getScope(scopes[1], typeFactory);
       Scope scope6 = ScopeFactory.theFactory.getScope(scopes[2], typeFactory);
+
+      // test scopes from outer frame
+      frame = frame.getOuter();
+      scopes = bias.die.getScopes(frame.getAdjustedAddress() - bias.bias);
+
+      Scope scope7 = ScopeFactory.theFactory.getScope(scopes[0], typeFactory);
+      Scope scope8 = ScopeFactory.theFactory.getScope(scopes[0], typeFactory);
+
       
       assertTrue("lexical block scope" , scope1 instanceof LexicalBlock);
-      assertTrue("InlinedSubroutine scope" , scope2 instanceof Subroutine && ((Subroutine)scope2).isInlined());
-      assertTrue("lexical block scope" , scope3 instanceof Scope);
+      assertTrue("InlinedSubroutine scope" , scope2 instanceof InlinedSubroutine && ((Subroutine)scope2).isInlined());
+      assertTrue("File scope" , scope3 instanceof Scope);
+      
+      assertTrue("Subprogram scope" , scope7 instanceof Subroutine && !((Subroutine)scope7).isInlined());
       
       assertTrue("same object" , scope1 == scope4);
       assertTrue("same object" , scope2 == scope5);
       assertTrue("same object" , scope3 == scope6);
+      assertTrue("same object" , scope7 == scope8);
       
     }    
 }


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


                 reply	other threads:[~2008-04-14 17:46 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080414174653.13175.qmail@sourceware.org \
    --to=swagiaal@sourceware.org \
    --cc=frysk-cvs@sourceware.org \
    --cc=frysk@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).