SIM_add_directory — add directory to search path
#include <simics/simulator-api.h> // in C
import "simics/simulator-api.dml"; // in DML
void
SIM_add_directory(const char *NOTNULL directory, bool prepend);
import simics
simics.SIM_add_directory(...)
Adds a directory to Simics’s search path. This is a list of directories which Simics uses when searching for files such as disk dumps, kernel images, etc.
The directory argument is first converted using SIM_native_path, to yield a path on host native form. If the path does not exist, a frontend exception is raised.
If prepend is true, the directory is inserted first in the list of directories.
This list of directories is saved as the attribute simics_path when doing write-configuration. Each directory is first converted to absolute form if relative.
SimExc_General Thrown if the directory does not exist.
SIM_lookup_file, SIM_clear_directories
Global Context
SIM_clear_directories — clear the search path
#include <simics/simulator-api.h> // in C
import "simics/simulator-api.dml"; // in DML
void
SIM_clear_directories();
import simics
simics.SIM_clear_directories(...)
Deletes all directories from the search path.
SIM_add_directory, SIM_lookup_file
Global Context
SIM_get_directories — get the current search path
#include <simics/simulator-api.h> // in C
import "simics/simulator-api.dml"; // in DML
attr_value_t
SIM_get_directories();
import simics
simics.SIM_get_directories(...)
Returns the current value of the directory search path.
Cell Context
SIM_lookup_file — find a file using simics search path
#include <simics/simulator-api.h> // in C
import "simics/simulator-api.dml"; // in DML
char *
SIM_lookup_file(const char *file);
import simics
simics.SIM_lookup_file(...)
Searches for a file in the Simics search path.
The returned path will always be in host native format, so it will not need to be converted. See SIM_native_path for more details on what “host native format” means.
NULL is returned if file cannot be found.
The search algorithm is as follows.
If file is NULL or an empty string, the function returns NULL.
If file exists and is an absolute path, it is converted to host native form and returned.
If file starts with %simics%, the rest of the path is looked up first in the current Simics project, and then in all configured Simics packages. If a match is found, the native form of the file found will be returned.
If file exists in or relative to the current directory, it is returned without using the Simics search path. This is more or less equivalent of always having “.” first in the search path.
For each directory in Simics search path: The directory and the file is concatenated and converted to host native format. Each such file is looked up first in the current Simics project, and then in all Simics packages. If a match is found, the native form of the file found will be returned.
If the file was found, a pointer to the full path to the file is returned. The ownership of the string is passed to the caller.
SIM_add_directory, SIM_clear_directories
Cell Context
SIM_native_path — convert path to its native form
#include <simics/simulator-api.h> // in C
import "simics/simulator-api.dml"; // in DML
char *
SIM_native_path(const char *NOTNULL path);
import simics
simics.SIM_native_path(...)
Translates a path to its host native form. This functions is a no-op on all platforms except Windows.
The value returned by this function is allocated and owned by the caller.
Cell Context