microsoft / microsoft/MIEngine
Avoid job control messages when launching GDB
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 859
- Forks
- 233
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 3
Description
It is my understanding that the following shell script is the cause of microsoft/vscode-cpptools#3298:
That is the annoying job control message in the terminal window, for example:
[1] + Done /usr/bin/gdb --interpreter=mi --tty=${DbgTerm} 0</tmp/Microsoft-MIEngine-In-ndptacu6.2ri 1>/tmp/Microsoft-MIEngine-Out-9278nini.hzx
By taking a look at the above script I noticed that GDB is sent to the background just for the sake of fetching its own PID so that it can be written to file. Then the GDB process is waited using wait and in order to do so the shell job control mechanism needs to be enabled.
The unfortunate drawback is the above issue. I'm not fully aware of the internals nor why it is important to save the PID to file but the following provides a way to obtain the same behaviour without the annoying job control message (which is basically what already happens in macOS):
set -o monitor
sleep 3 &
pid=$!
echo "save pid $pid to file..."
fg >/dev/null
The output is:
$ sh test.sh
save 47847 to file...
Moreover, the above comments about Linux vs macOS don't really make sense to me, but anyway this works in both OSs, both sh and bash and both in a shell script and inline:
$ sh -c 'set -o monitor; sleep 3 & pid=$!; echo "save $pid to file..."; fg >/dev/null'
save 47881 to file...
Is this something that are you willing to fix?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with src/MICore/UnixUtilities.cs lines 49-63, where the shell script launches GDB and records its PID. Reproduce the job-control message using the issue's shell examples, then verify that the launch still records and waits for GDB without printing that message on Linux and macOS.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, shell
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100