This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA] new python features: gdb.GdbError, gdb.string_to_argv


>>>>> "Doug" == Doug Evans <dje@google.com> 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]