Paste: nm
Author: | erikc |
Mode: | factor |
Date: | Mon, 12 Apr 2010 22:54:09 |
Plain Text |
:: nm ( path -- )
path <mapped-file> address>> <elf> sections :> sections
sections [ name>> ".symtab" = ] filter first symbols [
dup name>> "" = not [
[ sym>> st_value>> "%016d " printf ]
[ sym>> st_shndx>>
{
{ SHN_UNDEF [ "undefined" "%-16s" printf ] }
{ SHN_ABS [ "absolute" "%-16s" printf ] }
[ sections nth name>> "%-16s" printf ]
} case ]
[ name>> " %s\n" printf ] tri
] [ drop ] if
] each ;
Author: | erikc |
Mode: | factor |
Date: | Mon, 12 Apr 2010 23:17:05 |
Plain Text |
: nm-print-symbol ( sections symbol -- )
[ sym>> st_value>> "%016d " printf ]
[
sym>> st_shndx>>
{
{ SHN_UNDEF [ drop "undefined" ] }
{ SHN_ABS [ drop "absolute" ] }
[ swap nth name>> ]
} case "%-16s " printf
]
[ name>> "%s\n" printf ] tri ;
: nm ( path -- )
[
address>> <elf> sections [
[ name>> ".symtab" = ] find nip
symbols [ name>> empty? not ] filter
] keep [
swap nm-print-symbol
] curry each
] with-mapped-file ;
Author: | slava |
Mode: | factor |
Date: | Mon, 12 Apr 2010 23:19:19 |
Plain Text |
: print-symbol ( sections symbol -- )
[ sym>> st_value>> "%016d " printf ]
[
sym>> st_shndx>>
{
{ SHN_UNDEF [ drop "undefined" ] }
{ SHN_ABS [ drop "absolute" ] }
[ swap nth name>> ]
} case "%-16s " printf
]
[ name>> "%s\n" printf ] tri ;
: nm ( path -- )
[
address>> <elf> sections
dup [ name>> ".symtab" = ] find nip
symbols [ name>> empty? not ] filter
[ print-symbol ] with each
] with-mapped-file-reader ;
New Annotation