Merge lp:~aacid/unity8/enable_debugging_flag into lp:unity8

Proposed by Albert Astals Cid on 2016-04-05
Status: Merged
Approved by: Michael Zanetti on 2016-04-08
Approved revision: 2329
Merged at revision: 2358
Proposed branch: lp:~aacid/unity8/enable_debugging_flag
Merge into: lp:unity8
Diff against target: 83 lines (+43/-0)
3 files modified
src/Dash/main.cpp (+5/-0)
src/main.cpp (+5/-0)
src/qmldebuggerutils.h (+33/-0)
To merge this branch: bzr merge lp:~aacid/unity8/enable_debugging_flag
Reviewer Review Type Date Requested Status
Michael Zanetti (community) 2016-04-05 Approve on 2016-04-08
Unity8 CI Bot continuous-integration Needs Fixing on 2016-04-08
Review via email: mp+290969@code.launchpad.net

Commit Message

Add env var to enable js debugging/profiling even if not built on debug mode

Description of the Change

How to test:
 * Compile with -DCMAKE_BUILD_TYPE=release
 * run builddir/src/Dash/unity8.dash
    * See nothing about js debugging is printed
 * run ENABLE_QML_DEBUGGER=soemthing builddir/src/Dash/unity8-dash
    * See how "QML debugging is enabled. Only use this in a safe environment." is printed

 * Are there any related MPs required for this MP to build/function as expected?
No

 * Did you perform an exploratory manual test run of your code change and any related functionality?
Yes

 * Did you make sure that your branch does not contain spurious tags?
Yes

 * If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
N/A

 * If you changed the UI, has there been a design review?
N/A

To post a comment you must log in.
Gerry Boland (gerboland) wrote :

/me wonders if we should enable debugging if the -qmljsdebugger switch is set. One less hoop to jump through. Just a thought.

Albert Astals Cid (aacid) wrote :

> /me wonders if we should enable debugging if the -qmljsdebugger switch is set.
> One less hoop to jump through. Just a thought.

went for a new flag to make it clearer it is a different thing, i.e. otherwise you may run -qmljsdebugger on a different binary and wonder why it's not working.

This way you could still use ENABLE_QML_DEBUGGER on a different binary and wonder why it doesn't work but a grep over unity8 codebase will show why.

2327. By Albert Astals Cid on 2016-04-05

Add to unity8 too

Unity8 CI Bot (unity8-ci-bot) wrote :

FAILED: Continuous integration, rev:2326
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/928/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=vivid+overlay,testname=qmluitests.sh/518
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial,testname=qmluitests.sh/518
    FAILURE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=phone-armhf,release=vivid+overlay,testname=autopilot.sh/518/console
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/1264
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/1235
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/1235
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/1233
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/1233/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial/1233
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial/1233/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1233
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1233/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial/1233
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial/1233/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/1233
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/1233/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial/1233
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial/1233/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/928/rebuild

review: Needs Fixing (continuous-integration)
Unity8 CI Bot (unity8-ci-bot) wrote :

FAILED: Continuous integration, rev:2327
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/929/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=vivid+overlay,testname=qmluitests.sh/519
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial,testname=qmluitests.sh/519
    FAILURE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=phone-armhf,release=vivid+overlay,testname=autopilot.sh/519/console
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/1265
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/1236
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/1236
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/1234
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/1234/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial/1234
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial/1234/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1234
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1234/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial/1234
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial/1234/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/1234
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/1234/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial/1234
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial/1234/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/929/rebuild

review: Needs Fixing (continuous-integration)
Michael Zanetti (mzanetti) wrote :

if the -qmljsdebugger argument is always required (as it turned out to be in my tests) then not sure we need the env variable indeed, as Gerry said. I'd also be ok with the other way round, somehow configure it to some port (preferably 3768 as that's the preselected in our IDE) so exporting the env var is good enough and -qmljsdebugger arg is not needed any more.

review: Needs Fixing
2328. By Albert Astals Cid on 2016-04-08

Make enabling the qml debugger depend on the -qmljsdebugger command line option being there or not

2329. By Albert Astals Cid on 2016-04-08

eof

Unity8 CI Bot (unity8-ci-bot) wrote :

FAILED: Continuous integration, rev:2328
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/960/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/1302
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/1273
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/1273
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/1271/console
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial/1271
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial/1271/artifact/output/*zip*/output.zip
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1271/console
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial/1271
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial/1271/artifact/output/*zip*/output.zip
    FAILURE: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/1271/console
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial/1271
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial/1271/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/960/rebuild

review: Needs Fixing (continuous-integration)
Unity8 CI Bot (unity8-ci-bot) wrote :

FAILED: Continuous integration, rev:2329
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/961/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=vivid+overlay,testname=qmluitests.sh/536
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial,testname=qmluitests.sh/536
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=phone-armhf,release=vivid+overlay,testname=autopilot.sh/536
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/1303
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/1274
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/1274
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/1272
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/1272/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial/1272
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial/1272/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1272
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1272/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial/1272
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial/1272/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/1272
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/1272/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial/1272
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial/1272/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/961/rebuild

review: Needs Fixing (continuous-integration)
Unity8 CI Bot (unity8-ci-bot) wrote :

FAILED: Continuous integration, rev:2328
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/963/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=vivid+overlay,testname=qmluitests.sh/538
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial,testname=qmluitests.sh/538
    FAILURE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=phone-armhf,release=vivid+overlay,testname=autopilot.sh/538/console
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/1305
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=vivid+overlay/1276
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-1-sourcepkg/release=xenial/1276
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/1274
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=vivid+overlay/1274/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial/1274
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial/1274/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1274
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=vivid+overlay/1274/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial/1274
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial/1274/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/1274
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=vivid+overlay/1274/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial/1274
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial/1274/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/963/rebuild

review: Needs Fixing (continuous-integration)
Michael Zanetti (mzanetti) wrote :

A small nitpick perhaps... Your code accepts "--qmljsdebugger", however the qmljsdebugger only accepts it with one "-". This ends up with this message:

QML debugging is enabled. Only use this in a safe environment.
unity8-dash: unrecognized option '--qmljsdebugger=port:3768'

review: Needs Fixing
Michael Zanetti (mzanetti) wrote :

ok, turns out this is just a bogus debug print from Qt, it actually still works with -- too.

 * Did you perform an exploratory manual test run of the code change and any related functionality?

yes

 * Did CI run pass? If not, please explain why.

yes

 * Did you make sure that the branch does not contain spurious tags?

yes

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Dash/main.cpp'
2--- src/Dash/main.cpp 2015-12-16 13:58:39 +0000
3+++ src/Dash/main.cpp 2016-04-08 09:38:49 +0000
4@@ -27,6 +27,7 @@
5 #include <libintl.h>
6
7 #include <paths.h>
8+#include "../qmldebuggerutils.h"
9 #ifdef UNITY8_ENABLE_TOUCH_EMULATION
10 #include "../MouseTouchAdaptor.h"
11 #endif
12@@ -34,6 +35,10 @@
13
14 int main(int argc, const char *argv[])
15 {
16+ if (enableQmlDebugger(argc, argv)) {
17+ QQmlDebuggingEnabler qQmlEnableDebuggingHelper(true);
18+ }
19+
20 QGuiApplication *application = new QGuiApplication(argc, (char**)argv);
21
22 QCommandLineParser parser;
23
24=== modified file 'src/main.cpp'
25--- src/main.cpp 2015-10-20 16:43:53 +0000
26+++ src/main.cpp 2016-04-08 09:38:49 +0000
27@@ -16,6 +16,7 @@
28
29 // local
30 #include "ShellApplication.h"
31+#include "qmldebuggerutils.h"
32
33 int main(int argc, const char *argv[])
34 {
35@@ -25,6 +26,10 @@
36 isMirServer = true;
37 }
38
39+ if (enableQmlDebugger(argc, argv)) {
40+ QQmlDebuggingEnabler qQmlEnableDebuggingHelper(true);
41+ }
42+
43 ShellApplication *application = new ShellApplication(argc, (char**)argv, isMirServer);
44
45 int result = application->exec();
46
47=== added file 'src/qmldebuggerutils.h'
48--- src/qmldebuggerutils.h 1970-01-01 00:00:00 +0000
49+++ src/qmldebuggerutils.h 2016-04-08 09:38:49 +0000
50@@ -0,0 +1,33 @@
51+/*
52+ * Copyright (C) 2016 Canonical, Ltd.
53+ *
54+ * This program is free software; you can redistribute it and/or modify
55+ * it under the terms of the GNU General Public License as published by
56+ * the Free Software Foundation; version 3.
57+ *
58+ * This program is distributed in the hope that it will be useful,
59+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
60+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
61+ * GNU General Public License for more details.
62+ *
63+ * You should have received a copy of the GNU General Public License
64+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
65+ */
66+
67+#ifndef QMLDEBUGGERUTILS_H
68+#define QMLDEBUGGERUTILS_H
69+
70+bool enableQmlDebugger(int argc, const char *argv[])
71+{
72+ for (int i = 1; i < argc; ++i) {
73+ QByteArray arg = argv[i];
74+ if (arg.startsWith("--"))
75+ arg.remove(0, 1);
76+ if (arg.startsWith("-qmljsdebugger=") || (arg == "-qmljsdebugger" && i < argc - 1)) {
77+ return true;
78+ }
79+ }
80+ return false;
81+}
82+
83+#endif

Subscribers

People subscribed via source and target branches