diff options
author | Thomas McGuire <thomas.mcguire@kdab.com> | 2018-02-13 15:05:35 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2019-05-03 12:41:16 +0000 |
commit | 94093989c58d3afab3aaf278d1d761d06361045e (patch) | |
tree | 7f09a4e147f0588b73336d0f963fc7ccc521d6fc | |
parent | b5df17c04718ddc995ddf9030754253e8d4a0ca8 (diff) |
Halt perfparser when PERFPARSER_DEBUG_WAIT is set
This gives a developer the chance to attach a debugger.
Change-Id: I80ca1246e06727f511a326ab87a7fc32c8462fd2
Reviewed-by: Milian Wolff <milian.wolff@kdab.com>
-rw-r--r-- | app/main.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/app/main.cpp b/app/main.cpp index 5eba3db..4d216e5 100644 --- a/app/main.cpp +++ b/app/main.cpp @@ -39,7 +39,10 @@ #include <QtEndian> #include <cstring> -#include <limits> + +#ifdef Q_OS_LINUX +#include <signal.h> +#endif #ifdef Q_OS_WIN #include <io.h> @@ -79,6 +82,16 @@ int main(int argc, char *argv[]) app.setApplicationName(QLatin1String("perfparser")); app.setApplicationVersion(QLatin1String("4.9")); + if (qEnvironmentVariableIsSet("PERFPARSER_DEBUG_WAIT")) { +#ifdef Q_OS_LINUX + qWarning("PERFPARSER_DEBUG_WAIT is set, halting perfparser."); + qWarning("Continue with \"kill -SIGCONT %lld\" or by attaching a debugger.", app.applicationPid()); + kill(app.applicationPid(), SIGSTOP); +#else + qWarning("PERFPARSER_DEBUG_WAIT is set, but this only works on linux. Ignoring."); +#endif + } + QCommandLineParser parser; parser.setApplicationDescription(QLatin1String("Perf data parser and unwinder.")); parser.addHelpOption(); |