mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-11-03 21:09:12 +00:00 
			
		
		
		
	[YOSYS][Issue 3594] Print backtrace on abort/assert #3594
ERROR: No such command: prox (type help for a command overview) Error while executing script: Running script on file demo.ys --------------------------------- 1 read_verilog ./tests/lut/map_not.v 2 opt 3 proc_clean -->4 prox ---------------------------------
This commit is contained in:
		
							parent
							
								
									0469405abf
								
							
						
					
					
						commit
						dd5a56128a
					
				
					 3 changed files with 26 additions and 3 deletions
				
			
		| 
						 | 
					@ -354,6 +354,21 @@ static void logv_error_with_prefix(const char *prefix,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	log_check_expected();
 | 
						log_check_expected();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						int lineno = 1;
 | 
				
			||||||
 | 
						if ( !log_line_number.empty() ) {
 | 
				
			||||||
 | 
						  log("Error while executing script:\n\t");
 | 
				
			||||||
 | 
						  log( log_line_number.begin()->c_str() );
 | 
				
			||||||
 | 
						  log("\n");
 | 
				
			||||||
 | 
					          log_line_number.erase(log_line_number.begin());
 | 
				
			||||||
 | 
						  log("---------------------------------\n");
 | 
				
			||||||
 | 
						  for(const std::string& script_line : log_line_number) {
 | 
				
			||||||
 | 
						    const char* pfx = (lineno == log_line_number.size()) ? "-->" : "   ";
 | 
				
			||||||
 | 
						    log("%s%d %s\n",pfx,lineno++,script_line.c_str());
 | 
				
			||||||
 | 
						  }
 | 
				
			||||||
 | 
						  log("---------------------------------\n");
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						
 | 
				
			||||||
	if (log_error_atexit)
 | 
						if (log_error_atexit)
 | 
				
			||||||
		log_error_atexit();
 | 
							log_error_atexit();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -95,6 +95,7 @@ YOSYS_NAMESPACE_BEGIN
 | 
				
			||||||
struct log_cmd_error_exception { };
 | 
					struct log_cmd_error_exception { };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
extern std::vector<FILE*> log_files;
 | 
					extern std::vector<FILE*> log_files;
 | 
				
			||||||
 | 
					extern std::vector<std::string> log_line_number;
 | 
				
			||||||
extern std::vector<std::ostream*> log_streams;
 | 
					extern std::vector<std::ostream*> log_streams;
 | 
				
			||||||
extern std::vector<std::string> log_scratchpads;
 | 
					extern std::vector<std::string> log_scratchpads;
 | 
				
			||||||
extern std::map<std::string, std::set<std::string>> log_hdump;
 | 
					extern std::map<std::string, std::set<std::string>> log_hdump;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -359,7 +359,7 @@ int run_command(const std::string &command, std::function<void(const std::string
 | 
				
			||||||
		return -1;
 | 
							return -1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	std::string line;
 | 
						std::string line;
 | 
				
			||||||
	char logbuf[128];
 | 
						char logbuf[128]={0,};
 | 
				
			||||||
	while (fgets(logbuf, 128, f) != NULL) {
 | 
						while (fgets(logbuf, 128, f) != NULL) {
 | 
				
			||||||
		line += logbuf;
 | 
							line += logbuf;
 | 
				
			||||||
		if (!line.empty() && line.back() == '\n')
 | 
							if (!line.empty() && line.back() == '\n')
 | 
				
			||||||
| 
						 | 
					@ -1113,8 +1113,10 @@ static void handle_label(std::string &command, bool &from_to_active, const std::
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					std::vector<std::string> log_line_number;
 | 
				
			||||||
bool run_frontend(std::string filename, std::string command, RTLIL::Design *design, std::string *from_to_label)
 | 
					bool run_frontend(std::string filename, std::string command, RTLIL::Design *design, std::string *from_to_label)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					        log_line_number.clear();
 | 
				
			||||||
	if (design == nullptr)
 | 
						if (design == nullptr)
 | 
				
			||||||
		design = yosys_design;
 | 
							design = yosys_design;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1150,7 +1152,6 @@ bool run_frontend(std::string filename, std::string command, RTLIL::Design *desi
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		std::string run_from, run_to;
 | 
							std::string run_from, run_to;
 | 
				
			||||||
		bool from_to_active = true;
 | 
							bool from_to_active = true;
 | 
				
			||||||
 | 
					 | 
				
			||||||
		if (from_to_label != NULL) {
 | 
							if (from_to_label != NULL) {
 | 
				
			||||||
			size_t pos = from_to_label->find(':');
 | 
								size_t pos = from_to_label->find(':');
 | 
				
			||||||
			if (pos == std::string::npos) {
 | 
								if (pos == std::string::npos) {
 | 
				
			||||||
| 
						 | 
					@ -1175,12 +1176,18 @@ bool run_frontend(std::string filename, std::string command, RTLIL::Design *desi
 | 
				
			||||||
		if (f == NULL)
 | 
							if (f == NULL)
 | 
				
			||||||
			log_error("Can't open script file `%s' for reading: %s\n", filename.c_str(), strerror(errno));
 | 
								log_error("Can't open script file `%s' for reading: %s\n", filename.c_str(), strerror(errno));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
							  std::stringstream ss;
 | 
				
			||||||
 | 
							  ss << "Running " << command << " on file '" << filename << "'";
 | 
				
			||||||
 | 
							  log_line_number.push_back(ss.str());
 | 
				
			||||||
 | 
							}		
 | 
				
			||||||
		FILE *backup_script_file = Frontend::current_script_file;
 | 
							FILE *backup_script_file = Frontend::current_script_file;
 | 
				
			||||||
		Frontend::current_script_file = f;
 | 
							Frontend::current_script_file = f;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		try {
 | 
							try {
 | 
				
			||||||
			std::string command;
 | 
								std::string command;
 | 
				
			||||||
			while (fgetline(f, command)) {
 | 
								while (fgetline(f, command)) {
 | 
				
			||||||
 | 
								  log_line_number.push_back(command);
 | 
				
			||||||
			  while (!command.empty() && command[command.size()-1] == '\\') {
 | 
								  while (!command.empty() && command[command.size()-1] == '\\') {
 | 
				
			||||||
					std::string next_line;
 | 
										std::string next_line;
 | 
				
			||||||
					if (!fgetline(f, next_line))
 | 
										if (!fgetline(f, next_line))
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue