Backtrace for GNU make

筅森魡賤 提交于 2019-12-04 05:34:07

Use remake. It is a patched version of GNU Make that adds improved error reporting, the ability to trace execution in a comprehensible way, and a debugger.

make -p and make -d provide interesting information, but not precisely what you are asking for. See make's man page.

rocky

Yes, remake can give you a backtrace. Here is a run to using the remake's Makefile show this:

    remake --debugger Makefile
    GNU Make 4.1+dbg0.91
    Built for x86_64-unknown-linux-gnu
    Copyright (C) 1988-2014 Free Software Foundation, Inc.
    Copyright (C) 2015 Rocky Bernstein.
    License GPLv3+: GNU GPL version 3 or later 
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.
    Reading makefiles...
    Updating makefiles....
    -> (/src/github/remake/Makefile:608)
    Makefile: Makefile.in config.status
    remake<0> bt
    =>#0  Makefile at /src/github/remake/Makefile:608
    remake<1> s
    -> (/src/github/remake/Makefile:594)
    Makefile.in: 
    remake<2> bt
    =>#0  Makefile.in at /src/github/remake/Makefile:594
      #1  Makefile at /src/github/remake/Makefile:608
    remake<3> s
    -> (/src/github/remake/Makefile:618)
    config.status: configure
    remake<4> bt
    =>#0  config.status at /src/github/remake/Makefile:618
      #1  Makefile at /src/github/remake/Makefile:608
    remake<5> s
    -> (/src/github/remake/Makefile:621)
    configure: 
    remake<6> bt
    =&lt#0  configure at /src/github/remake/Makefile:621
      #1  config.status at /src/github/remake/Makefile:618
      #2  Makefile at /src/github/remake/Makefile:608
    remake<7> 

You could also set a breakpoint at a particular target (break), go there (continue) and backtrace that. And on error, you will get a backtrace of where you were at when you crashed.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!