From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18777 invoked by alias); 30 Jul 2014 10:45:56 -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 18673 invoked by uid 89); 30 Jul 2014 10:45:55 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 X-HELO: mail-pa0-f41.google.com Received: from mail-pa0-f41.google.com (HELO mail-pa0-f41.google.com) (209.85.220.41) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Wed, 30 Jul 2014 10:45:54 +0000 Received: by mail-pa0-f41.google.com with SMTP id rd3so1314888pab.28 for ; Wed, 30 Jul 2014 03:45:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=YH24uwPPNdF3SZTULyBTkUfPceEIDK4RWDY+oV7Tbek=; b=KrKg5ltZLJcCteLDsSNg1TwdObn8JWt5gshvNumQNYf3ZXDhANsj2UqotD7snG6Vt2 Rtk2n2fhLqsEcR/8ZKaygJ5ipPvntMj5fx+PVddrMQrusX2rRCS/Bz8DXvfyF4+ZrW2H gd+czdhZQqnrjdAnSXfiNsPQZHKJPukxPA6HyoBE0yPZzBfsXWS68Y1ZDkEWC+SjMBbB 4Ct8sP2c7ih1KMNK83a5CGlrM6UwaXs6dFB06FPs3yaLqvrWD+qGwty7mFcQMhfo2xEd MLLCvo7aPv1mc/O6mOsoNtaeag34ykgp2aYyPTezT3Al2ZLfKiqoxxzw/JXzrFaBF8xj Xd6g== X-Gm-Message-State: ALoCoQmqwEQFbnMMhitjp/4DUQcmcwDxEweMHgCyPU84+Xc6HC1fGlVWv6m3TsOhWQlCcsA2M+Uf X-Received: by 10.70.96.38 with SMTP id dp6mr3539251pdb.136.1406717152316; Wed, 30 Jul 2014 03:45:52 -0700 (PDT) Received: from linux (ip68-9-64-242.ri.ri.cox.net. [68.9.64.242]) by mx.google.com with ESMTPSA id qn13sm2877103pdb.69.2014.07.30.03.45.51 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 30 Jul 2014 03:45:51 -0700 (PDT) Date: Wed, 30 Jul 2014 10:45:00 -0000 From: Bob Rossi To: gdb@sourceware.org Subject: Re: GDB/MI escape characters Message-ID: <20140730104556.GA6116@linux> References: <20140728010303.GA10702@linux> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20140728010303.GA10702@linux> User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes X-SW-Source: 2014-07/txt/msg00033.txt.bz2 On Sun, Jul 27, 2014 at 09:03:03PM -0400, Bob Rossi wrote: > Hi, > > Does anyone know what characters GDB escapes in the GDB/MI protocol > above and beyond what would otherwise be escaped from the CLI? > > For instance if i print the variable p, > char *p = "aaa\"aaa\naaa\raaa\\aaa"; > from the cli I get, > (gdb) p p > $1 = 0x400584 "aaa\"aaa\naaa\raaa\\aaa" > from MI I get, > p p > ~"$2 = 0x400584 \"aaa\\\"aaa\\naaa\\raaa\\\\aaa\"" > > From the output I can see that \ and " are escaped in MI output above > and beyond what is escaped in the CLI. Are there other characters that > would be? > > The function mi-out.c:mi_field_string might be a clue? I've determined that the quoting explicitely happens for c-string's rules in the grammar here, https://sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI-Output-Syntax.html#GDB_002fMI-Output-Syntax I was debugging gdb and got to utils.c, this function, http://pastie.org/private/hcabdm4q81jdrt4yhpghwg#6 the quoter parameter is ". So I think I've determined that in general, gdb will escape \ to \\ and " to \" so the gdb/mi client has to undo that. Make sense? I was pretty suprised to see in that example that the ESC character goes to \e, but only in some situations. Thanks, Bob Rossi