xref: /openbsd-src/gnu/llvm/lldb/examples/customization/bin-utils/README (revision 061da546b983eb767bad15e67af1174fb0bcf31c)
1*061da546SpatrickFiles in this directory:
2*061da546Spatrick
3*061da546Spatricko .lldbinit:
4*061da546Spatrick
5*061da546SpatrickAn example lldb init file that imports the binutils.py module and adds the
6*061da546Spatrickfollowing commands: 'itob' and 'utob'.
7*061da546Spatrick
8*061da546Spatricko binutils.py:
9*061da546Spatrick
10*061da546SpatrickPython module which provides implementation for the 'itob' and 'utob' commands.
11*061da546Spatrick
12*061da546Spatricko README:
13*061da546Spatrick
14*061da546SpatrickThe file you are reading now.
15*061da546Spatrick
16*061da546Spatrick================================================================================
17*061da546SpatrickThe following terminal output shows an interaction with lldb using the .lldbinit
18*061da546Spatrickand the binutils.py files which are located in my HOME directory.  The lldb init
19*061da546Spatrickfile imports the utils Python module and adds the 'itob' and 'utob' commands.
20*061da546Spatrick
21*061da546Spatrick$ /Volumes/data/lldb/svn/trunk/build/Debug/lldb
22*061da546Spatrick(lldb) help itob
23*061da546SpatrickConvert the integer to print its two's complement representation.
24*061da546Spatrick    args[0] (mandatory) is the integer to be converted
25*061da546Spatrick    args[1] (mandatory) is the bit width of the two's complement representation
26*061da546Spatrick    args[2] (optional) if specified, turns on verbose printing
27*061da546SpatrickSyntax: itob
28*061da546Spatrick(lldb) itob -5 4
29*061da546Spatrick [1, 0, 1, 1]
30*061da546Spatrick(lldb) itob -5 32 v
31*061da546Spatrick 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10  9  8  7  6  5  4  3  2  1  0
32*061da546Spatrick [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1]
33*061da546Spatrick(lldb) utob 0xABCD 32 v
34*061da546Spatrick 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10  9  8  7  6  5  4  3  2  1  0
35*061da546Spatrick [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 1]
36*061da546Spatrick(lldb)
37