Class: LLDB::MemoryRegionInfo
- Inherits:
-
Object
- Object
- LLDB::MemoryRegionInfo
- Includes:
- NativeLifecycle
- Defined in:
- lib/lldb/memory_region_info.rb
Overview
Represents information about a memory region in the target process.
Class Method Summary collapse
Instance Method Summary collapse
-
#base_address ⇒ Object
Get the base address of the memory region.
-
#end_address ⇒ Object
Get the end address of the memory region.
-
#executable? ⇒ Boolean
Check if the memory region is executable.
-
#initialize(ptr, context: nil) ⇒ MemoryRegionInfo
constructor
A new instance of MemoryRegionInfo.
-
#mapped? ⇒ Boolean
Check if the memory region is mapped.
-
#name ⇒ Object
Get the name of the memory region (if available).
-
#permissions ⇒ Object
Get the permissions string (e.g., "rwx", "r-x", etc.).
-
#readable? ⇒ Boolean
Check if the memory region is readable.
-
#size ⇒ Object
Get the size of the memory region.
- #to_ptr ⇒ Object
- #to_s ⇒ Object
-
#writable? ⇒ Boolean
Check if the memory region is writable.
Methods included from NativeLifecycle
#close, #closed?, #context, #context!, #ensure_open!, #initialize_native_object, #valid?
Constructor Details
#initialize(ptr, context: nil) ⇒ MemoryRegionInfo
Returns a new instance of MemoryRegionInfo.
12 13 14 15 16 17 18 |
# File 'lib/lldb/memory_region_info.rb', line 12 def initialize(ptr, context: nil) initialize_native_object( ptr, release: ->(released) { FFIBindings.lldb_memory_region_info_destroy(released) }, context: context ) end |
Class Method Details
.release(ptr) ⇒ Object
22 23 24 |
# File 'lib/lldb/memory_region_info.rb', line 22 def self.release(ptr) ->(_id) { FFIBindings.lldb_memory_region_info_destroy(ptr) unless ptr.null? } end |
Instance Method Details
#base_address ⇒ Object
Get the base address of the memory region
29 30 31 |
# File 'lib/lldb/memory_region_info.rb', line 29 def base_address FFIBindings.lldb_memory_region_info_get_region_base(@ptr) end |
#end_address ⇒ Object
Get the end address of the memory region
36 37 38 |
# File 'lib/lldb/memory_region_info.rb', line 36 def end_address FFIBindings.lldb_memory_region_info_get_region_end(@ptr) end |
#executable? ⇒ Boolean
Check if the memory region is executable
64 65 66 |
# File 'lib/lldb/memory_region_info.rb', line 64 def executable? FFIBindings.lldb_memory_region_info_is_executable(@ptr) != 0 end |
#mapped? ⇒ Boolean
Check if the memory region is mapped
71 72 73 |
# File 'lib/lldb/memory_region_info.rb', line 71 def mapped? FFIBindings.lldb_memory_region_info_is_mapped(@ptr) != 0 end |
#name ⇒ Object
Get the name of the memory region (if available)
78 79 80 |
# File 'lib/lldb/memory_region_info.rb', line 78 def name FFIBindings.lldb_memory_region_info_get_name(@ptr) end |
#permissions ⇒ Object
Get the permissions string (e.g., "rwx", "r-x", etc.)
85 86 87 88 89 90 91 |
# File 'lib/lldb/memory_region_info.rb', line 85 def perms = +'' perms << (readable? ? 'r' : '-') perms << (writable? ? 'w' : '-') perms << (executable? ? 'x' : '-') perms.freeze end |
#readable? ⇒ Boolean
Check if the memory region is readable
50 51 52 |
# File 'lib/lldb/memory_region_info.rb', line 50 def readable? FFIBindings.lldb_memory_region_info_is_readable(@ptr) != 0 end |
#size ⇒ Object
Get the size of the memory region
43 44 45 |
# File 'lib/lldb/memory_region_info.rb', line 43 def size end_address - base_address end |
#to_ptr ⇒ Object
105 106 107 |
# File 'lib/lldb/memory_region_info.rb', line 105 def to_ptr @ptr end |
#to_s ⇒ Object
94 95 96 97 98 99 100 101 102 |
# File 'lib/lldb/memory_region_info.rb', line 94 def to_s format( '0x%016x-0x%016x %s %s', base_address, end_address, , name || '' ).strip end |
#writable? ⇒ Boolean
Check if the memory region is writable
57 58 59 |
# File 'lib/lldb/memory_region_info.rb', line 57 def writable? FFIBindings.lldb_memory_region_info_is_writable(@ptr) != 0 end |