From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 96024 invoked by alias); 15 Jul 2019 20:35:26 -0000 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org Received: (qmail 96016 invoked by uid 89); 15 Jul 2019 20:35:26 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,HTML_MESSAGE,SPF_FAIL autolearn=no version=3.3.1 spammy=H*r:TLS1.0, H*r:sk:DHE_RSA, 54, H*r:gdb@gnu.org X-HELO: eggs.gnu.org Received: from eggs.gnu.org (HELO eggs.gnu.org) (209.51.188.92) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 15 Jul 2019 20:35:24 +0000 Received: from fencepost.gnu.org ([2001:470:142:3::e]:56555) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hn7gw-0002M4-Oo for gdb@sourceware.org; Mon, 15 Jul 2019 16:35:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33663) by fencepost.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1hn7gw-0004A8-E0 for gdb@gnu.org; Mon, 15 Jul 2019 16:35:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hn7gv-0002LN-1N for gdb@gnu.org; Mon, 15 Jul 2019 16:35:22 -0400 Received: from mout.gmx.net ([212.227.15.15]:45253) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hn7gu-0002HU-Jv for gdb@gnu.org; Mon, 15 Jul 2019 16:35:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1563222914; bh=IqWCqadQIrOSjCRPjNOnEvL8xdP5bbgztSu0Apk5dOk=; h=X-UI-Sender-Class:To:From:Subject:Date; b=PEjBX0vkLTL0w9R7dYdLKghaFC3GcfMuTJw9tWprW42UnAvOfUcdAJENHgu/XtBFr 6ljxOAfl2LPVKwU6fVevV37mIYBV7XEkMS6/GWAlKq5QKnMYxiJLXlKWWswRXNUZKC L8SHP3C/9/9tRWf9zNPhU9uwwO1qkcnQCpfpikwI= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [192.168.0.72] ([84.131.117.188]) by mail.gmx.com (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MTABZ-1htM330zEN-00UbBi for ; Mon, 15 Jul 2019 22:35:14 +0200 To: gdb@gnu.org From: Christof Warlich Subject: using pipe with command Message-ID: Date: Mon, 15 Jul 2019 20:35:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.227.15.15 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable X-SW-Source: 2019-07/txt/msg00005.txt.bz2 Hi, I just got quite exited when I saw the newly introduced "pipe" command. But a closer look reveals that it does somewhat only work "occasionally". Fortunately, "occasionally" here means that the issue is at least reproducible. Here are some examples that show the problem. Note that the code (of GNU make) that I'm using is compiled with "-f=C2=A0 instrument-function" with appropriate function definitions. But I'd assume that the issue occurs with any code being debugged. In the following example, file "xxx" remains empty, although it should contain the output of the "up" command: ... Reading symbols from make... (gdb) b __cyg_profile_func_enter Breakpoint 1 at 0x41d6d5: file src/main.c, line 54. (gdb) command 1 Type commands for breakpoint(s) 1, one per line. End with a line saying just "end". >pipe up | cat - >xxx >end (gdb) run Starting program: /home/christof/Local/Repos/make/make Breakpoint 1, __cyg_profile_func_enter (func_address=3D0x41df5d
, call_site=3D0x7ffff7801b97 <__libc_start_main+231>) at src/main.c:54 54=C2=A0=C2=A0=C2=A0 } #1=C2=A0 0x000000000041dfa1 in main (argc=3D1, argv=3D0x7fffffffe0c8, envp=3D0x7fffffffe0d8) at src/main.c:1074 1074=C2=A0=C2=A0=C2=A0 { (gdb) !cat xxx (gdb) Strange enough, almost the same setup works when replacing the "up" command with the "bt" command: File xxx contains a backtrace as expected. ... Reading symbols from make... (gdb) b __cyg_profile_func_enter Breakpoint 1 at 0x41d6d5: file src/main.c, line 54. (gdb) command 1 Type commands for breakpoint(s) 1, one per line. End with a line saying just "end". >pipe bt | cat - >xxx >end (gdb) run Starting program: /home/christof/Local/Repos/make/make Breakpoint 1, __cyg_profile_func_enter (func_address=3D0x41df5d
, call_site=3D0x7ffff7801b97 <__libc_start_main+231>) at src/main.c:54 54=C2=A0=C2=A0=C2=A0 } (gdb) !cat xxx #0=C2=A0 __cyg_profile_func_enter (func_address=3D0x41df5d
, call_site=3D0x7ffff7801b97 <__libc_start_main+231>) at src/main.c:54 #1=C2=A0 0x000000000041dfa1 in main (argc=3D1, argv=3D0x7fffffffe0c8, envp=3D0x7fffffffe0d8) at src/main.c:1074 (gdb) To make things even more weird, piping the output of the "up" command directly (i.e. outside of the "command" command) works as well as expected: ... Reading symbols from make... (gdb) b __cyg_profile_func_enter Breakpoint 1 at 0x41d6d5: file src/main.c, line 54. (gdb) run Starting program: /home/christof/Local/Repos/make/make Breakpoint 1, __cyg_profile_func_enter (func_address=3D0x41df5d
, call_site=3D0x7ffff7801b97 <__libc_start_main+231>) at src/main.c:54 54=C2=A0=C2=A0=C2=A0 } (gdb) pipe up | cat - >xxx (gdb) !cat xxx #1=C2=A0 0x000000000041dfa1 in main (argc=3D1, argv=3D0x7fffffffe0c8, envp=3D0x7fffffffe0d8) at src/main.c:1074 1074=C2=A0=C2=A0=C2=A0 { (gdb) I'm aware that the "pipe" command may still be "in development", but maybe this early report may help to fix a lingering issue ... And I certainly would be more than happy to test any patch :-). Cheers, Chris