lldb 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/ext/lldb/liblldb_wrapper.dylib +0 -0
- data/ext/lldb/lldb_wrapper.cpp +64 -0
- data/ext/lldb/lldb_wrapper.h +12 -0
- data/ext/lldb/lldb_wrapper.o +0 -0
- data/lib/lldb/api_support.rb +74 -0
- data/lib/lldb/error.rb +1 -0
- data/lib/lldb/ffi_bindings.rb +13 -0
- data/lib/lldb/frame.rb +3 -0
- data/lib/lldb/memory_region_info.rb +104 -0
- data/lib/lldb/process.rb +21 -0
- data/lib/lldb/target.rb +4 -0
- data/lib/lldb/thread.rb +4 -0
- data/lib/lldb/version.rb +1 -1
- data/lib/lldb.rb +2 -0
- data/sig/lldb/ffi_bindings.rbs +11 -0
- metadata +3 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2a9c4b0d0816a16700d8fc4e5b7bcb5e122875ead9fcfc8a2dde3c722e68d827
|
|
4
|
+
data.tar.gz: 6268f8c9bea45f4947cdb5a95ca5d95603e1d322e16f2f4aa1267c84f258b84c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f305a6a355a1f599bd2706e8e9531c6a465ff17bf45aa3525bfac8f1c0a9f6cc3ecaf32bfc78f0ff7006b383094ad653e0656a5f994ab2a86335c632f57812d1
|
|
7
|
+
data.tar.gz: cdbe16e161820379724b65595ce44d4d04f307f3edb1c9cae6f854b6088f90e7d7ea654799fef0f5126243e41c020e4b84a412a4b4dd7e03510db039c7f8eecf
|
data/CHANGELOG.md
CHANGED
|
Binary file
|
data/ext/lldb/lldb_wrapper.cpp
CHANGED
|
@@ -759,6 +759,70 @@ uint32_t lldb_process_get_unique_id(lldb_process_t process) {
|
|
|
759
759
|
return static_cast<lldb::SBProcess*>(process)->GetUniqueID();
|
|
760
760
|
}
|
|
761
761
|
|
|
762
|
+
lldb_memory_region_info_t lldb_process_get_memory_region_info(lldb_process_t process, uint64_t addr, lldb_error_t error) {
|
|
763
|
+
if (!process) return nullptr;
|
|
764
|
+
|
|
765
|
+
lldb::SBProcess* p = static_cast<lldb::SBProcess*>(process);
|
|
766
|
+
lldb::SBError* err = error ? static_cast<lldb::SBError*>(error) : nullptr;
|
|
767
|
+
lldb::SBError local_error;
|
|
768
|
+
|
|
769
|
+
lldb::SBMemoryRegionInfo* info = new lldb::SBMemoryRegionInfo();
|
|
770
|
+
lldb::SBError result = p->GetMemoryRegionInfo(addr, *info);
|
|
771
|
+
|
|
772
|
+
if (result.Fail()) {
|
|
773
|
+
if (err) *err = result;
|
|
774
|
+
delete info;
|
|
775
|
+
return nullptr;
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
return static_cast<lldb_memory_region_info_t>(info);
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
// ============================================================================
|
|
782
|
+
// SBMemoryRegionInfo
|
|
783
|
+
// ============================================================================
|
|
784
|
+
|
|
785
|
+
void lldb_memory_region_info_destroy(lldb_memory_region_info_t info) {
|
|
786
|
+
if (info) {
|
|
787
|
+
delete static_cast<lldb::SBMemoryRegionInfo*>(info);
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
uint64_t lldb_memory_region_info_get_region_base(lldb_memory_region_info_t info) {
|
|
792
|
+
if (!info) return 0;
|
|
793
|
+
return static_cast<lldb::SBMemoryRegionInfo*>(info)->GetRegionBase();
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
uint64_t lldb_memory_region_info_get_region_end(lldb_memory_region_info_t info) {
|
|
797
|
+
if (!info) return 0;
|
|
798
|
+
return static_cast<lldb::SBMemoryRegionInfo*>(info)->GetRegionEnd();
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
int lldb_memory_region_info_is_readable(lldb_memory_region_info_t info) {
|
|
802
|
+
if (!info) return 0;
|
|
803
|
+
return static_cast<lldb::SBMemoryRegionInfo*>(info)->IsReadable() ? 1 : 0;
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
int lldb_memory_region_info_is_writable(lldb_memory_region_info_t info) {
|
|
807
|
+
if (!info) return 0;
|
|
808
|
+
return static_cast<lldb::SBMemoryRegionInfo*>(info)->IsWritable() ? 1 : 0;
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
int lldb_memory_region_info_is_executable(lldb_memory_region_info_t info) {
|
|
812
|
+
if (!info) return 0;
|
|
813
|
+
return static_cast<lldb::SBMemoryRegionInfo*>(info)->IsExecutable() ? 1 : 0;
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
int lldb_memory_region_info_is_mapped(lldb_memory_region_info_t info) {
|
|
817
|
+
if (!info) return 0;
|
|
818
|
+
return static_cast<lldb::SBMemoryRegionInfo*>(info)->IsMapped() ? 1 : 0;
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
const char* lldb_memory_region_info_get_name(lldb_memory_region_info_t info) {
|
|
822
|
+
if (!info) return nullptr;
|
|
823
|
+
return static_cast<lldb::SBMemoryRegionInfo*>(info)->GetName();
|
|
824
|
+
}
|
|
825
|
+
|
|
762
826
|
// ============================================================================
|
|
763
827
|
// SBThread
|
|
764
828
|
// ============================================================================
|
data/ext/lldb/lldb_wrapper.h
CHANGED
|
@@ -26,6 +26,7 @@ typedef void* lldb_type_t;
|
|
|
26
26
|
typedef void* lldb_watchpoint_t;
|
|
27
27
|
typedef void* lldb_command_interpreter_t;
|
|
28
28
|
typedef void* lldb_command_return_object_t;
|
|
29
|
+
typedef void* lldb_memory_region_info_t;
|
|
29
30
|
|
|
30
31
|
// Initialization
|
|
31
32
|
void lldb_initialize(void);
|
|
@@ -149,6 +150,17 @@ size_t lldb_process_put_stdin(lldb_process_t process, const char* buf, size_t si
|
|
|
149
150
|
int lldb_process_send_async_interrupt(lldb_process_t process);
|
|
150
151
|
uint32_t lldb_process_get_num_supported_hardware_watchpoints(lldb_process_t process, lldb_error_t error);
|
|
151
152
|
uint32_t lldb_process_get_unique_id(lldb_process_t process);
|
|
153
|
+
lldb_memory_region_info_t lldb_process_get_memory_region_info(lldb_process_t process, uint64_t addr, lldb_error_t error);
|
|
154
|
+
|
|
155
|
+
// SBMemoryRegionInfo
|
|
156
|
+
void lldb_memory_region_info_destroy(lldb_memory_region_info_t info);
|
|
157
|
+
uint64_t lldb_memory_region_info_get_region_base(lldb_memory_region_info_t info);
|
|
158
|
+
uint64_t lldb_memory_region_info_get_region_end(lldb_memory_region_info_t info);
|
|
159
|
+
int lldb_memory_region_info_is_readable(lldb_memory_region_info_t info);
|
|
160
|
+
int lldb_memory_region_info_is_writable(lldb_memory_region_info_t info);
|
|
161
|
+
int lldb_memory_region_info_is_executable(lldb_memory_region_info_t info);
|
|
162
|
+
int lldb_memory_region_info_is_mapped(lldb_memory_region_info_t info);
|
|
163
|
+
const char* lldb_memory_region_info_get_name(lldb_memory_region_info_t info);
|
|
152
164
|
|
|
153
165
|
// SBThread
|
|
154
166
|
void lldb_thread_destroy(lldb_thread_t thread);
|
data/ext/lldb/lldb_wrapper.o
CHANGED
|
Binary file
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# rbs_inline: enabled
|
|
4
|
+
|
|
5
|
+
module LLDB
|
|
6
|
+
# Module for checking API availability across different LLDB versions
|
|
7
|
+
# and lldb-ruby binding implementations.
|
|
8
|
+
module APISupport
|
|
9
|
+
# Feature to FFI method mapping
|
|
10
|
+
FEATURES = {
|
|
11
|
+
breakpoint_by_address: :lldb_target_breakpoint_create_by_address,
|
|
12
|
+
breakpoint_by_regex: :lldb_target_breakpoint_create_by_regex,
|
|
13
|
+
memory_read: :lldb_process_read_memory,
|
|
14
|
+
memory_write: :lldb_process_write_memory,
|
|
15
|
+
thread_by_id: :lldb_process_get_thread_by_id,
|
|
16
|
+
memory_region_info: :lldb_process_get_memory_region_info,
|
|
17
|
+
step_into: :lldb_thread_step_into,
|
|
18
|
+
step_over: :lldb_thread_step_over,
|
|
19
|
+
step_out: :lldb_thread_step_out,
|
|
20
|
+
step_instruction: :lldb_thread_step_instruction,
|
|
21
|
+
registers: :lldb_frame_get_registers,
|
|
22
|
+
find_variable: :lldb_frame_find_variable,
|
|
23
|
+
evaluate_expression: :lldb_frame_evaluate_expression
|
|
24
|
+
}.freeze
|
|
25
|
+
|
|
26
|
+
class << self
|
|
27
|
+
# Check if a specific FFI method is available
|
|
28
|
+
#
|
|
29
|
+
# @rbs method_name: Symbol
|
|
30
|
+
# @rbs return: bool
|
|
31
|
+
def method_available?(method_name)
|
|
32
|
+
FFIBindings.respond_to?(method_name)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# Raise UnsupportedAPIError if the required method is not available
|
|
36
|
+
#
|
|
37
|
+
# @rbs method_name: Symbol
|
|
38
|
+
# @rbs feature_name: String?
|
|
39
|
+
# @rbs return: void
|
|
40
|
+
def require_method!(method_name, feature_name = nil)
|
|
41
|
+
return if method_available?(method_name)
|
|
42
|
+
|
|
43
|
+
feature = feature_name || method_name.to_s
|
|
44
|
+
raise UnsupportedAPIError,
|
|
45
|
+
"API '#{feature}' is not supported in this LLDB version or binding"
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# Check if a feature is supported
|
|
49
|
+
#
|
|
50
|
+
# @rbs feature: Symbol
|
|
51
|
+
# @rbs return: bool
|
|
52
|
+
def feature_supported?(feature)
|
|
53
|
+
method_name = FEATURES[feature]
|
|
54
|
+
return false unless method_name
|
|
55
|
+
|
|
56
|
+
method_available?(method_name)
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
# Get list of all supported features
|
|
60
|
+
#
|
|
61
|
+
# @rbs return: Array[Symbol]
|
|
62
|
+
def supported_features
|
|
63
|
+
FEATURES.keys.select { |f| feature_supported?(f) }
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
# Get list of all unsupported features
|
|
67
|
+
#
|
|
68
|
+
# @rbs return: Array[Symbol]
|
|
69
|
+
def unsupported_features
|
|
70
|
+
FEATURES.keys.reject { |f| feature_supported?(f) }
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
end
|
data/lib/lldb/error.rb
CHANGED
data/lib/lldb/ffi_bindings.rb
CHANGED
|
@@ -156,6 +156,19 @@ module LLDB
|
|
|
156
156
|
attach_function :lldb_process_send_async_interrupt, [:pointer], :int
|
|
157
157
|
attach_function :lldb_process_get_num_supported_hardware_watchpoints, %i[pointer pointer], :uint32
|
|
158
158
|
attach_function :lldb_process_get_unique_id, [:pointer], :uint32
|
|
159
|
+
attach_function :lldb_process_get_memory_region_info, %i[pointer uint64 pointer], :pointer
|
|
160
|
+
|
|
161
|
+
# =========================================================================
|
|
162
|
+
# SBMemoryRegionInfo
|
|
163
|
+
# =========================================================================
|
|
164
|
+
attach_function :lldb_memory_region_info_destroy, [:pointer], :void
|
|
165
|
+
attach_function :lldb_memory_region_info_get_region_base, [:pointer], :uint64
|
|
166
|
+
attach_function :lldb_memory_region_info_get_region_end, [:pointer], :uint64
|
|
167
|
+
attach_function :lldb_memory_region_info_is_readable, [:pointer], :int
|
|
168
|
+
attach_function :lldb_memory_region_info_is_writable, [:pointer], :int
|
|
169
|
+
attach_function :lldb_memory_region_info_is_executable, [:pointer], :int
|
|
170
|
+
attach_function :lldb_memory_region_info_is_mapped, [:pointer], :int
|
|
171
|
+
attach_function :lldb_memory_region_info_get_name, [:pointer], :string
|
|
159
172
|
|
|
160
173
|
# =========================================================================
|
|
161
174
|
# SBThread
|
data/lib/lldb/frame.rb
CHANGED
|
@@ -96,6 +96,7 @@ module LLDB
|
|
|
96
96
|
# @rbs return: Value?
|
|
97
97
|
def find_variable(name)
|
|
98
98
|
raise InvalidObjectError, 'Frame is not valid' unless valid?
|
|
99
|
+
APISupport.require_method!(:lldb_frame_find_variable, 'find_variable')
|
|
99
100
|
|
|
100
101
|
value_ptr = FFIBindings.lldb_frame_find_variable(@ptr, name)
|
|
101
102
|
return nil if value_ptr.nil? || value_ptr.null?
|
|
@@ -107,6 +108,7 @@ module LLDB
|
|
|
107
108
|
# @rbs return: Value?
|
|
108
109
|
def evaluate_expression(expression)
|
|
109
110
|
raise InvalidObjectError, 'Frame is not valid' unless valid?
|
|
111
|
+
APISupport.require_method!(:lldb_frame_evaluate_expression, 'evaluate_expression')
|
|
110
112
|
|
|
111
113
|
value_ptr = FFIBindings.lldb_frame_evaluate_expression(@ptr, expression)
|
|
112
114
|
return nil if value_ptr.nil? || value_ptr.null?
|
|
@@ -177,6 +179,7 @@ module LLDB
|
|
|
177
179
|
# @rbs return: ValueList
|
|
178
180
|
def get_registers
|
|
179
181
|
raise InvalidObjectError, 'Frame is not valid' unless valid?
|
|
182
|
+
APISupport.require_method!(:lldb_frame_get_registers, 'get_registers')
|
|
180
183
|
|
|
181
184
|
list_ptr = FFIBindings.lldb_frame_get_registers(@ptr)
|
|
182
185
|
raise LLDBError, 'Failed to get registers' if list_ptr.nil? || list_ptr.null?
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# rbs_inline: enabled
|
|
4
|
+
|
|
5
|
+
module LLDB
|
|
6
|
+
# Represents information about a memory region in the target process.
|
|
7
|
+
class MemoryRegionInfo
|
|
8
|
+
# @rbs ptr: FFI::Pointer
|
|
9
|
+
# @rbs return: void
|
|
10
|
+
def initialize(ptr)
|
|
11
|
+
@ptr = ptr # : FFI::Pointer
|
|
12
|
+
ObjectSpace.define_finalizer(self, self.class.release(@ptr))
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# @rbs ptr: FFI::Pointer
|
|
16
|
+
# @rbs return: ^(Integer) -> void
|
|
17
|
+
def self.release(ptr)
|
|
18
|
+
->(_id) { FFIBindings.lldb_memory_region_info_destroy(ptr) unless ptr.null? }
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# Get the base address of the memory region
|
|
22
|
+
#
|
|
23
|
+
# @rbs return: Integer
|
|
24
|
+
def base_address
|
|
25
|
+
FFIBindings.lldb_memory_region_info_get_region_base(@ptr)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Get the end address of the memory region
|
|
29
|
+
#
|
|
30
|
+
# @rbs return: Integer
|
|
31
|
+
def end_address
|
|
32
|
+
FFIBindings.lldb_memory_region_info_get_region_end(@ptr)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# Get the size of the memory region
|
|
36
|
+
#
|
|
37
|
+
# @rbs return: Integer
|
|
38
|
+
def size
|
|
39
|
+
end_address - base_address
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# Check if the memory region is readable
|
|
43
|
+
#
|
|
44
|
+
# @rbs return: bool
|
|
45
|
+
def readable?
|
|
46
|
+
FFIBindings.lldb_memory_region_info_is_readable(@ptr) != 0
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# Check if the memory region is writable
|
|
50
|
+
#
|
|
51
|
+
# @rbs return: bool
|
|
52
|
+
def writable?
|
|
53
|
+
FFIBindings.lldb_memory_region_info_is_writable(@ptr) != 0
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# Check if the memory region is executable
|
|
57
|
+
#
|
|
58
|
+
# @rbs return: bool
|
|
59
|
+
def executable?
|
|
60
|
+
FFIBindings.lldb_memory_region_info_is_executable(@ptr) != 0
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
# Check if the memory region is mapped
|
|
64
|
+
#
|
|
65
|
+
# @rbs return: bool
|
|
66
|
+
def mapped?
|
|
67
|
+
FFIBindings.lldb_memory_region_info_is_mapped(@ptr) != 0
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# Get the name of the memory region (if available)
|
|
71
|
+
#
|
|
72
|
+
# @rbs return: String?
|
|
73
|
+
def name
|
|
74
|
+
FFIBindings.lldb_memory_region_info_get_name(@ptr)
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# Get the permissions string (e.g., "rwx", "r-x", etc.)
|
|
78
|
+
#
|
|
79
|
+
# @rbs return: String
|
|
80
|
+
def permissions
|
|
81
|
+
perms = +''
|
|
82
|
+
perms << (readable? ? 'r' : '-')
|
|
83
|
+
perms << (writable? ? 'w' : '-')
|
|
84
|
+
perms << (executable? ? 'x' : '-')
|
|
85
|
+
perms.freeze
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
# @rbs return: String
|
|
89
|
+
def to_s
|
|
90
|
+
format(
|
|
91
|
+
'0x%016x-0x%016x %s %s',
|
|
92
|
+
base_address,
|
|
93
|
+
end_address,
|
|
94
|
+
permissions,
|
|
95
|
+
name || ''
|
|
96
|
+
).strip
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
# @rbs return: FFI::Pointer
|
|
100
|
+
def to_ptr
|
|
101
|
+
@ptr
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
end
|
data/lib/lldb/process.rb
CHANGED
|
@@ -170,6 +170,7 @@ module LLDB
|
|
|
170
170
|
# @rbs return: Thread?
|
|
171
171
|
def thread_by_id(thread_id)
|
|
172
172
|
raise InvalidObjectError, 'Process is not valid' unless valid?
|
|
173
|
+
APISupport.require_method!(:lldb_process_get_thread_by_id, 'thread_by_id')
|
|
173
174
|
|
|
174
175
|
thread_ptr = FFIBindings.lldb_process_get_thread_by_id(@ptr, thread_id)
|
|
175
176
|
return nil if thread_ptr.nil? || thread_ptr.null?
|
|
@@ -201,6 +202,7 @@ module LLDB
|
|
|
201
202
|
# @rbs return: String
|
|
202
203
|
def read_memory(address, size)
|
|
203
204
|
raise InvalidObjectError, 'Process is not valid' unless valid?
|
|
205
|
+
APISupport.require_method!(:lldb_process_read_memory, 'read_memory')
|
|
204
206
|
|
|
205
207
|
buffer = FFI::MemoryPointer.new(:uint8, size)
|
|
206
208
|
error = Error.new
|
|
@@ -215,6 +217,7 @@ module LLDB
|
|
|
215
217
|
# @rbs return: Integer
|
|
216
218
|
def write_memory(address, data)
|
|
217
219
|
raise InvalidObjectError, 'Process is not valid' unless valid?
|
|
220
|
+
APISupport.require_method!(:lldb_process_write_memory, 'write_memory')
|
|
218
221
|
|
|
219
222
|
buffer = FFI::MemoryPointer.from_string(data)
|
|
220
223
|
error = Error.new
|
|
@@ -309,6 +312,24 @@ module LLDB
|
|
|
309
312
|
FFIBindings.lldb_process_get_unique_id(@ptr)
|
|
310
313
|
end
|
|
311
314
|
|
|
315
|
+
# Get information about the memory region at the specified address
|
|
316
|
+
#
|
|
317
|
+
# @rbs address: Integer
|
|
318
|
+
# @rbs return: MemoryRegionInfo?
|
|
319
|
+
def get_memory_region_info(address)
|
|
320
|
+
raise InvalidObjectError, 'Process is not valid' unless valid?
|
|
321
|
+
APISupport.require_method!(:lldb_process_get_memory_region_info,
|
|
322
|
+
'get_memory_region_info')
|
|
323
|
+
|
|
324
|
+
error = Error.new
|
|
325
|
+
info_ptr = FFIBindings.lldb_process_get_memory_region_info(@ptr, address, error.to_ptr)
|
|
326
|
+
|
|
327
|
+
error.raise_if_error!
|
|
328
|
+
return nil if info_ptr.nil? || info_ptr.null?
|
|
329
|
+
|
|
330
|
+
MemoryRegionInfo.new(info_ptr)
|
|
331
|
+
end
|
|
332
|
+
|
|
312
333
|
# @rbs return: FFI::Pointer
|
|
313
334
|
def to_ptr
|
|
314
335
|
@ptr
|
data/lib/lldb/target.rb
CHANGED
|
@@ -128,6 +128,8 @@ module LLDB
|
|
|
128
128
|
# @rbs return: Breakpoint
|
|
129
129
|
def breakpoint_create_by_address(address)
|
|
130
130
|
raise InvalidObjectError, 'Target is not valid' unless valid?
|
|
131
|
+
APISupport.require_method!(:lldb_target_breakpoint_create_by_address,
|
|
132
|
+
'breakpoint_create_by_address')
|
|
131
133
|
|
|
132
134
|
bp_ptr = FFIBindings.lldb_target_breakpoint_create_by_address(@ptr, address)
|
|
133
135
|
if bp_ptr.nil? || bp_ptr.null?
|
|
@@ -244,6 +246,8 @@ module LLDB
|
|
|
244
246
|
# @rbs return: Breakpoint
|
|
245
247
|
def breakpoint_create_by_regex(regex, module_name: nil)
|
|
246
248
|
raise InvalidObjectError, 'Target is not valid' unless valid?
|
|
249
|
+
APISupport.require_method!(:lldb_target_breakpoint_create_by_regex,
|
|
250
|
+
'breakpoint_create_by_regex')
|
|
247
251
|
|
|
248
252
|
bp_ptr = FFIBindings.lldb_target_breakpoint_create_by_regex(@ptr, regex, module_name)
|
|
249
253
|
raise BreakpointError, "Failed to create breakpoint for regex '#{regex}'" if bp_ptr.nil? || bp_ptr.null?
|
data/lib/lldb/thread.rb
CHANGED
|
@@ -30,6 +30,7 @@ module LLDB
|
|
|
30
30
|
# @rbs return: bool
|
|
31
31
|
def step_over
|
|
32
32
|
raise InvalidObjectError, 'Thread is not valid' unless valid?
|
|
33
|
+
APISupport.require_method!(:lldb_thread_step_over, 'step_over')
|
|
33
34
|
|
|
34
35
|
FFIBindings.lldb_thread_step_over(@ptr) != 0
|
|
35
36
|
end
|
|
@@ -37,6 +38,7 @@ module LLDB
|
|
|
37
38
|
# @rbs return: bool
|
|
38
39
|
def step_into
|
|
39
40
|
raise InvalidObjectError, 'Thread is not valid' unless valid?
|
|
41
|
+
APISupport.require_method!(:lldb_thread_step_into, 'step_into')
|
|
40
42
|
|
|
41
43
|
FFIBindings.lldb_thread_step_into(@ptr) != 0
|
|
42
44
|
end
|
|
@@ -44,6 +46,7 @@ module LLDB
|
|
|
44
46
|
# @rbs return: bool
|
|
45
47
|
def step_out
|
|
46
48
|
raise InvalidObjectError, 'Thread is not valid' unless valid?
|
|
49
|
+
APISupport.require_method!(:lldb_thread_step_out, 'step_out')
|
|
47
50
|
|
|
48
51
|
FFIBindings.lldb_thread_step_out(@ptr) != 0
|
|
49
52
|
end
|
|
@@ -52,6 +55,7 @@ module LLDB
|
|
|
52
55
|
# @rbs return: bool
|
|
53
56
|
def step_instruction(step_over: false)
|
|
54
57
|
raise InvalidObjectError, 'Thread is not valid' unless valid?
|
|
58
|
+
APISupport.require_method!(:lldb_thread_step_instruction, 'step_instruction')
|
|
55
59
|
|
|
56
60
|
FFIBindings.lldb_thread_step_instruction(@ptr, step_over ? 1 : 0) != 0
|
|
57
61
|
end
|
data/lib/lldb/version.rb
CHANGED
data/lib/lldb.rb
CHANGED
|
@@ -6,10 +6,12 @@ require_relative 'lldb/version'
|
|
|
6
6
|
require_relative 'lldb/ffi_bindings'
|
|
7
7
|
require_relative 'lldb/types'
|
|
8
8
|
require_relative 'lldb/error'
|
|
9
|
+
require_relative 'lldb/api_support'
|
|
9
10
|
require_relative 'lldb/debugger'
|
|
10
11
|
require_relative 'lldb/target'
|
|
11
12
|
require_relative 'lldb/launch_info'
|
|
12
13
|
require_relative 'lldb/process'
|
|
14
|
+
require_relative 'lldb/memory_region_info'
|
|
13
15
|
require_relative 'lldb/thread'
|
|
14
16
|
require_relative 'lldb/frame'
|
|
15
17
|
require_relative 'lldb/breakpoint'
|
data/sig/lldb/ffi_bindings.rbs
CHANGED
|
@@ -100,6 +100,17 @@ module LLDB
|
|
|
100
100
|
def self.lldb_process_send_async_interrupt: (FFI::Pointer) -> Integer
|
|
101
101
|
def self.lldb_process_get_num_supported_hardware_watchpoints: (FFI::Pointer, FFI::Pointer) -> Integer
|
|
102
102
|
def self.lldb_process_get_unique_id: (FFI::Pointer) -> Integer
|
|
103
|
+
def self.lldb_process_get_memory_region_info: (FFI::Pointer, Integer, FFI::Pointer) -> FFI::Pointer
|
|
104
|
+
|
|
105
|
+
# SBMemoryRegionInfo
|
|
106
|
+
def self.lldb_memory_region_info_destroy: (FFI::Pointer) -> void
|
|
107
|
+
def self.lldb_memory_region_info_get_region_base: (FFI::Pointer) -> Integer
|
|
108
|
+
def self.lldb_memory_region_info_get_region_end: (FFI::Pointer) -> Integer
|
|
109
|
+
def self.lldb_memory_region_info_is_readable: (FFI::Pointer) -> Integer
|
|
110
|
+
def self.lldb_memory_region_info_is_writable: (FFI::Pointer) -> Integer
|
|
111
|
+
def self.lldb_memory_region_info_is_executable: (FFI::Pointer) -> Integer
|
|
112
|
+
def self.lldb_memory_region_info_is_mapped: (FFI::Pointer) -> Integer
|
|
113
|
+
def self.lldb_memory_region_info_get_name: (FFI::Pointer) -> String?
|
|
103
114
|
|
|
104
115
|
# SBThread
|
|
105
116
|
def self.lldb_thread_destroy: (FFI::Pointer) -> void
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: lldb
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Yudai Takada
|
|
@@ -50,6 +50,7 @@ files:
|
|
|
50
50
|
- ext/lldb/lldb_wrapper.o
|
|
51
51
|
- ext/lldb/mkmf.log
|
|
52
52
|
- lib/lldb.rb
|
|
53
|
+
- lib/lldb/api_support.rb
|
|
53
54
|
- lib/lldb/breakpoint.rb
|
|
54
55
|
- lib/lldb/breakpoint_location.rb
|
|
55
56
|
- lib/lldb/command_interpreter.rb
|
|
@@ -59,6 +60,7 @@ files:
|
|
|
59
60
|
- lib/lldb/ffi_bindings.rb
|
|
60
61
|
- lib/lldb/frame.rb
|
|
61
62
|
- lib/lldb/launch_info.rb
|
|
63
|
+
- lib/lldb/memory_region_info.rb
|
|
62
64
|
- lib/lldb/module.rb
|
|
63
65
|
- lib/lldb/process.rb
|
|
64
66
|
- lib/lldb/symbol_context.rb
|