test.stackTrace

StackTrace test.stackTrace()

StackTrace test.stackTrace(startFrame)

StackTrace test.stackTrace(startFrameIndex, maxFrameCount)

This function returns a list of stack frames representing the currently active function calls. The first element in the list contains information about the location of the StackTrace test.stackTrace() call itself, the second element contains information about its caller and so on. The last element in the list is usually the main function call.

Each stack frame value in the returned list features two fields:

  • fileName: The name of the source file in which the function call was done.
  • line: The line number in the script file in which the function call was done.

If the optional startFrameIndex parameter (a number) is given, the given number of most recent frames will be skipped. This is useful for retrieving stack traces from framework functions, in which case the stack trace should possibly not include the code internal to the framework itself. If this parameter is not given it defaults to zero, i.e., no frames are skipped.

If both startFrameIndex as well as maxFrameCount are given, the stack trace will be limited to maxFrameCount frames, i.e., it will not be computed all the way back to the initial call to the main function. This can improve performance for deeply nested script frameworks.

© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners.
The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation.
Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.

Search Results