<legend id='G6ggx'><style id='G6ggx'><dir id='G6ggx'><q id='G6ggx'></q></dir></style></legend>
  • <small id='G6ggx'></small><noframes id='G6ggx'>

    <tfoot id='G6ggx'></tfoot>
      <bdo id='G6ggx'></bdo><ul id='G6ggx'></ul>

    1. <i id='G6ggx'><tr id='G6ggx'><dt id='G6ggx'><q id='G6ggx'><span id='G6ggx'><b id='G6ggx'><form id='G6ggx'><ins id='G6ggx'></ins><ul id='G6ggx'></ul><sub id='G6ggx'></sub></form><legend id='G6ggx'></legend><bdo id='G6ggx'><pre id='G6ggx'><center id='G6ggx'></center></pre></bdo></b><th id='G6ggx'></th></span></q></dt></tr></i><div id='G6ggx'><tfoot id='G6ggx'></tfoot><dl id='G6ggx'><fieldset id='G6ggx'></fieldset></dl></div>

      1. 自动将进入/退出功能日志添加到项目

        时间:2023-05-22
          <i id='LAXPd'><tr id='LAXPd'><dt id='LAXPd'><q id='LAXPd'><span id='LAXPd'><b id='LAXPd'><form id='LAXPd'><ins id='LAXPd'></ins><ul id='LAXPd'></ul><sub id='LAXPd'></sub></form><legend id='LAXPd'></legend><bdo id='LAXPd'><pre id='LAXPd'><center id='LAXPd'></center></pre></bdo></b><th id='LAXPd'></th></span></q></dt></tr></i><div id='LAXPd'><tfoot id='LAXPd'></tfoot><dl id='LAXPd'><fieldset id='LAXPd'></fieldset></dl></div>
              <tbody id='LAXPd'></tbody>

          • <legend id='LAXPd'><style id='LAXPd'><dir id='LAXPd'><q id='LAXPd'></q></dir></style></legend>
          • <tfoot id='LAXPd'></tfoot>

              1. <small id='LAXPd'></small><noframes id='LAXPd'>

                  <bdo id='LAXPd'></bdo><ul id='LAXPd'></ul>
                  本文介绍了自动将进入/退出功能日志添加到项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  我有一个需要调查的第 3 方源代码.我想看看函数的调用顺序,但我不想浪费时间打字:

                  I have a 3rd party source code that I have to investigate. I want to see in what order the functions are called but I don't want to waste my time typing:

                  printf("Entered into %s", __FUNCTION__)
                  

                  printf("Exited from %s", __FUNCTION__)
                  

                  对于每个函数,我也不想接触任何源文件.

                  for each function, nor do I want to touch any source file.

                  你有什么建议吗?是否有编译器标志可以自动为我执行此操作?

                  Do you have any suggestions? Is there a compiler flag that automagically does this for me?

                  对评论的澄清:

                  • 我将交叉编译源代码以在 ARM 上运行它.
                  • 我会用 gcc 编译它.
                  • 我不想分析静态代码.我想跟踪运行时.所以 doxygen 不会让我的生活更轻松.
                  • 我有源代码,我可以编译它.
                  • 我不想使用面向方面的编程.

                  我发现 gdb 提示符中的 'frame' 命令会在那个时间点打印当前帧(或者,您可以说是函数名称).也许,每次调用函数时都可以(使用 gdb 脚本)调用frame"命令.你怎么看?

                  I found that 'frame' command in the gdb prompt prints the current frame (or, function name, you could say) at that point in time. Perhaps, it is possible (using gdb scripts) to call 'frame' command everytime a function is called. What do you think?

                  推荐答案

                  除了通常的调试器和面向方面的编程技术之外,您还可以使用 gcc 的 -finstrument-functions 命令行选项.您必须实现自己的 __cyg_profile_func_enter()__cyg_profile_func_exit() 函数(在 C++ 中将它们声明为 extern "C").

                  Besides the usual debugger and aspect-oriented programming techniques, you can also inject your own instrumentation functions using gcc's -finstrument-functions command line options. You'll have to implement your own __cyg_profile_func_enter() and __cyg_profile_func_exit() functions (declare these as extern "C" in C++).

                  它们提供了一种方法来跟踪从何处调用了什么函数.但是,该接口有点难以使用,因为例如传递的是被调用函数的地址及其调用点,而不是函数名称.您可以记录地址,然后使用类似 objdump 的东西从符号表中提取相应的名称--symsnm,当然前提是这些符号没有从相关二进制文件中删除.

                  They provide a means to track what function was called from where. However, the interface is a bit difficult to use since the address of the function being called and its call site are passed instead of a function name, for example. You could log the addresses, and then pull the corresponding names from the symbol table using something like objdump --syms or nm, assuming of course the symbols haven't been stripped from the binaries in question.

                  使用 gdb 可能更容易.天啊.:)

                  It may just be easier to use gdb. YMMV. :)

                  这篇关于自动将进入/退出功能日志添加到项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:glGenVertexArrays(1, &amp;vao) 处的分段错误; 下一篇:“应用程序错误"是否可以解决?对话框被禁用

                  相关文章

                  最新文章

                  <i id='kJtLP'><tr id='kJtLP'><dt id='kJtLP'><q id='kJtLP'><span id='kJtLP'><b id='kJtLP'><form id='kJtLP'><ins id='kJtLP'></ins><ul id='kJtLP'></ul><sub id='kJtLP'></sub></form><legend id='kJtLP'></legend><bdo id='kJtLP'><pre id='kJtLP'><center id='kJtLP'></center></pre></bdo></b><th id='kJtLP'></th></span></q></dt></tr></i><div id='kJtLP'><tfoot id='kJtLP'></tfoot><dl id='kJtLP'><fieldset id='kJtLP'></fieldset></dl></div>

                    1. <small id='kJtLP'></small><noframes id='kJtLP'>

                      <legend id='kJtLP'><style id='kJtLP'><dir id='kJtLP'><q id='kJtLP'></q></dir></style></legend>
                      <tfoot id='kJtLP'></tfoot>

                        <bdo id='kJtLP'></bdo><ul id='kJtLP'></ul>