From 3a16a369c57da6a5d0a16239ea3a517faa669103 Mon Sep 17 00:00:00 2001 From: Alain Dargelas Date: Wed, 12 Mar 2025 16:35:50 -0700 Subject: [PATCH] Remove try/catch block that prevents proper stack trace unrolling --- kernel/yosys.cc | 44 +++++++++++++++++++------------------------- 1 file changed, 19 insertions(+), 25 deletions(-) diff --git a/kernel/yosys.cc b/kernel/yosys.cc index 230497cd9..907d64539 100644 --- a/kernel/yosys.cc +++ b/kernel/yosys.cc @@ -1109,34 +1109,28 @@ bool run_frontend(std::string filename, std::string command, RTLIL::Design *desi FILE *backup_script_file = Frontend::current_script_file; Frontend::current_script_file = f; - try { - std::string command; - while (fgetline(f, command)) { - while (!command.empty() && command[command.size()-1] == '\\') { - std::string next_line; - if (!fgetline(f, next_line)) - break; - command.resize(command.size()-1); - command += next_line; - } - handle_label(command, from_to_active, run_from, run_to); - if (from_to_active) { - Pass::call(design, command); - design->check(); - } + std::string command; + while (fgetline(f, command)) { + while (!command.empty() && command[command.size() - 1] == '\\') { + std::string next_line; + if (!fgetline(f, next_line)) + break; + command.resize(command.size() - 1); + command += next_line; } - - if (!command.empty()) { - handle_label(command, from_to_active, run_from, run_to); - if (from_to_active) { - Pass::call(design, command); - design->check(); - } + handle_label(command, from_to_active, run_from, run_to); + if (from_to_active) { + Pass::call(design, command); + design->check(); } } - catch (...) { - Frontend::current_script_file = backup_script_file; - throw; + + if (!command.empty()) { + handle_label(command, from_to_active, run_from, run_to); + if (from_to_active) { + Pass::call(design, command); + design->check(); + } } Frontend::current_script_file = backup_script_file;