This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: RFC: add ability to "source" Python code
- From: Joel Brobecker <brobecker at adacore dot com>
- To: Thiago Jung Bauermann <bauerman at br dot ibm dot com>
- Cc: Tom Tromey <tromey at redhat dot com>, Eli Zaretskii <eliz at gnu dot org>, drow at false dot org, pedro at codesourcery dot com, gdb-patches at sourceware dot org
- Date: Fri, 15 Jan 2010 11:20:54 +0400
- Subject: Re: RFC: add ability to "source" Python code
- References: <u3aekxq4k.fsf@gnu.org> <20090212062654.GG13021@adacore.com> <uy6wbwfx1.fsf@gnu.org> <20090213022246.GA5401@adacore.com> <utz6ywq8y.fsf@gnu.org> <20090217000746.GA3812@adacore.com> <u8wo5wvkh.fsf@gnu.org> <m3vdr83izz.fsf@fleche.redhat.com> <20090219200536.GA25486@adacore.com> <1243828612.9045.9.camel@hactar>
> This patch implements such tri-state setting:
>
> (gdb) help set script-extension
> Set mode for script filename extension recognition.
> off == no filename extension recognition (all sourced files are GDB scripts)
> soft == evaluate script according to filename extension, fallback to GDB script
> hard == evaluate script according to filename extension, error if not supported
>
> 2009-06-01 Tom Tromey <tromey@redhat.com>
> Thiago Jung Bauermann <bauerman@br.ibm.com>
>
> * python/python.c (source_python_script): New function.
> * python/python.h (source_python_script): Declare.
> * cli/cli-cmds.c (find_argument): New function.
> (source_command): Use find_argument. Handle -p argument. Use
> make_cleanup_restore_integer.
> (source_verbose_cleanup): Remove.
> (source_python): New global.
> Include python.h.
> (init_cli_cmds): Update.
>
> 2009-06-01 Tom Tromey <tromey@redhat.com>
>
> * gdb.texinfo (File Options): Document -x on .py files.
> (Command Files): Document source -p.
>
> 2009-06-01 Tom Tromey <tromey@redhat.com>
> Thiago Jung Bauermann <bauerman@br.ibm.com>
>
> * gdb.base/help.exp: Update "source" help text.
> * gdb.python/source2.py: New file.
> * gdb.python/source1: New file.
> * gdb.python/python.exp: Test "source" command.
This was approved a long time ago, with s/hard/strict/. Did we just
forget to apply it? I'm playing with python, right now, and it was
just brutal trying to find a way to "source" a file.
Refresher for those like me who are not completely fluent in Python.
It's:
(gdb) python "execfile your-file.py"
--
Joel