Hermes
memory_dump.h File Reference

Go to the source code of this file.

Classes

class  hermes::MemoryDumper
 Auxiliary logging class for printing blocks of memory. More...
 
struct  hermes::MemoryDumper::RegionLayout
 Memory region description. More...
 

Macros

#define RETURN_TYPE(T)
 

Enumerations

enum class  hermes::memory_dumper_options {
  none = 0x0 , binary = 0x1 , decimal = 0x2 , hexadecimal = 0x4 ,
  hexii = 0x8 , hide_header = 0x10 , cache_align = 0x20 , hide_zeros = 0x40 ,
  show_ascii = 0x80 , save_to_string = 0x100 , write_to_console = 0x200 , colored_output = 0x400 ,
  type_values = 0x800
}
 MemoryDumper output options. More...
 

Functions

 hermes::HERMES_ENABLE_BITMASK_OPERATORS (memory_dumper_options)
 Adds bitwise operator support to memory_dumper_options.
 
std::ostream & hermes::operator<< (std::ostream &os, const MemoryDumper::RegionLayout &layout)
 Adds MemoryDumper::RegionLayout support for std::ostream << operator. More...
 

Detailed Description

Copyright (c) 2021, FilipeCN.

The MIT License (MIT)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Author
FilipeCN (filip.nosp@m.edec.nosp@m.n@gma.nosp@m.il.c.nosp@m.om)
Date
2021-03-14

Macro Definition Documentation

◆ RETURN_TYPE

#define RETURN_TYPE (   T)
Value:
if(sub_region.type == DataTypes::typeFrom<T>()) { \
ss << std::setw(10) << std::right << std::setprecision(3) << *reinterpret_cast<T*>(data); \
return ss.str(); }

Enumeration Type Documentation

◆ memory_dumper_options

MemoryDumper output options.

Note
You may use bitwise operators to combine these options
Enumerator
none 

default usage

binary 

output memory contents in binary

decimal 

output memory contents in decimal

hexadecimal 

output memory contents in hexadecimal

hexii 

output memory contents in hexii

hide_header 

hide memory column names

cache_align 

aligns starting address to cache size

hide_zeros 

do not output bytes with 0 as value

show_ascii 

show ascii characters for each memory byte

save_to_string 

redirect output to string

write_to_console 

directly dump into stdout

colored_output 

use terminal colors

type_values 

cast values and output their values properly

Function Documentation

◆ operator<<()

std::ostream& hermes::operator<< ( std::ostream &  os,
const MemoryDumper::RegionLayout layout 
)
inline

Adds MemoryDumper::RegionLayout support for std::ostream << operator.

Parameters
os
layout
Returns