Commit Graph

1560 Commits

Author SHA1 Message Date
Eike Ziller
3d4d7c7e14 Merge remote-tracking branch 'origin/5.0'
Conflicts:
	src/plugins/clangtools/clangtoolssettings.cpp
	src/plugins/clangtools/executableinfo.cpp
	src/plugins/clangtools/executableinfo.h

Change-Id: Id8caf63e3e594792467d3447870086bd2d8f73b9
2021-09-13 17:03:55 +02:00
hjk
7cc4e27184 Debugger: Don't wait for responses for flushing dummy commands
As this is also used after -exec-continue we won't see a result
before the next stop and consequently run into the watchdog
timeout regularly.

Change-Id: Ibb7e42ae1810d4d9f536cf755219fba6d8aa0f96
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2021-09-10 05:34:32 +00:00
Orgad Shaneh
7e362326fe GDB: Ignore initial SIGTRAP when debugging mingw32 with gdb64
Task-number: QTCREATORBUG-26208
Change-Id: I97e37b6aaca19f20081750de003b012c9853a80c
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-09-09 06:38:21 +00:00
Orgad Shaneh
9032c7741a Debugger: Fix debugging 32-bit mingw console app with 64-bit gdb
For some reason, the executable is no determined correctly.

Feed it to gdb so it will have correct debugging symbols.

Fixes: QTCREATORBUG-26208
Change-Id: Id7da405e5ec9f9331399eb049fa383099981cb94
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-09-09 06:38:03 +00:00
Orgad Shaneh
7a7dc86716 GDB: Fix missing token on some responses
COOKIE FOR TOKEN 0 ALREADY EATEN (InferiorStopOk). TWO RESPONSES FOR ONE
COMMAND?

Change-Id: I569a9715f073f3fbba71045f14fa30a06cd434e9
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2021-09-06 12:48:11 +00:00
hjk
20a63d6c7e Utils: Drop OsType parameter from CommandLine functions
The type is implicitly given by the command's executble FilePath.

Also, rename the rarely used addArgs(const CommandLine &) overload
to addCommandLineAsArgs() and make it strip scheme and host from
the wrapped executable as there are no uses expected where keeping
them would be the right thing.

Change-Id: Id0b76778e7e01ac16e477f36bf30bb28d96bb177
Reviewed-by: Artem Sokolovskii <artem.sokolovskii@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-08-24 07:36:04 +00:00
hjk
adf1243ed9 Debugger: Simplify some path uses in GdbEngine
Change-Id: I5094fb5e71c664e6f6fc69648733c9307c3bc115
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2021-08-19 08:35:21 +00:00
hjk
52e5023bcc ProjectExplorer: Use Utils::CommandLine in ProjectExplorer::Runnable
Change-Id: Id965f1f9047dcbc3ea5c9ddaa550d12668cf8ae6
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-08-13 15:04:30 +00:00
Jarek Kobus
d22505c41f Use refactored ProcessMode
This patch needs to be applied together with the parent change.

There are 3 basic cases:
1. The user doesn't write anything to the write channel:
   You don't need to call closeWriteChannel manually anymore.
   By default the QtcProcess you create is in ProcessMode::Reader mode.
   Internally it opens the process in ReadOnly mode and
   closes the write channel just after starting.
2. The user writes some initial data (after being started)
   and then closes the write channel:
   All what is needed now it to set the write data
   (QtcProcess::setWriteData) before calling start.
   You also use the default ProcessMode::Reader mode.
   Internally it opens the process in ReadWrite mode
   and writes the writeData asynchonously when the process
   already started. After writing the data it closes the
   write channel automatically.
3. The user writes the data also after calling start.
   All you need now is to create a process with
   ProcessMode::Writer mode. In this mode the write
   channel is not closed.
   Internally it opens the process in ReadWrite mode
   as some writers also read the data from the process.

All the code base is adapted here to the above rules.

Change-Id: Id103019d1d71a3012fd1eade226fe96b9aaa48c2
Reviewed-by: hjk <hjk@qt.io>
2021-08-09 07:51:31 +00:00
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