CodeobjMap Class Reference

CodeobjMap Class Reference#

Rocprofiler SDK Developer API: rocprofiler::codeobj::disassembly::CodeobjMap Class Reference
Rocprofiler SDK Developer API 0.4.0
ROCm Profiling API and tools
rocprofiler::codeobj::disassembly::CodeobjMap Class Reference

Maps ID and offsets into instructions. More...

#include "rocprofiler-sdk/amd_detail/rocprofiler-sdk-codeobj/code_printing.hpp"

+ Inheritance diagram for rocprofiler::codeobj::disassembly::CodeobjMap:
+ Collaboration diagram for rocprofiler::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 277 of file code_printing.hpp.

Constructor & Destructor Documentation

◆ CodeobjMap()

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

◆ ~CodeobjMap()

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

Member Function Documentation

◆ addDecoder() [1/2]

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

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

Definition at line 283 of file code_printing.hpp.

287 {
288 decoders[id] = std::make_shared<LoadedCodeobjDecoder>(filepath, load_addr, memsize);
289 }
std::unordered_map< marker_id_t, std::shared_ptr< LoadedCodeobjDecoder > > decoders

References decoders.

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

+ Here is the caller graph for this function:

◆ addDecoder() [2/2]

virtual void rocprofiler::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::codeobj::disassembly::CodeobjAddressTranslate.

Definition at line 291 of file code_printing.hpp.

296 {
297 decoders[id] =
298 std::make_shared<LoadedCodeobjDecoder>(data, memory_size, load_addr, memsize);
299 }

References decoders.

◆ get()

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

Definition at line 303 of file code_printing.hpp.

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

References decoders.

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

+ Here is the caller graph for this function:

◆ getSymbolName()

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

Definition at line 316 of file code_printing.hpp.

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

References decoders.

◆ removeDecoderbyId()

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

Definition at line 301 of file code_printing.hpp.

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

References decoders.

Referenced by rocprofiler::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: