OpenASIP  2.0
TPEFDumper.hh
Go to the documentation of this file.
1 /*
2  Copyright (c) 2002-2009 Tampere University.
3 
4  This file is part of TTA-Based Codesign Environment (TCE).
5 
6  Permission is hereby granted, free of charge, to any person obtaining a
7  copy of this software and associated documentation files (the "Software"),
8  to deal in the Software without restriction, including without limitation
9  the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  and/or sell copies of the Software, and to permit persons to whom the
11  Software is furnished to do so, subject to the following conditions:
12 
13  The above copyright notice and this permission notice shall be included in
14  all copies or substantial portions of the Software.
15 
16  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  DEALINGS IN THE SOFTWARE.
23  */
24 /**
25  * @file TPEFDumper.cc
26  *
27  * Class for outputting TPEF sections in textual format.
28  *
29  * @author Mikael Lepistö 2005 (tmlepist-no.spam-tut.fi)
30  * @rating red
31  */
32 
33 #include <ostream>
34 
35 #include "Binary.hh"
36 #include "SymbolElement.hh"
37 #include "RelocElement.hh"
38 #include "ResourceElement.hh"
39 #include "DebugElement.hh"
40 
41 namespace TPEF {
42  class SectionElement;
43  class Section;
44  class SectionElement;
45  class ASpaceElement;
46 }
47 
48 /**
49  * Outputs TPEF hierarchy in textual form.
50  */
51 class TPEFDumper {
52 
53 public:
54  TPEFDumper(TPEF::Binary& tpef, std::ostream& out);
55  virtual ~TPEFDumper();
56 
57  void setOnlyLogical(bool flag);
58  bool onlyLogical() const;
59 
60  void fileHeaders();
61  void sectionHeaders();
62  void memoryInfo();
63  void relocationTables();
64  void symbolTables();
65  void section(Word sectionIndex);
66 
67 private:
68  void createLogicalIndexes();
69  Word actualIndex(Word logicalIndex) const;
70 
71  std::string sectionHeader();
72  std::string sectionHeader(TPEF::Section &sect, bool noIndex = false);
73  void section(TPEF::Section &sect);
74 
77 
78  std::string sectionString(TPEF::Section &sect, bool shortForm = false);
79  std::string addressSpaceString(TPEF::ASpaceElement& aSpace);
80  std::string symbolString(TPEF::Section& sect, TPEF::SymbolElement& sym);
81 
82  std::string sectionTypeString(
83  TPEF::Section::SectionType type, bool shortForm = false);
84 
86 
88 
89  std::string fileTypeString(TPEF::Binary::FileType type);
90 
92 
94 
96 
98 
99  std::string resourceIdString(
100  HalfWord id, TPEF::ResourceElement::ResourceType type);
101 
102  void dumpStringSet(std::set<std::string> &aSet) const;
103 
104  std::vector<Word> actualIndexes_;
105 
107  std::ostream &out_;
108 
110 };
TPEFDumper::sectionHeader
std::string sectionHeader()
Definition: TPEFDumper.cc:369
TPEFDumper::fileTypeString
std::string fileTypeString(TPEF::Binary::FileType type)
Definition: TPEFDumper.cc:1154
TPEFDumper::fileArchString
std::string fileArchString(TPEF::Binary::FileArchitecture arch)
Definition: TPEFDumper.cc:1113
TPEF::Binary::FileArchitecture
FileArchitecture
Definition: Binary.hh:67
TPEFDumper::sectionHeaders
void sectionHeaders()
Definition: TPEFDumper.cc:210
TPEFDumper::onlyLogical
bool onlyLogical() const
Definition: TPEFDumper.cc:173
TPEFDumper::sectionTypeString
std::string sectionTypeString(TPEF::Section::SectionType type, bool shortForm=false)
Definition: TPEFDumper.cc:1076
TPEFDumper::actualIndex
Word actualIndex(Word logicalIndex) const
Definition: TPEFDumper.cc:137
TPEFDumper::symbolString
std::string symbolString(TPEF::Section &sect, TPEF::SymbolElement &sym)
Definition: TPEFDumper.cc:1360
TPEFDumper::tpef_
TPEF::Binary & tpef_
Definition: TPEFDumper.hh:106
TPEF::Binary
Definition: Binary.hh:49
TPEFDumper::actualIndexes_
std::vector< Word > actualIndexes_
Definition: TPEFDumper.hh:104
TPEFDumper::debugElementTypeString
std::string debugElementTypeString(TPEF::DebugElement::ElementType type)
Definition: TPEFDumper.cc:1135
TPEF::SymbolElement::SymbolType
SymbolType
Type of symbol element.
Definition: SymbolElement.hh:66
TPEFDumper::TPEFDumper
TPEFDumper(TPEF::Binary &tpef, std::ostream &out)
Definition: TPEFDumper.cc:95
TPEFDumper::memoryInfo
void memoryInfo()
Definition: TPEFDumper.cc:232
TPEFDumper::findSectionIndex
int findSectionIndex(TPEF::Section &sect)
Definition: TPEFDumper.cc:1023
TPEFDumper::relocationTables
void relocationTables()
Definition: TPEFDumper.cc:321
TPEF::Section
Definition: Section.hh:64
TPEFDumper::setOnlyLogical
void setOnlyLogical(bool flag)
Definition: TPEFDumper.cc:157
TPEFDumper::relocTypeString
std::string relocTypeString(TPEF::RelocElement::RelocType type)
Definition: TPEFDumper.cc:1223
TPEFDumper::dumpStringSet
void dumpStringSet(std::set< std::string > &aSet) const
Definition: TPEFDumper.cc:1385
TPEFDumper::out_
std::ostream & out_
Definition: TPEFDumper.hh:107
TPEFDumper::~TPEFDumper
virtual ~TPEFDumper()
Definition: TPEFDumper.cc:102
TPEFDumper::sectionString
std::string sectionString(TPEF::Section &sect, bool shortForm=false)
Definition: TPEFDumper.cc:445
TPEF::ASpaceElement
Definition: ASpaceElement.hh:48
ResourceElement.hh
TPEFDumper
Definition: TPEFDumper.hh:51
TPEF::Binary::FileType
FileType
Definition: Binary.hh:54
TPEF::SectionElement
Definition: SectionElement.hh:44
RelocElement.hh
TPEF::SymbolElement
Definition: SymbolElement.hh:52
TPEF::ResourceElement::ResourceType
ResourceType
Resource types.
Definition: ResourceElement.hh:51
TPEFDumper::symbolTypeString
std::string symbolTypeString(TPEF::SymbolElement::SymbolType type)
Definition: TPEFDumper.cc:1178
TPEFDumper::symbolTables
void symbolTables()
Definition: TPEFDumper.cc:336
TPEF::SymbolElement::SymbolBinding
SymbolBinding
Binding types of symbol.
Definition: SymbolElement.hh:55
TPEFDumper::resourceIdString
std::string resourceIdString(HalfWord id, TPEF::ResourceElement::ResourceType type)
Definition: TPEFDumper.cc:1269
SymbolElement.hh
TPEFDumper::fileHeaders
void fileHeaders()
Definition: TPEFDumper.cc:181
TPEFDumper::symbolBindString
std::string symbolBindString(TPEF::SymbolElement::SymbolBinding bind)
Definition: TPEFDumper.cc:1202
TPEFDumper::findElementIndex
int findElementIndex(TPEF::Section &sect, TPEF::SectionElement &elem)
Definition: TPEFDumper.cc:1053
TPEF::Section::SectionType
SectionType
Definition: Section.hh:69
TPEF::DebugElement::ElementType
ElementType
Definition: DebugElement.hh:58
DebugElement.hh
TPEF::RelocElement::RelocType
RelocType
Definition: RelocElement.hh:56
TPEFDumper::createLogicalIndexes
void createLogicalIndexes()
Definition: TPEFDumper.cc:112
TPEFDumper::onlyLogicalInfo_
bool onlyLogicalInfo_
Definition: TPEFDumper.hh:109
TPEFDumper::section
void section(Word sectionIndex)
Definition: TPEFDumper.cc:353
TPEFDumper::addressSpaceString
std::string addressSpaceString(TPEF::ASpaceElement &aSpace)
Definition: TPEFDumper.cc:1320
TPEFDumper::resourceTypeString
std::string resourceTypeString(TPEF::ResourceElement::ResourceType type)
Definition: TPEFDumper.cc:1245
TPEF
Definition: Assembler.hh:43
Binary.hh