summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/CommandLine/trace-json-v1-check.py
Commit message (Collapse)AuthorAgeFilesLines
* Trace: process else and elseif commands correctlyBraulio Valdivielso Martinez2022-03-251-1/+9
| | | | | | | | | | | | | | | | | There have been two bugs reported about the `else` and `elseif` commands in the context of the tracing functionality and the json-v1 format (#23191 #22315). In essence, the reported traces referred to the layer of the stacktrace immediately on top of the expected ones. This MR fixes both issues. My solution adds a new parameter to the `PrintCommandTrace` function, `commandMissingFromStack`, that callers can specify if the command they want to report a trace for is not a regular part of the stack maintained in `cmMakefile`. This is only the case for `else` and `elseif`. The other bug is fixed by having the caller pass a `cmListFileBacktrace`, which helps in getting the right lines, file names... for the reported command. Fixes: #23191 #22315
* Trace: include `line_end` field in json-v1 formatBraulio Valdivielso Martinez2022-02-091-10/+27
| | | | | | | | | | | | | | | | | | | | After !6954 got merged, it has become easier for tools to get full stack-traces for runtime traces of a CMake program. The trace information already included in the JSON objects (line number, source file path) allows tools that display these stack traces to print the CMake source code associated to them. However, CMake commands may spawn multiple lines, and the JSON information associated to a trace only contains the line in which the command started, but not the one in which it ended. If tools want to print stack traces along the relevant source code, and they want to print the whole command associated to the stack frame, they will have to implement their own CMake language parser to know where the command ends. In order to simplify the life of those who want to write tooling for CMake, this commit adds a `line_end` field to the json-v1 trace format. If a given command spans multiple lines, the `line_end` field will contain the line of the last line spanned by the command (that of the closing parenthesis associated to the command).
* Trace: add global_frame field to json-v1 formatBraulio Valdivielso Martinez2022-02-071-3/+11
| | | | | | | | | | | | | | | | | | | Tools using the json-v1 format might want to trace stack frames across different `CMakeLists.txt` files, in order to, for example, provide stacktraces that span from the top-level `CMakeLists.txt` in a project. One would think that `frame` lets you do that, but it doesn't, because it tells you the depth of the stack within the current `CMakeLists.txt`, so it gets reset across calls to `add_subdirectory`. The solution involves adding a field with a "global frame". This value gets incremented on calls to `add_subdirectory`, which makes it easier for tools to reconstruct "global stacktraces". I considered changing the current "frame" value, but I didn't because it would be a breaking change. I cannot think of any use-case where "frame" is more useful to "global-frame", but maybe I'm missing something.
* cmake_language: Add signature to DEFER calls to later timesBrad King2020-09-291-1/+1
| | | | Fixes: #19575
* trace: Add time and stack level to JSON output formatFrank Winklmeier2020-01-221-4/+8
| | | | | | | | Add the timestamp and stack depth of the function call to the JSON trace output format. This information can be useful for cmake profiling and call stack inspection (see e.g. https://github.com/volo-zyko/cmake-profile-stats). Improve unit test to allow for varying set of keys to check in trace lines.
* Merge topic 'trace-test-support-python26-and-older'Kyle Edwards2020-01-031-8/+13
|\ | | | | | | | | | | | | 00f25dacc0 trace: Directly parse commandline arguments without argparse Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !4169
| * trace: Directly parse commandline arguments without argparseDaniel Mensinger2020-01-011-8/+13
| |
* | Tests: do not use the same variable name in nested loopsRolf Eike Beer2019-12-311-3/+3
|/ | | | Spotted by LGTM.com.
* trace: Add test for the JSON-v1 traceDaniel Mensinger2019-12-231-0/+67