microsoft / microsoft/vscode-cpptools

Feature Request to customize psLinuxCommand

Ouverte
#570 4 commentaires 1 réaction 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

debugger Feature Request
Langage dominant
TypeScript
Étoiles
6.2k
Forks
1.7k
Merge moyen
14 h 46 min
PR mergées (30 j)
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]);

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Commencez par nativeAttach.js et le chemin de configuration launch.json, puis suivez comment ${command:pickRemoteProcess} appelle la commande ps et comment parseProcessFromPs consomme sa sortie. Le travail est terminé lorsqu’une commande personnalisée peut être configurée pour lister les processus Linux distants, tout en continuant à faire fonctionner la sélection de processus existante.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
javascript, typescript
Domaine
tooling
Type d'issue
Fonctionnalité
Difficulté
4/5
Temps estimé
3-5 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
35/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.