Class: Ragweed::Wraposx::Vm::RegionExtendedInfo

Inherits:
RegionInfo show all
Defined in:
lib/ragweed/wraposx/region_info.rb

Overview

struct vm_region_extended_info

vm_prot_t               protection;
unsigned int            user_tag;
unsigned int            pages_resident;
unsigned int            pages_shared_now_private;
unsigned int            pages_swapped_out;
unsigned int            pages_dirtied;
unsigned int            ref_count;
unsigned short          shadow_depth;
unsigned char           external_pager;
unsigned char           share_mode;

;

Constant Summary collapse

FLAVOR =
Ragweed::Wraposx::Vm::REGION_EXTENDED_INFO

Instance Attribute Summary

Attributes inherited from RegionInfo

#base_address, #region_size

Instance Method Summary collapse

Methods included from FFIStructInclude

#method_missing, #methods, #respond_to?

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Ragweed::FFIStructInclude

Instance Method Details

#dump(&block) ⇒ Object



136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
# File 'lib/ragweed/wraposx/region_info.rb', line 136

def dump(&block)
  maybe_hex = lambda {|a| begin; "\n" + (" " * 9) + block.call(a, 16).hexdump(true)[10..-2]; rescue; ""; end }      
  maybe_dis = lambda {|a| begin; "\n" + block.call(a, 16).distorm.map {|i| "         " + i.mnem}.join("\n"); rescue; ""; end }

  string =<<EOM
  -----------------------------------------------------------------------
  EXTENDED INFO:
  base address:             #{self.base_address.to_s(16).rjust(8, "0")}

  protection:               #{self.protection.to_s(2).rjust(8, "0")} #{Ragweed::Wraposx::Vm::Pflags.flag_dump(self.protection)}
  user_tag:                 #{self.user_tag.to_s(16).rjust(8, "0")} #{maybe_hex.call(self.user_tag)}
  pages_resident:           #{self.pages_resident.to_s(16).rjust(8, "0")} #{maybe_hex.call(self.pages_resident)}
  pages_shared_now_private: #{self.pages_shared_now_private.to_s(16).rjust(8, "0")} #{maybe_hex.call(self.pages_shared_now_private)}
  pages_swapped_out:        #{self.pages_swapped_out.to_s(16).rjust(8, "0")} #{maybe_hex.call(self.pages_swapped_out)}
  pages_dirtied:            #{self.pages_dirtied.to_s(16).rjust(8, "0")} #{maybe_hex.call(self.pages_dirtied)}
  ref_count:                #{self.ref_count.to_s(16).rjust(8, "0")} #{maybe_hex.call(self.ref_count)}
  shadow_depth:             #{self.shadow_depth.to_s(16).rjust(8, "0")} #{maybe_hex.call(self.shadow_depth)}
  external_pager:           #{self.external_pager.to_s(16).rjust(8, "0")} #{maybe_hex.call(self.external_pager)}
  share_mode:               #{self.share_mode.to_s(16).rjust(8, "0")} #{maybe_hex.call(self.share_mode)}
  size:                     #{self.size.to_s(16).rjust(8, "0")} #{maybe_hex.call(self.size)}
EOM
end