Add options to enable nnc_debug. They will be processed later by compiler driver.
Signed-off-by: Denis Maksimenko <d.maksimenko@partner.samsung.com>
*/
extern Option<std::string> pluginsPath;
extern Option<bool> pluginVerbose;
+extern Option<std::string> debugMode;
+extern Option<std::string> debugZones;
/**
* @brief frontend options
overview("verbose printing when plugins will be being searched"),
false,
optional(true));
+Option<std::string> debugMode(optname("--debug"),
+ overview("turn debugging on (optional: provide filename)"),
+ "-", // when option is not passed to command line
+ optional(true),
+ optvalues(""),
+ checkDebugFile);
+Option<std::string> debugZones(optname("--debug-area"),
+ overview("if specified, debug code will be executed only in given areas"),
+ "",
+ optional(true));
/**
* @breif Options for frontend
void checkOutFile(const BaseOption &);
void checkOutDir(const BaseOption &);
void checkPluginsPath(const BaseOption &);
+void checkDebugFile(const BaseOption &);
} // namespace clopt
} // namespace contrib
#include "CommandLine.h"
#include <sys/types.h>
+#include <unistd.h>
#include <dirent.h>
using namespace nncc::contrib::clopt;
} // checkOutDir
+void checkDebugFile(const BaseOption &option)
+{
+ auto &in_file = dynamic_cast<const Option<std::string> &>(option);
+
+ if (access(in_file.c_str(), W_OK) != 0) {
+ throw BadOption("Has no permission to open debug output file");
+ }
+} // checkDebugFile
+
} // clopt
} // contirb
} // nncc