| 
									
										
										
										
											2008-12-10 20:35:18 -05:00
										 |  |  | ! Copyright (C) 2008 Slava Pestov. | 
					
						
							| 
									
										
										
										
											2008-02-14 21:27:04 -05:00
										 |  |  | ! See http://factorcode.org/license.txt for BSD license. | 
					
						
							| 
									
										
										
										
											2009-10-07 14:18:29 -04:00
										 |  |  | USING: alien alien.data arrays byte-arrays compiler.units destructors | 
					
						
							|  |  |  | io kernel libc math quotations sequences stack-checker system tr | 
					
						
							| 
									
										
										
										
											2011-11-02 14:23:41 -04:00
										 |  |  | vocabs words ;
 | 
					
						
							| 
									
										
										
										
											2008-02-14 18:56:47 -05:00
										 |  |  | IN: tools.disassembler | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-10 20:35:18 -05:00
										 |  |  | GENERIC: disassemble ( obj -- )
 | 
					
						
							| 
									
										
										
										
											2008-02-14 21:27:04 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-01-18 02:51:27 -05:00
										 |  |  | <PRIVATE
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-10 20:35:18 -05:00
										 |  |  | SYMBOL: disassembler-backend | 
					
						
							| 
									
										
										
										
											2008-02-14 21:27:04 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-10 20:35:18 -05:00
										 |  |  | HOOK: disassemble* disassembler-backend ( from to -- lines )
 | 
					
						
							| 
									
										
										
										
											2008-02-14 18:56:47 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-12-10 20:35:18 -05:00
										 |  |  | TR: tabs>spaces "\t" "\s" ;
 | 
					
						
							| 
									
										
										
										
											2008-03-13 04:51:25 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-04-02 03:30:27 -04:00
										 |  |  | GENERIC: (>address) ( object -- n )
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | M: integer (>address) ;
 | 
					
						
							|  |  |  | M: alien (>address) alien-address ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-01-18 02:51:27 -05:00
										 |  |  | PRIVATE>
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-07-27 23:14:26 -04:00
										 |  |  | M: byte-array disassemble  | 
					
						
							|  |  |  |     [ | 
					
						
							|  |  |  |         [ malloc-byte-array &free alien-address dup ] | 
					
						
							|  |  |  |         [ length + ] bi
 | 
					
						
							|  |  |  |         2array disassemble | 
					
						
							|  |  |  |     ] with-destructors ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-04-02 03:30:27 -04:00
										 |  |  | M: pair disassemble first2 [ (>address) ] bi@ disassemble* [ tabs>spaces print ] each ;
 | 
					
						
							| 
									
										
										
										
											2008-03-30 13:21:44 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-01-18 02:51:27 -05:00
										 |  |  | M: word disassemble word-code 2array disassemble ;
 | 
					
						
							| 
									
										
										
										
											2008-02-14 21:27:04 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-10-07 14:18:29 -04:00
										 |  |  | M: quotation disassemble [ dup infer define-temp ] with-compilation-unit disassemble ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-03-22 23:19:40 -04:00
										 |  |  | cpu x86? | 
					
						
							| 
									
										
										
										
											2008-12-12 19:44:43 -05:00
										 |  |  | "tools.disassembler.udis" | 
					
						
							|  |  |  | "tools.disassembler.gdb" ?
 | 
					
						
							|  |  |  | require |