aboutsummaryrefslogtreecommitdiff
path: root/src/third_party/libdisasm/swig/ruby
diff options
context:
space:
mode:
authorcdn@chromium.org <cdn@chromium.org@4c0a9323-5329-0410-9bdc-e9ce6186880e>2010-10-01 22:38:10 +0000
committercdn@chromium.org <cdn@chromium.org@4c0a9323-5329-0410-9bdc-e9ce6186880e>2010-10-01 22:38:10 +0000
commit2b4274afc4fae883d1251a7a420e24fd526a9f16 (patch)
treed9cafcfb8d68b4c005f5cb80c15e3286c291b067 /src/third_party/libdisasm/swig/ruby
parentAdd stack-scanning fallback to Stackwalker{AMD64,ARM}. (diff)
downloadbreakpad-2b4274afc4fae883d1251a7a420e24fd526a9f16.tar.xz
Added libdisasm to the repository. This library is no longer under development so there
is no reason not to keep it locally. Implemented a basic disassembler which can be used to scan bytecode for interesting conditions. This should be pretty easy to add to for things other than exploitability if there is a desire. This also adds several tests to the windows exploitability ranking code to take advantage of the disassembler for x86 code. BUG=None TEST=DisassemblerX86Test.* Review URL: http://breakpad.appspot.com/203001 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@705 4c0a9323-5329-0410-9bdc-e9ce6186880e
Diffstat (limited to 'src/third_party/libdisasm/swig/ruby')
-rw-r--r--src/third_party/libdisasm/swig/ruby/Makefile-swig68
-rw-r--r--src/third_party/libdisasm/swig/ruby/extconf.rb4
2 files changed, 72 insertions, 0 deletions
diff --git a/src/third_party/libdisasm/swig/ruby/Makefile-swig b/src/third_party/libdisasm/swig/ruby/Makefile-swig
new file mode 100644
index 00000000..ee480023
--- /dev/null
+++ b/src/third_party/libdisasm/swig/ruby/Makefile-swig
@@ -0,0 +1,68 @@
+ifndef BASE_NAME
+BASE_NAME = x86disasm
+endif
+
+ifndef SWIG
+SWIG = swig # apt-get install swig !
+endif
+
+ifndef GCC
+GCC = gcc
+endif
+
+ifndef CC_FLAGS
+CC_FLAGS = -c -fPIC
+endif
+
+ifndef LD_FLAGS
+LD_FLAGS = -shared -L../.. -ldisasm
+endif
+
+LIBDISASM_DIR = ../..
+
+INTERFACE_FILE = libdisasm_oop.i
+
+SWIG_INTERFACE = ../$(INTERFACE_FILE)
+
+# RUBY rules
+RUBY_MAKEFILE = Makefile
+RUBY_MOD = $(BASE_NAME).so
+RUBY_SHADOW = $(BASE_NAME)_wrap.c
+#RUBY_SWIG = $(BASE_NAME).rb
+RUBY_OBJ = $(BASE_NAME)_wrap.o
+RUBY_INC = `ruby -e 'puts $$:.join("\n")' | tail -2 | head -1`
+#RUBY_LIB =
+#RUBY_DEST =
+
+#====================================================
+# TARGETS
+
+all: swig-ruby
+
+dummy: swig-ruby install uninstall clean
+
+swig-ruby: $(RUBY_MOD)
+
+$(RUBY_MOD): $(RUBY_MAKEFILE)
+ make
+
+$(RUBY_MAKEFILE): $(RUBY_OBJ)
+ ruby extconf.rb
+
+$(RUBY_OBJ):$(RUBY_SHADOW)
+ $(GCC) $(CC_FLAGS) -I$(RUBY_INC) -I.. -o $@ $<
+
+$(RUBY_SHADOW): $(SWIG_INTERFACE)
+ swig -ruby -o $(RUBY_SHADOW) -outdir . $<
+
+# ==================================================================
+install: $(RUBY_MOD)
+ make install
+
+# ==================================================================
+uninstall:
+
+# ==================================================================
+clean:
+ make clean || true
+ rm $(RUBY_SHADOW) $(RUBY_MAKEFILE) $(RUBY_MOD) $(RUBY_OBJ)
diff --git a/src/third_party/libdisasm/swig/ruby/extconf.rb b/src/third_party/libdisasm/swig/ruby/extconf.rb
new file mode 100644
index 00000000..4e743264
--- /dev/null
+++ b/src/third_party/libdisasm/swig/ruby/extconf.rb
@@ -0,0 +1,4 @@
+require 'mkmf'
+find_library('disasm', 'x86_init', "/usr/local/lib", "../..")
+create_makefile('x86disasm')
+