diff options
author | sthiruva <sthiruva@gmail.com> | 2020-09-30 00:39:24 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-29 12:09:24 -0700 |
commit | 4baf970f1b151400152c43559e601625dc03bd67 (patch) | |
tree | 159fc751c4bc0044a399343ad43d31e6cad23b52 /fesvr | |
parent | e7cdd757248358235f3231cecf6aafdf23201d4e (diff) | |
download | spike-4baf970f1b151400152c43559e601625dc03bd67.zip spike-4baf970f1b151400152c43559e601625dc03bd67.tar.gz spike-4baf970f1b151400152c43559e601625dc03bd67.tar.bz2 |
Adding symbol lookup when --enable-commitlog is enabled (#558)
* Adding symbol lookup when --enable-commitlog is enabled
* Removed the #ifdef RISCV_ENABLE_COMMITLOG for all get_symbol related function
Only retained the in processor.cc where it is called.
Co-authored-by: Shajid Thiruvathodi <sthiruva@valtrix.in>
Diffstat (limited to 'fesvr')
-rw-r--r-- | fesvr/htif.cc | 19 | ||||
-rw-r--r-- | fesvr/htif.h | 5 |
2 files changed, 24 insertions, 0 deletions
diff --git a/fesvr/htif.cc b/fesvr/htif.cc index 62dfaa5..f828494 100644 --- a/fesvr/htif.cc +++ b/fesvr/htif.cc @@ -142,6 +142,25 @@ void htif_t::load_program() reg_t dummy_entry; load_payload(payload, &dummy_entry); } + + for (auto i : symbols) + { + auto it = addr2symbol.find(i.second); + if ( it == addr2symbol.end()) + addr2symbol[i.second] = i.first; + } + + return; +} + +const char* htif_t::get_symbol(uint64_t addr) +{ + auto it = addr2symbol.find(addr); + + if(it == addr2symbol.end()) + return nullptr; + + return it->second.c_str(); } void htif_t::stop() diff --git a/fesvr/htif.h b/fesvr/htif.h index d69bd42..5b16a60 100644 --- a/fesvr/htif.h +++ b/fesvr/htif.h @@ -49,6 +49,9 @@ class htif_t : public chunked_memif_t // range to memory, because it has already been loaded through a sideband virtual bool is_address_preloaded(addr_t taddr, size_t len) { return false; } + // Given an address, return symbol from addr2symbol map + const char* get_symbol(uint64_t addr); + private: void parse_arguments(int argc, char ** argv); void register_devices(); @@ -75,6 +78,8 @@ class htif_t : public chunked_memif_t const std::vector<std::string>& target_args() { return targs; } + std::map<uint64_t, std::string> addr2symbol; + friend class memif_t; friend class syscall_t; }; |