Commit Graph

1551 Commits

Author SHA1 Message Date
hjk
4a42bcd4e8 Utils/ProjectExplorer: Use FilePath for Runnable::workingDirectory
... and in some using code.

Change-Id: I231ea56628908f7d305d13f07eabe8803fe8a791
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-08-06 12:51:24 +00:00
hjk
430e81facd All: Replace most SynchronousProcess by QtcProcess
Change-Id: I0bf22fef2cd4a7297ef5a1e9aa9c3e2b9348ba42
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-06-23 07:55:31 +00:00
hjk
76cf6ce983 Utils: Add a QtcProcess flag to keep stdin open
Needed to run e.g. gdb on-device.

Change-Id: I5a98df575478f18adf1540ced44f6808bdba0b76
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-06-22 07:48:36 +00:00
hjk
325773b5f6 Debugger: Introduce a GdbEngine::usesOutputCollector helper
Change-Id: Ia148baeb602c8794d0b5075afd4259f1529d727f
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-06-22 06:28:03 +00:00
hjk
fe7d6f0def Utils: Drop QProcess specific parameters from QtcProcess::finished()
Mid-term plan is to concentrate on use of QtcProcess::result()
instead which is a bit more system-agnostic.

There's quite a bit of potential for downstream cleanup by
re-using QtcProcess::exitMessage() now.

Change-Id: I3806b3f5933d96e64b7cfb18cc6c52823fddcbcd
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-06-14 13:31:05 +00:00
hjk
c8241c12d0 Debugger: Add an option to enable newer gdb's symbol index cache
GDB 8.3+ can automatically save indices of DWARF symbols on disk
to speed up further loading of the same binaries.

Make this option available to the user and switch it on by default.

No harm is done for gdb builds without this feature.

Task-number: QTCREATORBUG-23207
Change-Id: Id0d467eee429a94f1d8e826a883179796732d31e
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-06-11 11:35:01 +00:00
hjk
fde88f9f07 Android, Debugger: Simplify setUseCtrlCStub callers
The Windows-only restriction is nowadays handled inside QtcProcess.

Change-Id: I77d6914831ff172026665a429b497940c60970ac
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-06-04 09:59:28 +00:00
hjk
accb1e6e08 Utils: Make QtcProcess::{setW,w}orkingDirectory use FilePath
But keep the old setter for a while to ease transition.

Change-Id: If02b79b1fcd31fbf8b06ef26876c41af891127f9
Reviewed-by: hjk <hjk@qt.io>
2021-06-03 10:31:13 +00:00
hjk
0ba4338467 Utils: Rename QtcProcess::Result::Finished to FinishedWithSuccess
To make clear that this is not just any finish.

Also change FinishedError to FinishedWithError, to create
symmetry.

Also adapt enum member description to reality.

Change-Id: I13e05391eb86fdb24e2ae660f14dfddb282e1104
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-06-02 14:16:36 +00:00
hjk
08040e4e94 Utils: Move QProcess base to QtcProcessPrivate
Change-Id: I4c6811d42e051fadfcf32edb664ff3bc09e692e6
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-06-02 13:21:08 +00:00
hjk
b63a5a0411 Debugger: Remove one (and only) use of QProcess::systemEnvironment
This is not recommended to use, and using Environment::systemEnvironment()
also saves a conversion.

Change-Id: I7af24a5bbf432617a75421e6950292acc4b529a3
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-05-21 17:18:49 +00:00
hjk
77d7b24326 Utils: Make Environment::setEnglishOutput a proper member function
The previous indirection was useful as long as they were overloads
for QProcessEnvironment and QStringList, but these are gone now.

Change-Id: I5066bd2e72fd06948a5cc7bbac6dda9006db96ed
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-05-21 15:07:34 +00:00
hjk
90ad902486 Utils: Remove CommandLine argument from QtcProcess::run{,Blocking}
Makes run() more similar to what start() looks like.

Also add some asserts to make sure run() and related functions are
only called on SyncronousProcesses, as these are currently the only
ones where this works.

Change-Id: Idee6076c3f40a484db5c17f5bb348698cc83d220
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-05-19 13:01:51 +00:00
hjk
55f768e1b0 Utils: Make process results accessible through QtcProcess object
The result is fully stored in the object anyway. Using the extra
SynchronousProcessResponse structure only causes copies of
the data and complicates access on the user side in
a lot of cases.

The result bits are now also accessible individually.

There's obvious room for follow-up changes on the topic, e.g.
ShellCommand::runCommand's parameter list could shrink to
just a SynchronousProcess parameter.

Change-Id: I45aa7eb23832340be06905929280c012e1217263
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-05-14 13:19:01 +00:00
hjk
c23cdd9262 Utils: Merge {synchronous,qtc}process.{h,cpp} file pairs
Mechanical to prepare merging the actual classes.
Adapting #includes.

Change-Id: I77a2c28129287778bc870c30cb890cd26bc2e62b
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-05-10 09:47:51 +00:00
hjk
5813c7e8c2 Utils: Make SynchronousProcess use Utils::Environment for environments
Makes the interface more similar to QtcProcess.

Change-Id: I58e57d9fdb7c37eb0d2a5c5eef8643d6be97c3cc
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2021-05-05 12:14:31 +00:00
hjk
8e352af0ec Core: Add a default parameter to various ICore::*path functions
Saves some code on the user side.

Change-Id: I32cd220b6e533f5497a1865f9c34ab9db4cfda79
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-04-27 06:52:05 +00:00
Eike Ziller
c1f90aeca2 ICore: Change some path API to use FilePath
Change-Id: Id841d6177206a021c9e606ce560b47d1ae6e52b9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
2021-04-26 08:03:47 +00:00
hjk
f2c34e51e9 Debugger: Fix setting of breakpoint by function name with GDB
Change-Id: Ib6194f9acc575ee089f11da6d1f3689eb7dee9af
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-03-19 12:08:04 +00:00
Eike Ziller
4151f091e3 Merge remote-tracking branch 'origin/4.15'
Change-Id: If0dbebdf37b0ffea2528bf6ce6d34d88554f8dfb
2021-03-16 10:55:54 +01:00
hjk
06a754cc74 Debugger: Add more information about the debugee when debugging
Fixes: QTCREATORBUG-25159
Change-Id: Ic462c8bb4d9f4f7163dbb9fcc13adce4c7172564
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: André Hartmann <aha_1980@gmx.de>
2021-03-16 08:12:26 +00:00
The Qt Project
01be3816f9 Merge "Merge remote-tracking branch 'origin/4.15'" 2021-03-09 14:33:44 +00:00
hjk
641604429a Debugger: Use an aspect for the source path mapping
More in line with the other settings.

Change-Id: I86494f1955120cddda7d2f2eec8ba0fdbfd99585
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-03-09 12:40:12 +00:00
Eike Ziller
6371fa23a6 Merge remote-tracking branch 'origin/4.15'
Change-Id: Ia0cf8d72871437386bf8ad16a8e101bd9d97cc73
2021-03-09 13:17:52 +01:00
hjk
89646aadce Utils: Don't raise SIGSTOP in the process stub
Previously, the starting inferior was sent a SIGSTOP to avoid
progress before the debugger could attach.

However, these signals are then also visible in the debugger and
need to be ignored as part of the startup handling in Creator.

The waiting effect can be achieved less intrusively by waiting
on a pipe read between fork() and exec().

Task-number: QTCREATORBUG-25073
Task-number: QTCREATORBUG-25082
Task-number: QTCREATORBUG-25227
Change-Id: Ie70b9eb5ea865f85411c26b0dbf377a019fec8d5
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-03-09 08:06:21 +00:00
hjk
93a5803956 Debugger: Aspectify settings
Change-Id: I527be79965250b82a0928171b17aa93bac9fa2a0
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-03-03 07:39:17 +00:00
hjk
c4b7da9ab2 ProjectExplorer/Debugger: Add a 'Run as root' option for Unix hosts
For local run and GDB debug, with or without terminal.

Task-number: QTCREATORBUG-2831
Task-number: QTCREATORBUG-25330
Change-Id: I9b5d2156bcffea4f358474ecdbcad580a4419917
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-02-22 13:38:25 +00:00
hjk
2fb9d08082 Utils: Don't use ptrace in the process stub
Previously, ptrace was used to keep a tight hold on the spawned process
across the exec(), followed by raising a SIGSTOP to allow un-racy
attaching a debugger.

This makes implementation of 'Run as root' more difficult and is
apparently not needed: instead of the ptrace use, the SIGSTOP can be
raised directly, before exec().

Change-Id: I36025ac547b2a335e2a203c728d221830e4c0a7d
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-02-18 13:18:21 +00:00
hjk
34945f84e4 Debugger: Use a class for GdbMI parser parameters
Currently only the previous from/to pair, but can be extended
by codec state.

Task-number: QTCREATORBUG-24462
Change-Id: I3d101e74d1fef65bb75ddaab1dc2eaf77201dcde
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-02-18 06:07:36 +00:00
Leander Schulten
54e5ff7e05 Debugger: Fix build
Amends 2081038953

Change-Id: Ieae6945b2a856b8ae253bf3a49ce8a7613e88a1f
Reviewed-by: hjk <hjk@qt.io>
2021-02-04 17:18:22 +00:00
Mattias Johansson
2081038953 Add gdb tracepoint support for Linux
Change-Id: Id2e46bae576a730f8c1b64a247aeed12e6d721af
Reviewed-by: hjk <hjk@qt.io>
2021-02-02 07:36:07 +00:00
Eike Ziller
ad09faab4e Fix build with Qt 6
Change-Id: I5c775460563dde17a363ea875d7f993e4e4d6ecd
Reviewed-by: Leander Schulten <Leander.Schulten@rwth-aachen.de>
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-01-28 12:49:50 +00:00
BogDan Vatra
111624970d Group registers by type to make them easier to follow
These days the ISAs are adding more and more registers, which sometimes
are quite hard to follow. For instance if you're interested only in float
or only in system/CSRs registers you have to scroll down quite a lot for
monitor them.

Grouping them by thier type, it makes it much easier to follow each
register type.

Change-Id: I268626b3fe71aa8fa54be0999836caf03e8780ca
Reviewed-by: hjk <hjk@qt.io>
2021-01-21 15:22:55 +00:00
hjk
3e30c4b571 Debugger: Move initial breakpoint setting into individual branches
This avoids pending breakpoints in local attach setups now.

Change-Id: I6872a97020955180d4c3f915f6bb19c1f771f07f
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-01-21 07:06:53 +00:00
hjk
cd6b0cb795 Debugger: Also ignore SIGSTOPs inside clone() when using a terminal
Chances are high these are triggered by the process stub. There is
a small chance for false positives here, but true SIGSTOPs by
other external sources in these locations are very unlikely.

Task-number: QTCREATORBUG-25073
Task-number: QTCREATORBUG-25082
Change-Id: I25478caf6803877f2f8cbb2edef68ae1183223a6
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-01-14 12:47:08 +00:00
Eike Ziller
7ce3ceabe9 Merge remote-tracking branch 'origin/4.14'
Change-Id: I26a53ef81a54a2f7aa482448118298895b712941
2021-01-12 14:14:41 +01:00
Orgad Shaneh
ac32cf56a1 Debugger: Add -file-exec-file when opening a core dump
-file-symbol-file alone doesn't cover all cases. Run -file-exec-file too.

Task-number: QTCREATORBUG-24541
Change-Id: Id4d8f7057f845bce32b28cc8f4db0eadcfcfab28
Reviewed-by: hjk <hjk@qt.io>
2021-01-11 05:19:08 +00:00
hjk
1df9951d03 Debugger: Split remote and local attach handlers
Called with different timing, no real shared code currently.

Change-Id: I5a8cc32c5f38f533acfa4512518fb51932d8aab2
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-01-08 10:37:38 +00:00
hjk
0cb171ac96 Debugger: Shift initial breakpoint setting even further down
In case of 'attach' this is still a bit too early to avoid pending
breakpoints, but we are getting there.

Also, lump in the commandsAfterConnect bits into the initial breakpoint
setting, as this is the right time. The function is mis-nomed now, will
be fixed in a later patch.

Change-Id: I8c4c53d02b4eab31e8e095865fc3cb24265c5028
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-01-08 10:37:33 +00:00
Tim Jenssen
b801a9339d Merge remote-tracking branch 'origin/4.14'
Change-Id: I70504e096be620434f38cd990c593950da8b24ba
2021-01-07 14:23:46 +00:00
hjk
da147880e8 Debugger: Rename 'AttachExternal' to 'AttachToLocalProcess'
And AttachCrashedExternal to AttachToCrashedProcess
And AttachCore to AttachToCore.

Clearer.

Change-Id: I47c2eca5cbdbbc0eb38b9f62b2504c96558ff112
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-01-07 12:11:42 +00:00
Orgad Shaneh
bb070d861b Debugger: Minor cleanup
Change-Id: Idfef663ec6701f7ed8904bd5c3dbfa87e0baaf8b
Reviewed-by: hjk <hjk@qt.io>
2021-01-07 09:14:54 +00:00
hjk
13c9b42a21 Debugger: Move initial GDB breakpoint settings after target setup
While GDB can handle breakpoints set before specifying an executable
fine, it stresses the machinery unnecessarily and fails in corner cases
("wrong" dynamic loader etc). We can avoid most of that by moving the
breakpoint setting to a later point in the process.

Change-Id: I0450a0e43a81c80bfdfefb7b67f6799042e0ec26
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-01-06 12:37:25 +00:00
hjk
8753889c63 Debugger: Use handleInferiorPrepared also for AttachToRemoteProcess
Same pattern as the other scenarios.

Change-Id: I065783b9ced3ad31a1918b48b44116071bb98d75
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-01-06 11:09:48 +00:00
hjk
c7e57ced3a Debugger: Simplify gdb startup
The reason for the special callback setup is lost in history.
A possibility is that the extra roundtrip was needed for synchronization
with earlier gdb versions and/or start up sequences. It seems to
works fine without nowadays.

Change-Id: I28c95aec2f065e9c6f0730f1ffbc3db1a3d819da
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-01-06 10:22:28 +00:00
hjk
d671983d81 Debugger: Drop GdbEngine::listFeatures()
The output of -list-features is nowhere near complete or usable to
determine the need of workarounds or such. We have never really
relied on it and the code was unused for a while.

Change-Id: Ide02f4d35d6075f534b756245ebe43c55ee69390
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-01-06 07:12:28 +00:00
hjk
b0d2c0d45d Debugger: Drop base DebuggerEngine::runEngine()
The lines between engine setup and running have always been
blurry, so it looks more and more unnatural to enforce this
in the architecture. Remove the runEngine() call from the
end of notifySetupEngineOk, and do it on the user side.

Change-Id: I3a5e158e8b3fe9b0a288d064f798e24b2ac47f86
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-01-05 06:21:27 +00:00
hjk
f2f139e90e Debugger: Remove DebuggerEngine::stateAcceptsBreakpointChanges()
Dead code since 3b5ecac238 (the end of the hybrid engine).

Change-Id: Ibb169ff657c8a88fdc52783a6a1f5b79fa0b29e5
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-12-18 16:16:58 +00:00
hjk
4ac7bb5a01 Debugger: Use -file-symbol-file for cores, not for remote debugging
In 5467faa0d7 the replacement of -file-exec-and-symbols with
-file-symbol-file accidentally ended up in the wrong branch.

Task-number: QTCREATORBUG-24996
Change-Id: I2d6cb5432c0b11b02c3f8d3517075a7c00b05c9f
Reviewed-by: Samuli Piippo <samuli.piippo@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-11-27 10:35:41 +00:00
Jarek Kobus
6d5e302157 Use typed syntax in calls to QMetaObject::invokeMethod
We do it wherever possible. Some places can't be fixed
since they still rely on dynamic introspection
(mainly QQuickItem cases).

Change-Id: Ia00b4a04d8b995c9a43b7bf2dbe76a60364bb8ca
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-11-16 13:45:02 +00:00