[CMake] CMake could really use a debugger...

Robert Dailey rcdailey at gmail.com
Thu Apr 2 14:17:18 EDT 2009


Good idea, but this requires domain knowledge.
For someone completely unfamiliar with the CMake code-base, this would be
impractical. However I still appreciate the thought!

It would be great to see CMake provide some more debug-related commands
later. Perhaps CMake could even implement its own prompt. For example:

Assume we have a CMakeLists.txt file with the following contents:
project( foo )
set( fubar "something arbitrary" )
add_executable( foo main.cpp )

And we would debug this file using the CMake debugger prompt like follows:

*C:\>cmake --debug-prompt*
*> step-forward*
*line 1: project( foo )*
*> view-variable "fubar"*
*Variable "fubar" not found*
*> step-forward*
*line 2: set( fubar "something arbitrary" )*
*> view-variable "fubar"*
*fubar ==> "something arbitrary"*
*> step-forward*
*line 3: add_executable( foo main.cpp )*

Later on, third party tools could be created to work directly with the
prompt and make usable frontends for people who prefer a GUI solution to
debugging like Visual Studio.


On Thu, Apr 2, 2009 at 12:57 PM, James Bigler <jamesbigler at gmail.com> wrote:

> On Thu, Apr 2, 2009 at 11:51 AM, Robert Dailey <rcdailey at gmail.com> wrote:
>
>> That's the thing that has the "Returning to" and "Entering" messages
>> right?
>> If it is, that's somewhat helpful but not anywhere near what I'm asking
>> for. Think of how visual studio debugs C++ code. That's exactly the most
>> optimal debugging method I would like to see for CMake. Here's a couple of
>> abilities/features I expect:
>>
>>    - The ability to view the values of variables dynamically. In other
>>    words, as I step through code and the variable's value changes, I want to
>>    see the values change in real-time, just like Visual Studio's Watch window.
>>    - I want to be able to pause at each line of CMake code as it is
>>    executing to evaluate the state of the application. I should be able to
>>    press a key (like F10) in whatever debugger I'm using to progress to the
>>    next line.
>>
>> I'm guessing such a thing does not exist. In addition, if CMake.exe does
>> not provide a way to step through the code and view variable values
>> dynamically, no such tool can be made for it. CMake has to support the
>> required hooks.
>>
>> On Thu, Apr 2, 2009 at 11:42 AM, Bill Hoffman <bill.hoffman at kitware.com>wrote:
>>
>>> Robert Dailey wrote:
>>>
>>>> I can't tell you how hard it is to hunt down strange behavior in CMake.
>>>> Often times I would save myself 30 minutes of time on each of the hard bug
>>>> fixes if I could just step through each line of logic as it was being
>>>> executed and view the values of variables in a "watch" window of some sort.
>>>>
>>>> Does anyone know if such a CMake debugger exists? If not, are there
>>>> plans to make one officially by the CMake team or some third party?
>>>>
>>>>
>>>>  Have you tried: cmake --trace
>>>
>>> -Bill
>>>
>>
> What about using a debug version of CMake and firing up the VS debugger?
> By putting break points in the right places in cmake.exe you might be able
> to query the state of things as CMake sees it.
>
> It might be too extreme for what you are asking for, but you could try it
> in 30 minutes rather than waiting for support for this feature.
>
> James
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090402/fdfb6080/attachment.htm>


More information about the CMake mailing list