This is the mail archive of the
mailing list for the Archer project.
Re: source command for python scripts (was Re: Python pretty-printers and non-ASCII strings do not play well together :-()
- From: Doug Evans <dje at google dot com>
- To: Thiago Jung Bauermann <bauerman at br dot ibm dot com>
- Cc: Paul Pluzhnikov <ppluzhnikov at google dot com>, archer at sourceware dot org
- Date: Wed, 5 Nov 2008 11:40:20 -0800
- Subject: Re: source command for python scripts (was Re: Python pretty-printers and non-ASCII strings do not play well together :-()
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=google.com; s=beta;t=1225914023; bh=xwxuTu7dq6BnwaqwAbO5IBjK3sA=;h=DomainKey-Signature:MIME-Version:In-Reply-To:References:Date: Message-ID:Subject:From:To:Cc:Content-Type: Content-Transfer-Encoding; b=MRek9k5yM4njUPe0HnbhAh2N74E6+njooifwNrZ5XVk3LdiCYQM6DUeCkibSuQGIn4EJ6sKNYeXFevLuCK+KUg==
- Domainkey-signature: a=rsa-sha1; s=beta; d=google.com; c=nofws; q=dns;h=mime-version:in-reply-to:references:date:message-id:subject:from:to:cc:content-type:content-transfer-encoding;b=EBgLWNgXEVWj7JJ2RvOxm/Qbu6dRLzvvmhFlo/D7rI+/6yYdB629d3iPgfDavTHst+a1up9IQZtAJME9Ci+Z/Q==
- References: <20081104192834.32F4D3A6B0B@localhost> <firstname.lastname@example.org> <email@example.com> <firstname.lastname@example.org>
On Wed, Nov 5, 2008 at 10:12 AM, Thiago Jung Bauermann
> El mié, 05-11-2008 a las 10:05 -0800, Paul Pluzhnikov escribió:
>> On Wed, Nov 5, 2008 at 9:56 AM, Thiago Jung Bauermann
>> <email@example.com> wrote:
>> > El mar, 04-11-2008 a las 11:28 -0800, Paul Pluzhnikov escribió:
>> >> (gdb) python execfile('simple.py')
>> > I was wondering if it would be useful to have a command in GDB to source
>> > Python scripts, something like "source -p foo.py".
>> To tell the truth, I've just been using 'source foo.py', where the
>> first line of 'foo.py' is
>> I think it might be nice for "plain" 'source' to auto-deduce that
>> this is python source either by looking at ".py" extension, or
>> by scanning file contents for "obvious" python-ness.
> I liked the idea of looking at the extension. Also, another argument
> which I thought in favor of using a gdb command directly instead of
> python execfile is that it gives you tab completion.
The thing I like about using a gdb command directly is that it feels
better from a u/i perspective. Having to use execfile seems way too
clumsy for something as important as finally having a real scripting
language built into gdb.
I vote for using the file extension, with -p (or some such) to handle
situations where the file extension isn't .py.