1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/toolkit/crashreporter/google-breakpad/src/third_party/libdisasm/swig/README Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,128 @@ 1.4 + Libdisasm SWIG README 1.5 + 1.6 +The SWIG utility (www.swig.org) can be used to generate 1.7 + 1.8 + 1.9 +Building SWIG Modules 1.10 +--------------------- 1.11 + 1.12 + make 1.13 + make install 1.14 + 1.15 +Make and Install both build Python, Perl, Ruby, and Tcl modules. If you 1.16 +do not have one of these languages installed, comment out the relevant 1.17 +target in the main Makefile. 1.18 + 1.19 +Install uses 'sudo' to put files in the correct locations; if you 1.20 +do not have sudo installed, change the install targets. 1.21 + 1.22 +The Module API 1.23 +-------------- 1.24 + 1.25 +The OOP API 1.26 +----------- 1.27 + 1.28 + 1.29 +The Python Module 1.30 +----------------- 1.31 + 1.32 +To test that the module loads: 1.33 + 1.34 + bash# python 1.35 + >>> import x86disasm 1.36 + >>> x86disasm.version_string() 1.37 + '0.21-pre' 1.38 + >>>^D 1.39 + bash# 1.40 + 1.41 + >>> import x86disasm 1.42 + >>> import array 1.43 + >>> disasm = x86disasm.X86_Disasm( ) 1.44 + >>> tgt = open( "/tmp/a.out", "rb" ) 1.45 + >>> tgt.seek( 0, 2 ) 1.46 + >>> size = tgt.tell() 1.47 + >>> tgt.seek( 0, 0 ) 1.48 + >>> buf = array.array( 'B' ) 1.49 + >>> buf.fromfile( tgt, size ) 1.50 + >>> tgt.close() 1.51 + >>> data = x86disasm.byteArray( size ) 1.52 + >>> for i in range( size ): 1.53 + ... data[i] = buf.pop(0) 1.54 + ... 1.55 + >>> del buf 1.56 + >>> del tgt 1.57 + >>> insn = disasm.disasm( data, size - 1, 0, 0 ) 1.58 + >>> insn.format( x86disasm.att_syntax ) 1.59 + 'jg\t0x00000047' 1.60 + >>> insn.format( x86disasm.raw_syntax ) 1.61 + '0x00000000|0x00000000|2|7F 45 |||controlflow|jcc|jg|80386|General Purpose|||zero_clear sign_eq_oflow |0|0|relative|sbyte|00000047|' 1.62 + >>> ops = insn.operand_list() 1.63 + >>> node = ops.first() 1.64 + >>> while node is not None: 1.65 + ... s = node.op.format(x86disasm.raw_syntax) 1.66 + ... print s 1.67 + ... node = ops.next() 1.68 + ... 1.69 + relative|sbyte|00000047| 1.70 + 1.71 + 1.72 + 1.73 + 1.74 + 1.75 + 1.76 +The Perl Module 1.77 +--------------- 1.78 + 1.79 +To test that the module loads: 1.80 + 1.81 + bash# perl 1.82 + use x86disasm; 1.83 + print x86disasm::version_string() . "\n"; 1.84 + ^D 1.85 + 0.21-pre 1.86 + bash# 1.87 + 1.88 +The Ruby Module 1.89 +--------------- 1.90 + 1.91 +To test that the module loads: 1.92 + 1.93 + bash# irb 1.94 + irb(main):001:0> require 'x86disasm' 1.95 + => true 1.96 + irb(main):002:0> X86disasm.version_string() 1.97 + => "0.21-pre" 1.98 + irb(main):003:0> x = X86disasm::X86_Disasm.new 1.99 + => #<X86disasm::X86_Disasm:0xb7d624a4> 1.100 + irb(main):004:0> x.max_register_string() 1.101 + => 8 1.102 + irb(main):003:0> ^D 1.103 + bash# 1.104 + 1.105 +The Tcl Module 1.106 +--------------- 1.107 + 1.108 +To test that the module loads: 1.109 + 1.110 + bash# tclsh 1.111 + % load /usr/lib/tcl8.3/x86disasm.so X86disasm 1.112 + % version_string 1.113 + 0.21-pre 1.114 + % ^D 1.115 + bash# 1.116 + 1.117 + % x86_init 0 NULL NULL 1.118 + OR 1.119 + % x86disasm dis 1.120 + _486b0708_p_x86disasm 1.121 + % puts "[dis cget -last_error]" 1.122 + 0 1.123 + 1.124 + 1.125 + 1.126 + 1.127 +The Interface Files 1.128 +------------------- 1.129 + 1.130 + libdisasm.i -- interface file without shadow classes 1.131 + libdisasm_oop.i -- interface file with shadow classes