microsoft / microsoft/vscode-cpptools
Feature Request to customize psLinuxCommand
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- TypeScript
- Sterne
- 6.2k
- Forks
- 1.7k
- Ø Merge
- 14 Std. 46 Min.
- Gemergte PRs (30 T.)
- 61
Beschreibung
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]);
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne mit nativeAttach.js und dem Konfigurationspfad launch.json und verfolge anschließend, wie ${command:pickRemoteProcess} den Befehl ps aufruft und wie parseProcessFromPs dessen Ausgabe verarbeitet. Als erledigt gilt, wenn ein benutzerdefinierter Befehl für die Auflistung entfernter Linux-Prozesse konfiguriert werden kann und die bestehende Prozessauswahl weiterhin funktioniert.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- javascript, typescript
- Bereich
- tooling
- Issue-Typ
- Feature
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100