利用Graphviz dot画函数调用图

比如addr2line的函数调用关系用dot语法表示如下:(存为call.dot)
digraph g  {
translate_addresses
->bfd_scan_vma;
translate_addresses
->bfd_map_over_sections;
translate_addresses
->find_address_in_section;
translate_addresses
->cplus_demangle;
find_address_in_section
->bfd_get_section_flags;
find_address_in_section
->bfd_get_section_vma;
find_address_in_section
->bfd_get_section_size_before_reloc;
find_address_in_section
->bfd_find_nearest_line;
process_file
->bfd_openr;
process_file
->bfd_fatal;
process_file
->bfd_check_format;
process_file
->bfd_check_format_matches;
process_file
->bfd_get_filename;
process_file
->bfd_get_error;
process_file
->list_matching_formats;
process_file
->slurp_symtab;
process_file
->translate_addresses;
process_file
->bfd_close;
main
->setlocale;
main
->bindtextdomain;
main
->textdomain;
main
->xmalloc_set_program_name;
main
->bfd_init;
main
->set_default_bfd_target;
main
->getopt_long;
main
->cplus_demangle_name_to_style;
main
->cplus_demangle_set_style;
main
->print_version;
main
->process_file;
main
->usage;
slurp_symtab
->bfd_get_file_flags;
slurp_symtab
->bfd_get_symtab_upper_bound;
slurp_symtab
->bfd_get_filename;
slurp_symtab
->xmalloc;
slurp_symtab
->bfd_canonicalize_symtab;
usage
->list_supported_targets;
}
然后在cmd下输入 dot -Tjpg call.dot -o Addr2line.jpg
就得到了函数调用关系图
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值