Fix filenames with dots overwriting debug .vpp files (#3373).

This commit is contained in:
Wilson Snyder 2022-04-10 10:31:58 -04:00
parent fbd568dc47
commit f5f4e15ce2
3 changed files with 5 additions and 3 deletions

View File

@ -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

View File

@ -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:

View File

@ -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()) {