mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-11-04 05:19:11 +00:00 
			
		
		
		
	Add log_debug() framework
Signed-off-by: Clifford Wolf <clifford@clifford.at>
This commit is contained in:
		
							parent
							
								
									c0f9a74b12
								
							
						
					
					
						commit
						e158ea2097
					
				
					 11 changed files with 183 additions and 53 deletions
				
			
		| 
						 | 
				
			
			@ -94,4 +94,38 @@ struct TracePass : public Pass {
 | 
			
		|||
	}
 | 
			
		||||
} TracePass;
 | 
			
		||||
 | 
			
		||||
struct DebugPass : public Pass {
 | 
			
		||||
	DebugPass() : Pass("debug", "run command with debug log messages enabled") { }
 | 
			
		||||
	void help() YS_OVERRIDE
 | 
			
		||||
	{
 | 
			
		||||
		//   |---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|---v---|
 | 
			
		||||
		log("\n");
 | 
			
		||||
		log("    debug cmd\n");
 | 
			
		||||
		log("\n");
 | 
			
		||||
		log("Execute the specified command with debug log messages enabled\n");
 | 
			
		||||
		log("\n");
 | 
			
		||||
	}
 | 
			
		||||
	void execute(std::vector<std::string> args, RTLIL::Design *design) YS_OVERRIDE
 | 
			
		||||
	{
 | 
			
		||||
		size_t argidx;
 | 
			
		||||
		for (argidx = 1; argidx < args.size(); argidx++)
 | 
			
		||||
		{
 | 
			
		||||
			// .. parse options ..
 | 
			
		||||
			break;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		log_force_debug++;
 | 
			
		||||
 | 
			
		||||
		try {
 | 
			
		||||
			std::vector<std::string> new_args(args.begin() + argidx, args.end());
 | 
			
		||||
			Pass::call(design, new_args);
 | 
			
		||||
		} catch (...) {
 | 
			
		||||
			log_force_debug--;
 | 
			
		||||
			throw;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		log_force_debug--;
 | 
			
		||||
	}
 | 
			
		||||
} DebugPass;
 | 
			
		||||
 | 
			
		||||
PRIVATE_NAMESPACE_END
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue