CodeobjMap Class Reference#
|
ROCprofiler-SDK developer API 1.3.2
ROCm Profiling API and tools
|
rocprofiler::sdk::codeobj::disassembly::CodeobjMap Class Reference
Maps ID and offsets into instructions. More...
#include <rocprofiler-sdk/cxx/codeobj/code_printing.hpp>
Inheritance diagram for rocprofiler::sdk::codeobj::disassembly::CodeobjMap:
Collaboration diagram for rocprofiler::sdk::codeobj::disassembly::CodeobjMap:Public Member Functions | |
| virtual void | addDecoder (const char *filepath, marker_id_t id, uint64_t load_addr, uint64_t memsize) |
| virtual void | addDecoder (const void *data, unsigned long memory_size, marker_id_t id, uint64_t load_addr, uint64_t memsize) |
| virtual bool | removeDecoderbyId (marker_id_t id) |
| std::unique_ptr< Instruction > | get (marker_id_t id, uint64_t offset) |
| const char * | getSymbolName (marker_id_t id, uint64_t offset) |
| funcmap::Funcmap::EntryPtr | getMarker (marker_id_t id, uint32_t funcmap_id) const |
| std::optional< funcmap::Funcmap > | getFuncmap (marker_id_t id) const |
Protected Attributes | |
| std::unordered_map< marker_id_t, std::shared_ptr< LoadedCodeobjDecoder > > | decoders {} |
Detailed Description
Maps ID and offsets into instructions.
Definition at line 480 of file code_printing.hpp.
Member Function Documentation
◆ addDecoder() [1/2]
|
inlinevirtual |
Definition at line 486 of file code_printing.hpp.
490 {
491 decoders[id] = std::make_shared<LoadedCodeobjDecoder>(filepath, load_addr, memsize);
492 }
◆ addDecoder() [2/2]
|
inlinevirtual |
Definition at line 494 of file code_printing.hpp.
499 {
500 decoders[id] =
501 std::make_shared<LoadedCodeobjDecoder>(data, memory_size, load_addr, memsize);
502 }
◆ get()
|
inline |
Definition at line 506 of file code_printing.hpp.
507 {
508 try
509 {
510 auto& decoder = decoders.at(id);
511 auto inst = decoder->get(decoder->begin() + offset);
512 if(inst != nullptr) inst->codeobj_id = id;
513 return inst;
514 } catch(std::out_of_range&)
515 {}
516 return nullptr;
517 }
◆ getFuncmap()
|
inline |
Definition at line 672 of file code_printing.hpp.
673{
674 auto it = decoders.find(id);
675 if(it == decoders.end() || !it->second || !it->second->has_decoder()) return std::nullopt;
676 return it->second->getFuncmap();
677}
◆ getMarker()
|
inline |
Definition at line 657 of file code_printing.hpp.
658{
659 auto it = decoders.find(id);
660 if(it == decoders.end()) return nullptr;
661
662 try
663 {
664 return it->second->getFuncmap().find(funcmap_id);
665 } catch(...)
666 {
667 return nullptr;
668 }
669}
◆ getSymbolName()
|
inline |
Definition at line 519 of file code_printing.hpp.
520 {
521 try
522 {
523 auto& decoder = decoders.at(id);
524 uint64_t vaddr = decoder->begin() + offset;
525 if(decoder->inrange(vaddr)) return decoder->getSymbolName(vaddr);
526 } catch(std::out_of_range&)
527 {}
528 return nullptr;
529 }
◆ removeDecoderbyId()
|
inlinevirtual |
Definition at line 504 of file code_printing.hpp.
504{ return decoders.erase(id) != 0; }
Field Documentation
◆ decoders
|
protected |
Definition at line 541 of file code_printing.hpp.
541{};
The documentation for this class was generated from the following file:
- rocprofiler-sdk/cxx/codeobj/code_printing.hpp
Generated by