duran 0.1.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.
Files changed (41) hide show
  1. data/LICENSE +20 -0
  2. data/README.rdoc +11 -0
  3. data/Rakefile +29 -0
  4. data/VERSION +1 -0
  5. data/client_src/dr_include/dr_api.h +102 -0
  6. data/client_src/dr_include/dr_app.h +92 -0
  7. data/client_src/dr_include/dr_config.h +650 -0
  8. data/client_src/dr_include/dr_defines.h +391 -0
  9. data/client_src/dr_include/dr_events.h +1057 -0
  10. data/client_src/dr_include/dr_ir_instr.h +1214 -0
  11. data/client_src/dr_include/dr_ir_instrlist.h +149 -0
  12. data/client_src/dr_include/dr_ir_macros.h +2426 -0
  13. data/client_src/dr_include/dr_ir_opcodes.h +768 -0
  14. data/client_src/dr_include/dr_ir_opnd.h +1170 -0
  15. data/client_src/dr_include/dr_ir_utils.h +708 -0
  16. data/client_src/dr_include/dr_proc.h +327 -0
  17. data/client_src/dr_include/dr_tools.h +1304 -0
  18. data/client_src/duran.c +57 -0
  19. data/client_src/extconf.rb +28 -0
  20. data/lib/duran.rb +18 -0
  21. data/lib/duran/app.rb +8 -0
  22. data/lib/duran/defines.rb +39 -0
  23. data/lib/duran/events.rb +156 -0
  24. data/lib/duran/ir_opcodes.rb +616 -0
  25. data/lib/duran/ir_opnd.rb +329 -0
  26. data/lib/duran/ir_utils.rb +133 -0
  27. data/lib/duran/proc.rb +49 -0
  28. data/lib/duran/structs.rb +20 -0
  29. data/lib/duran/structs/exception.rb +23 -0
  30. data/lib/duran/structs/fault_fragment_info.rb +34 -0
  31. data/lib/duran/structs/instruction.rb +15 -0
  32. data/lib/duran/structs/machine_context.rb +80 -0
  33. data/lib/duran/structs/memory_info.rb +12 -0
  34. data/lib/duran/structs/module_data.rb +61 -0
  35. data/lib/duran/structs/module_names.rb +24 -0
  36. data/lib/duran/structs/operand.rb +15 -0
  37. data/lib/duran/structs/restore_state_info.rb +30 -0
  38. data/lib/duran/structs/signal_info.rb +41 -0
  39. data/lib/duran/structs/tracedump.rb +50 -0
  40. data/lib/duran/tools.rb +214 -0
  41. metadata +104 -0
@@ -0,0 +1,214 @@
1
+
2
+ module Duran
3
+ attach_function :dr_standalone_init, [], :pointer
4
+ attach_function :dr_using_all_private_caches, [], :bool
5
+ attach_function :dr_get_options, [:client_id_t], :string
6
+ attach_function :dr_get_client_path, [:client_id_t], :string
7
+ attach_function :dr_get_application_name, [], :string
8
+ attach_function :dr_get_process_id, [], :process_id_t
9
+ attach_function :dr_get_parent_id, [], :process_id_t
10
+ attach_function :dr_abort, [], :void
11
+
12
+ class DR_Time < DRYStruct
13
+ dsl_layout do
14
+ field :year, :uint
15
+ field :month, :uint
16
+ field :day_of_week, :uint
17
+ field :day, :uint
18
+ field :hour, :uint
19
+ field :minute, :uint
20
+ field :second, :uint
21
+ field :milliseconds, :uint
22
+ end
23
+ end
24
+
25
+ attach_function :dr_get_time, [DR_Time], :void
26
+
27
+
28
+ #----------------------------------------------------------------------
29
+ # * APPLICATION-INDEPENDENT MEMORY ALLOCATION
30
+
31
+ attach_function :dr_thread_alloc, [:dr_ctx_t, :size_t], :pointer
32
+ attach_function :dr_thread_free, [:dr_ctx_t, :pointer, :size_t], :void
33
+ attach_function :dr_global_alloc, [:size_t], :pointer
34
+ attach_function :dr_global_free, [:pointer, :size_t], :void
35
+ attach_function :dr_nonheap_alloc, [:size_t, :uint], :pointer
36
+ attach_function :dr_nonheap_free, [:pointer, :size_t], :void
37
+ attach_function :__wrap_malloc, [:size_t], :pointer
38
+ attach_function :__wrap_realloc, [:pointer, :size_t], :pointer
39
+ attach_function :__wrap_free, [:pointer], :void
40
+
41
+
42
+ #----------------------------------------------------------------------
43
+ # * MEMORY QUERY/ACCESS ROUTINES
44
+
45
+ attach_function :dr_memory_is_readable, [:pointer, :size_t], :bool
46
+ attach_function :dr_memory_is_dr_internal, [:pointer], :bool
47
+ attach_function :dr_memory_is_in_client, [:pointer], :bool
48
+ attach_function :dr_query_memory, [:pointer, :pointer, :size_t, :uint], :bool
49
+ attach_function :dr_query_memory_ex, [:pointer, :pointer], :bool
50
+ attach_function :dr_safe_read, [:pointer, :size_t, :pointer, :pointer], :bool
51
+ attach_function :dr_safe_write, [:pointer, :size_t, :pointer, :pointer], :bool
52
+ attach_function :dr_memory_protect, [:pointer, :size_t, :uint], :bool
53
+
54
+ #----------------------------------------------------------------------
55
+ # * SIMPLE MUTEX SUPPORT
56
+
57
+ attach_function :dr_mutex_create, [], :pointer
58
+ attach_function :dr_mutex_destroy, [:pointer], :void
59
+ attach_function :dr_mutex_lock, [:pointer], :void
60
+ attach_function :dr_mutex_unlock, [:pointer], :void
61
+ attach_function :dr_mutex_trylock, [:pointer], :bool
62
+
63
+ #----------------------------------------------------------------------
64
+ # * MODULE INFORMATION ROUTINES
65
+
66
+ attach_function :dr_lookup_module, [:pointer], ModuleData
67
+ attach_function :dr_lookup_module_by_name, [:string], ModuleData
68
+ attach_function :dr_module_iterator_start, [], :dr_module_iterator_t
69
+ attach_function :dr_module_iterator_hasnext, [:dr_module_iterator_t], :bool
70
+ attach_function :dr_module_iterator_next, [:dr_module_iterator_t], ModuleData
71
+ attach_function :dr_module_iterator_stop, [:dr_module_iterator_t], :void
72
+ attach_function :dr_copy_module_data, [ModuleData], ModuleData
73
+ attach_function :dr_free_module_data, [ModuleData], :void
74
+ attach_function :dr_module_preferred_name, [ModuleData], :string
75
+ attach_function :dr_get_proc_address, [:module_handle_t, :string], :pointer
76
+
77
+ #----------------------------------------------------------------------
78
+ # * SYSTEM CALL PROCESSING ROUTINES
79
+
80
+ attach_function :dr_syscall_get_param, [:dr_ctx_t, :int], :reg_t
81
+ attach_function :dr_syscall_set_param, [:dr_ctx_t, :int, :reg_t], :void
82
+ attach_function :dr_syscall_get_result, [:dr_ctx_t], :reg_t
83
+ attach_function :dr_syscall_set_result, [:dr_ctx_t, :reg_t], :void
84
+ attach_function :dr_syscall_set_sysnum, [:dr_ctx_t, :int], :void
85
+ attach_function :dr_syscall_invoke_another, [:dr_ctx_t], :void
86
+
87
+
88
+ attach_function :dr_create_dir, [:string], :bool
89
+
90
+ FILE_READ = 0x1
91
+ FILE_WRITE_REQUIRE_NEW = 0x2
92
+ FILE_WRITE_APPEND = 0x4
93
+ FILE_WRITE_OVERWRITE = 0x8
94
+ FILE_ALLOW_LARGE = 0x10
95
+
96
+ attach_function :dr_open_file, [:string, :uint], :file_t
97
+ attach_function :dr_close_file, [:file_t], :void
98
+ attach_function :dr_flush_file, [:file_t], :void
99
+ attach_function :dr_write_file, [:file_t, :pointer, :size_t], :ssize_t
100
+ attach_function :dr_read_file, [:file_t, :pointer, :size_t], :ssize_t
101
+
102
+ SEEK_SET = 0
103
+ SEEK_CUR = 1
104
+ SEEK_END = 1
105
+
106
+ attach_function :dr_file_seek, [:file_t, :int64, :int], :bool
107
+ attach_function :dr_file_tell, [:file_t], :int64
108
+ attach_function :dr_dup_file_handle, [:file_t], :file_t
109
+
110
+
111
+ attach_function :dr_log,
112
+ [:dr_ctx_t, :uint, :uint, :string, :varargs], :void
113
+
114
+ # log mask constants
115
+
116
+ LOG_NONE = 0x00000000 # Log no data.
117
+ LOG_STATS = 0x00000001 # Log per-thread and global statistics.
118
+ LOG_TOP = 0x00000002 # Log top-level information.
119
+ LOG_THREADS = 0x00000004 # Log data related to threads.
120
+ LOG_SYSCALLS = 0x00000008 # Log data related to system calls.
121
+ LOG_ASYNCH = 0x00000010 # Log data related to signals/callbacks/etc.
122
+ LOG_INTERP = 0x00000020 # Log data related to app interpretation.
123
+ LOG_EMIT = 0x00000040 # Log data related to emitting code.
124
+ LOG_LINKS = 0x00000080 # Log data related to linking code.
125
+ LOG_CACHE = 0x00000100 # Log data related to code cache management.
126
+ LOG_FRAGMENT = 0x00000200 # Log data related to app code fragments.
127
+ LOG_DISPATCH = 0x00000400 # Log data on every context switch dispatch.
128
+ LOG_MONITOR = 0x00000800 # Log data related to trace building.
129
+ LOG_HEAP = 0x00001000 # Log data related to memory managment.
130
+ LOG_VMAREAS = 0x00002000 # Log data related to address space regions.
131
+ LOG_SYNCH = 0x00004000 # Log data related to synchronization.
132
+ LOG_MEMSTATS = 0x00008000 # Log data related to memory statistics.
133
+ LOG_OPTS = 0x00010000 # Log data related to optimizations.
134
+ LOG_SIDELINE = 0x00020000 # Log data related to sideline threads.
135
+ LOG_SYMBOLS = 0x00040000 # Log data related to app symbols.
136
+ LOG_RCT = 0x00080000 # Log data related to indirect transfers.
137
+ LOG_NT = 0x00100000 # Log data related to Windows Native API.
138
+ LOG_HOT_PATCHING = 0x00200000 # Log data related to hot patching.
139
+ LOG_HTABLE = 0x00400000 # Log data related to hash tables.
140
+ LOG_MODULEDB = 0x00800000 # Log data related to the module database.
141
+ LOG_ALL = 0x00ffffff # Log all data.
142
+
143
+ attach_function :dr_get_logfile, [:dr_ctx_t], :file_t
144
+
145
+ attach_function :dr_is_notify_on, [], :bool
146
+
147
+ #attach_function :dr_get_stdout_file, [], :file_t
148
+ #attach_function :dr_get_stderr_file, [], :file_t
149
+ #attach_function :dr_get_stdin_file, [], :file_t
150
+
151
+ attach_function :dr_printf, [:string, :varargs], :void
152
+ attach_function :dr_fprintf, [:file_t, :string, :varargs], :void
153
+ attach_function :dr_snprintf, [:pointer, :size_t, :string, :varargs], :int
154
+ attach_function :dr_print_instr,
155
+ [:dr_ctx_t, :file_t, Instruction, :string], :void
156
+
157
+ attach_function :dr_get_current_drcontext, [], :dr_ctx_t
158
+
159
+ attach_function :dr_get_thread_id, [:dr_ctx_t], :thread_id_t
160
+ attach_function :dr_get_tls_field, [:dr_ctx_t], :pointer
161
+ attach_function :dr_set_tls_field, [:dr_ctx_t, :pointer], :void
162
+
163
+ attach_function :dr_raw_tls_calloc, [:pointer, :pointer, :uint, :uint], :bool
164
+ attach_function :dr_raw_tls_cfree, [:uint, :uint], :bool
165
+ attach_function :dr_thread_yield, [], :void
166
+
167
+ attach_function :dr_resume_all_other_threads, [:pointer, :uint], :bool
168
+ attach_function :dr_suspend_all_other_threads,
169
+ [:pointer, :pointer, :pointer], :bool
170
+
171
+
172
+ attach_function :dr_replace_fragment,
173
+ [:dr_ctx_t, :dr_tag_t, :pointer], :bool
174
+
175
+ attach_function :dr_delete_fragment, [:dr_ctx_t, :dr_tag_t], :bool
176
+ attach_function :dr_flush_region, [:app_pc, :size_t], :bool
177
+ attach_function :dr_unlink_flush_region, [:app_pc, :size_t], :bool
178
+
179
+ # void (*flush_completion_callback) (int flush_id)
180
+ callback :flush_completion_cb, [:int], :void
181
+
182
+ attach_function :dr_delay_flush_region,
183
+ [:app_pc, :size_t, :uint, :flush_completion_cb], :bool
184
+
185
+ attach_function :dr_fragment_exists_at, [:dr_ctx_t, :dr_tag_t], :bool
186
+ attach_function :dr_bb_exists_at, [:dr_ctx_t, :dr_tag_t], :bool
187
+
188
+ attach_function :dr_fragment_size, [:dr_ctx_t, :dr_tag_t], :uint
189
+ attach_function :dr_fragment_app_pc, [:dr_tag_t], :app_pc
190
+
191
+ #----------------------------------------------------------------------
192
+ # * CUSTOM TRACE SUPPORT
193
+
194
+ attach_function :dr_mark_trace_head, [:dr_ctx_t, :dr_tag_t], :bool
195
+ attach_function :dr_trace_head_at, [:dr_ctx_t, :dr_tag_t], :bool
196
+ attach_function :dr_trace_exists_at, [:dr_ctx_t, :dr_tag_t], :bool
197
+
198
+
199
+ if ::Duran::PLATFORM == :windows
200
+ attach_function :dr_is_wow64, [], :bool
201
+
202
+ attach_function :dr_virtual_query, [:pointer, :pointer, :size_t], :size_t
203
+
204
+ attach_function :dr_lookup_module_section,
205
+ [:module_handle_t, :pointer, :pointer], :bool
206
+
207
+ attach_function :dr_directory_exists, [:string], :bool
208
+ attach_function :dr_file_exists, [:string], :bool
209
+
210
+ attach_function :dr_messagebox, [:string, :varargs], :void
211
+
212
+ end
213
+
214
+ end
metadata ADDED
@@ -0,0 +1,104 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: duran
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Eric Monti
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2010-02-03 00:00:00 -06:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: thoughtbot-shoulda
17
+ type: :development
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "0"
24
+ version:
25
+ description: Embedded Ruby client and FFI bindings for the DyanoRIO dynamic binary translation library.
26
+ email: esmonti@gmail.com
27
+ executables: []
28
+
29
+ extensions: []
30
+
31
+ extra_rdoc_files:
32
+ - LICENSE
33
+ - README.rdoc
34
+ files:
35
+ - LICENSE
36
+ - README.rdoc
37
+ - Rakefile
38
+ - VERSION
39
+ - client_src/dr_include/dr_api.h
40
+ - client_src/dr_include/dr_app.h
41
+ - client_src/dr_include/dr_config.h
42
+ - client_src/dr_include/dr_defines.h
43
+ - client_src/dr_include/dr_events.h
44
+ - client_src/dr_include/dr_ir_instr.h
45
+ - client_src/dr_include/dr_ir_instrlist.h
46
+ - client_src/dr_include/dr_ir_macros.h
47
+ - client_src/dr_include/dr_ir_opcodes.h
48
+ - client_src/dr_include/dr_ir_opnd.h
49
+ - client_src/dr_include/dr_ir_utils.h
50
+ - client_src/dr_include/dr_proc.h
51
+ - client_src/dr_include/dr_tools.h
52
+ - client_src/duran.c
53
+ - client_src/extconf.rb
54
+ - lib/duran.rb
55
+ - lib/duran/app.rb
56
+ - lib/duran/defines.rb
57
+ - lib/duran/events.rb
58
+ - lib/duran/ir_opcodes.rb
59
+ - lib/duran/ir_opnd.rb
60
+ - lib/duran/ir_utils.rb
61
+ - lib/duran/proc.rb
62
+ - lib/duran/structs.rb
63
+ - lib/duran/structs/exception.rb
64
+ - lib/duran/structs/fault_fragment_info.rb
65
+ - lib/duran/structs/instruction.rb
66
+ - lib/duran/structs/machine_context.rb
67
+ - lib/duran/structs/memory_info.rb
68
+ - lib/duran/structs/module_data.rb
69
+ - lib/duran/structs/module_names.rb
70
+ - lib/duran/structs/operand.rb
71
+ - lib/duran/structs/restore_state_info.rb
72
+ - lib/duran/structs/signal_info.rb
73
+ - lib/duran/structs/tracedump.rb
74
+ - lib/duran/tools.rb
75
+ has_rdoc: true
76
+ homepage: http://github.com/emonti/duran
77
+ licenses: []
78
+
79
+ post_install_message:
80
+ rdoc_options:
81
+ - --charset=UTF-8
82
+ require_paths:
83
+ - lib
84
+ required_ruby_version: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: "0"
89
+ version:
90
+ required_rubygems_version: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - ">="
93
+ - !ruby/object:Gem::Version
94
+ version: "0"
95
+ version:
96
+ requirements: []
97
+
98
+ rubyforge_project:
99
+ rubygems_version: 1.3.5
100
+ signing_key:
101
+ specification_version: 3
102
+ summary: Embedded Ruby client and FFI bindings for the DyanoRIO library.
103
+ test_files: []
104
+