toolkit/crashreporter/google-breakpad/src/third_party/libdisasm/swig/README

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 Libdisasm SWIG README
michael@0 2
michael@0 3 The SWIG utility (www.swig.org) can be used to generate
michael@0 4
michael@0 5
michael@0 6 Building SWIG Modules
michael@0 7 ---------------------
michael@0 8
michael@0 9 make
michael@0 10 make install
michael@0 11
michael@0 12 Make and Install both build Python, Perl, Ruby, and Tcl modules. If you
michael@0 13 do not have one of these languages installed, comment out the relevant
michael@0 14 target in the main Makefile.
michael@0 15
michael@0 16 Install uses 'sudo' to put files in the correct locations; if you
michael@0 17 do not have sudo installed, change the install targets.
michael@0 18
michael@0 19 The Module API
michael@0 20 --------------
michael@0 21
michael@0 22 The OOP API
michael@0 23 -----------
michael@0 24
michael@0 25
michael@0 26 The Python Module
michael@0 27 -----------------
michael@0 28
michael@0 29 To test that the module loads:
michael@0 30
michael@0 31 bash# python
michael@0 32 >>> import x86disasm
michael@0 33 >>> x86disasm.version_string()
michael@0 34 '0.21-pre'
michael@0 35 >>>^D
michael@0 36 bash#
michael@0 37
michael@0 38 >>> import x86disasm
michael@0 39 >>> import array
michael@0 40 >>> disasm = x86disasm.X86_Disasm( )
michael@0 41 >>> tgt = open( "/tmp/a.out", "rb" )
michael@0 42 >>> tgt.seek( 0, 2 )
michael@0 43 >>> size = tgt.tell()
michael@0 44 >>> tgt.seek( 0, 0 )
michael@0 45 >>> buf = array.array( 'B' )
michael@0 46 >>> buf.fromfile( tgt, size )
michael@0 47 >>> tgt.close()
michael@0 48 >>> data = x86disasm.byteArray( size )
michael@0 49 >>> for i in range( size ):
michael@0 50 ... data[i] = buf.pop(0)
michael@0 51 ...
michael@0 52 >>> del buf
michael@0 53 >>> del tgt
michael@0 54 >>> insn = disasm.disasm( data, size - 1, 0, 0 )
michael@0 55 >>> insn.format( x86disasm.att_syntax )
michael@0 56 'jg\t0x00000047'
michael@0 57 >>> insn.format( x86disasm.raw_syntax )
michael@0 58 '0x00000000|0x00000000|2|7F 45 |||controlflow|jcc|jg|80386|General Purpose|||zero_clear sign_eq_oflow |0|0|relative|sbyte|00000047|'
michael@0 59 >>> ops = insn.operand_list()
michael@0 60 >>> node = ops.first()
michael@0 61 >>> while node is not None:
michael@0 62 ... s = node.op.format(x86disasm.raw_syntax)
michael@0 63 ... print s
michael@0 64 ... node = ops.next()
michael@0 65 ...
michael@0 66 relative|sbyte|00000047|
michael@0 67
michael@0 68
michael@0 69
michael@0 70
michael@0 71
michael@0 72
michael@0 73 The Perl Module
michael@0 74 ---------------
michael@0 75
michael@0 76 To test that the module loads:
michael@0 77
michael@0 78 bash# perl
michael@0 79 use x86disasm;
michael@0 80 print x86disasm::version_string() . "\n";
michael@0 81 ^D
michael@0 82 0.21-pre
michael@0 83 bash#
michael@0 84
michael@0 85 The Ruby Module
michael@0 86 ---------------
michael@0 87
michael@0 88 To test that the module loads:
michael@0 89
michael@0 90 bash# irb
michael@0 91 irb(main):001:0> require 'x86disasm'
michael@0 92 => true
michael@0 93 irb(main):002:0> X86disasm.version_string()
michael@0 94 => "0.21-pre"
michael@0 95 irb(main):003:0> x = X86disasm::X86_Disasm.new
michael@0 96 => #<X86disasm::X86_Disasm:0xb7d624a4>
michael@0 97 irb(main):004:0> x.max_register_string()
michael@0 98 => 8
michael@0 99 irb(main):003:0> ^D
michael@0 100 bash#
michael@0 101
michael@0 102 The Tcl Module
michael@0 103 ---------------
michael@0 104
michael@0 105 To test that the module loads:
michael@0 106
michael@0 107 bash# tclsh
michael@0 108 % load /usr/lib/tcl8.3/x86disasm.so X86disasm
michael@0 109 % version_string
michael@0 110 0.21-pre
michael@0 111 % ^D
michael@0 112 bash#
michael@0 113
michael@0 114 % x86_init 0 NULL NULL
michael@0 115 OR
michael@0 116 % x86disasm dis
michael@0 117 _486b0708_p_x86disasm
michael@0 118 % puts "[dis cget -last_error]"
michael@0 119 0
michael@0 120
michael@0 121
michael@0 122
michael@0 123
michael@0 124 The Interface Files
michael@0 125 -------------------
michael@0 126
michael@0 127 libdisasm.i -- interface file without shadow classes
michael@0 128 libdisasm_oop.i -- interface file with shadow classes

mercurial