From a7870fc1b26f783ef0c7570ad2a7c84abe21bdb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20M=C4=85ka?= <62388446+michalmaka@users.noreply.github.com> Date: Thu, 27 Jul 2023 01:08:07 +0200 Subject: [PATCH] Added support for Toybox to remote process picker (#11175) * Added separate remote process command for ToyBox --- Extension/src/Debugger/attachToProcess.ts | 5 +++-- Extension/src/Debugger/nativeAttach.ts | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Extension/src/Debugger/attachToProcess.ts b/Extension/src/Debugger/attachToProcess.ts index 6621033054..1a47131bb0 100644 --- a/Extension/src/Debugger/attachToProcess.ts +++ b/Extension/src/Debugger/attachToProcess.ts @@ -132,8 +132,9 @@ export class RemoteAttachPicker { shPrefix = `/bin/`; } - return `${outerQuote}${shPrefix}sh -c ${innerQuote}uname && if [ ${parameterBegin}uname${parameterEnd} = ${escapedQuote}Linux${escapedQuote} ] ; ` + - `then ${PsProcessParser.psLinuxCommand} ; elif [ ${parameterBegin}uname${parameterEnd} = ${escapedQuote}Darwin${escapedQuote} ] ; ` + + return `${outerQuote}${shPrefix}sh -c ${innerQuote}uname && if [ ${parameterBegin}uname -o${parameterEnd} = ${escapedQuote}Toybox${escapedQuote} ] ; ` + + `then ${PsProcessParser.psToyboxCommand} ; elif [ ${parameterBegin}uname${parameterEnd} = ${escapedQuote}Darwin${escapedQuote} ] ; ` + + `then ${PsProcessParser.psLinuxCommand} ; elif [ ${parameterBegin}uname${parameterEnd} = ${escapedQuote}Linux${escapedQuote} ] ; ` + `then ${PsProcessParser.psDarwinCommand}; fi${innerQuote}${outerQuote}`; } diff --git a/Extension/src/Debugger/nativeAttach.ts b/Extension/src/Debugger/nativeAttach.ts index 1beb193fba..26914a90eb 100644 --- a/Extension/src/Debugger/nativeAttach.ts +++ b/Extension/src/Debugger/nativeAttach.ts @@ -119,6 +119,7 @@ export class PsProcessParser { // Since 'args' contains the full path to the executable, even if truncated, searching will work as desired. public static get psLinuxCommand(): string { return `ps axww -o pid=,comm=${PsProcessParser.commColumnTitle},args=`; } public static get psDarwinCommand(): string { return `ps axww -o pid=,comm=${PsProcessParser.commColumnTitle},args= -c`; } + public static get psToyboxCommand(): string { return `ps -A -o pid=,comm=${PsProcessParser.commColumnTitle},args=`; } // Only public for tests. public static ParseProcessFromPs(processes: string): Process[] {