• Home
  • History
  • Annotate
  • only in /external/lldb/utils/test/
NameDateSize

..12-Mar-20154 KiB

disasm.py12-Mar-20156.8 KiB

lldb-disasm.py12-Mar-20159.4 KiB

llvm-mc-shell.py12-Mar-20153.3 KiB

main.c12-Mar-2015346

ras.py12-Mar-20156.2 KiB

README-disasm12-Mar-201523.1 KiB

README-lldb-disasm12-Mar-201510 KiB

README-run-until-faulted12-Mar-2015713

run-dis.py12-Mar-20154.2 KiB

run-until-faulted.py12-Mar-20153.5 KiB

README-disasm

1This README describes a sample invocation of disasm.py whose purpose is to test
2the low level ARM/Thumb disassembly functionality from llvm using the llvm-mc
3command line.  We invoke gdb on an executable, try to disassemble a function,
4and then read the memory contents of the disassembled function.
5
6The byte contents are written into a file named disasm-input.txt and then we
7invoke llvm-mc -disassemble plus options (set with the -o/--options) on the
8byte contents.
9
10See the following for a sample session using this command:
11
12[16:26:57] johnny:/Volumes/data/Radar/9131529 $ /Volumes/data/lldb/svn/trunk/utils/test/disasm.py -C 'set shlib-path-substitutions /usr /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk/usr /System /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk/System /Library /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk/Library' -O '-arch armv7' -m /Volumes/data/lldb/llvm/Debug+Asserts/bin/llvm-mc -e /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk/usr/lib/libSystem.B.dylib -f printf --options='-triple=thumb-apple-darwin -debug-only=arm-disassembler'
13gdb commands: ['set shlib-path-substitutions /usr /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk/usr /System /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk/System /Library /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk/Library']
14gdb options: -arch armv7
15executable: /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk/usr/lib/libSystem.B.dylib
16function: printf
17llvm-mc: /Volumes/data/lldb/llvm/Debug+Asserts/bin/llvm-mc
18llvm-mc options: -triple=thumb-apple-darwin -debug-only=arm-disassembler
19GNU gdb 6.3.50-20050815 (Apple version gdb-1518) (Sat Feb 12 02:56:02 UTC 2011)
20Copyright 2004 Free Software Foundation, Inc.
21GDB is free software, covered by the GNU General Public License, and you are
22welcome to change it and/or distribute copies of it under certain conditions.
23Type "show copying" to see the conditions.
24There is absolutely no warranty for GDB.  Type "show warranty" for details.
25This GDB was configured as "--host=x86_64-apple-darwin --target=arm-apple-darwin".
26<Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk/Library
27<eloper/SDKs/iPhoneOS4.3.sdk/usr/lib/libSystem.B.dylib
28Reading symbols for shared libraries ................ done
29Reading symbols from /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk/usr/lib/libSystem.B.dylib...done.
30(gdb) disassemble printf
31Dump of assembler code for function printf:
320x0704cdd0 <printf+0>:	push	{r0, r1, r2, r3}
330x0704cdd2 <printf+2>:	push	{r4, r5, r7, lr}
340x0704cdd4 <printf+4>:	add	r7, sp, #8
350x0704cdd6 <printf+6>:	sub	sp, #4
360x0704cdd8 <printf+8>:	add	r3, sp, #20
370x0704cdda <printf+10>:	ldr.w	r5, [r3], #4
380x0704cdde <printf+14>:	str	r3, [sp, #0]
390x0704cde0 <printf+16>:	ldr	r3, [pc, #52]	(0x704ce18 <printf+72>)
400x0704cde2 <printf+18>:	add	r3, pc
410x0704cde4 <printf+20>:	ldr	r0, [r3, #0]
420x0704cde6 <printf+22>:	ldr	r4, [r0, #0]
430x0704cde8 <printf+24>:	ldr	r0, [pc, #48]	(0x704ce1c <printf+76>)
440x0704cdea <printf+26>:	add	r0, pc
450x0704cdec <printf+28>:	ldr	r0, [r0, #0]
460x0704cdee <printf+30>:	ldr	r0, [r0, #0]
470x0704cdf0 <printf+32>:	blx	0x707ba30 <pthread_getspecific>
480x0704cdf4 <printf+36>:	cbnz	r0, 0x704cdfe <printf+46>
490x0704cdf6 <printf+38>:	ldr	r1, [pc, #40]	(0x704ce20 <printf+80>)
500x0704cdf8 <printf+40>:	add	r1, pc
510x0704cdfa <printf+42>:	ldr	r1, [r1, #0]
520x0704cdfc <printf+44>:	b.n	0x704ce00 <printf+48>
530x0704cdfe <printf+46>:	mov	r1, r0
540x0704ce00 <printf+48>:	mov	r0, r4
550x0704ce02 <printf+50>:	mov	r2, r5
560x0704ce04 <printf+52>:	ldr	r3, [sp, #0]
570x0704ce06 <printf+54>:	bl	0x704ad44 <vfprintf_l>
580x0704ce0a <printf+58>:	sub.w	sp, r7, #8	; 0x8
590x0704ce0e <printf+62>:	ldmia.w	sp!, {r4, r5, r7, lr}
600x0704ce12 <printf+66>:	add	sp, #16
610x0704ce14 <printf+68>:	bx	lr
620x0704ce16 <printf+70>:	nop
630x0704ce18 <printf+72>:	movs	r3, #142
640x0704ce1a <printf+74>:	lsls	r5, r0, #0
650x0704ce1c <printf+76>:	adds	r1, #122
660x0704ce1e <printf+78>:	lsls	r5, r0, #0
670x0704ce20 <printf+80>:	adds	r1, #104
680x0704ce22 <printf+82>:	lsls	r5, r0, #0
69End of assembler dump.
70(gdb) x /2b 0x0704cdd0
710x704cdd0 <printf>:	0x0f	0xb4
72(gdb) x /2b 0x0704cdd2
730x704cdd2 <printf+2>:	0xb0	0xb5
74(gdb) x /2b 0x0704cdd4
750x704cdd4 <printf+4>:	0x02	0xaf
76(gdb) x /2b 0x0704cdd6
770x704cdd6 <printf+6>:	0x81	0xb0
78(gdb) x /2b 0x0704cdd8
790x704cdd8 <printf+8>:	0x05	0xab
80(gdb) x /4b 0x0704cdda
810x704cdda <printf+10>:	0x53	0xf8	0x04	0x5b
82(gdb) x /2b 0x0704cdde
830x704cdde <printf+14>:	0x00	0x93
84(gdb) x /2b 0x0704cde0
850x704cde0 <printf+16>:	0x0d	0x4b
86(gdb) x /2b 0x0704cde2
870x704cde2 <printf+18>:	0x7b	0x44
88(gdb) x /2b 0x0704cde4
890x704cde4 <printf+20>:	0x18	0x68
90(gdb) x /2b 0x0704cde6
910x704cde6 <printf+22>:	0x04	0x68
92(gdb) x /2b 0x0704cde8
930x704cde8 <printf+24>:	0x0c	0x48
94(gdb) x /2b 0x0704cdea
950x704cdea <printf+26>:	0x78	0x44
96(gdb) x /2b 0x0704cdec
970x704cdec <printf+28>:	0x00	0x68
98(gdb) x /2b 0x0704cdee
990x704cdee <printf+30>:	0x00	0x68
100(gdb) x /4b 0x0704cdf0
1010x704cdf0 <printf+32>:	0x2e	0xf0	0x1e	0xee
102(gdb) x /2b 0x0704cdf4
1030x704cdf4 <printf+36>:	0x18	0xb9
104(gdb) x /2b 0x0704cdf6
1050x704cdf6 <printf+38>:	0x0a	0x49
106(gdb) x /2b 0x0704cdf8
1070x704cdf8 <printf+40>:	0x79	0x44
108(gdb) x /2b 0x0704cdfa
1090x704cdfa <printf+42>:	0x09	0x68
110(gdb) x /2b 0x0704cdfc
1110x704cdfc <printf+44>:	0x00	0xe0
112(gdb) x /2b 0x0704cdfe
1130x704cdfe <printf+46>:	0x01	0x46
114(gdb) x /2b 0x0704ce00
1150x704ce00 <printf+48>:	0x20	0x46
116(gdb) x /2b 0x0704ce02
1170x704ce02 <printf+50>:	0x2a	0x46
118(gdb) x /2b 0x0704ce04
1190x704ce04 <printf+52>:	0x00	0x9b
120(gdb) x /4b 0x0704ce06
1210x704ce06 <printf+54>:	0xfd	0xf7	0x9d	0xff
122(gdb) x /4b 0x0704ce0a
1230x704ce0a <printf+58>:	0xa7	0xf1	0x08	0x0d
124(gdb) x /4b 0x0704ce0e
1250x704ce0e <printf+62>:	0xbd	0xe8	0xb0	0x40
126(gdb) x /2b 0x0704ce12
1270x704ce12 <printf+66>:	0x04	0xb0
128(gdb) x /2b 0x0704ce14
1290x704ce14 <printf+68>:	0x70	0x47
130(gdb) x /2b 0x0704ce16
1310x704ce16 <printf+70>:	0x00	0xbf
132(gdb) x /2b 0x0704ce18
1330x704ce18 <printf+72>:	0x8e	0x23
134(gdb) x /2b 0x0704ce1a
1350x704ce1a <printf+74>:	0x05	0x00
136(gdb) x /2b 0x0704ce1c
1370x704ce1c <printf+76>:	0x7a	0x31
138(gdb) x /2b 0x0704ce1e
1390x704ce1e <printf+78>:	0x05	0x00
140(gdb) x /2b 0x0704ce20
1410x704ce20 <printf+80>:	0x68	0x31
142(gdb) x /2b 0x0704ce22
1430x704ce22 <printf+82>:	0x05	0x00
144(gdb) quit
145
146Executing command: /Volumes/data/lldb/llvm/Debug+Asserts/bin/llvm-mc -disassemble -triple=thumb-apple-darwin -debug-only=arm-disassembler disasm-input.txt
147Opcode=2305 Name=tPUSH Format=ARM_FORMAT_THUMBFRM(25)
148 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 
149-------------------------------------------------------------------------------------------------
150| 0: 0: 0: 0| 0: 0: 0: 0| 0: 0: 0: 0| 0: 0: 0: 0| 1: 0: 1: 1| 0: 1: 0: 0| 0: 0: 0: 0| 1: 1: 1: 1|
151-------------------------------------------------------------------------------------------------
152
153	push	{r0, r1, r2, r3}
154Opcode=2305 Name=tPUSH Format=ARM_FORMAT_THUMBFRM(25)
155 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 
156-------------------------------------------------------------------------------------------------
157| 0: 0: 0: 0| 0: 0: 0: 0| 0: 0: 0: 0| 0: 0: 0: 0| 1: 0: 1: 1| 0: 1: 0: 1| 1: 0: 1: 1| 0: 0: 0: 0|
158-------------------------------------------------------------------------------------------------
159
160	push	{r4, r5, r7, lr}
161Opcode=2228 Name=tADDrSPi Format=ARM_FORMAT_THUMBFRM(25)
162 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 
163-------------------------------------------------------------------------------------------------
164| 0: 0: 0: 0| 0: 0: 0: 0| 0: 0: 0: 0| 0: 0: 0: 0| 1: 0: 1: 0| 1: 1: 1: 1| 0: 0: 0: 0| 0: 0: 1: 0|
165-------------------------------------------------------------------------------------------------
166
167	add	r7, sp, #8
168Opcode=2328 Name=tSUBspi Format=ARM_FORMAT_THUMBFRM(25)
169 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 
170-------------------------------------------------------------------------------------------------
171| 0: 0: 0: 0| 0: 0: 0: 0| 0: 0: 0: 0| 0: 0: 0: 0| 1: 0: 1: 1| 0: 0: 0: 0| 1: 0: 0: 0| 0: 0: 0: 1|
172-------------------------------------------------------------------------------------------------
173
174	sub	sp, #4
175Opcode=2228 Name=tADDrSPi Format=ARM_FORMAT_THUMBFRM(25)
176 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 
177-------------------------------------------------------------------------------------------------
178| 0: 0: 0: 0| 0: 0: 0: 0| 0: 0: 0: 0| 0: 0: 0: 0| 1: 0: 1: 0| 1: 0: 1: 1| 0: 0: 0: 0| 0: 1: 0: 1|
179-------------------------------------------------------------------------------------------------
180
181	add	r3, sp, #20
182Opcode=1963 Name=t2LDR_POST Format=ARM_FORMAT_THUMBFRM(25)
183 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 
184-------------------------------------------------------------------------------------------------
185| 1: 1: 1: 1| 1: 0: 0: 0| 0: 1: 0: 1| 0: 0: 1: 1| 0: 1: 0: 1| 1: 0: 1: 1| 0: 0: 0: 0| 0: 1: 0: 0|
186-------------------------------------------------------------------------------------------------
187
188	ldr	r5, [r3], #4
189Opcode=2324 Name=tSTRspi Format=ARM_FORMAT_THUMBFRM(25)
190 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 
191-------------------------------------------------------------------------------------------------
192| 0: 0: 0: 0| 0: 0: 0: 0| 0: 0: 0: 0| 0: 0: 0: 0| 1: 0: 0: 1| 0: 0: 1: 1| 0: 0: 0: 0| 0: 0: 0: 0|
193-------------------------------------------------------------------------------------------------
194
195	str	r3, [sp]
196Opcode=2275 Name=tLDRpci Format=ARM_FORMAT_THUMBFRM(25)
197 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 
198-------------------------------------------------------------------------------------------------
199| 0: 0: 0: 0| 0: 0: 0: 0| 0: 0: 0: 0| 0: 0: 0: 0| 0: 1: 0: 0| 1: 0: 1: 1| 0: 0: 0: 0| 1: 1: 0: 1|
200-------------------------------------------------------------------------------------------------
201
202	ldr.n	r3, #52
203Opcode=2223 Name=tADDhirr Format=ARM_FORMAT_THUMBFRM(25)
204 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 
205-------------------------------------------------------------------------------------------------
206| 0: 0: 0: 0| 0: 0: 0: 0| 0: 0: 0: 0| 0: 0: 0: 0| 0: 1: 0: 0| 0: 1: 0: 0| 0: 1: 1: 1| 1: 0: 1: 1|
207-------------------------------------------------------------------------------------------------
208
209	add	r3, pc
210Opcode=2274 Name=tLDRi Format=ARM_FORMAT_THUMBFRM(25)
211 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 
212-------------------------------------------------------------------------------------------------
213| 0: 0: 0: 0| 0: 0: 0: 0| 0: 0: 0: 0| 0: 0: 0: 0| 0: 1: 1: 0| 1: 0: 0: 0| 0: 0: 0: 1| 1: 0: 0: 0|
214-------------------------------------------------------------------------------------------------
215
216	ldr	r0, [r3]
217Opcode=2274 Name=tLDRi Format=ARM_FORMAT_THUMBFRM(25)
218 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 
219-------------------------------------------------------------------------------------------------
220| 0: 0: 0: 0| 0: 0: 0: 0| 0: 0: 0: 0| 0: 0: 0: 0| 0: 1: 1: 0| 1: 0: 0: 0| 0: 0: 0: 0| 0: 1: 0: 0|
221-------------------------------------------------------------------------------------------------
222
223	ldr	r4, [r0]
224Opcode=2275 Name=tLDRpci Format=ARM_FORMAT_THUMBFRM(25)
225 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 
226-------------------------------------------------------------------------------------------------
227| 0: 0: 0: 0| 0: 0: 0: 0| 0: 0: 0: 0| 0: 0: 0: 0| 0: 1: 0: 0| 1: 0: 0: 0| 0: 0: 0: 0| 1: 1: 0: 0|
228-------------------------------------------------------------------------------------------------
229
230	ldr.n	r0, #48
231Opcode=2223 Name=tADDhirr Format=ARM_FORMAT_THUMBFRM(25)
232 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 
233-------------------------------------------------------------------------------------------------
234| 0: 0: 0: 0| 0: 0: 0: 0| 0: 0: 0: 0| 0: 0: 0: 0| 0: 1: 0: 0| 0: 1: 0: 0| 0: 1: 1: 1| 1: 0: 0: 0|
235-------------------------------------------------------------------------------------------------
236
237	add	r0, pc
238Opcode=2274 Name=tLDRi Format=ARM_FORMAT_THUMBFRM(25)
239 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 
240-------------------------------------------------------------------------------------------------
241| 0: 0: 0: 0| 0: 0: 0: 0| 0: 0: 0: 0| 0: 0: 0: 0| 0: 1: 1: 0| 1: 0: 0: 0| 0: 0: 0: 0| 0: 0: 0: 0|
242-------------------------------------------------------------------------------------------------
243
244	ldr	r0, [r0]
245Opcode=2274 Name=tLDRi Format=ARM_FORMAT_THUMBFRM(25)
246 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 
247-------------------------------------------------------------------------------------------------
248| 0: 0: 0: 0| 0: 0: 0: 0| 0: 0: 0: 0| 0: 0: 0: 0| 0: 1: 1: 0| 1: 0: 0: 0| 0: 0: 0: 0| 0: 0: 0: 0|
249-------------------------------------------------------------------------------------------------
250
251	ldr	r0, [r0]
252Opcode=2243 Name=tBLXi_r9 Format=ARM_FORMAT_THUMBFRM(25)
253 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 
254-------------------------------------------------------------------------------------------------
255| 1: 1: 1: 1| 0: 0: 0: 0| 0: 0: 1: 0| 1: 1: 1: 0| 1: 1: 1: 0| 1: 1: 1: 0| 0: 0: 0: 1| 1: 1: 1: 0|
256-------------------------------------------------------------------------------------------------
257
258	blx	#191548
259Opcode=2255 Name=tCBNZ Format=ARM_FORMAT_THUMBFRM(25)
260 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 
261-------------------------------------------------------------------------------------------------
262| 0: 0: 0: 0| 0: 0: 0: 0| 0: 0: 0: 0| 0: 0: 0: 0| 1: 0: 1: 1| 1: 0: 0: 1| 0: 0: 0: 1| 1: 0: 0: 0|
263-------------------------------------------------------------------------------------------------
264
265	cbnz	r0, #6
266Opcode=2275 Name=tLDRpci Format=ARM_FORMAT_THUMBFRM(25)
267 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 
268-------------------------------------------------------------------------------------------------
269| 0: 0: 0: 0| 0: 0: 0: 0| 0: 0: 0: 0| 0: 0: 0: 0| 0: 1: 0: 0| 1: 0: 0: 1| 0: 0: 0: 0| 1: 0: 1: 0|
270-------------------------------------------------------------------------------------------------
271
272	ldr.n	r1, #40
273Opcode=2223 Name=tADDhirr Format=ARM_FORMAT_THUMBFRM(25)
274 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 
275-------------------------------------------------------------------------------------------------
276| 0: 0: 0: 0| 0: 0: 0: 0| 0: 0: 0: 0| 0: 0: 0: 0| 0: 1: 0: 0| 0: 1: 0: 0| 0: 1: 1: 1| 1: 0: 0: 1|
277-------------------------------------------------------------------------------------------------
278
279	add	r1, pc
280Opcode=2274 Name=tLDRi Format=ARM_FORMAT_THUMBFRM(25)
281 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 
282-------------------------------------------------------------------------------------------------
283| 0: 0: 0: 0| 0: 0: 0: 0| 0: 0: 0: 0| 0: 0: 0: 0| 0: 1: 1: 0| 1: 0: 0: 0| 0: 0: 0: 0| 1: 0: 0: 1|
284-------------------------------------------------------------------------------------------------
285
286	ldr	r1, [r1]
287Opcode=2238 Name=tB Format=ARM_FORMAT_THUMBFRM(25)
288 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 
289-------------------------------------------------------------------------------------------------
290| 0: 0: 0: 0| 0: 0: 0: 0| 0: 0: 0: 0| 0: 0: 0: 0| 1: 1: 1: 0| 0: 0: 0: 0| 0: 0: 0: 0| 0: 0: 0: 0|
291-------------------------------------------------------------------------------------------------
292
293	b	#0
294Opcode=2294 Name=tMOVr Format=ARM_FORMAT_THUMBFRM(25)
295 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 
296-------------------------------------------------------------------------------------------------
297| 0: 0: 0: 0| 0: 0: 0: 0| 0: 0: 0: 0| 0: 0: 0: 0| 0: 1: 0: 0| 0: 1: 1: 0| 0: 0: 0: 0| 0: 0: 0: 1|
298-------------------------------------------------------------------------------------------------
299
300	mov	r1, r0
301Opcode=2294 Name=tMOVr Format=ARM_FORMAT_THUMBFRM(25)
302 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 
303-------------------------------------------------------------------------------------------------
304| 0: 0: 0: 0| 0: 0: 0: 0| 0: 0: 0: 0| 0: 0: 0: 0| 0: 1: 0: 0| 0: 1: 1: 0| 0: 0: 1: 0| 0: 0: 0: 0|
305-------------------------------------------------------------------------------------------------
306
307	mov	r0, r4
308Opcode=2294 Name=tMOVr Format=ARM_FORMAT_THUMBFRM(25)
309 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 
310-------------------------------------------------------------------------------------------------
311| 0: 0: 0: 0| 0: 0: 0: 0| 0: 0: 0: 0| 0: 0: 0: 0| 0: 1: 0: 0| 0: 1: 1: 0| 0: 0: 1: 0| 1: 0: 1: 0|
312-------------------------------------------------------------------------------------------------
313
314	mov	r2, r5
315Opcode=2278 Name=tLDRspi Format=ARM_FORMAT_THUMBFRM(25)
316 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 
317-------------------------------------------------------------------------------------------------
318| 0: 0: 0: 0| 0: 0: 0: 0| 0: 0: 0: 0| 0: 0: 0: 0| 1: 0: 0: 1| 1: 0: 1: 1| 0: 0: 0: 0| 0: 0: 0: 0|
319-------------------------------------------------------------------------------------------------
320
321	ldr	r3, [sp]
322Opcode=2246 Name=tBLr9 Format=ARM_FORMAT_THUMBFRM(25)
323 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 
324-------------------------------------------------------------------------------------------------
325| 1: 1: 1: 1| 0: 1: 1: 1| 1: 1: 1: 1| 1: 1: 0: 1| 1: 1: 1: 1| 1: 1: 1: 1| 1: 0: 0: 1| 1: 1: 0: 1|
326-------------------------------------------------------------------------------------------------
327
328	bl	#-8390
329Opcode=2153 Name=t2SUBri Format=ARM_FORMAT_THUMBFRM(25)
330 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 
331-------------------------------------------------------------------------------------------------
332| 1: 1: 1: 1| 0: 0: 0: 1| 1: 0: 1: 0| 0: 1: 1: 1| 0: 0: 0: 0| 1: 1: 0: 1| 0: 0: 0: 0| 1: 0: 0: 0|
333-------------------------------------------------------------------------------------------------
334
335	sub.w	sp, r7, #8
336Opcode=1926 Name=t2LDMIA_UPD Format=ARM_FORMAT_THUMBFRM(25)
337 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 
338-------------------------------------------------------------------------------------------------
339| 1: 1: 1: 0| 1: 0: 0: 0| 1: 0: 1: 1| 1: 1: 0: 1| 0: 1: 0: 0| 0: 0: 0: 0| 1: 0: 1: 1| 0: 0: 0: 0|
340-------------------------------------------------------------------------------------------------
341
342	pop.w	{r4, r5, r7, lr}
343Opcode=2230 Name=tADDspi Format=ARM_FORMAT_THUMBFRM(25)
344 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 
345-------------------------------------------------------------------------------------------------
346| 0: 0: 0: 0| 0: 0: 0: 0| 0: 0: 0: 0| 0: 0: 0: 0| 1: 0: 1: 1| 0: 0: 0: 0| 0: 0: 0: 0| 0: 1: 0: 0|
347-------------------------------------------------------------------------------------------------
348
349	add	sp, #16
350Opcode=2250 Name=tBX_RET Format=ARM_FORMAT_THUMBFRM(25)
351 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 
352-------------------------------------------------------------------------------------------------
353| 0: 0: 0: 0| 0: 0: 0: 0| 0: 0: 0: 0| 0: 0: 0: 0| 0: 1: 0: 0| 0: 1: 1: 1| 0: 1: 1: 1| 0: 0: 0: 0|
354-------------------------------------------------------------------------------------------------
355
356	bx	lr
357Opcode=2300 Name=tNOP Format=ARM_FORMAT_THUMBFRM(25)
358 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 
359-------------------------------------------------------------------------------------------------
360| 0: 0: 0: 0| 0: 0: 0: 0| 0: 0: 0: 0| 0: 0: 0: 0| 1: 0: 1: 1| 1: 1: 1: 1| 0: 0: 0: 0| 0: 0: 0: 0|
361-------------------------------------------------------------------------------------------------
362
363	nop
364Opcode=2293 Name=tMOVi8 Format=ARM_FORMAT_THUMBFRM(25)
365 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 
366-------------------------------------------------------------------------------------------------
367| 0: 0: 0: 0| 0: 0: 0: 0| 0: 0: 0: 0| 0: 0: 0: 0| 0: 0: 1: 0| 0: 0: 1: 1| 1: 0: 0: 0| 1: 1: 1: 0|
368-------------------------------------------------------------------------------------------------
369
370	movs	r3, #142
371Opcode=2290 Name=tMOVSr Format=ARM_FORMAT_THUMBFRM(25)
372 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 
373-------------------------------------------------------------------------------------------------
374| 0: 0: 0: 0| 0: 0: 0: 0| 0: 0: 0: 0| 0: 0: 0: 0| 0: 0: 0: 0| 0: 0: 0: 0| 0: 0: 0: 0| 0: 1: 0: 1|
375-------------------------------------------------------------------------------------------------
376
377	movs	r5, r0
378Opcode=2225 Name=tADDi8 Format=ARM_FORMAT_THUMBFRM(25)
379 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 
380-------------------------------------------------------------------------------------------------
381| 0: 0: 0: 0| 0: 0: 0: 0| 0: 0: 0: 0| 0: 0: 0: 0| 0: 0: 1: 1| 0: 0: 0: 1| 0: 1: 1: 1| 1: 0: 1: 0|
382-------------------------------------------------------------------------------------------------
383
384	adds	r1, #122
385Opcode=2290 Name=tMOVSr Format=ARM_FORMAT_THUMBFRM(25)
386 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 
387-------------------------------------------------------------------------------------------------
388| 0: 0: 0: 0| 0: 0: 0: 0| 0: 0: 0: 0| 0: 0: 0: 0| 0: 0: 0: 0| 0: 0: 0: 0| 0: 0: 0: 0| 0: 1: 0: 1|
389-------------------------------------------------------------------------------------------------
390
391	movs	r5, r0
392Opcode=2225 Name=tADDi8 Format=ARM_FORMAT_THUMBFRM(25)
393 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 
394-------------------------------------------------------------------------------------------------
395| 0: 0: 0: 0| 0: 0: 0: 0| 0: 0: 0: 0| 0: 0: 0: 0| 0: 0: 1: 1| 0: 0: 0: 1| 0: 1: 1: 0| 1: 0: 0: 0|
396-------------------------------------------------------------------------------------------------
397
398	adds	r1, #104
399Opcode=2290 Name=tMOVSr Format=ARM_FORMAT_THUMBFRM(25)
400 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 
401-------------------------------------------------------------------------------------------------
402| 0: 0: 0: 0| 0: 0: 0: 0| 0: 0: 0: 0| 0: 0: 0: 0| 0: 0: 0: 0| 0: 0: 0: 0| 0: 0: 0: 0| 0: 1: 0: 1|
403-------------------------------------------------------------------------------------------------
404
405	movs	r5, r0
406[16:28:00] johnny:/Volumes/data/Radar/9131529 $ 
407

README-lldb-disasm

1This README describes a sample invocation of lldb-disasm.py whose purpose is to test
2the lldb 'disassemble' command.
3
4This is for the initial checkin of lldb-disasm.py which only reads an executable image and
5dumps the symbol table from the imgae and its dependent libraries.  The output was cut off
6since it is too large.
7
8da0603a-dhcp191:9131529 johnny$ /Volumes/data/lldb/svn/trunk/utils/test/lldb-disasm.py -C 'platform create remote-ios' -e /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk/usr/lib/libSystem.B.dylib
9lldb commands: ['platform create remote-ios']
10lldb options: None
11executable: /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk/usr/lib/libSystem.B.dylib
12sys.path: ['/Volumes/data/lldb/svn/trunk/utils/test', '/Volumes/data/lldb/svn/trunk/build/Debug/LLDB.framework/Resources/Python', '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python26.zip', '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6', '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-darwin', '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-mac', '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-mac/lib-scriptpackages', '/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python', '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-tk', '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-old', '/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-dynload', '/Library/Python/2.6/site-packages', '/AppleInternal/Library/Python/2.6/site-packages', '/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/PyObjC', '/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/wx-2.8-mac-unicode', '/Volumes/data/lldb/svn/trunk/utils/test/../../test/pexpect-2.4', '/Volumes/data/lldb/svn/trunk/test']
13/Volumes/data/lldb/svn/trunk/test/lldbutil.py:80: SyntaxWarning: import * only allowed at module level
14  def int_to_bytearray(val, bytesize):
15/Volumes/data/lldb/svn/trunk/test/lldbutil.py:105: SyntaxWarning: import * only allowed at module level
16  def bytearray_to_int(bytes, bytesize):
17run command: platform create remote-ios
18output: Platform: remote-ios
19Not connected to a remote platform.
20SDKROOT: "/Developer/Platforms/iPhoneOS.platform/DeviceSupport/4.3 (8F190)"
21
22run command: file /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk/usr/lib/libSystem.B.dylib
23output: Current executable set to '/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk/usr/lib/libSystem.B.dylib' (armv7).
24
25run command: image dump symtab
26output: Dumping symbol table for 18 modules.
27Symtab, file = /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk/usr/lib/libSystem.B.dylib, num_symbols = 851:
28               Debug symbol
29               |Synthetic symbol
30               ||Externally Visible
31               |||
32Index   UserID DSX Type         File Address/Value Load Address       Size               Flags      Name
33------- ------ --- ------------ ------------------ ------------------ ------------------ ---------- ----------------------------------
34[    0]      0     Code         0x0000000000001420                    0x0000000000000000 0x000e0008 libSystem_initializer
35[    1]      1     Code         0x00000000000014c4                    0x0000000000000000 0x001e0008 __keymgr_initializer
36[    2]      2     Code         0x00000000000014fc                    0x0000000000000000 0x000e0008 dwarf2_unwind_dyld_add_image_hook
37[    3]      3     Code         0x0000000000001564                    0x0000000000000000 0x000e0008 get_or_create_key_element
38[    4]      4     Code         0x0000000000001684                    0x0000000000000000 0x000e0008 unlock_node
39[    5]      5     Code         0x0000000000001930                    0x0000000000000000 0x000e0000 RsqrtTable
40[    6]      6     Code         0x0000000000001c30                    0x0000000000000000 0x000e0000 acosf_crossover
41[    7]      7     Code         0x0000000000001c34                    0x0000000000000000 0x000e0000 acosf_mid_poly
42[    8]      8     Code         0x0000000000001c48                    0x0000000000000000 0x000e0000 Pi2_Q30
43[    9]      9     Code         0x0000000000001c4c                    0x0000000000000000 0x000e0000 Pi_Q30
44[   10]     10     Code         0x0000000000001c78                    0x0000000000000000 0x000e0000 acosf_approx
45[   11]     11     Code         0x0000000000001cec                    0x0000000000000000 0x000e0000 acosf_pos_tail_poly
46[   12]     12     Code         0x0000000000001d00                    0x0000000000000000 0x000e0000 acosf_tail
47[   13]     13     Code         0x0000000000001dfc                    0x0000000000000000 0x000e0000 acosf_normalize
48[   14]     14     Code         0x0000000000001e10                    0x0000000000000000 0x000e0000 acosf_round
49[   15]     15     Code         0x0000000000001e28                    0x0000000000000000 0x000e0000 acosf_encode
50[   16]     16     Code         0x0000000000001e30                    0x0000000000000000 0x000e0000 acosf_done
51[   17]     17     Code         0x0000000000001e38                    0x0000000000000000 0x000e0000 acosf_special
52[   18]     18     Code         0x0000000000001e68                    0x0000000000000000 0x000e0000 acosf_small
53[   19]     19     Code         0x0000000000001e9c                    0x0000000000000000 0x000e0000 acosf_very_small
54[   20]     20     Code         0x0000000000001eb8                    0x0000000000000000 0x000e0000 Pif
55[   21]     21     Code         0x000000000000220c                    0x0000000000000000 0x000e0000 RsqrtTable
56[   22]     22     Code         0x000000000000250c                    0x0000000000000000 0x000e0000 asinf_crossover
57[   23]     23     Code         0x0000000000002510                    0x0000000000000000 0x000e0000 asinf_mid_poly
58[   24]     24     Code         0x0000000000002524                    0x0000000000000000 0x000e0000 Pi2_Q30
59[   25]     25     Code         0x0000000000002550                    0x0000000000000000 0x000e0000 asinf_approx
60[   26]     26     Code         0x00000000000025e4                    0x0000000000000000 0x000e0000 asinf_tail_poly
61[   27]     27     Code         0x0000000000002600                    0x0000000000000000 0x000e0000 asinf_tail
62[   28]     28     Code         0x00000000000026e0                    0x0000000000000000 0x000e0000 asinf_normalize
63[   29]     29     Code         0x00000000000026f4                    0x0000000000000000 0x000e0000 asinf_round
64[   30]     30     Code         0x000000000000270c                    0x0000000000000000 0x000e0000 asinf_encode
65[   31]     31     Code         0x0000000000002718                    0x0000000000000000 0x000e0000 asinf_done
66[   32]     32     Code         0x0000000000002720                    0x0000000000000000 0x000e0000 asinf_special
67[   33]     33     Code         0x0000000000002754                    0x0000000000000000 0x000e0000 asinf_small
68[   34]     34     Code         0x0000000000002784                    0x0000000000000000 0x000e0000 Pi2f
69[   35]     35     Code         0x0000000000005774                    0x0000000000000000 0x000e0008 rem_pio2
70[   36]     36     Code         0x00000000000076c4                    0x0000000000000000 0x000e0008 __kernel_rem_pio2
71[   37]     37     Code         0x0000000000008c90                    0x0000000000000000 0x000e0008 __kernel_tan
72[   38]     38     Code         0x0000000000008ef0                    0x0000000000000000 0x000e0008 lgammaApprox
73[   39]     39     Code         0x000000000000b3d4                    0x0000000000000000 0x000e0000 powf_not_special
74[   40]     40     Code         0x000000000000b3dc                    0x0000000000000000 0x000e0000 powf_ylgx
75[   41]     41     Code         0x000000000000b438                    0x0000000000000000 0x000e0000 powf_done
76[   42]     42     Code         0x000000000000b43c                    0x0000000000000000 0x000e0000 powf_special_y
77[   43]     43     Code         0x000000000000b4a8                    0x0000000000000000 0x000e0000 powf_special_x
78[   44]     44     Code         0x000000000000b4cc                    0x0000000000000000 0x000e0000 powf_mzero_minf
79[   45]     45     Code         0x000000000000b54c                    0x0000000000000000 0x000e0000 powf_y_odd
80[   46]     46     Code         0x000000000000b57c                    0x0000000000000000 0x000e0000 powf_y_nonint
81[   47]     47     Code         0x000000000000b588                    0x0000000000000000 0x000e0000 powf_y_even
82[   48]     48     Code         0x000000000000b7a8                    0x0000000000000000 0x000e0000 powf_log2_reduction
83[   49]     49     Code         0x000000000000b7a8                    0x0000000000000000 0x000e0000 powf_log2
84[   50]     50     Code         0x000000000000b814                    0x0000000000000000 0x000e0000 powf_log2_approx
85[   51]     51     Code         0x000000000000b88c                    0x0000000000000000 0x000e0000 powf_log2_synthesis
86[   52]     52     Code         0x000000000000b960                    0x0000000000000000 0x000e0000 powf_log2_exactPowerOfTwo
87[   53]     53     Code         0x000000000000b980                    0x0000000000000000 0x000e0000 powf_log2_near1
88[   54]     54     Code         0x000000000000b9ec                    0x0000000000000000 0x000e0000 powf_log2_synthesis_near1
89[   55]     55     Code         0x000000000000ba04                    0x0000000000000000 0x000e0000 Q32_minimax
90[   56]     56     Code         0x000000000000ba10                    0x0000000000000000 0x000e0000 iexp2_lut
91[   57]     57     Code         0x000000000000ba94                    0x0000000000000000 0x000e0000 powf_exp2
92[   58]     58     Code         0x000000000000bb18                    0x0000000000000000 0x000e0000 powf_exp2_exact_int
93[   59]     59     Code         0x000000000000bb24                    0x0000000000000000 0x000e0000 powf_exp2_big
94[   60]     60     Code         0x000000000000bb74                    0x0000000000000000 0x000e0000 powf_exp2_overflow
95

README-run-until-faulted

1A example usage of the Python script run-until-faulted.py:
2
3[18:20:29] johnny:/Volumes/data/lldb/svn/trunk/utils/test $ ./run-until-faulted.py -l /Volumes/data/lldb/svn/trunk/build/Debug/lldb -e './a.out'
4lldb command: /Volumes/data/lldb/svn/trunk/build/Debug/lldb
5executable: ./a.out
6executable options: 
7sending file command....
8sending process launch --  (iteration: 0)
9
10* thread #1: tid = 0x2d03, 0x0000000100000eef a.out`main + 39 at main.c:7, stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
11   4   	{
12   5   	    int *null_ptr = 0;
13   6   	    printf("Hello, fault!\n");
14-> 7   	    printf("Now segfault %d\n", *null_ptr);
15   8   	}
16
17(lldb) q
18[18:20:40] johnny:/Volumes/data/lldb/svn/trunk/utils/test $ 
19