From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 37804 invoked by alias); 30 May 2019 14:21:20 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 37785 invoked by uid 89); 30 May 2019 14:21:19 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-12.1 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.1 spammy=top.c, topc, UD:top.c, HContent-Transfer-Encoding:8bit X-HELO: mailsec108.isp.belgacom.be Received: from mailsec108.isp.belgacom.be (HELO mailsec108.isp.belgacom.be) (195.238.20.104) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 30 May 2019 14:21:17 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=skynet.be; i=@skynet.be; q=dns/txt; s=securemail; t=1559226077; x=1590762077; h=from:to:subject:date:message-id:mime-version: content-transfer-encoding; bh=JOQ7TseEKfO0Kc5NYKNQNEpAqCKDE6GYCeYA9qMLOjk=; b=BTpL65cEiKpYJ2vuphMkmsaUYWL6ryqJkKxMyWDRQkUss3cFH7b7tHa4 nWF7WDXQ0dWmr4AbP0bUin617nQVGQ==; Received: from 161.32-242-81.adsl-dyn.isp.belgacom.be (HELO md.home) ([81.242.32.161]) by relay.skynet.be with ESMTP/TLS/DHE-RSA-AES128-GCM-SHA256; 30 May 2019 16:21:15 +0200 From: Philippe Waroquiers To: gdb-patches@sourceware.org Subject: [RFAv4 0/5] Implement | (pipe) command. Date: Thu, 30 May 2019 14:21:00 -0000 Message-Id: <20190530142106.25487-1-philippe.waroquiers@skynet.be> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2019-05/txt/msg00698.txt.bz2 Implement | (pipe) command. This patch series adds the pipe command, that allows to send the output of a GDB command to a shell command. This is the fourth version of the patch, handling the additional comments of Pedro. The doc, help and NEWS are changed in this fourth version, so must be re-reviewed. * Main changes in this version: * Reworded the help, manual and code, e.g. use -d DELIM instead of -d SEP. Also, stopped forcing GDB users to read Ada syntax :). * Removed the patch related to WIF* macros on MinGW. * Reworked the arg parsing logic in pipe command. --- Previous versions: * Comments of Pedro: * Implement -d SEP (SEP being a string) instead of -dX. * popen has been kept as libiberty pexecute still implies to use the WIF* macros. However, exit status handling reworked to go via convenience variables, rather than being shown to the user. * various small changes (== '\0', Skip, ...). * simplified error messages to just indicate with a static string what argument is wrong or missing. * extended the test to verify all error handling messages and check the new convenience variables $_shell_exitcode and $_shell_exitsignal. * Comments from Eli : * better definition of WIF* macros for MinGW. * replace @ref by @xref in the doc. * Comment from Abhijit Halder/Tom: * it not that unlikely to have | in a GDB command => an optional -d SEP option allows to specify an alternate string to use SEP to replace the | as separator between the GDB COMMAND and the SHELL_COMMAND. * Comments from Tom: * make previous_saved_command_line static. For this, saved_command_line is now also static, and all repeat related functions/vars are now in top.c * various small changes (use std::swap, strchr, .empty (), ...). * removed the scoped_restore_current_thread restore * popen has been kept as libiberty pexecute still implies to use the WIF* macros. * Instead of using execute_command_to_string, use GDB redirection mechanism. I did several trials for this, and at the end, the only one working properly was very close to the code of execute_command_to_string. => we now have a function execute_command_to_ui_file that is used to implement the pipe command, and also used by execute_command_to_string.