Check for too many paths specified and fix path priority so paths specified on command line supersede built-in paths
This commit is contained in:
parent
844fa056f7
commit
a638d1eed0
96
vvp/main.cc
96
vvp/main.cc
|
|
@ -262,43 +262,6 @@ int main(int argc, char*argv[])
|
||||||
extern bool stop_is_finish;
|
extern bool stop_is_finish;
|
||||||
extern int stop_is_finish_exit_code;
|
extern int stop_is_finish_exit_code;
|
||||||
|
|
||||||
#ifdef __MINGW32__
|
|
||||||
/* Calculate the module path from the path to the command.
|
|
||||||
This is necessary because of the installation process on
|
|
||||||
Windows. Mostly, it is those darn drive letters, but oh
|
|
||||||
well. We know the command path is formed like this:
|
|
||||||
|
|
||||||
D:\iverilog\bin\iverilog.exe
|
|
||||||
|
|
||||||
The IVL_ROOT in a Windows installation is the path:
|
|
||||||
|
|
||||||
D:\iverilog\lib\ivl$(suffix)
|
|
||||||
|
|
||||||
so we chop the file name and the last directory by
|
|
||||||
turning the last two \ characters to null. Then we append
|
|
||||||
the lib\ivl$(suffix) to finish. */
|
|
||||||
char *s;
|
|
||||||
char basepath[4096], tmp[4096];
|
|
||||||
GetModuleFileName(NULL, tmp, sizeof tmp);
|
|
||||||
/* Convert to a short name to remove any embedded spaces. */
|
|
||||||
GetShortPathName(tmp, basepath, sizeof basepath);
|
|
||||||
s = strrchr(basepath, '\\');
|
|
||||||
if (s) *s = 0;
|
|
||||||
else {
|
|
||||||
fprintf(stderr, "%s: Missing first \\ in exe path!\n", argv[0]);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
s = strrchr(basepath, '\\');
|
|
||||||
if (s) *s = 0;
|
|
||||||
else {
|
|
||||||
fprintf(stderr, "%s: Missing second \\ in exe path!\n", argv[0]);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
strcat(s, "\\lib\\ivl" IVL_SUFFIX);
|
|
||||||
vpip_module_path[0] = strdup(basepath);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
if( ::getenv("VVP_WAIT_FOR_DEBUGGER") != 0 ) {
|
if( ::getenv("VVP_WAIT_FOR_DEBUGGER") != 0 ) {
|
||||||
fprintf( stderr, "Waiting for debugger...\n");
|
fprintf( stderr, "Waiting for debugger...\n");
|
||||||
bool debugger_release = false;
|
bool debugger_release = false;
|
||||||
|
|
@ -343,6 +306,10 @@ int main(int argc, char*argv[])
|
||||||
vpip_module_path_cnt = 0;
|
vpip_module_path_cnt = 0;
|
||||||
vpip_module_path[0] = 0;
|
vpip_module_path[0] = 0;
|
||||||
} else {
|
} else {
|
||||||
|
if (vpip_module_path_cnt >= VPIP_MODULE_PATH_MAX) {
|
||||||
|
fprintf(stderr, "Too many paths specified\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
vpip_module_path[vpip_module_path_cnt++] = optarg;
|
vpip_module_path[vpip_module_path_cnt++] = optarg;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -369,6 +336,61 @@ int main(int argc, char*argv[])
|
||||||
flag_errors += 1;
|
flag_errors += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef __MINGW32__
|
||||||
|
/* Calculate the module path from the path to the command.
|
||||||
|
This is necessary because of the installation process on
|
||||||
|
Windows. Mostly, it is those darn drive letters, but oh
|
||||||
|
well. We know the command path is formed like this:
|
||||||
|
|
||||||
|
D:\iverilog\bin\iverilog.exe
|
||||||
|
|
||||||
|
The IVL_ROOT in a Windows installation is the path:
|
||||||
|
|
||||||
|
D:\iverilog\lib\ivl$(suffix)
|
||||||
|
|
||||||
|
so we chop the file name and the last directory by
|
||||||
|
turning the last two \ characters to null. Then we append
|
||||||
|
the lib\ivl$(suffix) to finish. */
|
||||||
|
char *s;
|
||||||
|
char basepath[4096], tmp[4096];
|
||||||
|
GetModuleFileName(NULL, tmp, sizeof tmp);
|
||||||
|
/* Convert to a short name to remove any embedded spaces. */
|
||||||
|
GetShortPathName(tmp, basepath, sizeof basepath);
|
||||||
|
s = strrchr(basepath, '\\');
|
||||||
|
if (s) *s = 0;
|
||||||
|
else {
|
||||||
|
fprintf(stderr, "%s: Missing first \\ in exe path!\n", argv[0]);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
s = strrchr(basepath, '\\');
|
||||||
|
if (s) *s = 0;
|
||||||
|
else {
|
||||||
|
fprintf(stderr, "%s: Missing second \\ in exe path!\n", argv[0]);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
strcat(s, "\\lib\\ivl" IVL_SUFFIX);
|
||||||
|
if (vpip_module_path_cnt >= VPIP_MODULE_PATH_MAX) {
|
||||||
|
fprintf(stderr, "Too many paths specified\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
vpip_module_path[vpip_module_path_cnt++] = strdup(basepath);
|
||||||
|
#else
|
||||||
|
#ifdef MODULE_DIR1
|
||||||
|
if (vpip_module_path_cnt >= VPIP_MODULE_PATH_MAX) {
|
||||||
|
fprintf(stderr, "Too many paths specified\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
vpip_module_path[vpip_module_path_cnt++] = MODULE_DIR1;
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
#ifdef MODULE_DIR2
|
||||||
|
if (vpip_module_path_cnt >= VPIP_MODULE_PATH_MAX) {
|
||||||
|
fprintf(stderr, "Too many paths specified\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
vpip_module_path[vpip_module_path_cnt++] = MODULE_DIR2;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (flag_errors)
|
if (flag_errors)
|
||||||
return flag_errors;
|
return flag_errors;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,24 +33,9 @@ static unsigned dll_list_cnt = 0;
|
||||||
typedef void (*vlog_startup_routines_t)(void);
|
typedef void (*vlog_startup_routines_t)(void);
|
||||||
|
|
||||||
|
|
||||||
const char* vpip_module_path[64] = {
|
const char* vpip_module_path[VPIP_MODULE_PATH_MAX] = {0};
|
||||||
#ifdef MODULE_DIR1
|
|
||||||
MODULE_DIR1,
|
|
||||||
#endif
|
|
||||||
#ifdef MODULE_DIR2
|
|
||||||
MODULE_DIR2,
|
|
||||||
#endif
|
|
||||||
0
|
|
||||||
};
|
|
||||||
|
|
||||||
unsigned vpip_module_path_cnt = 0
|
unsigned vpip_module_path_cnt = 0;
|
||||||
#ifdef MODULE_DIR1
|
|
||||||
+ 1
|
|
||||||
#endif
|
|
||||||
#ifdef MODULE_DIR2
|
|
||||||
+ 1
|
|
||||||
#endif
|
|
||||||
;
|
|
||||||
|
|
||||||
void load_module_delete(void)
|
void load_module_delete(void)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -874,7 +874,7 @@ vpiHandle vpip_make_vthr_APV(char*label, unsigned index, unsigned bit, unsigned
|
||||||
extern void vpip_load_module(const char*name);
|
extern void vpip_load_module(const char*name);
|
||||||
|
|
||||||
# define VPIP_MODULE_PATH_MAX 64
|
# define VPIP_MODULE_PATH_MAX 64
|
||||||
extern const char* vpip_module_path[64];
|
extern const char* vpip_module_path[VPIP_MODULE_PATH_MAX];
|
||||||
extern unsigned vpip_module_path_cnt;
|
extern unsigned vpip_module_path_cnt;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue