CodeobjMap Class Reference

CodeobjMap Class Reference#

Rocprofiler SDK Developer API: rocprofiler::sdk::codeobj::disassembly::CodeobjMap Class Reference
Rocprofiler SDK Developer API 0.5.0
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

 CodeobjMap ()=default
 
virtual ~CodeobjMap ()=default
 
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< Instructionget (marker_id_t id, uint64_t offset)
 
const char * getSymbolName (marker_id_t id, uint64_t offset)
 

Protected Attributes

std::unordered_map< marker_id_t, std::shared_ptr< LoadedCodeobjDecoder > > decoders {}
 

Detailed Description

Maps ID and offsets into instructions.

Definition at line 281 of file code_printing.hpp.

Constructor & Destructor Documentation

◆ CodeobjMap()

rocprofiler::sdk::codeobj::disassembly::CodeobjMap::CodeobjMap ( )
default

◆ ~CodeobjMap()

virtual rocprofiler::sdk::codeobj::disassembly::CodeobjMap::~CodeobjMap ( )
virtualdefault

Member Function Documentation

◆ addDecoder() [1/2]

virtual void rocprofiler::sdk::codeobj::disassembly::CodeobjMap::addDecoder ( const char *  filepath,
marker_id_t  id,
uint64_t  load_addr,
uint64_t  memsize 
)
inlinevirtual

Reimplemented in rocprofiler::sdk::codeobj::disassembly::CodeobjAddressTranslate.

Definition at line 287 of file code_printing.hpp.

291 {
292 decoders[id] = std::make_shared<LoadedCodeobjDecoder>(filepath, load_addr, memsize);
293 }
std::unordered_map< marker_id_t, std::shared_ptr< LoadedCodeobjDecoder > > decoders

References decoders.

Referenced by rocprofiler::sdk::codeobj::disassembly::CodeobjAddressTranslate::addDecoder(), and rocprofiler::sdk::codeobj::disassembly::CodeobjAddressTranslate::addDecoder().

+ Here is the caller graph for this function:

◆ addDecoder() [2/2]

virtual void rocprofiler::sdk::codeobj::disassembly::CodeobjMap::addDecoder ( const void *  data,
unsigned long  memory_size,
marker_id_t  id,
uint64_t  load_addr,
uint64_t  memsize 
)
inlinevirtual

Reimplemented in rocprofiler::sdk::codeobj::disassembly::CodeobjAddressTranslate.

Definition at line 295 of file code_printing.hpp.

300 {
301 decoders[id] =
302 std::make_shared<LoadedCodeobjDecoder>(data, memory_size, load_addr, memsize);
303 }

References decoders.

◆ get()

std::unique_ptr< Instruction > rocprofiler::sdk::codeobj::disassembly::CodeobjMap::get ( marker_id_t  id,
uint64_t  offset 
)
inline

Definition at line 307 of file code_printing.hpp.

308 {
309 try
310 {
311 auto& decoder = decoders.at(id);
312 auto inst = decoder->get(decoder->begin() + offset);
313 if(inst != nullptr) inst->codeobj_id = id;
314 return inst;
315 } catch(std::out_of_range&)
316 {}
317 return nullptr;
318 }

References decoders.

Referenced by rocprofiler::sdk::codeobj::disassembly::CodeobjAddressTranslate::get(), and rocprofiler::sdk::codeobj::disassembly::CodeobjAddressTranslate::get().

+ Here is the caller graph for this function:

◆ getSymbolName()

const char * rocprofiler::sdk::codeobj::disassembly::CodeobjMap::getSymbolName ( marker_id_t  id,
uint64_t  offset 
)
inline

Definition at line 320 of file code_printing.hpp.

321 {
322 try
323 {
324 auto& decoder = decoders.at(id);
325 uint64_t vaddr = decoder->begin() + offset;
326 if(decoder->inrange(vaddr)) return decoder->getSymbolName(vaddr);
327 } catch(std::out_of_range&)
328 {}
329 return nullptr;
330 }

References decoders.

◆ removeDecoderbyId()

virtual bool rocprofiler::sdk::codeobj::disassembly::CodeobjMap::removeDecoderbyId ( marker_id_t  id)
inlinevirtual

Definition at line 305 of file code_printing.hpp.

305{ return decoders.erase(id) != 0; }

References decoders.

Referenced by rocprofiler::sdk::codeobj::disassembly::CodeobjAddressTranslate::removeDecoder().

+ Here is the caller graph for this function:

Field Documentation

◆ decoders


The documentation for this class was generated from the following file: