forked from github/verilator
Fix crash in commandArgsPlusMatch, bug987.
This commit is contained in:
parent
49108c23f0
commit
379bfd062f
2
Changes
2
Changes
@ -37,6 +37,8 @@ indicates the contributor was also the author of the fix; Thanks!
|
||||
|
||||
**** Fix dot indexing into arrayed inferfaces, bug978. [Johan Bjork]
|
||||
|
||||
**** Fix crash in commandArgsPlusMatch, bug987. [Jamie Iles]
|
||||
|
||||
|
||||
* Verilator 3.876 2015-08-12
|
||||
|
||||
|
@ -1151,7 +1151,8 @@ void Verilated::commandArgs(int argc, const char** argv) {
|
||||
}
|
||||
|
||||
const char* Verilated::commandArgsPlusMatch(const char* prefixp) {
|
||||
return VerilatedImp::argPlusMatch(prefixp).c_str();
|
||||
const char* strp = vl_mc_scan_plusargs(prefixp);
|
||||
return strp ? strp : ""; // Backward compatible interface, "" for no match
|
||||
}
|
||||
|
||||
void Verilated::internalsDump() {
|
||||
|
@ -289,6 +289,7 @@ public:
|
||||
static void commandArgs(int argc, const char** argv);
|
||||
static void commandArgs(int argc, char** argv) { commandArgs(argc,(const char**)argv); }
|
||||
static CommandArgValues* getCommandArgs() {return &s_args;}
|
||||
/// Match plusargs with a given prefix. Returns static char* valid only for a single call
|
||||
static const char* commandArgsPlusMatch(const char* prefixp);
|
||||
|
||||
/// Produce name & version for (at least) VPI
|
||||
|
@ -1139,8 +1139,8 @@ sub _make_main {
|
||||
|
||||
if ($self->{savable}) {
|
||||
$fh->print(" const char* save_time_strp = Verilated::commandArgsPlusMatch(\"save_time=\");\n");
|
||||
$fh->print(" const char* save_restore_strp = Verilated::commandArgsPlusMatch(\"save_restore=\");\n");
|
||||
$fh->print(" unsigned int save_time = !save_time_strp[0] ? 0 : atoi(save_time_strp+strlen(\"+save_time=\"));\n");
|
||||
$fh->print(" const char* save_restore_strp = Verilated::commandArgsPlusMatch(\"save_restore=\");\n");
|
||||
$fh->print(" unsigned int save_restore = !save_restore_strp[0] ? 0 : 1;\n");
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user