LineInformation.h

Go to the documentation of this file.
00001 /*
00002  * See the dyninst/COPYRIGHT file for copyright information.
00003  * 
00004  * We provide the Paradyn Tools (below described as "Paradyn")
00005  * on an AS IS basis, and do not warrant its validity or performance.
00006  * We reserve the right to update, modify, or discontinue this
00007  * software at any time.  We shall have no obligation to supply such
00008  * updates or modifications or any other form of support to you.
00009  * 
00010  * By your use of Paradyn, you understand and agree that we (or any
00011  * other person or entity with proprietary rights in Paradyn) are
00012  * under no obligation to provide either maintenance services,
00013  * update services, notices of latent defects, or correction of
00014  * defects for Paradyn.
00015  * 
00016  * This library is free software; you can redistribute it and/or
00017  * modify it under the terms of the GNU Lesser General Public
00018  * License as published by the Free Software Foundation; either
00019  * version 2.1 of the License, or (at your option) any later version.
00020  * 
00021  * This library is distributed in the hope that it will be useful,
00022  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00023  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00024  * Lesser General Public License for more details.
00025  * 
00026  * You should have received a copy of the GNU Lesser General Public
00027  * License along with this library; if not, write to the Free Software
00028  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
00029  */
00030 
00031 #if ! defined( LINE_INFORMATION_H )
00032 #define LINE_INFORMATION_H
00033 
00034 #include "symutil.h"
00035 #include "RangeLookup.h"
00036 #include "Serialization.h"
00037 #include "Annotatable.h"
00038 #include "Module.h"
00039 
00040 #define NEW_GETSOURCELINES_INTERFACE
00041 
00042 namespace Dyninst{
00043 namespace SymtabAPI{
00044 
00045 class LineInformation : public AnnotationContainer<Statement>, 
00046                         private RangeLookup< Statement, Statement::StatementLess > 
00047 {
00048     SYMTAB_EXPORT bool addItem_impl(Statement);
00049     SYMTAB_EXPORT Serializable *ac_serialize_impl(SerializerBase *, const char * = "lineInformation") THROW_SPEC (SerializerError);
00050    public:
00051       typedef RangeLookup< Statement, Statement::StatementLess >::const_iterator const_iterator;
00052       typedef RangeLookup< Statement, Statement::StatementLess >::AddressRange AddressRange;
00053 
00054       SYMTAB_EXPORT LineInformation();
00055 
00056       /* You MAY freely deallocate the lineSource strings you pass in. */
00057       SYMTAB_EXPORT bool addLine( const char * lineSource, 
00058             unsigned int lineNo, 
00059             unsigned int lineOffset, 
00060             Offset lowInclusiveAddr, 
00061             Offset highExclusiveAddr );
00062 
00063       SYMTAB_EXPORT void addLineInfo(LineInformation *lineInfo);          
00064 
00065       SYMTAB_EXPORT bool addAddressRange( Offset lowInclusiveAddr, 
00066             Offset highExclusiveAddr, 
00067             const char * lineSource, 
00068             unsigned int lineNo, 
00069             unsigned int lineOffset = 0 );
00070 
00071       /* You MUST NOT deallocate the strings returned. */
00072       SYMTAB_EXPORT bool getSourceLines( Offset addressInRange, std::vector< Statement *> & lines );
00073       SYMTAB_EXPORT bool getSourceLines( Offset addressInRange, std::vector< LineNoTuple > & lines);
00074 
00075       SYMTAB_EXPORT bool getAddressRanges( const char * lineSource, unsigned int LineNo, std::vector< AddressRange > & ranges );
00076 
00077       SYMTAB_EXPORT const_iterator begin() const;
00078       SYMTAB_EXPORT const_iterator end() const;
00079       SYMTAB_EXPORT unsigned getSize() const;
00080 
00081       SYMTAB_EXPORT ~LineInformation();
00082 
00083    protected:
00084       /* We maintain internal copies of all the source file names.  Because
00085          both directions of the mapping include pointers to these names,
00086          maintain a separate list of them, and only ever deallocate those
00087          (in the destructor).  Note that it speeds and simplifies things
00088          to have the string pointers be the same. */
00089 
00090       unsigned size_;
00091 }; /* end class LineInformation */
00092 
00093 }//namespace SymtabAPI
00094 }//namespace Dyninst
00095 
00096 #endif /* ! LINE_INFORMATION_H */
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 12 Jul 2013 for SymtabAPI by  doxygen 1.6.1