14 #include "boost/io/ios_state.hpp" 
   22 constexpr 
unsigned int width = 16;
 
   39   const char* 
ptr = 
reinterpret_cast<const char*
> (addr);
 
   42   boost::io::ios_all_saver saver (
s);
 
   46   char cbuf[
width + 1] = {0};
 
   53     if ((ipos % 
width) == 0) {
 
   54       s << std::setw(16) << reinterpret_cast<uintptr_t>(
ptr + ipos) - 
offset << 
" ";
 
   56     if ((ipos % 4) == 0) {
 
   59     bbuf.uc[ipos % 4] = 
ptr[ipos];
 
   60     cbuf[ipos % 
width] = std::isgraph (
ptr[ipos]) ? 
ptr[ipos] : 
'.';
 
   63     if ((ipos % 4) == 0) {
 
   64       s << std::setw(8) << static_cast<unsigned int>(bbuf.u32);
 
   66     if ((ipos % 
width) == 0) {
 
   67       s << 
"  " << cbuf << 
"\n";
 
   71   if ((ipos % 
width) > 0) {
 
   72     unsigned ntrail = (ipos % 4);
 
   74       for (
unsigned i = ntrail; 
i < 4; 
i++) {
 
   77       s << std::setw(2*ntrail) << static_cast<unsigned int>(bbuf.u32);
 
   79     while ((ipos % 
width) != 0) {
 
   80       if ((ipos % 4) == 0) {
 
   84       cbuf[ipos % 
width] = 
' ';
 
   87     s << 
"  " << cbuf << 
"\n";
 
  106   const char* 
ptr = 
reinterpret_cast<const char*
> (addr);
 
  109   size_t nadj = 
reinterpret_cast<uintptr_t
>(
ptr) % 
width;
 
  115   long pagesize_ret = sysconf (_SC_PAGESIZE);
 
  116   if (pagesize_ret < 0 || pagesize_ret >= 1024*1024*1024) {
 
  119   size_t pagesize = pagesize_ret;
 
  126     uintptr_t iptr = 
reinterpret_cast<uintptr_t
>(
ptr);
 
  127     size_t thispage = ((iptr + pagesize) & ~(pagesize-1)) - iptr;
 
  136       boost::io::ios_all_saver saver (
s);
 
  139       s << std::setw(16) << reinterpret_cast<uintptr_t>(
ptr) - 
offset 
  140         << 
"  --- is not readable\n";