【问题标题】:Tool for debugging makefiles调试生成文件的工具
【发布时间】:2010-09-08 11:00:48
【问题描述】:

我有一个庞大的遗留代码库,其中包含非常复杂的 makefile 和很多变量。有时我需要更改它们,我发现很难弄清楚为什么更改没有按我预期的方式进行。我想找到的是一个基本上可以逐步调试“make”过程的工具,我会给它一个目录,我可以在不同的点看到不同变量的值过程。没有一个调试标志似乎向我展示了我想要的东西,尽管我可能遗漏了一些东西。有谁知道这样做的方法吗?

【问题讨论】:

    标签: debugging makefile


    【解决方案1】:

    您是否一直在查看运行 make -nmake -np 以及大人物 make -nd 的输出?

    您使用的是最新版本的gmake

    您是否查看过 O'Reilly 网站上关于 Debugging Makefiles 的免费章节,因为他们的优秀著作“使用 GNU Make 管理项目”(Amazon Link)。

    【讨论】:

      【解决方案2】:

      我确定remake 就是您要查找的内容。

      来自主页:

      remake 是 GNU make 实用程序的补丁和现代化版本,它增加了改进的错误报告、以可理解的方式跟踪执行的能力以及调试器。

      它具有类似 gdb 的界面,并且受 (x)emacs 中的 mdb-mode 支持,这意味着断点、监视等。如果您不喜欢 (x)emacs,还有DDD

      【讨论】:

      • 如果可以的话,我会加 +100。使用 remake('brew install remake' 进行安装)时,我必须调试的问题简单地消失了。不知道问题是什么,但谁在乎呢? :)
      【解决方案3】:

      来自 make 命令行选项的手册页:

      -n, --just-print, --dry-run, --recon  
      Print the commands that would be executed, but do not execute them.  
      
      -d  Print debugging information in addition to normal processing.  
      The debugging information says  
      which files are being considered for remaking,  
      which file-times are being compared and with what results,  
      which files actually need  to  be  remade,  
      which implicit  rules are considered and which are applied---  
      everything interesting about how make decides what to do.  
      
      --debug[=FLAGS] Print debugging information in addition to normal processing.  
      If the FLAGS are omitted, then the behaviour is the same as if -d was specified.  
      FLAGS may be:  
      'a' for all debugging output same as using -d,  
      'b' for basic debugging,  
      'v' for more verbose basic debugging,  
      'i' for showing implicit rules,  
      'j' for details on invocation of commands, and  
      'm' for debugging while remaking makefiles.  
      

      【讨论】:

        【解决方案4】:

        我不知道有任何特定标志可以完全满足您的要求,但是

        --print-data-base
        听起来可能很有用。

        【讨论】:

          【解决方案5】:

          【讨论】:

            【解决方案6】:

            http://gmd.sf.net 有一个 GNU make 调试器项目,看起来非常有用。 gmd 支持的主要功能是断点,它可能比单步更有用。要使用它,您可以从http://gmd.sf.net 下载 gmd 和从http://gmsl.sf.net 下载 gmsl,然后在您的 makefile 中执行“包含 gmd”。

            【讨论】:

              猜你喜欢
              • 1970-01-01
              • 1970-01-01
              • 2022-06-14
              • 1970-01-01
              • 2012-02-05
              • 1970-01-01
              • 2018-12-15
              • 1970-01-01
              • 2010-10-22
              相关资源
              最近更新 更多