factor/basis/tools/disassembler/utils/utils.factor

21 lines
600 B
Factor
Raw Normal View History

USING: accessors kernel math math.parser prettyprint sequences
splitting tools.memory ;
2009-06-22 17:06:07 -04:00
IN: tools.disassembler.utils
: 0x- ( str -- str' ) "0x" prepend ;
2009-06-22 17:06:07 -04:00
: complete-address ( n seq -- str )
[ nip owner>> unparse-short ] [ entry-point>> - ] 2bi
[ >hex 0x- " + " glue ] unless-zero ;
2009-06-22 17:06:07 -04:00
: search-xt ( addr -- str/f )
dup lookup-return-address
dup [ complete-address ] [ 2drop f ] if ;
2009-06-22 17:06:07 -04:00
: resolve-xt ( str -- str' )
[ 0x- ] [ hex> ] bi
2009-06-22 17:06:07 -04:00
[ search-xt [ " (" ")" surround append ] when* ] when* ;
: resolve-call ( str -- str' )
"0x" split1-last [ resolve-xt "0x" glue ] when* ;