diff --git a/Changes b/Changes index d605bbe74..08bbaffbd 100644 --- a/Changes +++ b/Changes @@ -18,6 +18,7 @@ Verilator 4.221 devel * Fix MSVC localtime_s (#3124). * Fix Bison 3.8.2 error (#3366). [elike-ypq] * Fix rare bug in -Oz (V3Localize) (#3286). [Geza Lore, Shunyao CAD] +* Fix filenames with dots overwriting debug .vpp files (#3373). Verilator 4.220 2022-03-12 diff --git a/docs/guide/files.rst b/docs/guide/files.rst index 522855ce3..796a4c756 100644 --- a/docs/guide/files.rst +++ b/docs/guide/files.rst @@ -120,7 +120,7 @@ In certain debug and other modes, it also creates: - Debugging graph files (from --debug) * - *{prefix}{misc}*\ .tree - Debugging files (from --debug) - * - {mod_prefix}_{each_verilog_module}*{__n}*\ .vpp + * - {mod_prefix}_{each_verilog_base_filename}*\ .vpp - Pre-processed verilog (from --debug) After running Make, the C++ compiler may produce the following: diff --git a/src/V3ParseImp.cpp b/src/V3ParseImp.cpp index 00ee4a53c..de03355ef 100644 --- a/src/V3ParseImp.cpp +++ b/src/V3ParseImp.cpp @@ -268,6 +268,7 @@ void V3ParseImp::preprocDumps(std::ostream& os) { void V3ParseImp::parseFile(FileLine* fileline, const string& modfilename, bool inLibrary, const string& errmsg) { // "" for no error, make fake node + const string nondirname = V3Os::filenameNonDir(modfilename); const string modname = V3Os::filenameNonExt(modfilename); UINFO(2, __FUNCTION__ << ": " << modname << (inLibrary ? " [LIB]" : "") << endl); @@ -288,8 +289,8 @@ void V3ParseImp::parseFile(FileLine* fileline, const string& modfilename, bool i if (v3Global.opt.preprocOnly() || v3Global.opt.keepTempFiles()) { // Create output file with all the preprocessor output we buffered up - const string vppfilename - = v3Global.opt.hierTopDataDir() + "/" + v3Global.opt.prefix() + "_" + modname + ".vpp"; + const string vppfilename = v3Global.opt.hierTopDataDir() + "/" + v3Global.opt.prefix() + + "_" + nondirname + ".vpp"; std::ofstream* ofp = nullptr; std::ostream* osp; if (v3Global.opt.preprocOnly()) {