From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13217 invoked by alias); 14 Apr 2008 17:46:54 -0000 Received: (qmail 13190 invoked by uid 9561); 14 Apr 2008 17:46:53 -0000 Date: Mon, 14 Apr 2008 17:46:00 -0000 Message-ID: <20080414174653.13175.qmail@sourceware.org> From: swagiaal@sourceware.org To: frysk-cvs@sourceware.org Subject: [SCM] master: swagiaal: created and used InlinedSubroutine. X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: 59acb89f662cace8e7b3cb61f86c8c93f9b8cea1 X-Git-Newrev: 701ccd302e772219f2031219afa5fdcf69f27618 Mailing-List: contact frysk-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: frysk-cvs-owner@sourceware.org Reply-To: frysk@sourceware.org X-SW-Source: 2008-q2/txt/msg00094.txt.bz2 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 Date: Mon Apr 14 13:06:22 2008 -0400 swagiaal: created and used InlinedSubroutine. frysk-core/frysk/scopes/ChangeLog +2008-04-14 Sami Wagiaalla + + * 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 + + * TestScopeFactory.java: test InlinedSubroutine. + * ScopeFactory.java: Now handles InlinedSubroutine objects. + * Subroutine.java: Updated javadoc. + * InlinedSubroutine.java: New class. + 2008-04-10 Sami Wagiaalla * 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