microsoft / microsoft/vscode-cpptools

Feature Request to customize psLinuxCommand

Aperta
#570 4 commenti 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

debugger Feature Request
Lingua principale
TypeScript
Stelle
6.2k
Fork
1.7k
Merge medio
14h 46m
PR unite (30g)
61

Descrizione

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]);

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia con nativeAttach.js e il percorso di configurazione launch.json, quindi segui il modo in cui ${command:pickRemoteProcess} invoca il comando ps e il modo in cui parseProcessFromPs consuma il relativo output. Il lavoro è completato quando è possibile configurare un comando personalizzato per l'elenco dei processi Linux remoti, mantenendo il funzionamento della selezione dei processi esistente.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
javascript, typescript
Ambito
tooling
Tipo di issue
Funzionalità
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.