OpenCores
URL https://opencores.org/ocsvn/lxp32/lxp32/trunk

Subversion Repositories lxp32

[/] [lxp32/] [trunk/] [tools/] [src/] [lxp32dump/] [main.cpp] - Diff between revs 2 and 6

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 2 Rev 6
Line 28... Line 28...
 
 
        os<<"Options:"<<std::endl;
        os<<"Options:"<<std::endl;
        os<<"    -b <addr>    Base address (for comments only)"<<std::endl;
        os<<"    -b <addr>    Base address (for comments only)"<<std::endl;
        os<<"    -f <fmt>     Input format (bin, textio, dec, hex), default: autodetect"<<std::endl;
        os<<"    -f <fmt>     Input format (bin, textio, dec, hex), default: autodetect"<<std::endl;
        os<<"    -h, --help   Display a short help message"<<std::endl;
        os<<"    -h, --help   Display a short help message"<<std::endl;
 
        os<<"    -na          Do not use instruction and register aliases"<<std::endl;
        os<<"    -o <file>    Output file name, default: standard output"<<std::endl;
        os<<"    -o <file>    Output file name, default: standard output"<<std::endl;
        os<<"    --           Do not interpret subsequent arguments as options"<<std::endl;
        os<<"    --           Do not interpret subsequent arguments as options"<<std::endl;
}
}
 
 
static Disassembler::Format detectInputFormat(std::istream &in) {
static Disassembler::Format detectInputFormat(std::istream &in) {
Line 62... Line 63...
 
 
int main(int argc,char *argv[]) try {
int main(int argc,char *argv[]) try {
        std::string inputFileName,outputFileName;
        std::string inputFileName,outputFileName;
 
 
        std::cerr<<"LXP32 Platform Disassembler"<<std::endl;
        std::cerr<<"LXP32 Platform Disassembler"<<std::endl;
        std::cerr<<"Copyright (c) 2016 by Alex I. Kuznetsov"<<std::endl;
        std::cerr<<"Copyright (c) 2016-2019 by Alex I. Kuznetsov"<<std::endl;
 
 
        Disassembler::Format fmt=Disassembler::Bin;
        Disassembler::Format fmt=Disassembler::Bin;
        bool noMoreOptions=false;
        bool noMoreOptions=false;
        bool formatSpecified=false;
        bool formatSpecified=false;
        Disassembler::Word base=0;
        Disassembler::Word base=0;
 
        bool noAliases=false;
 
 
        if(argc<=1) {
        if(argc<=1) {
                displayUsage(std::cout,argv[0]);
                displayUsage(std::cout,argv[0]);
                return 0;
                return 0;
        }
        }
Line 109... Line 111...
                }
                }
                else if(!strcmp(argv[i],"-h")||!strcmp(argv[i],"--help")) {
                else if(!strcmp(argv[i],"-h")||!strcmp(argv[i],"--help")) {
                        displayUsage(std::cout,argv[0]);
                        displayUsage(std::cout,argv[0]);
                        return 0;
                        return 0;
                }
                }
 
                else if(!strcmp(argv[i],"-na")) {
 
                        noAliases=true;
 
                }
                else if(!strcmp(argv[i],"-o")) {
                else if(!strcmp(argv[i],"-o")) {
                        if(++i==argc) {
                        if(++i==argc) {
                                displayUsage(std::cerr,argv[0]);
                                displayUsage(std::cerr,argv[0]);
                                return EXIT_FAILURE;
                                return EXIT_FAILURE;
                        }
                        }
Line 173... Line 178...
        *os<<" */"<<std::endl<<std::endl;
        *os<<" */"<<std::endl<<std::endl;
 
 
        Disassembler disasm(in,*os);
        Disassembler disasm(in,*os);
        disasm.setFormat(fmt);
        disasm.setFormat(fmt);
        disasm.setBase(base);
        disasm.setBase(base);
 
        disasm.setPreferAliases(!noAliases);
 
 
        try {
        try {
                disasm.dump();
                disasm.dump();
        }
        }
        catch(std::exception &) {
        catch(std::exception &) {

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.