microsoft / microsoft/vscode-cpptools

Feature Request to customize psLinuxCommand

オープン
#570 コメント 4 件 リアクション 1 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

debugger Feature Request
主要言語
TypeScript
スター
6.2k
フォーク
1.7k
平均マージ
14時間 46分
マージ済み PR(30日)
61

説明

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

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

nativeAttach.js と launch.json の設定パスから始め、${command:pickRemoteProcess} が ps コマンドを呼び出す方法と、parseProcessFromPs がその出力を処理する方法を追跡します。リモート Linux プロセスの一覧表示用にカスタムコマンドを設定でき、既存のプロセス選択が引き続き機能すれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript, typescript
領域
tooling
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。