From 2e26be362acbe6ebc81e51856e2bce4a38ed6154 Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Fri, 27 Apr 2018 20:07:24 +0200 Subject: [PATCH] Adapted plugin behavior obeying availabiltiy of instrumentation interface and updated CMake files Conflicts: dbt-core --- .cproject | 7 +++++-- cmake/Conan.cmake | 3 ++- conanfile.txt | 1 - riscv/CMakeLists.txt | 2 ++ riscv/src/plugin/cycle_estimate.cpp | 3 +++ riscv/src/plugin/instruction_count.cpp | 4 +++- sc-components | 2 +- 7 files changed, 16 insertions(+), 6 deletions(-) diff --git a/.cproject b/.cproject index 288f130..64a9192 100644 --- a/.cproject +++ b/.cproject @@ -13,7 +13,7 @@ - + @@ -60,7 +60,7 @@ - + @@ -166,6 +166,9 @@ + + + diff --git a/cmake/Conan.cmake b/cmake/Conan.cmake index cfbf2d4..7fd859f 100644 --- a/cmake/Conan.cmake +++ b/cmake/Conan.cmake @@ -41,5 +41,6 @@ macro(setup_conan) endif() include(${conanfile_cmake}) - conan_basic_setup(TARGETS) + #conan_basic_setup(TARGETS) + conan_basic_setup() endmacro() diff --git a/conanfile.txt b/conanfile.txt index 20309c4..9c4e339 100644 --- a/conanfile.txt +++ b/conanfile.txt @@ -9,7 +9,6 @@ [generators] cmake - txt [options] Poco:shared=True diff --git a/riscv/CMakeLists.txt b/riscv/CMakeLists.txt index 965ed25..8db683b 100644 --- a/riscv/CMakeLists.txt +++ b/riscv/CMakeLists.txt @@ -30,6 +30,8 @@ if(GIT_FOUND) set (VCS_REVISION ${GIT_SHA1}) endif() +conan_basic_setup() + # This line finds the boost lib and headers. set(Boost_NO_BOOST_CMAKE ON) # Don't do a find_package in config mode before searching for a regular boost install. find_package(Boost COMPONENTS program_options system thread REQUIRED) diff --git a/riscv/src/plugin/cycle_estimate.cpp b/riscv/src/plugin/cycle_estimate.cpp index 445fa53..e5270bd 100644 --- a/riscv/src/plugin/cycle_estimate.cpp +++ b/riscv/src/plugin/cycle_estimate.cpp @@ -60,6 +60,7 @@ iss::plugin::cycle_estimate::~cycle_estimate() { bool iss::plugin::cycle_estimate::registration(const char* const version, vm_if& vm) { arch_instr = vm.get_arch()->get_instrumentation_if(); + if(!arch_instr) return false; const std::string core_name = arch_instr->core_type_name(); Json::Value &val = root[core_name]; if(val.isArray()){ @@ -77,9 +78,11 @@ bool iss::plugin::cycle_estimate::registration(const char* const version, vm_if& } } return true; + } void iss::plugin::cycle_estimate::callback(instr_info_t instr_info) { + assert(arch_instr && "No instrumentation interface available but callback executed"); auto entry = delays[instr_info.instr_id]; bool taken = (arch_instr->get_next_pc()-arch_instr->get_pc()) != (entry.size/8); if(taken && entry.taken > 1 ) // 1 is the default increment per instruction diff --git a/riscv/src/plugin/instruction_count.cpp b/riscv/src/plugin/instruction_count.cpp index e2cbdfc..282b173 100644 --- a/riscv/src/plugin/instruction_count.cpp +++ b/riscv/src/plugin/instruction_count.cpp @@ -64,7 +64,9 @@ iss::plugin::instruction_count::~instruction_count() { } bool iss::plugin::instruction_count::registration(const char* const version, vm_if& vm) { - const std::string core_name = vm.get_arch()->get_instrumentation_if()->core_type_name(); + auto instr_if = vm.get_arch()->get_instrumentation_if(); + if(!instr_if) return false; + const std::string core_name = instr_if->core_type_name(); Json::Value &val = root[core_name]; if(val.isArray()){ delays.reserve(val.size()); diff --git a/sc-components b/sc-components index ac8bd1d..bab66d1 160000 --- a/sc-components +++ b/sc-components @@ -1 +1 @@ -Subproject commit ac8bd1d2912996c0ec526963f6f6bb862555402f +Subproject commit bab66d1744221fdce7d0634c08c5c21184539d2a