fixes CLI handling of plugin paramters in ISS
This commit is contained in:
parent
7e45a25218
commit
a32c83e1be
|
@ -40,11 +40,15 @@ set(LIB_SOURCES
|
|||
if(TARGET ${CORE_NAME}_cpp)
|
||||
list(APPEND LIB_SOURCES ${${CORE_NAME}_OUTPUT_FILES})
|
||||
else()
|
||||
FILE(GLOB GEN_SOURCES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src-gen/iss/arch/*.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src-gen/vm/interp/vm_*.cpp
|
||||
)
|
||||
list(APPEND LIB_SOURCES ${GEN_SOURCES})
|
||||
FILE(GLOB GEN_ISS_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src-gen/iss/arch/*.cpp)
|
||||
FILE(GLOB GEN_VM_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src-gen/vm/interp/vm_*.cpp)
|
||||
list(APPEND LIB_SOURCES ${GEN_ISS_SOURCES} ${GEN_VM_SOURCES})
|
||||
foreach(FILEPATH ${GEN_ISS_SOURCES})
|
||||
get_filename_component(CORE ${FILEPATH} NAME_WE)
|
||||
string(TOUPPER ${CORE} CORE)
|
||||
list(APPEND LIB_DEFINES CORE_${CORE})
|
||||
endforeach()
|
||||
message("Defines are ${LIB_DEFINES}")
|
||||
endif()
|
||||
|
||||
if(TARGET RapidJSON OR TARGET RapidJSON::RapidJSON)
|
||||
|
|
16
src/main.cpp
16
src/main.cpp
|
@ -31,6 +31,8 @@
|
|||
*******************************************************************************/
|
||||
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <array>
|
||||
#include "iss/factory.h"
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
@ -170,27 +172,29 @@ int main(int argc, char *argv[]) {
|
|||
if (clim.count("plugin")) {
|
||||
for (std::string const& opt_val : clim["plugin"].as<std::vector<std::string>>()) {
|
||||
std::string plugin_name=opt_val;
|
||||
std::string filename{"cycles.txt"};
|
||||
std::string arg{""};
|
||||
std::size_t found = opt_val.find('=');
|
||||
if (found != std::string::npos) {
|
||||
plugin_name = opt_val.substr(0, found);
|
||||
filename = opt_val.substr(found + 1, opt_val.size());
|
||||
arg = opt_val.substr(found + 1, opt_val.size());
|
||||
}
|
||||
if (plugin_name == "ic") {
|
||||
auto *ic_plugin = new iss::plugin::instruction_count(filename);
|
||||
auto *ic_plugin = new iss::plugin::instruction_count(arg);
|
||||
vm->register_plugin(*ic_plugin);
|
||||
plugin_list.push_back(ic_plugin);
|
||||
} else if (plugin_name == "ce") {
|
||||
auto *ce_plugin = new iss::plugin::cycle_estimate(filename);
|
||||
auto *ce_plugin = new iss::plugin::cycle_estimate(arg);
|
||||
vm->register_plugin(*ce_plugin);
|
||||
plugin_list.push_back(ce_plugin);
|
||||
} else if (plugin_name == "pctrace") {
|
||||
auto *plugin = new iss::plugin::pctrace(filename);
|
||||
auto *plugin = new iss::plugin::pctrace(arg);
|
||||
vm->register_plugin(*plugin);
|
||||
plugin_list.push_back(plugin);
|
||||
} else {
|
||||
#ifndef WIN32
|
||||
std::array<char const*, 1> a{{filename.c_str()}};
|
||||
std::vector<char const*> a{};
|
||||
if(arg.length())
|
||||
a.push_back({arg.c_str()});
|
||||
iss::plugin::loader l(plugin_name, {{"initPlugin"}});
|
||||
auto* plugin = l.call_function<iss::vm_plugin*>("initPlugin", a.size(), a.data());
|
||||
if(plugin){
|
||||
|
|
Loading…
Reference in New Issue