From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from barracuda.bionetics.com (mail.bionetics.com [72.84.91.118]) by sourceware.org (Postfix) with ESMTPS id 8BB233858CDA for ; Thu, 10 Nov 2022 19:48:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8BB233858CDA Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=bionetics.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=bionetics.com X-ASG-Debug-ID: 1668047200-1535bc1599100ac0001-z78K6e Received: from mail.bionetics.com ([172.16.90.10]) by barracuda.bionetics.com with ESMTP id Trc9QQm38LcdwXWY (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO) for ; Wed, 09 Nov 2022 21:26:40 -0500 (EST) X-Barracuda-Envelope-From: apiazza@bionetics.com X-Barracuda-RBL-Trusted-Forwarder: 172.16.90.10 Received: from ms3.bionetics.com (10.10.10.5) by ms3.bionetics.com (10.10.10.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.6; Wed, 9 Nov 2022 21:26:39 -0500 Received: from ms3.bionetics.com ([fe80::8872:7e6e:8982:f296]) by ms3.bionetics.com ([fe80::8872:7e6e:8982:f296%3]) with mapi id 15.01.2507.006; Wed, 9 Nov 2022 21:26:39 -0500 X-Barracuda-RBL-Trusted-Forwarder: 10.10.10.5 From: "Angelo J. Piazza" To: "gdb@sourceware.org" Subject: Discrepancy in GDB/MI output stream when debugging remote target via pipe to gdbserver Thread-Topic: Discrepancy in GDB/MI output stream when debugging remote target via pipe to gdbserver X-ASG-Orig-Subj: Discrepancy in GDB/MI output stream when debugging remote target via pipe to gdbserver Thread-Index: Adj0pGrjJq8ibTY7QTyDfAivBjU/Mw== Date: Thu, 10 Nov 2022 02:26:39 +0000 Message-ID: <958d6b26e4dc433d85059a81dc2c0165@bionetics.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.1.1.1] Content-Type: multipart/alternative; boundary="_000_958d6b26e4dc433d85059a81dc2c0165bioneticscom_" MIME-Version: 1.0 X-Barracuda-Connect: UNKNOWN[172.16.90.10] X-Barracuda-Start-Time: 1668047200 X-Barracuda-Encrypted: ECDHE-RSA-AES128-GCM-SHA256 X-Barracuda-URL: https://172.16.90.2:443/cgi-mod/mark.cgi X-Barracuda-BRTS-Status: 0 X-Virus-Scanned: by bsmtpd at bionetics.com X-Barracuda-Scan-Msg-Size: 33186 X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=5.0 tests=HTML_MESSAGE X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.102025 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.00 HTML_MESSAGE BODY: HTML included in message X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_40,HTML_MESSAGE,KAM_DMARC_STATUS,KAM_SHORT,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --_000_958d6b26e4dc433d85059a81dc2c0165bioneticscom_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable I'm trying to debug a program running on a remote device using gdbserver vi= a stdio pipes. My issue is , when using the MI interpreter, stdout messages= (i.e. cout) from the debugee are coming through as log streams (prepended = with '&') as opposed to regular text. I illustrate this in detail below. My= arch is x86_64. Though my end-goal is to perform this remote debugging over ssh (security i= s important), the issue I've run into persists whether I'm piping through s= sh or not. Therefore, the examples below will omit the ssh part for ease of= reproduction. Here are the commands I use to initialize my debug session... (I've tried t= o add red text to the commands I input, hopefully it shows through) --- Begin piped gdbserver sample --- gdb --interpreter=3Dmi =3Dthread-group-added,id=3D"i1" ~"GNU gdb (GDB) 12.0.90\n" ~"Copyright (C) 2022 Free Software Foundation, Inc.\n" ~"License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.ht= ml\nThis is free software: you are free to change and redistribute it.\nThe= re is NO WARRANTY, to the extent permitted by law." ~"\nType \"show copying\" and \"show warranty\" for details.\n" ~"This GDB was configured as \"x86_64-pc-linux-gnu\".\n" ~"Type \"show configuration\" for configuration details.\n" ~"For bug reporting instructions, please see:\n" ~"https://www.gnu.org/software/gdb/bugs/.\n" ~"Find the GDB manual and other documentation resources online at:\n htt= p://www.gnu.org/software/gdb/documentation/." ~"\n\n" ~"For help, type \"help\".\n" ~"Type \"apropos word\" to search for commands related to \"word\".\n" (gdb) -target-select extended-remote | gdbserver --multi - &"Remote debugging using stdio\n" =3Dtsv-created,name=3D"trace_timestamp",initial=3D"0" ^connected (gdb) -interpreter-exec console "set remote exec-file /home/odt/ohalo-olympus/Oly= mpusFAS" =3Dcmd-param-changed,param=3D"remote exec-file",value=3D"/home/odt/ohalo-ol= ympus/OlympusFAS" ^done (gdb) -file-exec-and-symbols /home/odt/Projects/olympus/build/Release/src/Olympus= FAS ^done (gdb) -exec-run &"stdin/stdout redirected\n" &"Process /home/odt/ohalo-olympus/OlympusFAS created; pid =3D 74077\n" ... &"Starting up Project\n" &"Running from /home/odt/ohalo-olympus\n" &"Loaded Valid Configuration File.\n" &"\n" &"Set Default Camera Parameters\n" &"State File 1 Not Valid.\n" &"State File 2 Not Valid.\n" &"State File 3 Not Valid.\n" &"Unable to Set Startup Time.\n" &"[0] System Startup Complete But Recover Data Not Valid\n" &"\n" &"Logging Started to logger.txt\n" &"Sync With Network Time.\n" &"Current Image File Is -1\n" &"Unable to Find Current Log File.\n" &"Camera Startup Success.\n" &"Unable to Find Current Data File." &"\n" &"Unable to Find Next Log File." &"\n" &"Unable to Find Next Data File." ... --- End piped gdbserver sample --- Notice at the end how the print statements are prepended with an ampersand.= These are the print outputs from my program, which should just be regular = print statements, but are instead marked as log streams from gdb's internal= engine and thus get parsed by my front-end GUI as such. As a comparison, below is the exact same program run locally (not via a pip= ed remote) --- Begin local debug sample --- gdb --interpreter=3Dmi =3Dthread-group-added,id=3D"i1" ~"GNU gdb (GDB) 12.0.90\n" ~"Copyright (C) 2022 Free Software Foundation, Inc.\n" ~"License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.ht= ml\nThis is free software: you are free to change and redistribute it.\nThe= re is NO WARRANTY, to the extent permitted by law." ~"\nType \"show copying\" and \"show warranty\" for details.\n" ~"This GDB was configured as \"x86_64-pc-linux-gnu\".\n" ~"Type \"show configuration\" for configuration details.\n" ~"For bug reporting instructions, please see:\n" ~"https://www.gnu.org/software/gdb/bugs/.\n" ~"Find the GDB manual and other documentation resources online at:\n htt= p://www.gnu.org/software/gdb/documentation/." ~"\n\n" ~"For help, type \"help\".\n" ~"Type \"apropos word\" to search for commands related to \"word\".\n" (gdb) -file-exec-and-symbols /home/odt/Projects/olympus/build/Release/src/Olympus= FAS ^done (gdb) -exec-run ... Starting up Project Loaded Valid Configuration File. Set Default Camera Parameters State File 1 Not Valid. State File 2 Not Valid. State File 3 Not Valid. Unable to Set Startup Time. [0] System Startup Complete But Recover Data Not Valid =3Dthread-created,id=3D"2",group-id=3D"i1" ~"[New Thread 0x7fffec773700 (LWP 74434)]\n" *running,thread-id=3D"2" Logging Started to logger.txt FLIGHT APP VERSION 1060-S-6130-09 Sync With Network Time. Current Image File Is -1 Unable to Find Current Log File. Camera Startup Success. Unable to Find Current Data File. ... --- End local debug sample --- Is this a bug? Is there a better way to establish the remote target so that= the MI interpreter can properly differentiate between actual gdb log messa= ges and the stdout from a piped remote? The ultimate consequence of this is mostly aesthetic, as the GUI I am using= for debug interprets the amperstand-prepended messages as log messages and= therefore does not display them to my console. This is rather inconvenient= as I gain the ability to step through code, but lose my print statements. = I want to have my cake and eat it too! This is my first time posting to this email list, so please forgive me if I= 've done something improper. Hopefully this is just a trivial thing I am mi= ssing! Respectfully, Angelo Angelo J. Piazza The Bionetics Corporation Palm Bay, FL Phone: (321) 261-3784 FAX: [Bionetics] Important Notice to Recipient: Please do not read, copy or disseminate this= communication or any attachment unless you are the intended addressee. Thi= s communication may contain confidential information intended only for the = addressee(s). Anyone who receives this communication in error should treat = it as confidential and is asked to contact the sender at the e-mail, phone = number or fax number listed above. Please do not forward or disseminate thi= s information to any third party. Important Notice to Recipient: =0D Please do not read, copy or disseminate this communication or any attachmen= t unless you are the intended addressee. =0D This communication may contain confidential information intended only for t= he addressee(s). =0D Anyone who receives this communication in error should treat it as confiden= tial and is asked to contact the sender at the e-mail, phone number or fax = number listed above.=0D Please do not forward or disseminate this information to any third party.= --_000_958d6b26e4dc433d85059a81dc2c0165bioneticscom_--