OpenASIP 2.2
Loading...
Searching...
No Matches
Classes | Functions
DumpTPEF.cc File Reference
#include <ostream>
#include "Exception.hh"
#include "CmdLineOptions.hh"
#include "BinaryReader.hh"
#include "BinaryStream.hh"
#include "Binary.hh"
#include "TPEFDumper.hh"
#include "tce_config.h"
Include dependency graph for DumpTPEF.cc:

Go to the source code of this file.

Classes

class  DumperCmdLineOptions
 

Functions

int main (int argc, char *argv[])
 

Detailed Description

Program for outputting TPEF hierarchy in textual format.

Author
Mikael Lepist� 2005 (tmlepist-no.spam-tut.fi)
Note
rating: red

Definition in file DumpTPEF.cc.

Function Documentation

◆ main()

int main ( int  argc,
char *  argv[] 
)

Calls TPEFDumper with parameters given in commandline.

Definition at line 179 of file DumpTPEF.cc.

179 {
180
182
183 try {
184 options.parse(argv, argc);
185 } catch (ParserStopRequest const&) {
186 return 0;
187 } catch (IllegalCommandLine const& e) {
188 std::cerr << "Illegal command line parameters: "
189 << e.errorMessage() << std::endl;
190
192 return 0;
193 }
194
195 if (options.numberOfArguments() != 1) {
196 std::cerr << "Error: Must give input binary file.\n\n";
198 return 0;
199 }
200
201 BinaryStream stream(options.argument(1));
202
203 Binary* tpef = NULL;
204 try {
205 tpef = BinaryReader::readBinary(stream);
206 } catch (UnresolvedReference& e) {
207 std::cerr
208 << "Misread the input file: " << options.argument(1) << std::endl
209 << "error: " << e.errorMessage() << std::endl;
210 return 0;
211 } catch (const Exception& e) {
212 std::cerr
213 << "Can't read input file: " << options.argument(1) << std::endl
214 << "error: " << e.errorMessage() << std::endl;
215 return 0;
216 }
217
218 TPEFDumper dumper(*tpef, std::cout);
219
220 dumper.setOnlyLogical(options.onlyLogicalInfo());
221
222 if (options.printFileHeaders()) {
223 dumper.fileHeaders();
224 }
225
226 if (options.printSectionHeaders()) {
227 dumper.sectionHeaders();
228 }
229
230 if (options.printMemoryInfo()) {
231 dumper.memoryInfo();
232 }
233
234 if (options.printSymbols()) {
235 dumper.symbolTables();
236 }
237
238 if (options.printRelocations()) {
239 dumper.relocationTables();
240 }
241
242 for (int i = 1; i < options.sectionIdCount() + 1; i++) {
243 dumper.section(options.sectionId(i));
244 }
245
246 delete tpef;
247
248 return 0;
249}
static MachInfoCmdLineOptions options
Definition MachInfo.cc:46
void parse(char *argv[], int argc)
virtual std::string argument(int index) const
virtual int numberOfArguments() const
std::string errorMessage() const
Definition Exception.cc:123
virtual void printHelp() const
static Binary * readBinary(BinaryStream &stream)

References CmdLineParser::argument(), Exception::errorMessage(), TPEFDumper::fileHeaders(), TPEFDumper::memoryInfo(), CmdLineParser::numberOfArguments(), options, CmdLineOptions::parse(), MachInfoCmdLineOptions::printHelp(), TPEF::BinaryReader::readBinary(), TPEFDumper::relocationTables(), TPEFDumper::section(), TPEFDumper::sectionHeaders(), TPEFDumper::setOnlyLogical(), and TPEFDumper::symbolTables().

Here is the call graph for this function: