microsoft / microsoft/vscode-cpptools
Feature Request to customize psLinuxCommand
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 6.2k
- Forks
- 1.7k
- Avg merge
- 14h 46m
- Merged PRs (30d)
- 61
Description
I would like the ability to customize the psLinuxCommand, since the current psLinuxCommand does not work on all Linuxes
The ps command ps -axww -o pid=,comm=${PsProcessParser.commColumnTitle},args= used in nativeAttach.js does not work on all Linuxes. For example when using pipeTransport to an alpine distribution, xww is not supported. Since there are bound to be many similar situations, would it be possible to expose a custom ps command to the launch.json.
Right now when I run into this problem, I just can't use ${command:pickRemoteProcess}. If I could write my own custom ps command, then I could try and figure out a way to list all processes, with the processname padded to 80 characters, etc..
Most gdbs are complied with python, and it is not to difficult to write a gdb command that embedded executes python to accomplish this.
This is crude and for a slightly different objective, but the idea is the same (I wouldn't use info os processes again, it's unreliable among all OSes):
var psCommand = "gdb -q -ex 'target extended-remote "+address+"' "
psCommand += "-ex 'python import tempfile; tmp=tempfile.NamedTemporaryFile(); gdb.execute(\"set logging file \"+tmp.name)' "
//Create a temp file for logging so that the output of gdb commands go to temp file
psCommand += "-ex 'set logging on' "
//turn on logging
psCommand += "-ex 'info os processes' "
//Get list of processed
psCommand += "-ex 'set logging off' "
//Turn off loggging
psCommand += "-ex 'python pids = open(tmp.name, \"r\").readlines()[1:]; import sys; [sys.stdout.write(\"%s %"+PsAttachItemsProvider.secondColumnCharacters+"s %s\\n\" % tuple(pid.split(None, 2))) for pid in pids]' "
//Read in file, parse, and output it in an identical ps format
psCommand += "-ex disconnect "
psCommand += "-ex q"
return common_1.execChildProcess(psCommand, null).then(function (processes) {
return _this.parseProcessFromPs(processes.split("\nDone logging")[1].split('\nEnding remote debugging.')[0]);
Contributor guide
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 nativeAttach.js and the launch.json configuration path, then trace how ${command:pickRemoteProcess} invokes the ps command and how parseProcessFromPs consumes its output. Done means a custom command can be configured for remote Linux process listing while existing process picking continues to work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100