hyperplatform_log_parser/symbol_resolver.cpp
// Return a symbol name from the address or an empty string on error
Return a symbol name from the address or an empty string on error
Return a symbol name from the address or an empty string on error
_Use_decl_annotations_ std::basic_string<TCHAR> SymbolResolver::GetName(
    std::uint64_t address) const {
  std::uint8_t buffer[sizeof(SYMBOL_INFO) + MAX_SYM_NAME * sizeof(TCHAR)] = {};
  auto symbol = reinterpret_cast<PSYMBOL_INFO>(buffer);
  symbol->SizeOfStruct = sizeof(SYMBOL_INFO);
  symbol->MaxNameLen = MAX_SYM_NAME;
  std::uint64_t displacement = 0;
  if (!SymFromAddr_(process_, address, &displacement, symbol)) {
    return {};
  }
  if (!displacement) {
    return symbol->Name;
  }
  std::basic_stringstream<TCHAR> stream;
  stream << "+0x" << std::nouppercase << std::hex << displacement;
  std::basic_string<TCHAR> result(stream.str());
  return symbol->Name + result;
}
_Use_decl_annotations_ std :: basic_string < TCHAR > SymbolResolver :: GetName ( std :: uint64_t address ) const { std :: uint8_t buffer [ sizeof ( SYMBOL_INFO ) + MAX_SYM_NAME * sizeof ( TCHAR ) ] = { } ; auto symbol = reinterpret_cast < PSYMBOL_INFO > ( buffer ) ; symbol -> SizeOfStruct = sizeof ( SYMBOL_INFO ) ; symbol -> MaxNameLen = MAX_SYM_NAME ; std :: uint64_t displacement = 0 ; if ( ! SymFromAddr_ ( process_ , address , & displacement , symbol ) ) { return { } ; } if ( ! displacement ) { return symbol -> Name ; } std :: basic_stringstream < TCHAR > stream ; stream << " " << std :: nouppercase << std :: hex << displacement ; std :: basic_string < TCHAR > result ( stream . str ( ) ) ; return symbol -> Name + result ; }
Return a symbol name from the address or an empty string on error
Return a symbol name from the address or an empty string on error