阅读/了解第三方代码 [英] Reading/Understanding third-party code

查看:193
本文介绍了阅读/了解第三方代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当您获得第三方库(c,c ++),开源(LGPL说),没有良好的文档,什么是最好的方式去了解它,以便能够集成到您的应用程序?



库通常有一些示例程序,我最后使用gdb遍历代码。任何其他建议/最佳实践?



例如,我只是从sourceforge.net中选择一个,但它只是一个广泛的工程/编程问题:
http://sourceforge.net/projects/aftp/




  • 解决方案

GNU全球。它生成交叉引用数据库,并可以从源代码生成超链接的HTML。点击函数调用将带你到它们的定义,你可以看到所有引用的函数的列表。只适用于C和C ++。

  • Doxygen 。它从Javadoc风格的注释生成文档。如果你告诉它为未记录的方法生成文档,它会给你很好的总结。它还可以生成超链接的源代码列表(并可以链接到htags提供的列表)。



  • 这两个工具在Emacs中读取代码,并使用递归grep进行一些搜索,是我如何做大多数源代码反向工程。


    When you get a third-party library (c, c++), open-source (LGPL say), that does not have good documentation, what is the best way to go about understanding it to be able to integrate into your application?

    The library usually has some example programs and I end up walking through the code using gdb. Any other suggestions/best-practicies?

    For an example, I just picked one from sourceforge.net, but it's just a broad engineering/programming question: http://sourceforge.net/projects/aftp/

    解决方案

    I frequently use a couple of tools to help me with this:

    • GNU Global. It generates cross-referencing databases and can produce hyperlinked HTML from source code. Clicking function calls will take you to their definitions, and you can see lists of all references to a function. Only works for C and perhaps C++.
    • Doxygen. It generates documentation from Javadoc-style comments. If you tell it to generate documentation for undocumented methods, it will give you nice summaries. It can also produce hyperlinked source code listings (and can link into the listings provided by htags).

    These two tools, along with just reading code in Emacs and doing some searches with recursive grep, are how I do most of my source reverse-engineering.

    这篇关于阅读/了解第三方代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆