From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 113126 invoked by alias); 4 May 2019 16:18:06 -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 113116 invoked by uid 89); 4 May 2019 16:18:05 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-8.8 required=5.0 tests=AWL,BAYES_00,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: mailsec106.isp.belgacom.be Received: from mailsec106.isp.belgacom.be (HELO mailsec106.isp.belgacom.be) (195.238.20.102) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 04 May 2019 16:18:01 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=skynet.be; i=@skynet.be; q=dns/txt; s=securemail; t=1556986681; x=1588522681; h=from:to:subject:date:message-id:mime-version: content-transfer-encoding; bh=kxNPU+LDfLdvknHIva+nwT66x2X+ggAbGwCaGLU0Tbg=; b=P+2vpuQhwoNSlM3PKNiF7/2veanko0+ZW4ylOlKesd4MNm7uV4yNNr6t ozUV6jLBZODaxtSFVbECXuwO0QNs5w==; Received: from 59.151-129-109.adsl-dyn.isp.belgacom.be (HELO md.home) ([109.129.151.59]) by relay.skynet.be with ESMTP/TLS/DHE-RSA-AES128-GCM-SHA256; 04 May 2019 18:17:58 +0200 From: Philippe Waroquiers To: gdb-patches@sourceware.org Subject: [RFAv3 0/6] Implement | (pipe) command. Date: Sat, 04 May 2019 16:18:00 -0000 Message-Id: <20190504161753.15530-1-philippe.waroquiers@skynet.be> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2019-05/txt/msg00130.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 third version, handling the comments of Pedro. The doc, help and NEWS are changed in this version, so must be re-reviewed. * 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.