From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10198 invoked by alias); 24 May 2010 15:35:57 -0000 Received: (qmail 10189 invoked by uid 22791); 24 May 2010 15:35:56 -0000 X-SWARE-Spam-Status: No, hits=-5.7 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,TW_RG,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 24 May 2010 15:35:52 +0000 Received: from int-mx03.intmail.prod.int.phx2.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o4OFZmiw017933 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 24 May 2010 11:35:48 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx03.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o4OFZlph016417; Mon, 24 May 2010 11:35:48 -0400 Received: from opsy.redhat.com (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id o4OFZldc026865; Mon, 24 May 2010 11:35:47 -0400 Received: by opsy.redhat.com (Postfix, from userid 500) id D5DAC3782C5; Mon, 24 May 2010 09:35:46 -0600 (MDT) From: Tom Tromey To: Doug Evans Cc: gdb-patches@sourceware.org Subject: Re: [RFA] new python features: gdb.GdbError, gdb.string_to_argv References: <20100522165438.5D5A48439A@ruffy.mtv.corp.google.com> Reply-To: Tom Tromey Date: Mon, 24 May 2010 16:27:00 -0000 In-Reply-To: (Doug Evans's message of "Sat, 22 May 2010 11:40:47 -0700") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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 X-SW-Source: 2010-05/txt/msg00548.txt.bz2 >>>>> "Doug" == Doug Evans writes: Tom> I think you can use the built-in shlex.split for this. Doug> Depends I guess. Doug> I remembered you saying we want to be able to write compatible Doug> replacements for gdb commands in python, and some gdb commands use Doug> libiberty's buildargv. Doug> Ergo I wanted a 100% identical version of buildargv that I know I can Doug> "just use" (e.g. without any needed extra, manual, error-prone setup), Doug> and not worry about any differences between the behavior. Yeah, I definitely think that would be useful for some commands. When we talked about it on irc, I wasn't aware of the existence of the shlex module. There isn't really any setup to speak of: import shlex argv = shlex.split(arg) Doug> So, setting aside the implementation (i.e. maybe gdb.string_to_argv Doug> could be implemented with shlex, or anything else), I still think Doug> having it is reasonable. Doug> But whatever, it's not that important. I think that in general we ought to provide gdb-specific facilities and defer to the Python library when equivalent things already exist there. That's one of the big benefits of picking a large popular language like Python. I did not check to see that shlex.split is completely compatible with buildargv. I suspect it is. But if not, I suppose that would be an argument for including a new function. If shlex.split fits the bill, I think it would be worthwhile to mention this in the "Commands In Python" node. Tom